From a6fd4b0d82d76ffea4edebc9f2f203b4ca0bb01b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 9 Apr 2002 18:36:05 +0000 Subject: [PATCH] Use .get() explicitly and add a few extra casts to avoid 2 #includes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2204 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/iTerminators.h | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/include/llvm/iTerminators.h b/include/llvm/iTerminators.h index 790b0e2b111..e0d6d62d204 100644 --- a/include/llvm/iTerminators.h +++ b/include/llvm/iTerminators.h @@ -11,8 +11,6 @@ #define LLVM_ITERMINATORS_H #include "llvm/InstrTypes.h" -#include "llvm/BasicBlock.h" -#include "llvm/ConstantVals.h" //===----------------------------------------------------------------------===// // Classes to represent Basic Block "Terminator" instructions @@ -98,16 +96,16 @@ public: void setUnconditionalDest(BasicBlock *Dest) { if (Operands.size() == 3) Operands.erase(Operands.begin()+1, Operands.end()); - Operands[0] = Dest; + Operands[0] = (Value*)Dest; } // Additionally, they must provide a method to get at the successors of this // terminator instruction. // virtual const BasicBlock *getSuccessor(unsigned i) const { - return (i == 0) ? cast(Operands[0]) : + return (i == 0) ? cast(Operands[0].get()) : ((i == 1 && Operands.size() > 1) - ? cast(Operands[1]) : 0); + ? cast(Operands[1].get()) : 0); } inline BasicBlock *getSuccessor(unsigned idx) { return (BasicBlock*)((const BranchInst *)this)->getSuccessor(idx); @@ -145,10 +143,10 @@ public: inline const Value *getCondition() const { return Operands[0]; } inline Value *getCondition() { return Operands[0]; } inline const BasicBlock *getDefaultDest() const { - return cast(Operands[1]); + return cast(Operands[1].get()); } inline BasicBlock *getDefaultDest() { - return cast(Operands[1]); + return cast(Operands[1].get()); } void dest_push_back(Constant *OnVal, BasicBlock *Dest); @@ -161,22 +159,22 @@ public: // virtual const BasicBlock *getSuccessor(unsigned idx) const { if (idx >= Operands.size()/2) return 0; - return cast(Operands[idx*2+1]); + return cast(Operands[idx*2+1].get()); } inline BasicBlock *getSuccessor(unsigned idx) { if (idx >= Operands.size()/2) return 0; - return cast(Operands[idx*2+1]); + return cast(Operands[idx*2+1].get()); } // getSuccessorValue - Return the value associated with the specified // successor. WARNING: This does not gracefully accept idx's out of range! inline const Constant *getSuccessorValue(unsigned idx) const { assert(idx < getNumSuccessors() && "Successor # out of range!"); - return cast(Operands[idx*2]); + return cast(Operands[idx*2].get()); } inline Constant *getSuccessorValue(unsigned idx) { assert(idx < getNumSuccessors() && "Successor # out of range!"); - return cast(Operands[idx*2]); + return cast(Operands[idx*2].get()); } virtual unsigned getNumSuccessors() const { return Operands.size()/2; } @@ -218,16 +216,16 @@ public: // get*Dest - Return the destination basic blocks... inline const BasicBlock *getNormalDest() const { - return cast(Operands[1]); + return cast(Operands[1].get()); } inline BasicBlock *getNormalDest() { - return cast(Operands[1]); + return cast(Operands[1].get()); } inline const BasicBlock *getExceptionalDest() const { - return cast(Operands[2]); + return cast(Operands[2].get()); } inline BasicBlock *getExceptionalDest() { - return cast(Operands[2]); + return cast(Operands[2].get()); } virtual const char *getOpcodeName() const { return "invoke"; }