aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-13 01:52:33 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-13 01:52:33 +0000
commit24c37ad067320e9d40978d97a73e4bca0f0eae54 (patch)
tree2a930764ee4039f3a892773c5dab55ce298026be /lib/Checker/RegionStore.cpp
parent7fe0b9ea2c8137c035402e6ea01dfdfbc93214cb (diff)
Enhance RegionStore::InvalidateRegions() to correctly invalidate bindings
by scanning through the values of LazyCompoundVals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96067 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/RegionStore.cpp')
-rw-r--r--lib/Checker/RegionStore.cpp44
1 files changed, 32 insertions, 12 deletions
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp
index ed1737cddb..f70105af13 100644
--- a/lib/Checker/RegionStore.cpp
+++ b/lib/Checker/RegionStore.cpp
@@ -475,17 +475,19 @@ class InvalidateRegionsWorker {
ClusterMap ClusterM;
WorkList WL;
+ RegionStoreManager &RM;
StoreManager::InvalidatedSymbols *IS;
ASTContext &Ctx;
ValueManager &ValMgr;
public:
- InvalidateRegionsWorker(StoreManager::InvalidatedSymbols *is,
+ InvalidateRegionsWorker(RegionStoreManager &rm,
+ StoreManager::InvalidatedSymbols *is,
ASTContext &ctx, ValueManager &valMgr)
- : IS(is), Ctx(ctx), ValMgr(valMgr) {}
+ : RM(rm), IS(is), Ctx(ctx), ValMgr(valMgr) {}
- Store InvalidateRegions(RegionStoreManager &RM, Store store,
- const MemRegion * const *I,const MemRegion * const *E,
+ Store InvalidateRegions(Store store, const MemRegion * const *I,
+ const MemRegion * const *E,
const Expr *Ex, unsigned Count);
private:
@@ -529,17 +531,34 @@ InvalidateRegionsWorker::getCluster(const MemRegion *R) {
}
void InvalidateRegionsWorker::VisitBinding(SVal V) {
- if (const MemRegion *R = V.getAsRegion())
- AddToWorkList(R);
-
// A symbol? Mark it touched by the invalidation.
if (IS)
if (SymbolRef Sym = V.getAsSymbol())
IS->insert(Sym);
-}
-Store InvalidateRegionsWorker::InvalidateRegions(RegionStoreManager &RM,
- Store store,
+ if (const MemRegion *R = V.getAsRegion()) {
+ AddToWorkList(R);
+ return;
+ }
+
+ // Is it a LazyCompoundVal? All references get invalidated as well.
+ if (const nonloc::LazyCompoundVal *LCS =
+ dyn_cast<nonloc::LazyCompoundVal>(&V)) {
+
+ const MemRegion *LazyR = LCS->getRegion();
+ RegionBindings B = RegionStoreManager::GetRegionBindings(LCS->getStore());
+
+ for (RegionBindings::iterator RI = B.begin(), RE = B.end(); RI != RE; ++RI){
+ const MemRegion *baseR = RI.getKey().getRegion();
+ if (cast<SubRegion>(baseR)->isSubRegionOf(LazyR))
+ VisitBinding(RI.getData());
+ }
+
+ return;
+ }
+}
+
+Store InvalidateRegionsWorker::InvalidateRegions(Store store,
const MemRegion * const *I,
const MemRegion * const *E,
const Expr *Ex, unsigned Count)
@@ -652,8 +671,9 @@ Store RegionStoreManager::InvalidateRegions(Store store,
const MemRegion * const *E,
const Expr *Ex, unsigned Count,
InvalidatedSymbols *IS) {
- InvalidateRegionsWorker W(IS, getContext(), StateMgr.getValueManager());
- return W.InvalidateRegions(*this, store, I, E, Ex, Count);
+ InvalidateRegionsWorker W(*this, IS, getContext(),
+ StateMgr.getValueManager());
+ return W.InvalidateRegions(store, I, E, Ex, Count);
}
//===----------------------------------------------------------------------===//