aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-13 00:54:03 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-13 00:54:03 +0000
commitc1ddcabef0b0e1185b6ea35d64a1ff41dabd7626 (patch)
treed5726cf23aa6e8da89b1c22bd8d21e5a07b24ca9 /lib/Checker/RegionStore.cpp
parentc4a2638b5ef3e2d35d872614ceb655a7a22c58be (diff)
Pull logic for visiting value bindings in InvalidateRegionsWorker into a separate method.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/RegionStore.cpp')
-rw-r--r--lib/Checker/RegionStore.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp
index 4a8d9a0b0a..ed1737cddb 100644
--- a/lib/Checker/RegionStore.cpp
+++ b/lib/Checker/RegionStore.cpp
@@ -473,19 +473,27 @@ class InvalidateRegionsWorker {
BumpVectorContext BVC;
ClusterMap ClusterM;
- WorkList WL;
+ WorkList WL;
+
+ StoreManager::InvalidatedSymbols *IS;
+ ASTContext &Ctx;
+ ValueManager &ValMgr;
+
public:
+ InvalidateRegionsWorker(StoreManager::InvalidatedSymbols *is,
+ ASTContext &ctx, ValueManager &valMgr)
+ : IS(is), Ctx(ctx), ValMgr(valMgr) {}
+
Store InvalidateRegions(RegionStoreManager &RM, Store store,
const MemRegion * const *I,const MemRegion * const *E,
- const Expr *Ex, unsigned Count,
- StoreManager::InvalidatedSymbols *IS,
- ASTContext &Ctx, ValueManager &ValMgr);
+ const Expr *Ex, unsigned Count);
private:
void AddToWorkList(BindingKey K);
void AddToWorkList(const MemRegion *R);
void AddToCluster(BindingKey K);
RegionCluster **getCluster(const MemRegion *R);
+ void VisitBinding(SVal V);
};
}
@@ -520,14 +528,22 @@ InvalidateRegionsWorker::getCluster(const MemRegion *R) {
return &CRef;
}
+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,
const MemRegion * const *I,
const MemRegion * const *E,
- const Expr *Ex, unsigned Count,
- StoreManager::InvalidatedSymbols *IS,
- ASTContext &Ctx,
- ValueManager &ValMgr) {
+ const Expr *Ex, unsigned Count)
+{
RegionBindings B = RegionStoreManager::GetRegionBindings(store);
// Scan the entire store and make the region clusters.
@@ -554,15 +570,8 @@ Store InvalidateRegionsWorker::InvalidateRegions(RegionStoreManager &RM,
BindingKey K = *I;
// Get the old binding. Is it a region? If so, add it to the worklist.
- if (const SVal *V = RM.Lookup(B, K)) {
- 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);
- }
+ if (const SVal *V = RM.Lookup(B, K))
+ VisitBinding(*V);
B = RM.Remove(B, K);
}
@@ -643,9 +652,8 @@ Store RegionStoreManager::InvalidateRegions(Store store,
const MemRegion * const *E,
const Expr *Ex, unsigned Count,
InvalidatedSymbols *IS) {
- InvalidateRegionsWorker W;
- return W.InvalidateRegions(*this, store, I, E, Ex, Count, IS, getContext(),
- StateMgr.getValueManager());
+ InvalidateRegionsWorker W(IS, getContext(), StateMgr.getValueManager());
+ return W.InvalidateRegions(*this, store, I, E, Ex, Count);
}
//===----------------------------------------------------------------------===//