diff options
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 4 | ||||
-rw-r--r-- | test/CodeGen/enum2.c | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index a75ff10476..4e020f92ce 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1808,6 +1808,10 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, // Create the descriptor for the variable. llvm::DIFile Unit = getOrCreateFile(VD->getLocation()); llvm::StringRef Name = VD->getName(); + llvm::DIType Ty = getOrCreateType(VD->getType(), Unit); + // Do not use DIGlobalVariable for enums. + if (Ty.getTag() == llvm::dwarf::DW_TAG_enumeration_type) + return; DebugFactory.CreateGlobalVariable(Unit, Name, Name, Name, Unit, getLineNumber(VD->getLocation()), getOrCreateType(VD->getType(), Unit), diff --git a/test/CodeGen/enum2.c b/test/CodeGen/enum2.c new file mode 100644 index 0000000000..3203627b89 --- /dev/null +++ b/test/CodeGen/enum2.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -g -emit-llvm -o /dev/null +int v; +enum e { MAX }; + +void foo (void) +{ + v = MAX; +} |