Migrate MemRegionManager from StateManager to StoreManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57225 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index 3be8a11..47e2905 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -26,9 +26,11 @@
class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager {
VarBindingsTy::Factory VBFactory;
GRStateManager& StateMgr;
+ MemRegionManager MRMgr;
public:
- BasicStoreManager(GRStateManager& mgr) : StateMgr(mgr) {}
+ BasicStoreManager(GRStateManager& mgr)
+ : StateMgr(mgr), MRMgr(StateMgr.getAllocator()) {}
virtual ~BasicStoreManager() {}
@@ -37,6 +39,12 @@
virtual Store Remove(Store St, LVal LV);
virtual Store getInitialStore();
+
+ virtual MemRegionManager& getRegionManager() { return MRMgr; }
+
+ virtual LVal getLVal(const VarDecl* VD) {
+ return lval::MemRegionVal(MRMgr.getVarRegion(VD));
+ }
virtual Store
RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live,
@@ -55,7 +63,7 @@
virtual void print(Store store, std::ostream& Out,
const char* nl, const char *sep);
-
+
};
} // end anonymous namespace
@@ -164,7 +172,7 @@
// Iterate over the variable bindings.
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I)
if (Liveness.isLive(Loc, I.getKey())) {
- RegionRoots.push_back(StateMgr.getRegion(I.getKey()));
+ RegionRoots.push_back(MRMgr.getVarRegion(I.getKey()));
RVal X = I.getData();
for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI)
@@ -198,7 +206,7 @@
// Remove dead variable bindings.
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
- const VarRegion* R = cast<VarRegion>(StateMgr.getRegion(I.getKey()));
+ const VarRegion* R = cast<VarRegion>(MRMgr.getVarRegion(I.getKey()));
if (!Marked.count(R)) {
store = Remove(store, lval::MemRegionVal(R));
@@ -240,7 +248,7 @@
? RVal::GetSymbolValue(StateMgr.getSymbolManager(), VD)
: UndefinedVal();
- St = SetRVal(St, StateMgr.getLVal(VD), X);
+ St = SetRVal(St, lval::MemRegionVal(MRMgr.getVarRegion(VD)), X);
}
}
}
@@ -280,16 +288,16 @@
if (!Ex) {
QualType T = VD->getType();
if (LVal::IsLValType(T))
- store = SetRVal(store, StateMgr.getLVal(VD),
+ store = SetRVal(store, getLVal(VD),
lval::ConcreteInt(BasicVals.getValue(0, T)));
else if (T->isIntegerType())
- store = SetRVal(store, StateMgr.getLVal(VD),
+ store = SetRVal(store, getLVal(VD),
nonlval::ConcreteInt(BasicVals.getValue(0, T)));
else {
// assert(0 && "ignore other types of variables");
}
} else {
- store = SetRVal(store, StateMgr.getLVal(VD), InitVal);
+ store = SetRVal(store, getLVal(VD), InitVal);
}
}
} else {
@@ -307,7 +315,7 @@
: cast<RVal>(nonlval::SymbolVal(Sym));
}
- store = SetRVal(store, StateMgr.getLVal(VD), V);
+ store = SetRVal(store, getLVal(VD), V);
}
}
@@ -337,7 +345,7 @@
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I) {
- f.HandleBinding(*this, store, StateMgr.getRegion(I.getKey()),I.getData());
+ f.HandleBinding(*this, store, MRMgr.getVarRegion(I.getKey()),I.getData());
}
}