Skip to content

Commit 8e886ab

Browse files
authored
Apply -debug-prefix-map to isysroot (#32580)
* Apply -debug-prefix-map to isysroot Previously the absolute path to the sysroot, which could differ across machines in remote build scenarios, was included in the debug info of object files: ``` !11 = distinct !DICompileUnit(language: DW_LANG_Swift, file: !12, producer: "Swift version 5.3-dev (LLVM 93caf26, Swift 58b2ddc65afbd60)", isOptimized: false, runtimeVersion: 5, emissionKind: FullDebug, enums: !13, imports: !14, sysroot: "/Applications/Xcode-11.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk", sdk: "MacOSX.sdk") ``` With this change these are included in the remapping done by `-debug-prefix-map`. * Fix test
1 parent cc622b7 commit 8e886ab

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,7 @@ IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts,
17821782
/* DWOId */ 0, /* SplitDebugInlining */ true,
17831783
/* DebugInfoForProfiling */ false,
17841784
llvm::DICompileUnit::DebugNameTableKind::Default,
1785-
/* RangesBaseAddress */ false, Sysroot, SDK);
1785+
/* RangesBaseAddress */ false, DebugPrefixMap.remapPath(Sysroot), SDK);
17861786

17871787
// Because the swift compiler relies on Clang to setup the Module,
17881788
// the clang CU is always created first. Several dwarf-reading
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -sdk %t/SOME_SDK -g %s -emit-ir | %FileCheck -check-prefix=WITHOUT-PREFIX-MAP %s
3+
// RUN: %target-swift-frontend -sdk %t/SOME_SDK -g %s -emit-ir -debug-prefix-map %t/SOME_SDK=foo | %FileCheck -check-prefix=WITH-PREFIX-MAP -implicit-check-not=SOME_SDK %s
4+
5+
func foo() {}
6+
7+
// WITHOUT-PREFIX-MAP: sysroot: "{{.*}}SOME_SDK
8+
// WITH-PREFIX-MAP: sysroot: "foo

0 commit comments

Comments
 (0)