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/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index a56e1ae..6fee787 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -214,7 +214,7 @@
Result = GetTypeFromParser(DS.getTypeRep());
if (DeclSpec::ProtocolQualifierListTy PQ = DS.getProtocolQualifiers()) {
- if (const ObjCInterfaceType *Interface = Result->getAsObjCInterfaceType())
+ if (const ObjCInterfaceType *Interface = Result->getAs<ObjCInterfaceType>())
// It would be nice if protocol qualifiers were only stored with the
// ObjCObjectPointerType. Unfortunately, this isn't possible due
// to the following typedef idiom (which is uncommon, but allowed):
@@ -949,7 +949,7 @@
// Build the type anyway.
}
if (getLangOptions().ObjC1 && T->isObjCInterfaceType()) {
- const ObjCInterfaceType *OIT = T->getAsObjCInterfaceType();
+ const ObjCInterfaceType *OIT = T->getAs<ObjCInterfaceType>();
T = Context.getObjCObjectPointerType(T,
(ObjCProtocolDecl **)OIT->qual_begin(),
OIT->getNumProtocols());
@@ -1141,7 +1141,7 @@
} else if (!FTI.hasPrototype) {
if (ArgTy->isPromotableIntegerType()) {
ArgTy = Context.getPromotedIntegerType(ArgTy);
- } else if (const BuiltinType* BTy = ArgTy->getAsBuiltinType()) {
+ } else if (const BuiltinType* BTy = ArgTy->getAs<BuiltinType>()) {
if (BTy->getKind() == BuiltinType::Float)
ArgTy = Context.DoubleTy;
}
@@ -1223,7 +1223,7 @@
}
if (getLangOptions().CPlusPlus && T->isFunctionType()) {
- const FunctionProtoType *FnTy = T->getAsFunctionProtoType();
+ const FunctionProtoType *FnTy = T->getAs<FunctionProtoType>();
assert(FnTy && "Why oh why is there not a FunctionProtoType here ?");
// C++ 8.3.5p4: A cv-qualifier-seq shall only be part of the function type
@@ -1400,7 +1400,7 @@
else
return false;
- const FunctionProtoType *FnT = T->getAsFunctionProtoType();
+ const FunctionProtoType *FnT = T->getAs<FunctionProtoType>();
if (!FnT)
return false;
@@ -1816,7 +1816,7 @@
const TagType *Tag = 0;
if (const RecordType *Record = T->getAs<RecordType>())
Tag = Record;
- else if (const EnumType *Enum = T->getAsEnumType())
+ else if (const EnumType *Enum = T->getAs<EnumType>())
Tag = Enum;
if (Tag && !Tag->getDecl()->isInvalidDecl())