@@ -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
@@ -697,7 +705,11 @@ pub(crate) unsafe fn optimize(
697
705
let _handlers = DiagnosticHandlers :: new ( cgcx, dcx, llcx, module, CodegenDiagnosticsStage :: Opt ) ;
698
706
699
707
if config. emit_no_opt_bc {
700
- let out = cgcx. output_filenames . temp_path_ext_for_cgu ( "no-opt.bc" , & module. name ) ;
708
+ let out = cgcx. output_filenames . temp_path_ext_for_cgu (
709
+ "no-opt.bc" ,
710
+ & module. name ,
711
+ cgcx. invocation_temp . as_deref ( ) ,
712
+ ) ;
701
713
write_bitcode_to_file ( module, & out)
702
714
}
703
715
@@ -742,8 +754,11 @@ pub(crate) unsafe fn optimize(
742
754
if let Some ( thin_lto_buffer) = thin_lto_buffer {
743
755
let thin_lto_buffer = unsafe { ThinBuffer :: from_raw_ptr ( thin_lto_buffer) } ;
744
756
module. thin_lto_buffer = Some ( thin_lto_buffer. data ( ) . to_vec ( ) ) ;
745
- let bc_summary_out =
746
- cgcx. output_filenames . temp_path_for_cgu ( OutputType :: ThinLinkBitcode , & module. name ) ;
757
+ let bc_summary_out = cgcx. output_filenames . temp_path_for_cgu (
758
+ OutputType :: ThinLinkBitcode ,
759
+ & module. name ,
760
+ cgcx. invocation_temp . as_deref ( ) ,
761
+ ) ;
747
762
if config. emit_thin_lto_summary
748
763
&& let Some ( thin_link_bitcode_filename) = bc_summary_out. file_name ( )
749
764
{
@@ -811,8 +826,16 @@ pub(crate) unsafe fn codegen(
811
826
// copy it to the .o file, and delete the bitcode if it wasn't
812
827
// otherwise requested.
813
828
814
- let bc_out = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Bitcode , & module. name ) ;
815
- let obj_out = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Object , & module. name ) ;
829
+ let bc_out = cgcx. output_filenames . temp_path_for_cgu (
830
+ OutputType :: Bitcode ,
831
+ & module. name ,
832
+ cgcx. invocation_temp . as_deref ( ) ,
833
+ ) ;
834
+ let obj_out = cgcx. output_filenames . temp_path_for_cgu (
835
+ OutputType :: Object ,
836
+ & module. name ,
837
+ cgcx. invocation_temp . as_deref ( ) ,
838
+ ) ;
816
839
817
840
if config. bitcode_needed ( ) {
818
841
if config. emit_bc || config. emit_obj == EmitObj :: Bitcode {
@@ -854,8 +877,11 @@ pub(crate) unsafe fn codegen(
854
877
if config. emit_ir {
855
878
let _timer =
856
879
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_ir" , & * module. name ) ;
857
- let out =
858
- cgcx. output_filenames . temp_path_for_cgu ( OutputType :: LlvmAssembly , & module. name ) ;
880
+ let out = cgcx. output_filenames . temp_path_for_cgu (
881
+ OutputType :: LlvmAssembly ,
882
+ & module. name ,
883
+ cgcx. invocation_temp . as_deref ( ) ,
884
+ ) ;
859
885
let out_c = path_to_c_string ( & out) ;
860
886
861
887
extern "C" fn demangle_callback (
@@ -897,7 +923,11 @@ pub(crate) unsafe fn codegen(
897
923
if config. emit_asm {
898
924
let _timer =
899
925
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_asm" , & * module. name ) ;
900
- let path = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Assembly , & module. name ) ;
926
+ let path = cgcx. output_filenames . temp_path_for_cgu (
927
+ OutputType :: Assembly ,
928
+ & module. name ,
929
+ cgcx. invocation_temp . as_deref ( ) ,
930
+ ) ;
901
931
902
932
// We can't use the same module for asm and object code output,
903
933
// because that triggers various errors like invalid IR or broken
@@ -927,7 +957,9 @@ pub(crate) unsafe fn codegen(
927
957
. prof
928
958
. generic_activity_with_arg ( "LLVM_module_codegen_emit_obj" , & * module. name ) ;
929
959
930
- let dwo_out = cgcx. output_filenames . temp_path_dwo_for_cgu ( & module. name ) ;
960
+ let dwo_out = cgcx
961
+ . output_filenames
962
+ . temp_path_dwo_for_cgu ( & module. name , cgcx. invocation_temp . as_deref ( ) ) ;
931
963
let dwo_out = match ( cgcx. split_debuginfo , cgcx. split_dwarf_kind ) {
932
964
// Don't change how DWARF is emitted when disabled.
933
965
( SplitDebuginfo :: Off , _) => None ,
@@ -992,6 +1024,7 @@ pub(crate) unsafe fn codegen(
992
1024
config. emit_asm ,
993
1025
config. emit_ir ,
994
1026
& cgcx. output_filenames ,
1027
+ cgcx. invocation_temp . as_deref ( ) ,
995
1028
) )
996
1029
}
997
1030
0 commit comments