summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-11-21 00:39:43 +0000
committerAdrian Prantl <aprantl@apple.com>2014-11-21 00:39:43 +0000
commit940257f7e43fe8f052de76f15355c3ce55d93b6f (patch)
tree10be0e258e374fdabbfbf67bcd421d57c0cf20ac /llvm/lib/IR/Verifier.cpp
parent88eec39460db6bc00dcccaed44dbaa50c817e2fc (diff)
downloadbcm5719-llvm-940257f7e43fe8f052de76f15355c3ce55d93b6f.tar.gz
bcm5719-llvm-940257f7e43fe8f052de76f15355c3ce55d93b6f.zip
Verifier: Check that all instructions have their parent pointers set up
correctly. This helps with catching problems caused by IRBuilder abuse such as the one fixed in CFE r222487. llvm-svn: 222488
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index d42ca31b5aa..05600155a8c 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1176,6 +1176,10 @@ void Verifier::visitBasicBlock(BasicBlock &BB) {
}
}
}
+
+ // Check that all instructions have their parent pointers set up correctly.
+ for (auto &I: BB)
+ Assert(I.getParent() == &BB, "Instruction has bogus parent pointer!");
}
void Verifier::visitTerminatorInst(TerminatorInst &I) {
OpenPOWER on IntegriCloud