summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-06-17 19:40:52 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-06-17 19:40:52 +0000
commit4f3b7364a4595a547b246d00f07e38630bf2cf97 (patch)
treed971867f6007a07278dc70c0f93f4caa37cc6161
parent15722626e3299e92683be26e2f07dd5127931f49 (diff)
downloadbcm5719-llvm-4f3b7364a4595a547b246d00f07e38630bf2cf97.tar.gz
bcm5719-llvm-4f3b7364a4595a547b246d00f07e38630bf2cf97.zip
PR42205: DebugInfio: Do not attempt to emit debug info metadata for static member variable template partial specializations
Would cause a crash in an attempt to create the type for the still unresolved 'auto' in the partial specialization (& even without the use of 'auto', the expression would be value dependent & crash/assertion-fail there). llvm-svn: 363606
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp3
-rw-r--r--clang/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp13
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index af9bac9b388..a53ca8f5243 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1410,6 +1410,9 @@ void CGDebugInfo::CollectRecordFields(
isa<VarTemplateSpecializationDecl>(V))
continue;
+ if (isa<VarTemplatePartialSpecializationDecl>(V))
+ continue;
+
// Reuse the existing static member declaration if one exists
auto MI = StaticDataMemberCache.find(V->getCanonicalDecl());
if (MI != StaticDataMemberCache.end()) {
diff --git a/clang/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp b/clang/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp
new file mode 100644
index 00000000000..675e3282371
--- /dev/null
+++ b/clang/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -std=c++14 -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
+
+// CHECK: ![[empty:[0-9]+]] = !{}
+
+// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B",
+// CHECK-SAME: elements: ![[empty]]
+
+struct B {
+ template <typename... e>
+ static const int d = 0;
+ template <typename e>
+ static const auto d<e> = d<e, e>;
+} c;
OpenPOWER on IntegriCloud