diff options
author | Devang Patel <dpatel@apple.com> | 2009-03-20 18:24:39 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-03-20 18:24:39 +0000 |
commit | 99c20ebfbd7261bc4b92d617ada412b4ffe4f717 (patch) | |
tree | 6a503044a54c04be4e778f627fee89221ad32171 /lib | |
parent | fc6a89964badf45cbe8e907cd1e1ea1765f5357b (diff) |
Fix ivar's size encoding.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index ebf403038e..c349e4863a 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -367,12 +367,25 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, SourceLocation FieldDefLoc = Field->getLocation(); llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc); unsigned FieldLine = SM.getInstantiationLineNumber(FieldDefLoc); + + QualType FType = Field->getType(); + uint64_t FieldSize = 0; + unsigned FieldAlign = 0; + + if (!FType->isIncompleteArrayType()) { - // Bit size, align and offset of the type. - uint64_t FieldSize = M->getContext().getTypeSize(Ty); - unsigned FieldAlign = M->getContext().getTypeAlign(Ty); - uint64_t FieldOffset = RL.getFieldOffset(FieldNo); + // Bit size, align and offset of the type. + FieldSize = M->getContext().getTypeSize(FType); + Expr *BitWidth = Field->getBitWidth(); + if (BitWidth) + FieldSize = + BitWidth->getIntegerConstantExprValue(M->getContext()).getZExtValue(); + + FieldAlign = M->getContext().getTypeAlign(FType); + } + uint64_t FieldOffset = RL.getFieldOffset(FieldNo); + unsigned Flags = 0; if (Field->getAccessControl() == ObjCIvarDecl::Protected) Flags = llvm::DIType::FlagProtected; |