aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-09-27 16:43:19 +0000
committerDuncan Sands <baldrick@free.fr>2011-09-27 16:43:19 +0000
commit00418ea91c6d9a681fe33182a3bf669e4347f7d2 (patch)
treeaaeaec6f92171e62e880ffc7e51cc5b3b0479818
parenta3c42f3d4e5d14c8f4fb9bb123e7759c425d041b (diff)
Have the verifier check that all landingpad operands are constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140606 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Verifier.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 5936d80983..804d9c5d3b 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -1449,6 +1449,17 @@ void Verifier::visitLandingPadInst(LandingPadInst &LPI) {
"Personality function doesn't match others in function", &LPI);
PersonalityFn = LPI.getPersonalityFn();
+ // All operands must be constants.
+ Assert1(isa<Constant>(PersonalityFn), "Personality function is not constant!",
+ &LPI);
+ for (unsigned i = 0, e = LPI.getNumClauses(); i < e; ++i) {
+ Value *Clause = LPI.getClause(i);
+ Assert1(isa<Constant>(Clause), "Clause is not constant!", &LPI);
+ if (LPI.isFilter(i))
+ Assert1(isa<ConstantArray>(Clause) || isa<ConstantAggregateZero>(Clause),
+ "Filter is not an array of constants!", &LPI);
+ }
+
visitInstruction(LPI);
}