[cfe-commits] r110697 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/enum2.c

Devang Patel dpatel at apple.com
Tue Aug 10 11:27:15 PDT 2010


Author: dpatel
Date: Tue Aug 10 13:27:15 2010
New Revision: 110697

URL: http://llvm.org/viewvc/llvm-project?rev=110697&view=rev
Log:
Do not use DIGlobalVariable to emit debugging information for enums.

Added:
    cfe/trunk/test/CodeGen/enum2.c
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=110697&r1=110696&r2=110697&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Aug 10 13:27:15 2010
@@ -1808,6 +1808,10 @@
   // 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),

Added: cfe/trunk/test/CodeGen/enum2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/enum2.c?rev=110697&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/enum2.c (added)
+++ cfe/trunk/test/CodeGen/enum2.c Tue Aug 10 13:27:15 2010
@@ -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;
+}





More information about the cfe-commits mailing list