diff options
author | Eric Christopher <echristo@apple.com> | 2011-12-16 23:42:45 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-12-16 23:42:45 +0000 |
commit | 27886c6c1efd95ddda693f2f77a301956505b11d (patch) | |
tree | e66190f25d3f8f7060ec507ac2d1077bd973fdf2 /llvm/lib/Analysis | |
parent | da011dd0e3dd35491b832ca72d4ce84626ecc60c (diff) | |
download | bcm5719-llvm-27886c6c1efd95ddda693f2f77a301956505b11d.tar.gz bcm5719-llvm-27886c6c1efd95ddda693f2f77a301956505b11d.zip |
When recursing for the original size of a type, stop if we are at a
pointer or a reference type - we actually just want the size of the
pointer then for that.
Fixes rdar://10335756
llvm-svn: 146785
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index 640ad95e5cc..1f0053d8cfb 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -482,6 +482,7 @@ bool DINameSpace::Verify() const { /// return base type size. uint64_t DIDerivedType::getOriginalTypeSize() const { unsigned Tag = getTag(); + if (Tag == dwarf::DW_TAG_member || Tag == dwarf::DW_TAG_typedef || Tag == dwarf::DW_TAG_const_type || Tag == dwarf::DW_TAG_volatile_type || Tag == dwarf::DW_TAG_restrict_type) { @@ -490,7 +491,12 @@ uint64_t DIDerivedType::getOriginalTypeSize() const { // approach. if (!BaseType.isValid()) return getSizeInBits(); - if (BaseType.isDerivedType()) + // If this is a derived type, go ahead and get the base type, unless + // it's a reference or pointer type, then it's just the size of the field. + if (BaseType.getTag() == dwarf::DW_TAG_reference_type || + BaseType.getTag() == dwarf::DW_TAG_pointer_type) + return getSizeInBits(); + else if (BaseType.isDerivedType()) return DIDerivedType(BaseType).getOriginalTypeSize(); else return BaseType.getSizeInBits(); |