aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-08-24 18:14:06 +0000
committerDevang Patel <dpatel@apple.com>2010-08-24 18:14:06 +0000
commitffc52e78a27564d0512d42ed5c98a5588cf906b5 (patch)
tree7f4deb27193433090c4083a93194b1858c4ef0be /lib/CodeGen/CGDebugInfo.cpp
parent2fb11ebc36a6604adb1e0f0331aeae48a95df212 (diff)
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
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp10
1 files changed, 6 insertions, 4 deletions
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;
}