Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index 99bfac2..7aa63c1 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -251,7 +251,7 @@
static bool isHigherOrderRawPtr(QualType T, ASTContext &C) {
bool foundPointer = false;
while (1) {
- const PointerType *PT = T->getAs<PointerType>();
+ const PointerType *PT = T->getAsPointerType();
if (!PT) {
if (!foundPointer)
return false;
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 1fa3e57..3d2e3ac 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -248,7 +248,7 @@
return false;
// Is the type void*?
- const PointerType* PT = RetTy->getAs<PointerType>();
+ const PointerType* PT = RetTy->getAsPointerType();
if (!(PT->getPointeeType().getUnqualifiedType() == Ctx->VoidTy))
return false;
@@ -1250,7 +1250,7 @@
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
}
}
- else if (RetTy->getAs<PointerType>()) {
+ else if (RetTy->getAsPointerType()) {
if (FD->getAttr<CFReturnsRetainedAttr>()) {
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
}
@@ -1276,7 +1276,7 @@
}
if (!isTrackedLoc)
- isTrackedLoc = MD->getResultType()->getAs<PointerType>() != NULL;
+ isTrackedLoc = MD->getResultType()->getAsPointerType() != NULL;
if (isTrackedLoc && MD->getAttr<CFReturnsRetainedAttr>())
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
diff --git a/lib/Analysis/CheckNSError.cpp b/lib/Analysis/CheckNSError.cpp
index 4e8ba01..c1382d0 100644
--- a/lib/Analysis/CheckNSError.cpp
+++ b/lib/Analysis/CheckNSError.cpp
@@ -161,7 +161,7 @@
bool NSErrorCheck::CheckNSErrorArgument(QualType ArgTy) {
- const PointerType* PPT = ArgTy->getAs<PointerType>();
+ const PointerType* PPT = ArgTy->getAsPointerType();
if (!PPT)
return false;
@@ -182,7 +182,7 @@
bool NSErrorCheck::CheckCFErrorArgument(QualType ArgTy) {
- const PointerType* PPT = ArgTy->getAs<PointerType>();
+ const PointerType* PPT = ArgTy->getAsPointerType();
if (!PPT) return false;
const TypedefType* TT = PPT->getPointeeType()->getAsTypedefType();
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index b4bec54..f83e92a 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1274,7 +1274,7 @@
return false;
Expr *theValueExpr = CE->getArg(2);
- const PointerType *theValueType = theValueExpr->getType()->getAs<PointerType>();
+ const PointerType *theValueType = theValueExpr->getType()->getAsPointerType();
// theValueType not a pointer?
if (!theValueType)
@@ -1382,7 +1382,7 @@
// Determine the type of function we're calling (if available).
const FunctionProtoType *Proto = NULL;
QualType FnType = CE->getCallee()->IgnoreParens()->getType();
- if (const PointerType *FnTypePtr = FnType->getAs<PointerType>())
+ if (const PointerType *FnTypePtr = FnType->getAsPointerType())
Proto = FnTypePtr->getPointeeType()->getAsFunctionProtoType();
VisitCallRec(CE, Pred, AI, AE, Dst, Proto, /*ParamIdx=*/0);
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index f956eca..0d2467f 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -365,7 +365,7 @@
if (Ty->isVoidType())
return true;
- if (const PointerType *PT = Ty->getAs<PointerType>()) {
+ if (const PointerType *PT = Ty->getAsPointerType()) {
Ty = PT->getPointeeType();
continue;
}
@@ -680,7 +680,7 @@
T = Sym->getType(getContext());
}
- QualType EleTy = T->getAs<PointerType>()->getPointeeType();
+ QualType EleTy = T->getAsPointerType()->getPointeeType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
ER = MRMgr.getElementRegion(EleTy, ZeroIdx, SR, getContext());
break;
@@ -689,7 +689,7 @@
// Get the alloca region's current cast type.
const AllocaRegion *AR = cast<AllocaRegion>(MR);
QualType T = *(state->get<RegionCasts>(AR));
- QualType EleTy = T->getAs<PointerType>()->getPointeeType();
+ QualType EleTy = T->getAsPointerType()->getPointeeType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
ER = MRMgr.getElementRegion(EleTy, ZeroIdx, AR, getContext());
break;
@@ -865,7 +865,7 @@
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R)) {
QualType T = *p;
- RTy = T->getAs<PointerType>()->getPointeeType();
+ RTy = T->getAsPointerType()->getPointeeType();
}
// All other values are symbolic.
@@ -937,7 +937,7 @@
// If the region is already cast to another type, use that type to create the
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R))
- Ty = (*p)->getAs<PointerType>()->getPointeeType();
+ Ty = (*p)->getAsPointerType()->getPointeeType();
return ValMgr.getRegionValueSymbolValOrUnknown(R, Ty);
}
@@ -976,7 +976,7 @@
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R)) {
QualType tmp = *p;
- Ty = tmp->getAs<PointerType>()->getPointeeType();
+ Ty = tmp->getAsPointerType()->getPointeeType();
}
// All other values are symbolic.
@@ -1009,7 +1009,7 @@
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R)) {
QualType tmp = *p;
- Ty = tmp->getAs<PointerType>()->getPointeeType();
+ Ty = tmp->getAsPointerType()->getPointeeType();
}
// All other values are symbolic.
@@ -1201,7 +1201,7 @@
QualType T = R->getValueType(getContext());
assert(T->isStructureType());
- const RecordType* RT = T->getAs<RecordType>();
+ const RecordType* RT = T->getAsRecordType();
RecordDecl* RD = RT->getDecl();
if (!RD->isDefinition())
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp
index 66b99a8..b939a0d 100644
--- a/lib/Analysis/Store.cpp
+++ b/lib/Analysis/Store.cpp
@@ -36,7 +36,7 @@
}
static bool IsCompleteType(ASTContext &Ctx, QualType Ty) {
- if (const RecordType *RT = Ty->getAs<RecordType>()) {
+ if (const RecordType *RT = Ty->getAsRecordType()) {
const RecordDecl *D = RT->getDecl();
if (!D->getDefinition(Ctx))
return false;
@@ -62,7 +62,7 @@
// Now assume we are casting from pointer to pointer. Other cases should
// already be handled.
- QualType PointeeTy = CastToTy->getAs<PointerType>()->getPointeeType();
+ QualType PointeeTy = CastToTy->getAsPointerType()->getPointeeType();
// Process region cast according to the kind of the region being cast.
switch (R->getKind()) {
@@ -243,7 +243,7 @@
// If the region is cast to another type, use that type.
if (const QualType *CastTy = getCastType(state, R)) {
assert(!(*CastTy)->isObjCObjectPointerType());
- QualType NewT = (*CastTy)->getAs<PointerType>()->getPointeeType();
+ QualType NewT = (*CastTy)->getAsPointerType()->getPointeeType();
// The only exception is if the original region had a location type as its
// value type we always want to treat the region as binding to a location.