@@ -119,14 +119,14 @@ pub(crate) fn create_target_machine(tcx: TyCtxt<'_>, mod_name: &str) -> OwnedTar
119
119
tcx. output_filenames ( ( ) ) . split_dwarf_path (
120
120
tcx. sess . split_debuginfo ( ) ,
121
121
tcx. sess . opts . unstable_opts . split_dwarf_kind ,
122
- Some ( mod_name) ,
122
+ mod_name,
123
123
)
124
124
} else {
125
125
None
126
126
} ;
127
127
128
128
let output_obj_file =
129
- Some ( tcx. output_filenames ( ( ) ) . temp_path ( OutputType :: Object , Some ( mod_name) ) ) ;
129
+ Some ( tcx. output_filenames ( ( ) ) . temp_path_for_cgu ( OutputType :: Object , mod_name) ) ;
130
130
let config = TargetMachineFactoryConfig { split_dwarf_file, output_obj_file } ;
131
131
132
132
target_machine_factory (
@@ -330,8 +330,7 @@ pub(crate) fn save_temp_bitcode(
330
330
return ;
331
331
}
332
332
let ext = format ! ( "{name}.bc" ) ;
333
- let cgu = Some ( & module. name [ ..] ) ;
334
- let path = cgcx. output_filenames . temp_path_ext ( & ext, cgu) ;
333
+ let path = cgcx. output_filenames . temp_path_ext_for_cgu ( & ext, & module. name ) ;
335
334
write_bitcode_to_file ( module, & path)
336
335
}
337
336
@@ -697,11 +696,8 @@ pub(crate) unsafe fn optimize(
697
696
let llcx = & * module. module_llvm . llcx ;
698
697
let _handlers = DiagnosticHandlers :: new ( cgcx, dcx, llcx, module, CodegenDiagnosticsStage :: Opt ) ;
699
698
700
- let module_name = module. name . clone ( ) ;
701
- let module_name = Some ( & module_name[ ..] ) ;
702
-
703
699
if config. emit_no_opt_bc {
704
- let out = cgcx. output_filenames . temp_path_ext ( "no-opt.bc" , module_name ) ;
700
+ let out = cgcx. output_filenames . temp_path_ext_for_cgu ( "no-opt.bc" , & module . name ) ;
705
701
write_bitcode_to_file ( module, & out)
706
702
}
707
703
@@ -747,7 +743,7 @@ pub(crate) unsafe fn optimize(
747
743
let thin_lto_buffer = unsafe { ThinBuffer :: from_raw_ptr ( thin_lto_buffer) } ;
748
744
module. thin_lto_buffer = Some ( thin_lto_buffer. data ( ) . to_vec ( ) ) ;
749
745
let bc_summary_out =
750
- cgcx. output_filenames . temp_path ( OutputType :: ThinLinkBitcode , module_name ) ;
746
+ cgcx. output_filenames . temp_path_for_cgu ( OutputType :: ThinLinkBitcode , & module . name ) ;
751
747
if config. emit_thin_lto_summary
752
748
&& let Some ( thin_link_bitcode_filename) = bc_summary_out. file_name ( )
753
749
{
@@ -804,8 +800,6 @@ pub(crate) unsafe fn codegen(
804
800
let llmod = module. module_llvm . llmod ( ) ;
805
801
let llcx = & * module. module_llvm . llcx ;
806
802
let tm = & * module. module_llvm . tm ;
807
- let module_name = module. name . clone ( ) ;
808
- let module_name = Some ( & module_name[ ..] ) ;
809
803
let _handlers =
810
804
DiagnosticHandlers :: new ( cgcx, dcx, llcx, & module, CodegenDiagnosticsStage :: Codegen ) ;
811
805
@@ -817,8 +811,8 @@ pub(crate) unsafe fn codegen(
817
811
// copy it to the .o file, and delete the bitcode if it wasn't
818
812
// otherwise requested.
819
813
820
- let bc_out = cgcx. output_filenames . temp_path ( OutputType :: Bitcode , module_name ) ;
821
- let obj_out = cgcx. output_filenames . temp_path ( OutputType :: Object , module_name ) ;
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 ) ;
822
816
823
817
if config. bitcode_needed ( ) {
824
818
if config. emit_bc || config. emit_obj == EmitObj :: Bitcode {
@@ -860,7 +854,8 @@ pub(crate) unsafe fn codegen(
860
854
if config. emit_ir {
861
855
let _timer =
862
856
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_ir" , & * module. name ) ;
863
- let out = cgcx. output_filenames . temp_path ( OutputType :: LlvmAssembly , module_name) ;
857
+ let out =
858
+ cgcx. output_filenames . temp_path_for_cgu ( OutputType :: LlvmAssembly , & module. name ) ;
864
859
let out_c = path_to_c_string ( & out) ;
865
860
866
861
extern "C" fn demangle_callback (
@@ -902,7 +897,7 @@ pub(crate) unsafe fn codegen(
902
897
if config. emit_asm {
903
898
let _timer =
904
899
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_asm" , & * module. name ) ;
905
- let path = cgcx. output_filenames . temp_path ( OutputType :: Assembly , module_name ) ;
900
+ let path = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Assembly , & module . name ) ;
906
901
907
902
// We can't use the same module for asm and object code output,
908
903
// because that triggers various errors like invalid IR or broken
@@ -932,7 +927,7 @@ pub(crate) unsafe fn codegen(
932
927
. prof
933
928
. generic_activity_with_arg ( "LLVM_module_codegen_emit_obj" , & * module. name ) ;
934
929
935
- let dwo_out = cgcx. output_filenames . temp_path_dwo ( module_name ) ;
930
+ let dwo_out = cgcx. output_filenames . temp_path_dwo_for_cgu ( & module . name ) ;
936
931
let dwo_out = match ( cgcx. split_debuginfo , cgcx. split_dwarf_kind ) {
937
932
// Don't change how DWARF is emitted when disabled.
938
933
( SplitDebuginfo :: Off , _) => None ,
0 commit comments