Need to walk the derived chain of typedefs to get actual size.

llvm-svn: 32744
This commit is contained in:
Jim Laskey 2006-12-22 20:03:42 +00:00
parent 763550323d
commit d7a090ffc4
1 changed files with 13 additions and 4 deletions

View File

@ -1539,10 +1539,19 @@ private:
uint64_t FieldAlign = Align;
uint64_t FieldOffset = Offset;
if (TypeDesc *FromTy = MemberDesc->getFromType()) {
AddType(Member, FromTy, Unit);
FieldSize = FromTy->getSize();
FieldAlign = FromTy->getSize();
// Set the member type.
TypeDesc *FromTy = MemberDesc->getFromType();
AddType(Member, FromTy, Unit);
// Walk up typedefs until a real size is found.
while (FromTy) {
if (FromTy->getTag() != DW_TAG_typedef) {
FieldSize = FromTy->getSize();
FieldAlign = FromTy->getSize();
break;
}
FromTy = dyn_cast<DerivedTypeDesc>(FromTy)->getFromType();
}
// Unless we have a bit field.