[PATCH] D76377: Correctly initialize the DW_AT_comp_dir attribute of Clang module skeleton CUs
Adrian Prantl via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 14:40:35 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG079c6ddaf534: Correctly initialize the DW_AT_comp_dir attribute of Clang module skeleton CUs (authored by aprantl).
Herald added a project: clang.
Changed prior to commit:
https://reviews.llvm.org/D76377?vs=251142&id=251771#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76377/new/
https://reviews.llvm.org/D76377
Files:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/Modules/debug-info-moduleimport.m
clang/test/PCH/debug-info-pch-path.c
Index: clang/test/PCH/debug-info-pch-path.c
===================================================================
--- clang/test/PCH/debug-info-pch-path.c
+++ clang/test/PCH/debug-info-pch-path.c
@@ -23,7 +23,7 @@
// CHECK-REL-NODIR: ![[C]] = !DIFile({{.*}}directory: "[[DIR:.*]]"
// CHECK-REL-NODIR: !DICompileUnit(
// CHECK-REL-NODIR-SAME: file: ![[PCH:[0-9]+]]
-// CHECK-REL-NODIR-SAME: splitDebugFilename: "prefix.pch"
+// CHECK-REL-NODIR-SAME: splitDebugFilename: "{{.*}}PCH{{.*}}prefix.pch"
// CHECK-REL-NODIR: ![[PCH]] = !DIFile({{.*}}directory: "[[DIR]]
// ---------------------------------------------------------------------
@@ -47,8 +47,8 @@
// CHECK-REL: ![[C]] = !DIFile({{.*}}directory: "[[DIR:.*]]"
// CHECK-REL: !DICompileUnit(
// CHECK-REL-SAME: file: ![[PCH:[0-9]+]]
-// CHECK-REL-SAME: splitDebugFilename: "prefix.pch"
-// CHECK-REL: ![[PCH]] = !DIFile({{.*}}directory: "[[DIR]]{{.*}}pchdir"
+// CHECK-REL-SAME: splitDebugFilename: "[[DIR]]{{.*}}pchdir{{.*}}prefix.pch"
+// CHECK-REL: ![[PCH]] = !DIFile({{.*}}directory: "[[DIR]]"
// ---------------------------------------------------------------------
// Absolute PCH.
@@ -70,5 +70,5 @@
// CHECK-ABS: ![[C]] = !DIFile({{.*}}directory: "[[DIR:.*]]"
// CHECK-ABS: !DICompileUnit(
// CHECK-ABS-SAME: file: ![[PCH:[0-9]+]]
-// CHECK-ABS-SAME: splitDebugFilename: "prefix.pch"
+// CHECK-ABS-SAME: splitDebugFilename: "[[DIR]]{{.*}}prefix.pch"
// CHECK-ABS: ![[PCH]] = !DIFile({{.*}}directory: "[[DIR]]
Index: clang/test/Modules/debug-info-moduleimport.m
===================================================================
--- clang/test/Modules/debug-info-moduleimport.m
+++ clang/test/Modules/debug-info-moduleimport.m
@@ -28,5 +28,7 @@
// 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]+]]{{.*}}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,16 @@
? (uint64_t)Mod.getSignature()[1] << 32 | Mod.getSignature()[0]
: ~1ULL;
llvm::DIBuilder DIB(CGM.getModule());
+ SmallString<0> PCM;
+ if (!llvm::sys::path::is_absolute(PCM))
+ PCM = Mod.getPath();
+ llvm::sys::path::append(PCM, Mod.getASTFile());
+ StringRef CompDir = getCurrentDirname();
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);
+ DIB.createFile(Mod.getModuleName(), CompDir),
+ TheCU->getProducer(), true, StringRef(), 0, PCM,
+ llvm::DICompileUnit::FullDebug, Signature);
DIB.finalize();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76377.251771.patch
Type: text/x-patch
Size: 3570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200320/acce0863/attachment.bin>
More information about the cfe-commits
mailing list