Add verification of union types.

llvm-svn: 97889
This commit is contained in:
Nick Lewycky 2010-03-06 20:26:48 +00:00
parent c9c8b2713c
commit 4b5e95426d
1 changed files with 9 additions and 0 deletions

View File

@ -1525,6 +1525,15 @@ void Verifier::VerifyType(const Type *Ty) {
VerifyType(ElTy);
}
} break;
case Type::UnionTyID: {
const UnionType *UTy = cast<UnionType>(Ty);
for (unsigned i = 0, e = UTy->getNumElements(); i != e; ++i) {
const Type *ElTy = UTy->getElementType(i);
Assert2(UnionType::isValidElementType(ElTy),
"Union type with invalid element type", ElTy, UTy);
VerifyType(ElTy);
}
} break;
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
Assert1(ArrayType::isValidElementType(ATy->getElementType()),