diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-21 21:51:34 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-21 21:51:34 +0000 |
commit | c62abc1012feb0b15eff091b02c176649766a347 (patch) | |
tree | 61bd1482a0292fac61add423346827b1efdf564d /lib/Analysis/BasicStore.cpp | |
parent | 293b4d6a4394174e46d0b3faf6353ed98203792d (diff) |
Refactor 'BasicStoreManager::CastRegion' and 'RegionStoreManager::CastRegion'
into StoreManager::CastRegion. Both methods were practically identical, and this
is core logic that is common to all StoreManagers since it defines the basic
invariants of the abstract memory model.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicStore.cpp')
-rw-r--r-- | lib/Analysis/BasicStore.cpp | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index cf8d3176c4..616c4b5135 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -35,14 +35,12 @@ public: class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager { BindingsTy::Factory VBFactory; - GRStateManager& StateMgr; const MemRegion* SelfRegion; public: BasicStoreManager(GRStateManager& mgr) - : StoreManager(mgr.getValueManager()), + : StoreManager(mgr), VBFactory(mgr.getAllocator()), - StateMgr(mgr), SelfRegion(0) {} ~BasicStoreManager() {} @@ -87,12 +85,6 @@ public: /// conversions between arrays and pointers. SVal ArrayToPointer(Loc Array) { return Array; } - /// CastRegion - Used by GRExprEngine::VisitCast to handle casts from - /// a MemRegion* to a specific location type. 'R' is the region being - /// casted and 'CastToTy' the result type of the cast. - CastResult CastRegion(const GRState* state, const MemRegion* R, - QualType CastToTy); - /// getSelfRegion - Returns the region for the 'self' (Objective-C) or /// 'this' object (C++). When used when analyzing a normal function this /// method returns NULL. @@ -168,27 +160,7 @@ SVal BasicStoreManager::getLValueIvar(const GRState* St, const ObjCIvarDecl* D, return UnknownVal(); } - -/// CastRegion - Used by GRExprEngine::VisitCast to handle casts from -/// a MemRegion* to a specific location type. 'R' is the region being -/// casted and 'CastToTy' the result type of the cast. -StoreManager::CastResult -BasicStoreManager::CastRegion(const GRState* state, const MemRegion* R, - QualType CastToTy) { - - // Return the same region if the region types are compatible. - if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) { - ASTContext& Ctx = StateMgr.getContext(); - QualType Ta = Ctx.getCanonicalType(TR->getLValueType(Ctx)); - QualType Tb = Ctx.getCanonicalType(CastToTy); - - if (Ta == Tb) - return CastResult(state, R); - } - return CastResult(state, MRMgr.getTypedViewRegion(CastToTy, R)); -} - SVal BasicStoreManager::getLValueField(const GRState* St, SVal Base, const FieldDecl* D) { |