summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-03-06 20:26:48 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-03-06 20:26:48 +0000
commit4b5e95426de5d97a1c42af83900fcbe06cbd1bc3 (patch)
treeb9709098da14524da1f1d325a46bfa39fff938aa /llvm
parentc9c8b2713c1e683e814d1e6cd16d9447825400e4 (diff)
downloadbcm5719-llvm-4b5e95426de5d97a1c42af83900fcbe06cbd1bc3.tar.gz
bcm5719-llvm-4b5e95426de5d97a1c42af83900fcbe06cbd1bc3.zip
Add verification of union types.
llvm-svn: 97889
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 35625a59396..721e96a0f55 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -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()),
OpenPOWER on IntegriCloud