summaryrefslogtreecommitdiff
path: root/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r--lib/Analysis/DebugInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 7bff11ec5b45..b64dbf433aae 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