diff options
author | Devang Patel <dpatel@apple.com> | 2009-11-04 23:48:00 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-11-04 23:48:00 +0000 |
commit | 61ecbd196c0128abb8c588aebc456ed96cdf1d63 (patch) | |
tree | eb31eeaf714c6f88187105ff5599823148f53936 /lib/Analysis/DebugInfo.cpp | |
parent | 4371cda7f8fc21fc3192ead122ba48b0152fb0e4 (diff) |
While calculating original type size for a derived type, handle type variants encoded as DIDerivedType appropriately.
This improves bitfield support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 7bff11ec5b..b64dbf433a 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -401,12 +401,18 @@ bool DIVariable::Verify() const { /// getOriginalTypeSize - If this type is derived from a base type then /// return base type size. uint64_t DIDerivedType::getOriginalTypeSize() const { - DIType BT = getTypeDerivedFrom(); - if (!BT.isNull() && BT.isDerivedType()) - return DIDerivedType(BT.getNode()).getOriginalTypeSize(); - if (BT.isNull()) - return getSizeInBits(); - return BT.getSizeInBits(); + 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) { + DIType BaseType = getTypeDerivedFrom(); + if (BaseType.isDerivedType()) + return DIDerivedType(BaseType.getNode()).getOriginalTypeSize(); + else + return BaseType.getSizeInBits(); + } + + return getSizeInBits(); } /// describes - Return true if this subprogram provides debugging |