diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-16 19:58:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-16 19:58:26 +0000 |
commit | 1a1a6e2bd4c5aefd7fd643cf25915f9623a02e59 (patch) | |
tree | 333652f464e28debc770fc4b30bc5b8f74254d28 /lib/Analysis/RegionStore.cpp | |
parent | e41611aa2237d06a0ef61db4528fb2883a8defcd (diff) |
Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.
The motivation behind this change is twofold:
1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.
2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.
Along with this patch:
a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 0d2467f55e..31623b9983 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -365,7 +365,7 @@ static bool isGenericPtr(ASTContext &Ctx, QualType Ty) { if (Ty->isVoidType()) return true; - if (const PointerType *PT = Ty->getAsPointerType()) { + if (const PointerType *PT = Ty->getAs<PointerType>()) { Ty = PT->getPointeeType(); continue; } @@ -680,7 +680,7 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state, T = Sym->getType(getContext()); } - QualType EleTy = T->getAsPointerType()->getPointeeType(); + QualType EleTy = T->getAs<PointerType>()->getPointeeType(); SVal ZeroIdx = ValMgr.makeZeroArrayIndex(); ER = MRMgr.getElementRegion(EleTy, ZeroIdx, SR, getContext()); break; @@ -689,7 +689,7 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state, // Get the alloca region's current cast type. const AllocaRegion *AR = cast<AllocaRegion>(MR); QualType T = *(state->get<RegionCasts>(AR)); - QualType EleTy = T->getAsPointerType()->getPointeeType(); + QualType EleTy = T->getAs<PointerType>()->getPointeeType(); SVal ZeroIdx = ValMgr.makeZeroArrayIndex(); ER = MRMgr.getElementRegion(EleTy, ZeroIdx, AR, getContext()); break; @@ -865,7 +865,7 @@ SVal RegionStoreManager::Retrieve(const GRState *state, Loc L, QualType T) { // symbol value. if (const QualType *p = state->get<RegionCasts>(R)) { QualType T = *p; - RTy = T->getAsPointerType()->getPointeeType(); + RTy = T->getAs<PointerType>()->getPointeeType(); } // All other values are symbolic. @@ -937,7 +937,7 @@ SVal RegionStoreManager::RetrieveElement(const GRState* state, // 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)->getAsPointerType()->getPointeeType(); + Ty = (*p)->getAs<PointerType>()->getPointeeType(); return ValMgr.getRegionValueSymbolValOrUnknown(R, Ty); } @@ -976,7 +976,7 @@ SVal RegionStoreManager::RetrieveField(const GRState* state, // symbol value. if (const QualType *p = state->get<RegionCasts>(R)) { QualType tmp = *p; - Ty = tmp->getAsPointerType()->getPointeeType(); + Ty = tmp->getAs<PointerType>()->getPointeeType(); } // All other values are symbolic. @@ -1009,7 +1009,7 @@ SVal RegionStoreManager::RetrieveObjCIvar(const GRState* state, // symbol value. if (const QualType *p = state->get<RegionCasts>(R)) { QualType tmp = *p; - Ty = tmp->getAsPointerType()->getPointeeType(); + Ty = tmp->getAs<PointerType>()->getPointeeType(); } // All other values are symbolic. |