]> granicus.if.org Git - clang/commitdiff
Fix enum size and align. Tested by setvar.exp in gdb testsuite.
authorDevang Patel <dpatel@apple.com>
Tue, 24 Aug 2010 18:14:06 +0000 (18:14 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 24 Aug 2010 18:14:06 +0000 (18:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111936 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 388d45c253b9d4057fe94750e964f3ad074fce63..4873587a41c6aba68d1796052321c78951d3a081 100644 (file)
@@ -1240,13 +1240,15 @@ llvm::DIType CGDebugInfo::CreateEnumType(const EnumDecl *ED, llvm::DIFile Unit){
   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;
 }