diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-29 18:16:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-29 18:16:25 +0000 |
commit | 1004a9f2b9eaf885e55ad8656194ef2a341db0f5 (patch) | |
tree | 03f7509b0df6a4b6459be7381fda1cae8bd75679 /lib/Analysis/BasicStore.cpp | |
parent | 0e3ec3ff2477e60f0ceda922cc2e3a25a59d81f2 (diff) |
Make StoreManager::InvalidateRegion() virtual, move the current implementation
in StoreManager to RegionStoreManager, and create a special, highly reduced
version in BasicStoreManager.
These changes are in preparation for future RegionStore-specific changes to
InvalidateRegion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicStore.cpp')
-rw-r--r-- | lib/Analysis/BasicStore.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index f276975e9b..b84bdf4100 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -50,7 +50,10 @@ public: } SValuator::CastResult Retrieve(const GRState *state, Loc loc, - QualType T = QualType()); + QualType T = QualType()); + + const GRState *InvalidateRegion(const GRState *state, const MemRegion *R, + const Expr *E, unsigned Count); const GRState *Bind(const GRState *state, Loc L, SVal V) { return state->makeWithStore(BindInternal(state->getStore(), L, V)); @@ -623,3 +626,27 @@ void BasicStoreManager::iterBindings(Store store, BindingsHandler& f) { } StoreManager::BindingsHandler::~BindingsHandler() {} + +//===----------------------------------------------------------------------===// +// Binding invalidation. +//===----------------------------------------------------------------------===// + +const GRState *BasicStoreManager::InvalidateRegion(const GRState *state, + const MemRegion *R, + const Expr *E, + unsigned Count) { + R = R->getBaseRegion(); + + if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R))) + return state; + + // We only track bindings to self.ivar. + if (const ObjCIvarRegion *IVR = dyn_cast<ObjCIvarRegion>(R)) + if (IVR->getSuperRegion() != SelfRegion) + return state; + + QualType T = cast<TypedRegion>(R)->getValueType(R->getContext()); + SVal V = ValMgr.getConjuredSymbolVal(E, T, Count); + return Bind(state, loc::MemRegionVal(R), V); +} + |