From: Nick Lewycky Date: Sat, 6 Mar 2010 20:26:48 +0000 (+0000) Subject: Add verification of union types. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e20ab4a03c662a573b6be98c6da4be3031a874ba;p=oota-llvm.git Add verification of union types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97889 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 35625a59396..721e96a0f55 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1525,6 +1525,15 @@ void Verifier::VerifyType(const Type *Ty) { VerifyType(ElTy); } } break; + case Type::UnionTyID: { + const UnionType *UTy = cast(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(Ty); Assert1(ArrayType::isValidElementType(ATy->getElementType()),