Avoid const_casts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47616 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2008-02-26 19:15:26 +00:00
parent 53bdbd7565
commit fea9830468
2 changed files with 6 additions and 6 deletions

View File

@ -1381,7 +1381,7 @@ public:
class ReturnInst : public TerminatorInst {
Use RetVal;
ReturnInst(const ReturnInst &RI);
void init(const Value * const* retVals, unsigned N);
void init(Value * const* retVals, unsigned N);
public:
// ReturnInst constructors:

View File

@ -618,25 +618,25 @@ ReturnInst::ReturnInst(const std::vector<Value *> &retVals)
init(&retVals[0], retVals.size());
}
void ReturnInst::init(const Value * const* retVals, unsigned N) {
void ReturnInst::init(Value * const* retVals, unsigned N) {
assert (N > 0 && "Invalid operands numbers in ReturnInst init");
NumOperands = N;
if (NumOperands == 1) {
const Value *V = *retVals;
Value *V = *retVals;
if (V->getType() == Type::VoidTy)
return;
RetVal.init(const_cast<Value*>(V), this);
RetVal.init(V, this);
return;
}
Use *OL = OperandList = new Use[NumOperands];
for (unsigned i = 0; i < NumOperands; ++i) {
const Value *V = *retVals++;
Value *V = *retVals++;
assert(!isa<BasicBlock>(V) &&
"Cannot return basic block. Probably using the incorrect ctor");
OL[i].init(const_cast<Value *>(V), this);
OL[i].init(V, this);
}
}