[llvm] r243380 - Remove unnecessary const_casts. NFC

Craig Topper craig.topper at gmail.com
Mon Jul 27 21:28:47 PDT 2015


Author: ctopper
Date: Mon Jul 27 23:28:46 2015
New Revision: 243380

URL: http://llvm.org/viewvc/llvm-project?rev=243380&view=rev
Log:
Remove unnecessary const_casts. NFC

Modified:
    llvm/trunk/lib/IR/Type.cpp

Modified: llvm/trunk/lib/IR/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Type.cpp?rev=243380&r1=243379&r2=243380&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Type.cpp (original)
+++ llvm/trunk/lib/IR/Type.cpp Mon Jul 27 23:28:46 2015
@@ -345,7 +345,7 @@ FunctionType::FunctionType(Type *Result,
   assert(isValidReturnType(Result) && "invalid return type for function");
   setSubclassData(IsVarArgs);
 
-  SubTys[0] = const_cast<Type*>(Result);
+  SubTys[0] = Result;
 
   for (unsigned i = 0, e = Params.size(); i != e; ++i) {
     assert(isValidArgumentType(Params[i]) &&
@@ -680,10 +680,9 @@ ArrayType::ArrayType(Type *ElType, uint6
   NumElements = NumEl;
 }
 
-ArrayType *ArrayType::get(Type *elementType, uint64_t NumElements) {
-  Type *ElementType = const_cast<Type*>(elementType);
+ArrayType *ArrayType::get(Type *ElementType, uint64_t NumElements) {
   assert(isValidElementType(ElementType) && "Invalid type for array element!");
-    
+
   LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
   ArrayType *&Entry = 
     pImpl->ArrayTypes[std::make_pair(ElementType, NumElements)];
@@ -707,8 +706,7 @@ VectorType::VectorType(Type *ElType, uns
   NumElements = NumEl;
 }
 
-VectorType *VectorType::get(Type *elementType, unsigned NumElements) {
-  Type *ElementType = const_cast<Type*>(elementType);
+VectorType *VectorType::get(Type *ElementType, unsigned NumElements) {
   assert(NumElements > 0 && "#Elements of a VectorType must be greater than 0");
   assert(isValidElementType(ElementType) && "Element type of a VectorType must "
                                             "be an integer, floating point, or "





More information about the llvm-commits mailing list