@@ -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
@@ -694,11 +693,8 @@ pub(crate) unsafe fn optimize(
694
693
let llcx = & * module. module_llvm . llcx ;
695
694
let _handlers = DiagnosticHandlers :: new ( cgcx, dcx, llcx, module, CodegenDiagnosticsStage :: Opt ) ;
696
695
697
- let module_name = module. name . clone ( ) ;
698
- let module_name = Some ( & module_name[ ..] ) ;
699
-
700
696
if config. emit_no_opt_bc {
701
- let out = cgcx. output_filenames . temp_path_ext ( "no-opt.bc" , module_name ) ;
697
+ let out = cgcx. output_filenames . temp_path_ext_for_cgu ( "no-opt.bc" , & module . name ) ;
702
698
write_bitcode_to_file ( module, & out)
703
699
}
704
700
@@ -744,7 +740,7 @@ pub(crate) unsafe fn optimize(
744
740
let thin_lto_buffer = unsafe { ThinBuffer :: from_raw_ptr ( thin_lto_buffer) } ;
745
741
module. thin_lto_buffer = Some ( thin_lto_buffer. data ( ) . to_vec ( ) ) ;
746
742
let bc_summary_out =
747
- cgcx. output_filenames . temp_path ( OutputType :: ThinLinkBitcode , module_name ) ;
743
+ cgcx. output_filenames . temp_path_for_cgu ( OutputType :: ThinLinkBitcode , & module . name ) ;
748
744
if config. emit_thin_lto_summary
749
745
&& let Some ( thin_link_bitcode_filename) = bc_summary_out. file_name ( )
750
746
{
@@ -801,8 +797,6 @@ pub(crate) unsafe fn codegen(
801
797
let llmod = module. module_llvm . llmod ( ) ;
802
798
let llcx = & * module. module_llvm . llcx ;
803
799
let tm = & * module. module_llvm . tm ;
804
- let module_name = module. name . clone ( ) ;
805
- let module_name = Some ( & module_name[ ..] ) ;
806
800
let _handlers =
807
801
DiagnosticHandlers :: new ( cgcx, dcx, llcx, & module, CodegenDiagnosticsStage :: Codegen ) ;
808
802
@@ -814,8 +808,8 @@ pub(crate) unsafe fn codegen(
814
808
// copy it to the .o file, and delete the bitcode if it wasn't
815
809
// otherwise requested.
816
810
817
- let bc_out = cgcx. output_filenames . temp_path ( OutputType :: Bitcode , module_name ) ;
818
- let obj_out = cgcx. output_filenames . temp_path ( OutputType :: Object , module_name ) ;
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 ) ;
819
813
820
814
if config. bitcode_needed ( ) {
821
815
if config. emit_bc || config. emit_obj == EmitObj :: Bitcode {
@@ -857,7 +851,8 @@ pub(crate) unsafe fn codegen(
857
851
if config. emit_ir {
858
852
let _timer =
859
853
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_ir" , & * module. name ) ;
860
- let out = cgcx. output_filenames . temp_path ( OutputType :: LlvmAssembly , module_name) ;
854
+ let out =
855
+ cgcx. output_filenames . temp_path_for_cgu ( OutputType :: LlvmAssembly , & module. name ) ;
861
856
let out_c = path_to_c_string ( & out) ;
862
857
863
858
extern "C" fn demangle_callback (
@@ -899,7 +894,7 @@ pub(crate) unsafe fn codegen(
899
894
if config. emit_asm {
900
895
let _timer =
901
896
cgcx. prof . generic_activity_with_arg ( "LLVM_module_codegen_emit_asm" , & * module. name ) ;
902
- let path = cgcx. output_filenames . temp_path ( OutputType :: Assembly , module_name ) ;
897
+ let path = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Assembly , & module . name ) ;
903
898
904
899
// We can't use the same module for asm and object code output,
905
900
// because that triggers various errors like invalid IR or broken
@@ -929,7 +924,7 @@ pub(crate) unsafe fn codegen(
929
924
. prof
930
925
. generic_activity_with_arg ( "LLVM_module_codegen_emit_obj" , & * module. name ) ;
931
926
932
- let dwo_out = cgcx. output_filenames . temp_path_dwo ( module_name ) ;
927
+ let dwo_out = cgcx. output_filenames . temp_path_dwo_for_cgu ( & module . name ) ;
933
928
let dwo_out = match ( cgcx. split_debuginfo , cgcx. split_dwarf_kind ) {
934
929
// Don't change how DWARF is emitted when disabled.
935
930
( SplitDebuginfo :: Off , _) => None ,
0 commit comments