aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-12-16 23:42:45 +0000
committerEric Christopher <echristo@apple.com>2011-12-16 23:42:45 +0000
commit2e1b0c0cd9fab8f1841e1039cf39dcceeba70f73 (patch)
tree629a362bf9529f8b2a7e406d4f2ddcccd4c7e978 /lib/Analysis
parent1a8e8869cafa16d94afcb6f73bc3e0f2f72f70f1 (diff)
downloadexternal_llvm-2e1b0c0cd9fab8f1841e1039cf39dcceeba70f73.zip
external_llvm-2e1b0c0cd9fab8f1841e1039cf39dcceeba70f73.tar.gz
external_llvm-2e1b0c0cd9fab8f1841e1039cf39dcceeba70f73.tar.bz2
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/DebugInfo.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 640ad95..1f0053d 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/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();