[cfe-commits] r111936 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Tue Aug 24 11:14:06 PDT 2010


Author: dpatel
Date: Tue Aug 24 13:14:06 2010
New Revision: 111936

URL: http://llvm.org/viewvc/llvm-project?rev=111936&view=rev
Log:
Fix enum size and align. Tested by setvar.exp in gdb testsuite.

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=111936&r1=111935&r2=111936&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Aug 24 13:14:06 2010
@@ -1240,13 +1240,15 @@
   llvm::DIFile DefUnit = getOrCreateFile(ED->getLocation());
   unsigned Line = getLineNumber(ED->getLocation());
   uint64_t Size = 0;
-  if (!ED->getTypeForDecl()->isIncompleteType())
-    CGM.getContext().getTypeSize(ED->getTypeForDecl());
-
+  uint64_t Align = 0;
+  if (!ED->getTypeForDecl()->isIncompleteType()) {
+    Size = CGM.getContext().getTypeSize(ED->getTypeForDecl());
+    Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl());
+  }
   llvm::DIType DbgTy = 
     DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_enumeration_type,
                                      Unit, ED->getName(), DefUnit, Line,
-                                     Size, 0, 0, 0,
+                                     Size, Align, 0, 0,
                                      llvm::DIType(), EltArray);
   return DbgTy;
 }





More information about the cfe-commits mailing list