When computing the size of a base type be conservative if the type

is a declaration and return the size of the type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2014-03-12 18:18:05 +00:00
parent 9225686155
commit 365f0455a6
2 changed files with 145 additions and 2 deletions

View File

@ -751,8 +751,9 @@ static uint64_t getBaseTypeSize(DwarfDebug *DD, DIDerivedType Ty) {
DIType BaseType = DD->resolve(Ty.getTypeDerivedFrom());
// If this type is not derived from any type then take conservative approach.
if (!BaseType.isValid())
// If this type is not derived from any type or the type is a declaration then
// take conservative approach.
if (!BaseType.isValid() || BaseType.isForwardDecl())
return Ty.getSizeInBits();
// If this is a derived type, go ahead and get the base type, unless it's a