[llvm-commits] [poolalloc] r159900 - in /poolalloc/trunk/lib: AssistDS/Devirt.cpp DSA/Printer.cpp

Will Dietz wdietz2 at illinois.edu
Sat Jul 7 12:21:40 PDT 2012


Author: wdietz2
Date: Sat Jul  7 14:21:40 2012
New Revision: 159900

URL: http://llvm.org/viewvc/llvm-project?rev=159900&view=rev
Log:
Use const_cast where it's intended; appease gcc 4.7 warnings.

Modified:
    poolalloc/trunk/lib/AssistDS/Devirt.cpp
    poolalloc/trunk/lib/DSA/Printer.cpp

Modified: poolalloc/trunk/lib/AssistDS/Devirt.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/Devirt.cpp?rev=159900&r1=159899&r2=159900&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/Devirt.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/Devirt.cpp Sat Jul  7 14:21:40 2012
@@ -192,7 +192,7 @@
     BasicBlock* BL = BasicBlock::Create (M->getContext(), FL->getName(), F);
     targets[FL] = BL;
     // Create the direct function call
-    Value* directCall = CallInst::Create ((Value *)FL,
+    Value* directCall = CallInst::Create (const_cast<Function*>(FL),
                                           fargs,
                                           "",
                                           BL);
@@ -231,7 +231,7 @@
     // Cast the function pointer to an integer.  This can go in the entry
     // block.
     //
-    Value * TargetInt = castTo ((Value *)(Targets[index]),
+    Value * TargetInt = castTo (const_cast<Function*>(Targets[index]),
                                 VoidPtrType,
                                 "",
                                 InsertPt);
@@ -322,7 +322,7 @@
     if (CallInst* CI = dyn_cast<CallInst>(CS.getInstruction())) {
       std::vector<Value*> Params (CI->op_begin(), CI->op_end());
       std::string name = CI->hasName() ? CI->getName().str() + ".dv" : "";
-      CallInst* CN = CallInst::Create ((Value *) NF,
+      CallInst* CN = CallInst::Create (const_cast<Function*>(NF),
                                        Params,
                                        name,
                                        CI);
@@ -331,7 +331,7 @@
     } else if (InvokeInst* CI = dyn_cast<InvokeInst>(CS.getInstruction())) {
       std::vector<Value*> Params (CI->op_begin(), CI->op_end());
       std::string name = CI->hasName() ? CI->getName().str() + ".dv" : "";
-      InvokeInst* CN = InvokeInst::Create((Value *) NF,
+      InvokeInst* CN = InvokeInst::Create(const_cast<Function*>(NF),
                                           CI->getNormalDest(),
                                           CI->getUnwindDest(),
                                           Params,

Modified: poolalloc/trunk/lib/DSA/Printer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Printer.cpp?rev=159900&r1=159899&r2=159900&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Printer.cpp (original)
+++ poolalloc/trunk/lib/DSA/Printer.cpp Sat Jul  7 14:21:40 2012
@@ -237,13 +237,13 @@
         else
           Label = I->first->getName().str() + " ret node";
         // Output the return node...
-        GW.emitSimpleNode((void*)I->first, "plaintext=circle", Label);
+        GW.emitSimpleNode(const_cast<Function*>(I->first), "plaintext=circle", Label);
 
         // Add edge from return node to real destination
         DSNode *RetNode = I->second.getNode();
         int RetEdgeDest = I->second.getOffset();
         if (RetEdgeDest == 0) RetEdgeDest = -1;
-        GW.emitEdge((void*)I->first, -1, RetNode,
+        GW.emitEdge(const_cast<Function*>(I->first), -1, RetNode,
                     RetEdgeDest, "arrowtail=tee,color=gray63");
       }
 





More information about the llvm-commits mailing list