Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.
The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/TargetABIInfo.cpp b/lib/CodeGen/TargetABIInfo.cpp
index a9d883b..3ad8cfc 100644
--- a/lib/CodeGen/TargetABIInfo.cpp
+++ b/lib/CodeGen/TargetABIInfo.cpp
@@ -159,7 +159,7 @@
}
static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
- if (!Ty->getAsBuiltinType() && !Ty->isPointerType())
+ if (!Ty->getAs<BuiltinType>() && !Ty->isPointerType())
return false;
uint64_t Size = Context.getTypeSize(Ty);
@@ -292,7 +292,7 @@
}
// If this is a builtin, pointer, or complex type, it is ok.
- if (Ty->getAsBuiltinType() || Ty->isPointerType() || Ty->isAnyComplexType())
+ if (Ty->getAs<BuiltinType>() || Ty->isPointerType() || Ty->isAnyComplexType())
return true;
// Arrays are treated like records.
@@ -326,7 +326,7 @@
llvm::LLVMContext &VMContext) const {
if (RetTy->isVoidType()) {
return ABIArgInfo::getIgnore();
- } else if (const VectorType *VT = RetTy->getAsVectorType()) {
+ } else if (const VectorType *VT = RetTy->getAs<VectorType>()) {
// On Darwin, some vectors are returned in registers.
if (IsDarwinVectorABI) {
uint64_t Size = Context.getTypeSize(RetTy);
@@ -360,7 +360,7 @@
// Classify "single element" structs as their element type.
if (const Type *SeltTy = isSingleElementStruct(RetTy, Context)) {
- if (const BuiltinType *BT = SeltTy->getAsBuiltinType()) {
+ if (const BuiltinType *BT = SeltTy->getAs<BuiltinType>()) {
if (BT->isIntegerType()) {
// We need to use the size of the structure, padding
// bit-fields can adjust that to be larger than the single
@@ -618,7 +618,7 @@
Class &Current = OffsetBase < 64 ? Lo : Hi;
Current = Memory;
- if (const BuiltinType *BT = Ty->getAsBuiltinType()) {
+ if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) {
BuiltinType::Kind k = BT->getKind();
if (k == BuiltinType::Void) {
@@ -636,12 +636,12 @@
}
// FIXME: _Decimal32 and _Decimal64 are SSE.
// FIXME: _float128 and _Decimal128 are (SSE, SSEUp).
- } else if (const EnumType *ET = Ty->getAsEnumType()) {
+ } else if (const EnumType *ET = Ty->getAs<EnumType>()) {
// Classify the underlying integer type.
classify(ET->getDecl()->getIntegerType(), Context, OffsetBase, Lo, Hi);
} else if (Ty->hasPointerRepresentation()) {
Current = Integer;
- } else if (const VectorType *VT = Ty->getAsVectorType()) {
+ } else if (const VectorType *VT = Ty->getAs<VectorType>()) {
uint64_t Size = Context.getTypeSize(VT);
if (Size == 32) {
// gcc passes all <4 x char>, <2 x short>, <1 x int>, <1 x
@@ -673,7 +673,7 @@
Lo = SSE;
Hi = SSEUp;
}
- } else if (const ComplexType *CT = Ty->getAsComplexType()) {
+ } else if (const ComplexType *CT = Ty->getAs<ComplexType>()) {
QualType ET = Context.getCanonicalType(CT->getElementType());
uint64_t Size = Context.getTypeSize(Ty);
@@ -1468,7 +1468,7 @@
return false;
// If this is a builtin or pointer type then it is ok.
- if (Ty->getAsBuiltinType() || Ty->isPointerType())
+ if (Ty->getAs<BuiltinType>() || Ty->isPointerType())
return true;
// Complex types "should" be ok by the definition above, but they are not.
@@ -1651,7 +1651,7 @@
bool SystemZABIInfo::isPromotableIntegerType(QualType Ty) const {
// SystemZ ABI requires all 8, 16 and 32 bit quantities to be extended.
- if (const BuiltinType *BT = Ty->getAsBuiltinType())
+ if (const BuiltinType *BT = Ty->getAs<BuiltinType>())
switch (BT->getKind()) {
case BuiltinType::Bool:
case BuiltinType::Char_S: