git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243843
91177308-0d34-0410-b5e6-
96231b3b80d8
/// getScalarType - If this is a vector type, return the element type,
/// otherwise return 'this'.
/// 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.
//===--------------------------------------------------------------------===//
// Type Iteration support.
/// getScalarType - If this is a vector type, return the element type,
/// otherwise return this.
/// 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 VTy->getElementType();
+ return const_cast<Type*>(this);
}
/// isIntegerTy - Return true if this is an IntegerType of the specified width.
}
/// isIntegerTy - Return true if this is an IntegerType of the specified width.