From: Devang Patel Date: Tue, 24 Aug 2010 18:14:06 +0000 (+0000) Subject: Fix enum size and align. Tested by setvar.exp in gdb testsuite. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ffc52e78a27564d0512d42ed5c98a5588cf906b5;p=clang Fix enum size and align. Tested by setvar.exp in gdb testsuite. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111936 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 388d45c253..4873587a41 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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; }