@@ -120,13 +120,17 @@ pub(crate) fn create_target_machine(tcx: TyCtxt<'_>, mod_name: &str) -> OwnedTar
120
120
tcx. sess . split_debuginfo ( ) ,
121
121
tcx. sess . opts . unstable_opts . split_dwarf_kind ,
122
122
mod_name,
123
+ tcx. sess . invocation_temp . as_deref ( ) ,
123
124
)
124
125
} else {
125
126
None
126
127
} ;
127
128
128
- let output_obj_file =
129
- Some ( tcx. output_filenames ( ( ) ) . temp_path_for_cgu ( OutputType :: Object , mod_name) ) ;
129
+ let output_obj_file = Some ( tcx. output_filenames ( ( ) ) . temp_path_for_cgu (
130
+ OutputType :: Object ,
131
+ mod_name,
132
+ tcx. sess . invocation_temp . as_deref ( ) ,
133
+ ) ) ;
130
134
let config = TargetMachineFactoryConfig { split_dwarf_file, output_obj_file } ;
131
135
132
136
target_machine_factory (
@@ -330,7 +334,11 @@ pub(crate) fn save_temp_bitcode(
330
334
return ;
331
335
}
332
336
let ext = format ! ( "{name}.bc" ) ;
333
- let path = cgcx. output_filenames . temp_path_ext_for_cgu ( & ext, & module. name ) ;
337
+ let path = cgcx. output_filenames . temp_path_ext_for_cgu (
338
+ & ext,
339
+ & module. name ,
340
+ cgcx. invocation_temp . as_deref ( ) ,
341
+ ) ;
334
342
write_bitcode_to_file ( module, & path)
335
343
}
336
344
@@ -694,7 +702,11 @@ pub(crate) unsafe fn optimize(
694
702
let _handlers = DiagnosticHandlers :: new ( cgcx, dcx, llcx, module, CodegenDiagnosticsStage :: Opt ) ;
695
703
696
704
if config. emit_no_opt_bc {
697
- let out = cgcx. output_filenames . temp_path_ext_for_cgu ( "no-opt.bc" , & module. name ) ;
705
+ let out = cgcx. output_filenames . temp_path_ext_for_cgu (
706
+ "no-opt.bc" ,
707
+ & module. name ,
708
+ cgcx. invocation_temp . as_deref ( ) ,
709
+ ) ;
698
710
write_bitcode_to_file ( module, & out)
699
711
}
700
712
@@ -739,8 +751,11 @@ pub(crate) unsafe fn optimize(
739
751
if let Some ( thin_lto_buffer) = thin_lto_buffer {
740
752
let thin_lto_buffer = unsafe { ThinBuffer :: from_raw_ptr ( thin_lto_buffer) } ;
741
753
module. thin_lto_buffer = Some ( thin_lto_buffer. data ( ) . to_vec ( ) ) ;
742
- let bc_summary_out =
743
- cgcx. output_filenames . temp_path_for_cgu ( OutputType :: ThinLinkBitcode , & module. name ) ;
754
+ let bc_summary_out = cgcx. output_filenames . temp_path_for_cgu (
755
+ OutputType :: ThinLinkBitcode ,
756
+ & module. name ,
757
+ cgcx. invocation_temp . as_deref ( ) ,
758
+ ) ;
744
759
if config. emit_thin_lto_summary
745
760
&& let Some ( thin_link_bitcode_filename) = bc_summary_out. file_name ( )
746
761
{
@@ -808,8 +823,16 @@ pub(crate) unsafe fn codegen(
808
823
// copy it to the .o file, and delete the bitcode if it wasn't
809
824
// otherwise requested.
810
825
811
- let bc_out = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Bitcode , & module. name ) ;
812
- let obj_out = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Object , & module. name ) ;
826
+ let bc_out = cgcx. output_filenames . temp_path_for_cgu (
827
+ OutputType :: Bitcode ,
828
+ & module. name ,
829
+ cgcx. invocation_temp . as_deref ( ) ,
830
+ ) ;
831
+ let obj_out = cgcx. output_filenames . temp_path_for_cgu (
832
+ OutputType :: Object ,
833
+ & module. name ,
834
+ cgcx. invocation_temp . as_deref ( ) ,
835
+ ) ;
813
836
814
837
if config. bitcode_needed ( ) {
815
838
if config. emit_bc || config. emit_obj == EmitObj :: Bitcode {
@@ -851,8 +874,11 @@ pub(crate) unsafe fn codegen(
851
874
if config. emit_ir {
852
875
let _timer =
853
876
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_ir" , & * module. name ) ;
854
- let out =
855
- cgcx. output_filenames . temp_path_for_cgu ( OutputType :: LlvmAssembly , & module. name ) ;
877
+ let out = cgcx. output_filenames . temp_path_for_cgu (
878
+ OutputType :: LlvmAssembly ,
879
+ & module. name ,
880
+ cgcx. invocation_temp . as_deref ( ) ,
881
+ ) ;
856
882
let out_c = path_to_c_string ( & out) ;
857
883
858
884
extern "C" fn demangle_callback (
@@ -894,7 +920,11 @@ pub(crate) unsafe fn codegen(
894
920
if config. emit_asm {
895
921
let _timer =
896
922
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_asm" , & * module. name ) ;
897
- let path = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Assembly , & module. name ) ;
923
+ let path = cgcx. output_filenames . temp_path_for_cgu (
924
+ OutputType :: Assembly ,
925
+ & module. name ,
926
+ cgcx. invocation_temp . as_deref ( ) ,
927
+ ) ;
898
928
899
929
// We can't use the same module for asm and object code output,
900
930
// because that triggers various errors like invalid IR or broken
@@ -924,7 +954,9 @@ pub(crate) unsafe fn codegen(
924
954
. prof
925
955
. generic_activity_with_arg ( "LLVM_module_codegen_emit_obj" , & * module. name ) ;
926
956
927
- let dwo_out = cgcx. output_filenames . temp_path_dwo_for_cgu ( & module. name ) ;
957
+ let dwo_out = cgcx
958
+ . output_filenames
959
+ . temp_path_dwo_for_cgu ( & module. name , cgcx. invocation_temp . as_deref ( ) ) ;
928
960
let dwo_out = match ( cgcx. split_debuginfo , cgcx. split_dwarf_kind ) {
929
961
// Don't change how DWARF is emitted when disabled.
930
962
( SplitDebuginfo :: Off , _) => None ,
@@ -989,6 +1021,7 @@ pub(crate) unsafe fn codegen(
989
1021
config. emit_asm ,
990
1022
config. emit_ir ,
991
1023
& cgcx. output_filenames ,
1024
+ cgcx. invocation_temp . as_deref ( ) ,
992
1025
) )
993
1026
}
994
1027
0 commit comments