[PATCH] D76383: Allow remapping Clang module skeleton CU references with -fdebug-prefix-map
Adrian Prantl via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 18 13:35:24 PDT 2020
aprantl created this revision.
aprantl added reviewers: friss, JDevlieghere.
aprantl added a project: debug-info.
rdar://problem/55685132
https://reviews.llvm.org/D76383
Files:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/Modules/debug-info-moduleimport.m
Index: clang/test/Modules/debug-info-moduleimport.m
===================================================================
--- clang/test/Modules/debug-info-moduleimport.m
+++ clang/test/Modules/debug-info-moduleimport.m
@@ -1,11 +1,19 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - | FileCheck %s --check-prefix=NOIMPORT
+// RUN: %clang_cc1 -debug-info-kind=limited -fmodules \
+// RUN: -DGREETING="Hello World" -UNDEBUG \
+// RUN: -fimplicit-module-maps -fmodules-cache-path=%t %s \
+// RUN: -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - \
+// RUN: | FileCheck %s --check-prefix=NOIMPORT
// NOIMPORT-NOT: !DIImportedEntity
// NOIMPORT-NOT: !DIModule
// RUN: rm -rf %t
-// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -fmodules \
+// RUN: -DGREETING="Hello World" -UNDEBUG \
+// RUN: -fimplicit-module-maps -fmodules-cache-path=%t %s \
+// RUN: -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm \
+// RUN: -debugger-tuning=lldb -o - | FileCheck %s
// CHECK: ![[CU:.*]] = distinct !DICompileUnit
// CHECK-SAME: sysroot: "/tmp/..")
@@ -18,15 +26,18 @@
// CHECK-SAME: includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs"
// CHECK: ![[F]] = !DIFile(filename: {{.*}}debug-info-moduleimport.m
-// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
-// RUN: %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - \
-// RUN: | FileCheck %s --check-prefix=NO-SKEL-CHECK
+// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -fimplicit-module-maps \
+// RUN: -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t \
+// RUN: -emit-llvm -o - | FileCheck %s --check-prefix=NO-SKEL-CHECK
// NO-SKEL-CHECK: distinct !DICompileUnit
// NO-SKEL-CHECK-NOT: distinct !DICompileUnit
-// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
+// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -fimplicit-module-maps \
+// RUN: -fmodules-cache-path=%t -fdebug-prefix-map=%t=/MODULE-CACHE \
// RUN: -fmodule-format=obj -dwarf-ext-refs \
// RUN: %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=SKEL-CHECK
-// SKEL-CHECK: distinct !DICompileUnit
-// SKEL-CHECK: distinct !DICompileUnit{{.*}}dwoId
+// SKEL-CHECK: distinct !DICompileUnit({{.*}}file: ![[CUFILE:[0-9]+]]
+// SKEL-CHECK: ![[CUFILE]] = !DIFile({{.*}}directory: "[[COMP_DIR:.*]]"
+// SKEL-CHECK: distinct !DICompileUnit({{.*}}file: ![[DWOFILE:[0-9]+]]{{.*}}splitDebugFilename: "/MODULE-CACHE{{.*}}dwoId
+// SKEL-CHECK: ![[DWOFILE]] = !DIFile({{.*}}directory: "[[COMP_DIR]]"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2492,12 +2492,15 @@
? (uint64_t)Mod.getSignature()[1] << 32 | Mod.getSignature()[0]
: ~1ULL;
llvm::DIBuilder DIB(CGM.getModule());
- DIB.createCompileUnit(TheCU->getSourceLanguage(),
- // TODO: Support "Source" from external AST providers?
- DIB.createFile(Mod.getModuleName(), Mod.getPath()),
- TheCU->getProducer(), true, StringRef(), 0,
- Mod.getASTFile(), llvm::DICompileUnit::FullDebug,
- Signature);
+ std::string PCM = remapDIPath(Mod.getASTFile());
+ StringRef RelativePCM(PCM);
+ RelativePCM.consume_front(TheCU->getDirectory());
+ DIB.createCompileUnit(
+ TheCU->getSourceLanguage(),
+ // TODO: Support "Source" from external AST providers?
+ DIB.createFile(Mod.getModuleName(), TheCU->getDirectory()),
+ TheCU->getProducer(), false, StringRef(), 0, RelativePCM,
+ llvm::DICompileUnit::FullDebug, Signature);
DIB.finalize();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76383.251160.patch
Type: text/x-patch
Size: 4275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200318/4d8208d7/attachment-0001.bin>
More information about the cfe-commits
mailing list