summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BasicStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-29 18:16:25 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-29 18:16:25 +0000
commitbca70671e79664dd2ecebbd92021a8e9396a3809 (patch)
tree592630e31b01373b54f1c7979456feb6f9ce5729 /clang/lib/Analysis/BasicStore.cpp
parent727a582c594f4719042bdd54fd718286ac28a471 (diff)
downloadbcm5719-llvm-bca70671e79664dd2ecebbd92021a8e9396a3809.tar.gz
bcm5719-llvm-bca70671e79664dd2ecebbd92021a8e9396a3809.zip
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. llvm-svn: 77483
Diffstat (limited to 'clang/lib/Analysis/BasicStore.cpp')
-rw-r--r--clang/lib/Analysis/BasicStore.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/clang/lib/Analysis/BasicStore.cpp b/clang/lib/Analysis/BasicStore.cpp
index f276975e9bd..b84bdf41005 100644
--- a/clang/lib/Analysis/BasicStore.cpp
+++ b/clang/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);
+}
+
OpenPOWER on IntegriCloud