[llvm-commits] [llvm] r47616 - in /llvm/trunk: include/llvm/Instructions.h lib/VMCore/Instructions.cpp

Devang Patel dpatel at apple.com
Tue Feb 26 11:15:27 PST 2008


Author: dpatel
Date: Tue Feb 26 13:15:26 2008
New Revision: 47616

URL: http://llvm.org/viewvc/llvm-project?rev=47616&view=rev
Log:
Avoid const_casts

Modified:
    llvm/trunk/include/llvm/Instructions.h
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=47616&r1=47615&r2=47616&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Feb 26 13:15:26 2008
@@ -1381,7 +1381,7 @@
 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:

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=47616&r1=47615&r2=47616&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Feb 26 13:15:26 2008
@@ -618,25 +618,25 @@
     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);
   }
 }
 





More information about the llvm-commits mailing list