diff options
| author | Craig Topper <craig.topper@gmail.com> | 2015-07-28 04:28:46 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2015-07-28 04:28:46 +0000 |
| commit | 7554da2ca332297518e124e24f37a2aec2a3f27c (patch) | |
| tree | a0b37b7f12cdb6366cb8cd5585d171867d30e8c2 /llvm/lib | |
| parent | 043ee65ef3c27191db3ca6618e1ee6497ade094d (diff) | |
| download | bcm5719-llvm-7554da2ca332297518e124e24f37a2aec2a3f27c.tar.gz bcm5719-llvm-7554da2ca332297518e124e24f37a2aec2a3f27c.zip | |
Remove unnecessary const_casts. NFC
llvm-svn: 243380
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/Type.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp index b5c4e5d4c6d..0891508d7b1 100644 --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -345,7 +345,7 @@ FunctionType::FunctionType(Type *Result, ArrayRef<Type*> Params, 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, uint64_t NumEl) 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, unsigned NumEl) 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 " |

