mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 14:36:34 +00:00
Avoid const_casts
llvm-svn: 47616
This commit is contained in:
parent
2cb16cddf1
commit
e5766a12da
@ -1381,7 +1381,7 @@ public:
|
|||||||
class ReturnInst : public TerminatorInst {
|
class ReturnInst : public TerminatorInst {
|
||||||
Use RetVal;
|
Use RetVal;
|
||||||
ReturnInst(const ReturnInst &RI);
|
ReturnInst(const ReturnInst &RI);
|
||||||
void init(const Value * const* retVals, unsigned N);
|
void init(Value * const* retVals, unsigned N);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// ReturnInst constructors:
|
// ReturnInst constructors:
|
||||||
|
@ -618,25 +618,25 @@ ReturnInst::ReturnInst(const std::vector<Value *> &retVals)
|
|||||||
init(&retVals[0], retVals.size());
|
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");
|
assert (N > 0 && "Invalid operands numbers in ReturnInst init");
|
||||||
|
|
||||||
NumOperands = N;
|
NumOperands = N;
|
||||||
if (NumOperands == 1) {
|
if (NumOperands == 1) {
|
||||||
const Value *V = *retVals;
|
Value *V = *retVals;
|
||||||
if (V->getType() == Type::VoidTy)
|
if (V->getType() == Type::VoidTy)
|
||||||
return;
|
return;
|
||||||
RetVal.init(const_cast<Value*>(V), this);
|
RetVal.init(V, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Use *OL = OperandList = new Use[NumOperands];
|
Use *OL = OperandList = new Use[NumOperands];
|
||||||
for (unsigned i = 0; i < NumOperands; ++i) {
|
for (unsigned i = 0; i < NumOperands; ++i) {
|
||||||
const Value *V = *retVals++;
|
Value *V = *retVals++;
|
||||||
assert(!isa<BasicBlock>(V) &&
|
assert(!isa<BasicBlock>(V) &&
|
||||||
"Cannot return basic block. Probably using the incorrect ctor");
|
"Cannot return basic block. Probably using the incorrect ctor");
|
||||||
OL[i].init(const_cast<Value *>(V), this);
|
OL[i].init(V, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user