[llvm] r177675 - Add a query to tell if a landing pad has a catch-all.
Duncan Sands
baldrick at free.fr
Fri Mar 22 01:36:13 PDT 2013
Hi Bill,
On 22/03/13 00:01, Bill Wendling wrote:
> 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.
I think this is a bad idea, as it is highly language specific. For example Ada
has a catch-all but it isn't "null", so this will give the wrong result for
Ada. If you added this for the benefit of clang I reckon it would be better to
move it into the clang source. In any case, I'd rather this wasn't part of the
landingpad API.
Ciao, Duncan.
>
> 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
> //===----------------------------------------------------------------------===//
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list