[llvm-commits] [llvm] r97889 - /llvm/trunk/lib/VMCore/Verifier.cpp
Nick Lewycky
nicholas at mxc.ca
Sat Mar 6 12:26:48 PST 2010
Author: nicholas
Date: Sat Mar 6 14:26:48 2010
New Revision: 97889
URL: http://llvm.org/viewvc/llvm-project?rev=97889&view=rev
Log:
Add verification of union types.
Modified:
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=97889&r1=97888&r2=97889&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Sat Mar 6 14:26:48 2010
@@ -1525,6 +1525,15 @@
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()),
More information about the llvm-commits
mailing list