summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-12-22 20:03:42 +0000
committerJim Laskey <jlaskey@mac.com>2006-12-22 20:03:42 +0000
commitee5f9274b925c59082e7ed7f5506bbb5af0d854b (patch)
treecd8254a86b8db997fc4634faaa3c1f4f6128662c /lib
parentd472ad7c7cb9378367bdc105dd208f80c7cd5998 (diff)
downloadllvm-ee5f9274b925c59082e7ed7f5506bbb5af0d854b.tar.gz
llvm-ee5f9274b925c59082e7ed7f5506bbb5af0d854b.tar.bz2
llvm-ee5f9274b925c59082e7ed7f5506bbb5af0d854b.tar.xz
Need to walk the derived chain of typedefs to get actual size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 2500d58fdf..3690f37620 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -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.