aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/IR/Instructions.h3
-rw-r--r--lib/IR/Instructions.cpp7
2 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/IR/Instructions.h b/include/llvm/IR/Instructions.h
index 7e29699f73..5dbca52e82 100644
--- a/include/llvm/IR/Instructions.h
+++ b/include/llvm/IR/Instructions.h
@@ -2230,6 +2230,9 @@ public:
/// to determine what type of clause this is.
Value *getClause(unsigned Idx) const { return OperandList[Idx + 1]; }
+ /// hasCatchAll - Return 'true' if this landing pad has a catch-all.
+ bool hasCatchAll() const;
+
/// isCatch - Return 'true' if the clause and index Idx is a catch clause.
bool isCatch(unsigned Idx) const {
return !isa<ArrayType>(OperandList[Idx + 1]->getType());
diff --git a/lib/IR/Instructions.cpp b/lib/IR/Instructions.cpp
index d58877ef77..841cc5926a 100644
--- a/lib/IR/Instructions.cpp
+++ b/lib/IR/Instructions.cpp
@@ -256,6 +256,13 @@ void LandingPadInst::addClause(Value *Val) {
OperandList[OpNo] = Val;
}
+bool LandingPadInst::hasCatchAll() const {
+ for (unsigned I = 0, E = getNumClauses(); I != E; ++I)
+ if (isCatch(I) && isa<ConstantPointerNull>(getClause(I)))
+ return true;
+ return false;
+}
+
//===----------------------------------------------------------------------===//
// CallInst Implementation
//===----------------------------------------------------------------------===//