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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2015-08-01 22:20:27 +00:00
parent 84bbcfe200
commit e0582480a4
2 changed files with 4 additions and 11 deletions

View File

@ -304,8 +304,7 @@ public:
/// getScalarType - If this is a vector type, return the element type,
/// otherwise return 'this'.
const Type *getScalarType() const LLVM_READONLY;
Type *getScalarType() LLVM_READONLY;
Type *getScalarType() const LLVM_READONLY;
//===--------------------------------------------------------------------===//
// Type Iteration support.

View File

@ -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))
Type *Type::getScalarType() const {
if (auto *VTy = dyn_cast<VectorType>(this))
return VTy->getElementType();
return this;
}
const Type *Type::getScalarType() const {
if (const VectorType *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.