[PATCH] D70537: [clang] CGDebugInfo asserts `!DT.isNull()` when compiling with debug symbols
kamlesh kumar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 13 23:27:59 PST 2019
kamleshbhalui updated this revision to Diff 233919.
kamleshbhalui added a comment.
added validation check in testcase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70537/new/
https://reviews.llvm.org/D70537
Files:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/pr42710.cpp
Index: clang/test/CodeGenCXX/pr42710.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/pr42710.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++17 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=CHECK
+
+namespace INT {
+struct TypeId
+{
+ inline static int counter{};
+
+ template<typename ...>
+ inline static const int identifier = counter++;
+
+ template<typename... Args>
+ inline static const int value = identifier<Args...>;
+
+};
+
+int main()
+{
+ return TypeId::value<int>;
+}
+}
+
+// CHECK: ![[L:[0-9]+]] = distinct !DIGlobalVariable(name: "identifier", linkageName: "_ZN3INT6TypeId10identifierIJiEEE"
+// CHECK: ![[L:[0-9]+]] = distinct !DIGlobalVariable(name: "identifier", linkageName: "_ZN4AUTO6TypeId10identifierIJiEEE"
+// CHECK: ![[L:[0-9]+]] = distinct !DIGlobalVariable(name: "counter", linkageName: "_ZN3INT6TypeId7counterE"
+// CHECK: ![[L:[0-9]+]] = distinct !DIGlobalVariable(name: "value", linkageName: "_ZN3INT6TypeId5valueIJiEEE"
+// CHECK: ![[L:[0-9]+]] = distinct !DIGlobalVariable(name: "counter", linkageName: "_ZN4AUTO6TypeId7counterE"
+// CHECK: ![[L:[0-9]+]] = distinct !DIGlobalVariable(name: "value", linkageName: "_ZN4AUTO6TypeId5valueIJiEEE"
+
+namespace AUTO {
+struct TypeId
+{
+ inline static int counter{};
+
+ template<typename ...>
+ inline static const auto identifier = counter++;
+
+ template<typename... Args>
+ inline static const auto value = identifier<Args...>;
+};
+
+int main()
+{
+ return TypeId::value<int>;
+}
+}
+
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1428,6 +1428,10 @@
if (isa<VarTemplatePartialSpecializationDecl>(V))
continue;
+ if (isa<VarTemplateSpecializationDecl>(V)
+ && V->getType()->isUndeducedType())
+ continue;
+
// Reuse the existing static member declaration if one exists
auto MI = StaticDataMemberCache.find(V->getCanonicalDecl());
if (MI != StaticDataMemberCache.end()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70537.233919.patch
Type: text/x-patch
Size: 2196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191214/3551a192/attachment-0001.bin>
More information about the cfe-commits
mailing list