Avoid const_casts
authorDevang Patel <dpatel@apple.com>
Tue, 26 Feb 2008 19:15:26 +0000 (19:15 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 26 Feb 2008 19:15:26 +0000 (19:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47616 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Instructions.h
lib/VMCore/Instructions.cpp

index e15430b090095d5e5e2ffc55fa7e876394c87db1..316d6b5a091ceb89e90c6b1d108f6dfbbd86a581 100644 (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:
index 8a375048bf1e5388c6b7c46498335fb81298dcc7..ffd93dbc6227d9146d41c8b6252264031eae5b7b 100644 (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);
   }
 }