From ced39ec4ab3935d70203a3f07a464f425b1137c7 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sat, 17 Aug 2013 20:01:53 +0000 Subject: [PATCH] PR16927: Don't assert (or, previously, skip) static data members of enumeration type git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188612 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 3 --- test/CodeGenCXX/debug-info-static-member.cpp | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 74b4662171..e6e12e4a1a 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -874,9 +874,6 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::DIFile VUnit = getOrCreateFile(Var->getLocation()); llvm::DIType VTy = getOrCreateType(Var->getType(), VUnit); - assert(VTy.getTag() != llvm::dwarf::DW_TAG_enumeration_type && - "Do not describe enums as static members"); - unsigned LineNumber = getLineNumber(Var->getLocation()); StringRef VName = Var->getName(); llvm::Constant *C = NULL; diff --git a/test/CodeGenCXX/debug-info-static-member.cpp b/test/CodeGenCXX/debug-info-static-member.cpp index 774f7b1727..cd48f6b8b8 100644 --- a/test/CodeGenCXX/debug-info-static-member.cpp +++ b/test/CodeGenCXX/debug-info-static-member.cpp @@ -1,7 +1,9 @@ // RUN: %clangxx -target x86_64-unknown-unknown -g -O0 %s -emit-llvm -S -o - | FileCheck %s // PR14471 - +enum X { + Y +}; class C { static int a; @@ -13,6 +15,7 @@ public: static int c; const static int const_c = 18; int d; + static X x_a; }; int C::a = 4; @@ -37,5 +40,6 @@ int main() // CHECK: metadata !"const_b", {{.*}}, float 0x{{.*}}} ; [ DW_TAG_member ] [const_b] [line {{.*}}, size 0, align 0, offset 0] [protected] [static] // CHECK: ![[DECL_C:[0-9]+]] {{.*}} metadata !"c", {{.*}} [ DW_TAG_member ] [c] [line {{.*}}, size 0, align 0, offset 0] [static] // CHECK: metadata !"const_c", {{.*}} [ DW_TAG_member ] [const_c] [line {{.*}}, size 0, align 0, offset 0] [static] +// CHECK: metadata !"x_a", {{.*}} [ DW_TAG_member ] [x_a] {{.*}} [static] // CHECK: metadata !"b", {{.*}} @_ZN1C1bE, metadata ![[DECL_B]]} ; [ DW_TAG_variable ] [b] {{.*}} [def] // CHECK: metadata !"c", {{.*}} @_ZN1C1cE, metadata ![[DECL_C]]} ; [ DW_TAG_variable ] [c] {{.*}} [def] -- 2.40.0