Fixing some -Wcast-qual warnings; NFC.
authorAaron Ballman <aaron@aaronballman.com>
Thu, 6 Nov 2014 14:32:30 +0000 (14:32 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 6 Nov 2014 14:32:30 +0000 (14:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221454 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/NVPTX/NVPTXLowerStructArgs.cpp

index 6c1cc80a9fd8fa1d77d894945cdd6f2549a11125..b592023631b87ceaacf4eb48c51d8df32fd17d5f 100644 (file)
@@ -64,7 +64,7 @@ void NVPTXLowerStructArgs::handleParam(Argument *Arg) {
   const Type *StructType = PType->getElementType();
 
   AllocaInst *AllocA =
-    new AllocaInst((Type *)StructType, Arg->getName(), FirstInst);
+    new AllocaInst(const_cast<Type *>(StructType), Arg->getName(), FirstInst);
 
   /* Set the alignment to alignment of the byval parameter. This is because,
    * later load/stores assume that alignment, and we are going to replace
@@ -79,9 +79,9 @@ void NVPTXLowerStructArgs::handleParam(Argument *Arg) {
     Type::getInt8PtrTy(Func->getParent()->getContext(), ADDRESS_SPACE_PARAM),
     Type::getInt8PtrTy(Func->getParent()->getContext(), ADDRESS_SPACE_GENERIC)
   };
-  Function *CvtFunc = (Function *)Intrinsic::getDeclaration(
+  Function *CvtFunc = Intrinsic::getDeclaration(
       Func->getParent(), Intrinsic::nvvm_ptr_gen_to_param,
-      ArrayRef<Type *>((Type **)CvtTypes, 2));
+      ArrayRef<Type *>(const_cast<Type **>(CvtTypes), 2));
   std::vector<Value *> BC1;
   BC1.push_back(
       new BitCastInst(Arg, Type::getInt8PtrTy(Func->getParent()->getContext(),
@@ -90,9 +90,10 @@ void NVPTXLowerStructArgs::handleParam(Argument *Arg) {
   CallInst *CallCVT = CallInst::Create(CvtFunc, ArrayRef<Value *>(BC1),
                                        "cvt_to_param", FirstInst);
 
-  BitCastInst *BitCast = new BitCastInst(
-      CallCVT, PointerType::get((Type *)StructType, ADDRESS_SPACE_PARAM),
-      Arg->getName(), FirstInst);
+  BitCastInst *BitCast =
+      new BitCastInst(CallCVT, PointerType::get(const_cast<Type *>(StructType),
+                                                ADDRESS_SPACE_PARAM),
+                      Arg->getName(), FirstInst);
   LoadInst *LI = new LoadInst(BitCast, Arg->getName(), FirstInst);
   new StoreInst(LI, AllocA, FirstInst);
 }