r363606 - PR42205: DebugInfio: Do not attempt to emit debug info metadata for static member variable template partial specializations

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 12:40:52 PDT 2019


Author: dblaikie
Date: Mon Jun 17 12:40:52 2019
New Revision: 363606

URL: http://llvm.org/viewvc/llvm-project?rev=363606&view=rev
Log:
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).

Added:
    cfe/trunk/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=363606&r1=363605&r2=363606&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jun 17 12:40:52 2019
@@ -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()) {

Added: cfe/trunk/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp?rev=363606&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp Mon Jun 17 12:40:52 2019
@@ -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;




More information about the cfe-commits mailing list