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/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp
index 9c20089..af300f3 100644
--- a/lib/Analysis/BasicObjCFoundationChecks.cpp
+++ b/lib/Analysis/BasicObjCFoundationChecks.cpp
@@ -38,7 +38,7 @@
return NULL;
if (const ObjCObjectPointerType *PT =
- Receiver->getType()->getAsObjCObjectPointerType())
+ Receiver->getType()->getAs<ObjCObjectPointerType>())
return PT->getInterfaceType();
return NULL;
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 86edfb9..81ebccb 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -553,7 +553,7 @@
const ObjCInterfaceDecl* getReceiverDecl(Expr* E) {
if (const ObjCObjectPointerType* PT =
- E->getType()->getAsObjCObjectPointerType())
+ E->getType()->getAs<ObjCObjectPointerType>())
return PT->getInterfaceDecl();
return NULL;
@@ -886,7 +886,7 @@
if (!Ty->isObjCObjectPointerType())
return false;
- const ObjCObjectPointerType *PT = Ty->getAsObjCObjectPointerType();
+ const ObjCObjectPointerType *PT = Ty->getAs<ObjCObjectPointerType>();
// Can be true for objects with the 'NSObject' attribute.
if (!PT)
@@ -953,9 +953,9 @@
break;
}
- // [PR 3337] Use 'getAsFunctionType' to strip away any typedefs on the
+ // [PR 3337] Use 'getAs<FunctionType>' to strip away any typedefs on the
// function's type.
- const FunctionType* FT = FD->getType()->getAsFunctionType();
+ const FunctionType* FT = FD->getType()->getAs<FunctionType>();
const char* FName = FD->getIdentifier()->getName();
// Strip away preceding '_'. Doing this here will effect all the checks
@@ -2739,7 +2739,7 @@
// If RetE is a message expression, return its types if it is something
/// more specific than id.
if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(RetE))
- if (const ObjCObjectPointerType *PT = RetTy->getAsObjCObjectPointerType())
+ if (const ObjCObjectPointerType *PT = RetTy->getAs<ObjCObjectPointerType>())
if (PT->isObjCQualifiedIdType() || PT->isObjCIdType() ||
PT->isObjCClassType()) {
// At this point we know the return type of the message expression is
@@ -3012,7 +3012,7 @@
if (Sym) {
if (const RefVal* T = St->get<RefBindings>(Sym)) {
if (const ObjCObjectPointerType* PT =
- T->getType()->getAsObjCObjectPointerType())
+ T->getType()->getAs<ObjCObjectPointerType>())
ID = PT->getInterfaceDecl();
}
}
@@ -3021,7 +3021,7 @@
// that is called.
if (!ID) {
if (const ObjCObjectPointerType *PT =
- Receiver->getType()->getAsObjCObjectPointerType())
+ Receiver->getType()->getAs<ObjCObjectPointerType>())
ID = PT->getInterfaceDecl();
}
diff --git a/lib/Analysis/CheckNSError.cpp b/lib/Analysis/CheckNSError.cpp
index 7e59643..8086da5 100644
--- a/lib/Analysis/CheckNSError.cpp
+++ b/lib/Analysis/CheckNSError.cpp
@@ -166,7 +166,7 @@
return false;
const ObjCObjectPointerType* PT =
- PPT->getPointeeType()->getAsObjCObjectPointerType();
+ PPT->getPointeeType()->getAs<ObjCObjectPointerType>();
if (!PT)
return false;
@@ -185,7 +185,7 @@
const PointerType* PPT = ArgTy->getAs<PointerType>();
if (!PPT) return false;
- const TypedefType* TT = PPT->getPointeeType()->getAsTypedefType();
+ const TypedefType* TT = PPT->getPointeeType()->getAs<TypedefType>();
if (!TT) return false;
return TT->getDecl()->getIdentifier() == II;
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 821dbbf..3e9ed5b 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1590,7 +1590,7 @@
const FunctionProtoType *Proto = NULL;
QualType FnType = CE->getCallee()->IgnoreParens()->getType();
if (const PointerType *FnTypePtr = FnType->getAs<PointerType>())
- Proto = FnTypePtr->getPointeeType()->getAsFunctionProtoType();
+ Proto = FnTypePtr->getPointeeType()->getAs<FunctionProtoType>();
VisitCallRec(CE, Pred, AI, AE, Dst, Proto, /*ParamIdx=*/0);
}
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index f4f2fec..8b5848f 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -756,7 +756,7 @@
if (const PointerType *PT = T->getAs<PointerType>())
EleTy = PT->getPointeeType();
else
- EleTy = T->getAsObjCObjectPointerType()->getPointeeType();
+ EleTy = T->getAs<ObjCObjectPointerType>()->getPointeeType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
ER = MRMgr.getElementRegion(EleTy, ZeroIdx, SR, getContext());