Make the verifier reject instructions which have null pointers

for operands: rdar://6179606.  no testcase, because I can't write
a .ll file that is this broken ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55460 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2008-08-28 04:02:44 +00:00
parent 1e1ef3e2bd
commit cad208b8bc

View File

@ -224,6 +224,10 @@ namespace {
void visitGlobalAlias(GlobalAlias &GA);
void visitFunction(Function &F);
void visitBasicBlock(BasicBlock &BB);
using InstVisitor<Verifier>::visit;
void visit(Instruction &I);
void visitTruncInst(TruncInst &I);
void visitZExtInst(ZExtInst &I);
void visitSExtInst(SExtInst &I);
@ -326,6 +330,13 @@ static RegisterPass<Verifier> X("verify", "Module Verifier");
do { if (!(C)) { CheckFailed(M, V1, V2, V3, V4); return; } } while (0)
void Verifier::visit(Instruction &I) {
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
Assert1(I.getOperand(i) != 0, "Operand is null", &I);
InstVisitor<Verifier>::visit(I);
}
void Verifier::visitGlobalValue(GlobalValue &GV) {
Assert1(!GV.isDeclaration() ||
GV.hasExternalLinkage() ||