Add new setCondition member

llvm-svn: 6603
This commit is contained in:
Chris Lattner 2003-06-04 05:08:31 +00:00
parent 4e7bad01ff
commit d1f91d0660
1 changed files with 6 additions and 4 deletions

View File

@ -78,11 +78,13 @@ public:
inline bool isUnconditional() const { return Operands.size() == 1; } inline bool isUnconditional() const { return Operands.size() == 1; }
inline bool isConditional() const { return Operands.size() == 3; } inline bool isConditional() const { return Operands.size() == 3; }
inline const Value *getCondition() const { inline Value *getCondition() const {
return isUnconditional() ? 0 : Operands[2].get(); return isUnconditional() ? 0 : (Value*)Operands[2].get();
} }
Value *getCondition() {
return isUnconditional() ? 0 : Operands[2].get(); void setCondition(Value *V) {
assert(isConditional() && "Cannot set condition of unconditional branch!");
setOperand(2, V);
} }
// setUnconditionalDest - Change the current branch to an unconditional branch // setUnconditionalDest - Change the current branch to an unconditional branch