Make sure that if we're going to attempt to add a type to a DIE that

the type exists.

Fix up cases where we weren't checking for optional types and add
an assert to addType to make sure we catch this in the future.

Fix up a testcase that was using the tag for DW_TAG_array_type
when it meant DW_TAG_enumeration_type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2013-08-08 07:40:37 +00:00
parent afdd1f8a85
commit dc1363f5af
4 changed files with 27 additions and 16 deletions

View File

@ -483,6 +483,12 @@ bool DICompositeType::Verify() const {
if (!fieldIsMDNode(DbgNode, 12))
return false;
// If this is an array type verify that we have a DIType in the derived type
// field as that's the type of our element.
if (getTag() == dwarf::DW_TAG_array_type)
if (!DIType(getTypeDerivedFrom()))
return false;
return DbgNode->getNumOperands() >= 10 && DbgNode->getNumOperands() <= 14;
}