summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-28 04:02:44 +0000
committerChris Lattner <sabre@nondot.org>2008-08-28 04:02:44 +0000
commite5a22c06c53256cbc0d818b27ed589511f2a1620 (patch)
tree2832c47c4a30453182aa3552884430320e967b8d /llvm/lib
parent266ec3fb4ee9cb0ce4383a94961d9ecf138d6a46 (diff)
downloadbcm5719-llvm-e5a22c06c53256cbc0d818b27ed589511f2a1620.tar.gz
bcm5719-llvm-e5a22c06c53256cbc0d818b27ed589511f2a1620.zip
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 ;-) llvm-svn: 55460
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index b5876a7e98e..034a0628fba 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -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() ||
OpenPOWER on IntegriCloud