[cfe-commits] r117507 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info-namespace.cpp

Devang Patel dpatel at apple.com
Wed Oct 27 16:23:58 PDT 2010


Author: dpatel
Date: Wed Oct 27 18:23:58 2010
New Revision: 117507

URL: http://llvm.org/viewvc/llvm-project?rev=117507&view=rev
Log:
Fix context info for enums.
Radar 8595129

Added:
    cfe/trunk/test/CodeGenCXX/debug-info-namespace.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=117507&r1=117506&r2=117507&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Oct 27 18:23:58 2010
@@ -1376,10 +1376,12 @@
     Size = CGM.getContext().getTypeSize(ED->getTypeForDecl());
     Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl());
   }
+  llvm::DIDescriptor EnumContext = 
+    getContextDescriptor(dyn_cast<Decl>(ED->getDeclContext()), Unit);
   llvm::DIType DbgTy = 
     DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_enumeration_type,
-                                     Unit, ED->getName(), DefUnit, Line,
-                                     Size, Align, 0, 0,
+                                     EnumContext, ED->getName(),
+                                     DefUnit, Line, Size, Align, 0, 0,
                                      llvm::DIType(), EltArray);
   return DbgTy;
 }

Added: cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp?rev=117507&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp Wed Oct 27 18:23:58 2010
@@ -0,0 +1,12 @@
+// RUN: %clang  -g -S %s -o - | FileCheck %s
+
+// CHECK: TAG_namespace
+namespace A {
+  enum numbers {
+    ZERO,
+    ONE
+  };
+}
+
+using namespace A;
+numbers n;





More information about the cfe-commits mailing list