From: Craig Topper Date: Tue, 28 Jul 2015 04:28:46 +0000 (+0000) Subject: Remove unnecessary const_casts. NFC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=80458cb49cda721fa2873086ba0f3d86ded1af31;p=oota-llvm.git Remove unnecessary const_casts. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243380 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/Type.cpp b/lib/IR/Type.cpp index b5c4e5d4c6d..0891508d7b1 100644 --- a/lib/IR/Type.cpp +++ b/lib/IR/Type.cpp @@ -345,7 +345,7 @@ FunctionType::FunctionType(Type *Result, ArrayRef Params, assert(isValidReturnType(Result) && "invalid return type for function"); setSubclassData(IsVarArgs); - SubTys[0] = const_cast(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, uint64_t NumEl) NumElements = NumEl; } -ArrayType *ArrayType::get(Type *elementType, uint64_t NumElements) { - Type *ElementType = const_cast(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, unsigned NumEl) NumElements = NumEl; } -VectorType *VectorType::get(Type *elementType, unsigned NumElements) { - Type *ElementType = const_cast(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 "