Skip to content

Commit 9aa4c93

Browse files
authored
Merge pull request #61583 from bulbazord/prefix-remapping
[DebugInfo] Respect debug-prefix-map when emitting path to PCM in Skeleton CUs
2 parents 8535e80 + 686193b commit 9aa4c93

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
725725
return cast<llvm::DIModule>(Val->second);
726726

727727
std::string RemappedIncludePath = DebugPrefixMap.remapPath(IncludePath);
728+
std::string RemappedASTFile = DebugPrefixMap.remapPath(ASTFile);
728729

729730
// For Clang modules / PCH, create a Skeleton CU pointing to the PCM/PCH.
730731
if (!Opts.DisableClangModuleSkeletonCUs) {
@@ -736,7 +737,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
736737
: llvm::dwarf::DW_LANG_C99,
737738
DIB.createFile(Name, RemappedIncludePath),
738739
TheCU->getProducer(), true, StringRef(), 0,
739-
ASTFile, llvm::DICompileUnit::FullDebug,
740+
RemappedASTFile, llvm::DICompileUnit::FullDebug,
740741
Signature);
741742
DIB.finalize();
742743
}

test/DebugInfo/ClangModuleBreadcrumbs.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
// RUN: %target-swift-frontend -emit-ir %s -g -I %S/Inputs \
55
// RUN: -Xcc -DFOO="foo" -Xcc -UBAR -o - -no-clang-module-breadcrumbs \
66
// RUN: | %FileCheck %s --check-prefix=NONE
7+
//
8+
// RUN: %target-swift-frontend -module-cache-path %t.mcp -emit-ir %s \
9+
// RUN: -g -I %S/Inputs -Xcc -DFOO="foo" -Xcc -UBAR \
10+
// RUN: -debug-prefix-map %t.mcp=PREFIX \
11+
// RUN: -o - | %FileCheck %s --check-prefix=REMAP
12+
713
import ClangModule.SubModule
814
import OtherClangModule.SubModule
915

@@ -24,3 +30,15 @@ let _ = someFunc(0)
2430

2531
// NONE: DICompileUnit({{.*}}
2632
// NONE-NOT: DICompileUnit({{.*}}ClangModule
33+
34+
// REMAP: !DICompileUnit(language: DW_LANG_{{ObjC|C99}},{{.*}} producer: "{{.*}}Swift
35+
// REMAP-SAME: PREFIX{{/|\\\\}}{{.*}}{{/|\\\\}}ClangModule
36+
// REMAP-SAME: dwoId:
37+
38+
// REMAP: !DICompileUnit(language: DW_LANG_{{ObjC|C99}},{{.*}} producer: "{{.*}}Swift
39+
// REMAP-SAME: PREFIX{{/|\\\\}}{{.*}}{{/|\\\\}}OtherClangModule
40+
// REMAP-SAME: dwoId:
41+
42+
// REMAP: !DICompileUnit(language: DW_LANG_{{ObjC|C99}},{{.*}} producer: "{{.*}}clang
43+
// REMAP-SAME: PREFIX{{/|\\\\}}{{.*}}{{/|\\\\}}ClangModule
44+
// REMAP-SAME: dwoId:

0 commit comments

Comments
 (0)