Add a query to tell if a landing pad has a catch-all.
authorBill Wendling <isanbard@gmail.com>
Thu, 21 Mar 2013 23:01:03 +0000 (23:01 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 21 Mar 2013 23:01:03 +0000 (23:01 +0000)
llvm-svn: 177675

llvm/include/llvm/IR/Instructions.h
llvm/lib/IR/Instructions.cpp

index 7e29699..5dbca52 100644 (file)
@@ -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());
index d58877e..841cc59 100644 (file)
@@ -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
 //===----------------------------------------------------------------------===//