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 | 9f804934dfc3cfd58f1b256853702064206149f0 (patch) | |
tree | 085f08bcd8bcb46586f4b0a9d6d3d7bce11f2d3f /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 7f2600244c21712fa0ca2f169d38a95806e15c49 (diff) | |
download | bcm5719-llvm-9f804934dfc3cfd58f1b256853702064206149f0.tar.gz bcm5719-llvm-9f804934dfc3cfd58f1b256853702064206149f0.zip |
Fix ivar's size encoding.
llvm-svn: 67389
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index ebf403038e0..c349e4863a6 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/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; |