From: Bill Wendling Date: Thu, 21 Mar 2013 23:01:03 +0000 (+0000) Subject: Add a query to tell if a landing pad has a catch-all. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d254ab229820f1e6a98b44329974acb968a761b7;p=platform%2Fupstream%2Fllvm.git Add a query to tell if a landing pad has a catch-all. llvm-svn: 177675 --- diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index 7e29699..5dbca52 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/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(OperandList[Idx + 1]->getType()); diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index d58877e..841cc59 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/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(getClause(I))) + return true; + return false; +} + //===----------------------------------------------------------------------===// // CallInst Implementation //===----------------------------------------------------------------------===//