summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-11-04 23:48:00 +0000
committerDevang Patel <dpatel@apple.com>2009-11-04 23:48:00 +0000
commitf05d57283e70e228ee619c63973114dd8bd26371 (patch)
treeb3f14c0455b3af13e10e952dadfadd3b3144b4b4 /llvm/lib/Analysis/DebugInfo.cpp
parenta5beced60e4f01169573f46b3872f6dd6f89ed5a (diff)
downloadbcm5719-llvm-f05d57283e70e228ee619c63973114dd8bd26371.tar.gz
bcm5719-llvm-f05d57283e70e228ee619c63973114dd8bd26371.zip
While calculating original type size for a derived type, handle type variants encoded as DIDerivedType appropriately.
This improves bitfield support. llvm-svn: 86073
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
-rw-r--r--llvm/lib/Analysis/DebugInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index 7bff11ec5b4..b64dbf433aa 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud