[llvm] r177675 - Add a query to tell if a landing pad has a catch-all.

Bill Wendling isanbard at gmail.com
Thu Mar 21 16:01:04 PDT 2013


Author: void
Date: Thu Mar 21 18:01:03 2013
New Revision: 177675

URL: http://llvm.org/viewvc/llvm-project?rev=177675&view=rev
Log:
Add a query to tell if a landing pad has a catch-all.

Modified:
    llvm/trunk/include/llvm/IR/Instructions.h
    llvm/trunk/lib/IR/Instructions.cpp

Modified: llvm/trunk/include/llvm/IR/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Instructions.h?rev=177675&r1=177674&r2=177675&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Instructions.h (original)
+++ llvm/trunk/include/llvm/IR/Instructions.h Thu Mar 21 18:01:03 2013
@@ -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());

Modified: llvm/trunk/lib/IR/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Instructions.cpp?rev=177675&r1=177674&r2=177675&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Instructions.cpp (original)
+++ llvm/trunk/lib/IR/Instructions.cpp Thu Mar 21 18:01:03 2013
@@ -256,6 +256,13 @@ void LandingPadInst::addClause(Value *Va
   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
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list