diff options
author | Chris Lattner <sabre@nondot.org> | 2005-04-24 07:28:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-04-24 07:28:37 +0000 |
commit | 64001d0a138cfff860a50aaa42f215028ca68be6 (patch) | |
tree | 31015a136c87fad62995d16976e71459e917b6a8 /lib | |
parent | 353835447c22559f00d010b9274bea96abf77e06 (diff) | |
download | external_llvm-64001d0a138cfff860a50aaa42f215028ca68be6.zip external_llvm-64001d0a138cfff860a50aaa42f215028ca68be6.tar.gz external_llvm-64001d0a138cfff860a50aaa42f215028ca68be6.tar.bz2 |
Allow these methods to take a generic Value* to simplify clients. Use
const_cast instead of c casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index c3eacdd..c2e7254 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -823,27 +823,28 @@ bool BinaryOperator::isNot(const Value *V) { return false; } -Value *BinaryOperator::getNegArgument(BinaryOperator *Bop) { - assert(isNeg(Bop) && "getNegArgument from non-'neg' instruction!"); - return Bop->getOperand(1); +Value *BinaryOperator::getNegArgument(Value *BinOp) { + assert(isNeg(BinOp) && "getNegArgument from non-'neg' instruction!"); + return cast<BinaryOperator>(BinOp)->getOperand(1); } -const Value *BinaryOperator::getNegArgument(const BinaryOperator *Bop) { - return getNegArgument((BinaryOperator*)Bop); +const Value *BinaryOperator::getNegArgument(const Value *BinOp) { + return getNegArgument(const_cast<Value*>(BinOp)); } -Value *BinaryOperator::getNotArgument(BinaryOperator *Bop) { - assert(isNot(Bop) && "getNotArgument on non-'not' instruction!"); - Value *Op0 = Bop->getOperand(0); - Value *Op1 = Bop->getOperand(1); +Value *BinaryOperator::getNotArgument(Value *BinOp) { + assert(isNot(BinOp) && "getNotArgument on non-'not' instruction!"); + BinaryOperator *BO = cast<BinaryOperator>(BinOp); + Value *Op0 = BO->getOperand(0); + Value *Op1 = BO->getOperand(1); if (isConstantAllOnes(Op0)) return Op1; assert(isConstantAllOnes(Op1)); return Op0; } -const Value *BinaryOperator::getNotArgument(const BinaryOperator *Bop) { - return getNotArgument((BinaryOperator*)Bop); +const Value *BinaryOperator::getNotArgument(const Value *BinOp) { + return getNotArgument(const_cast<Value*>(BinOp)); } |