@@ -878,26 +878,21 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
878
878
. for_scope ( tcx. sess , RemapPathScopeComponents :: DEBUGINFO )
879
879
. to_string_lossy ( ) ;
880
880
let output_filenames = tcx. output_filenames ( ( ) ) ;
881
- let split_name = if tcx. sess . target_can_use_split_dwarf ( ) {
882
- output_filenames
883
- . split_dwarf_path (
884
- tcx. sess . split_debuginfo ( ) ,
885
- tcx. sess . opts . unstable_opts . split_dwarf_kind ,
886
- Some ( codegen_unit_name) ,
887
- )
888
- // We get a path relative to the working directory from split_dwarf_path
889
- . map ( |f| {
890
- if tcx. sess . should_prefer_remapped ( RemapPathScopeComponents :: DEBUGINFO ) {
891
- tcx. sess . source_map ( ) . path_mapping ( ) . map_prefix ( f) . 0
892
- } else {
893
- f. into ( )
894
- }
895
- } )
881
+ let split_name = if tcx. sess . target_can_use_split_dwarf ( )
882
+ && let Some ( f) = output_filenames. split_dwarf_path (
883
+ tcx. sess . split_debuginfo ( ) ,
884
+ tcx. sess . opts . unstable_opts . split_dwarf_kind ,
885
+ Some ( codegen_unit_name) ,
886
+ ) {
887
+ // We get a path relative to the working directory from split_dwarf_path
888
+ Some ( tcx. sess . source_map ( ) . path_mapping ( ) . to_real_filename ( f) )
896
889
} else {
897
890
None
898
- }
899
- . unwrap_or_default ( ) ;
900
- let split_name = split_name. to_str ( ) . unwrap ( ) ;
891
+ } ;
892
+ let split_name = split_name
893
+ . as_ref ( )
894
+ . map ( |f| f. for_scope ( tcx. sess , RemapPathScopeComponents :: DEBUGINFO ) . to_string_lossy ( ) )
895
+ . unwrap_or_default ( ) ;
901
896
let kind = DebugEmissionKind :: from_generic ( tcx. sess . opts . debuginfo ) ;
902
897
903
898
let dwarf_version =
0 commit comments