Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
authorRoman Divacky <rdivacky@freebsd.org>
Thu, 6 Sep 2012 15:42:13 +0000 (15:42 +0000)
committerRoman Divacky <rdivacky@freebsd.org>
Thu, 6 Sep 2012 15:42:13 +0000 (15:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163324 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ConstantFolding.cpp
lib/Bitcode/Reader/BitcodeReader.cpp
lib/CodeGen/StackColoring.cpp

index f5e619c6736cf8a15f7a2e3e42ba6079595e4f50..4ad613c66af75acd7ca610d5451923c1b8756c11 100644 (file)
@@ -659,7 +659,8 @@ static Constant *SymbolicallyEvaluateGEP(ArrayRef<Constant *> Ops,
   unsigned BitWidth = TD->getTypeSizeInBits(IntPtrTy);
   APInt Offset =
     APInt(BitWidth, TD->getIndexedOffset(Ptr->getType(),
-                                         makeArrayRef((Value **)Ops.data() + 1,
+                                         makeArrayRef((Value *const*)
+                                                        Ops.data() + 1,
                                                       Ops.size() - 1)));
   Ptr = StripPtrCastKeepAS(Ptr);
 
index a5b34f4898a769543278a1881b0ed8df47803a20..f242df4f97a27d031ee446a4bca5cf8775e88442 100644 (file)
@@ -2864,7 +2864,7 @@ bool BitcodeReader::InitStream() {
 }
 
 bool BitcodeReader::InitStreamFromBuffer() {
-  const unsigned char *BufPtr = (unsigned char *)Buffer->getBufferStart();
+  const unsigned char *BufPtr = (const unsigned char*)Buffer->getBufferStart();
   const unsigned char *BufEnd = BufPtr+Buffer->getBufferSize();
 
   if (Buffer->getBufferSize() & 3) {
index cd333f2f9f619dd5a3e616c060e6d6db3e99fb56..e1fc52d662f7d11dfbe275f234f128b6c5ff73a5 100644 (file)
@@ -522,7 +522,7 @@ void StackColoring::expungeSlotMap(DenseMap<int, int> &SlotRemap,
 bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
   DEBUG(dbgs() << "********** Stack Coloring **********\n"
                << "********** Function: "
-               << ((Value*)Func.getFunction())->getName() << '\n');
+               << ((const Value*)Func.getFunction())->getName() << '\n');
   MF = &Func;
   MFI = MF->getFrameInfo();
   Indexes = &getAnalysis<SlotIndexes>();