summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-08-01 22:20:27 +0000
committerCraig Topper <craig.topper@gmail.com>2015-08-01 22:20:27 +0000
commit53fb02390613d3f89ebe4a9fef8515b285daee49 (patch)
tree997f670458c980921d7a7a4cda3c9aa7fb8c8a62 /llvm/lib/IR
parente3dcce9700c6f7045774f46f66faa610081495a5 (diff)
downloadbcm5719-llvm-53fb02390613d3f89ebe4a9fef8515b285daee49.tar.gz
bcm5719-llvm-53fb02390613d3f89ebe4a9fef8515b285daee49.zip
Merge the const and non-const Type::getScalarType to a const version that returns a non-const pointer. Since we don't put const on Types all places were already calling the non-const version.
llvm-svn: 243843
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Type.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index ad0013aed39..17d24465601 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -42,16 +42,10 @@ Type *Type::getPrimitiveType(LLVMContext &C, TypeID IDNumber) {
/// getScalarType - If this is a vector type, return the element type,
/// otherwise return this.
-Type *Type::getScalarType() {
- if (VectorType *VTy = dyn_cast<VectorType>(this))
- return VTy->getElementType();
- return this;
-}
-
-const Type *Type::getScalarType() const {
- if (const VectorType *VTy = dyn_cast<VectorType>(this))
+Type *Type::getScalarType() const {
+ if (auto *VTy = dyn_cast<VectorType>(this))
return VTy->getElementType();
- return this;
+ return const_cast<Type*>(this);
}
/// isIntegerTy - Return true if this is an IntegerType of the specified width.
OpenPOWER on IntegriCloud