Remove redundant parameter and rename StMgr to StateMgr.

llvm-svn: 57107
This commit is contained in:
Zhongxing Xu 2008-10-05 12:12:48 +00:00
parent d2aded08ac
commit 8c9771bdf0
3 changed files with 19 additions and 19 deletions

View File

@ -39,14 +39,14 @@ public:
virtual RVal GetRVal(Store St, LVal LV, QualType T = QualType()) = 0; virtual RVal GetRVal(Store St, LVal LV, QualType T = QualType()) = 0;
virtual Store SetRVal(Store St, LVal LV, RVal V) = 0; virtual Store SetRVal(Store St, LVal LV, RVal V) = 0;
virtual Store Remove(Store St, LVal LV) = 0; virtual Store Remove(Store St, LVal LV) = 0;
virtual Store getInitialStore(GRStateManager& StateMgr) = 0; virtual Store getInitialStore() = 0;
virtual Store virtual Store
RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live, RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots, llvm::SmallVectorImpl<const MemRegion*>& RegionRoots,
LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols) = 0; LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols) = 0;
virtual Store AddDecl(Store store, GRStateManager& StMgr, virtual Store AddDecl(Store store,
const VarDecl* VD, Expr* Ex, const VarDecl* VD, Expr* Ex,
RVal InitVal = UndefinedVal(), unsigned Count = 0) = 0; RVal InitVal = UndefinedVal(), unsigned Count = 0) = 0;

View File

@ -25,10 +25,10 @@ namespace {
class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager { class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager {
VarBindingsTy::Factory VBFactory; VarBindingsTy::Factory VBFactory;
GRStateManager& StMgr; GRStateManager& StateMgr;
public: public:
BasicStoreManager(GRStateManager& mgr) : StMgr(mgr) {} BasicStoreManager(GRStateManager& mgr) : StateMgr(mgr) {}
virtual ~BasicStoreManager() {} virtual ~BasicStoreManager() {}
@ -36,7 +36,7 @@ public:
virtual Store SetRVal(Store St, LVal LV, RVal V); virtual Store SetRVal(Store St, LVal LV, RVal V);
virtual Store Remove(Store St, LVal LV); virtual Store Remove(Store St, LVal LV);
virtual Store getInitialStore(GRStateManager& StateMgr); virtual Store getInitialStore();
virtual Store virtual Store
RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live, RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live,
@ -45,7 +45,7 @@ public:
virtual void iterBindings(Store store, BindingsHandler& f); virtual void iterBindings(Store store, BindingsHandler& f);
virtual Store AddDecl(Store store, GRStateManager& StateMgr, virtual Store AddDecl(Store store,
const VarDecl* VD, Expr* Ex, const VarDecl* VD, Expr* Ex,
RVal InitVal = UndefinedVal(), unsigned Count = 0); RVal InitVal = UndefinedVal(), unsigned Count = 0);
@ -164,7 +164,7 @@ BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
// Iterate over the variable bindings. // Iterate over the variable bindings.
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I)
if (Liveness.isLive(Loc, I.getKey())) { if (Liveness.isLive(Loc, I.getKey())) {
RegionRoots.push_back(StMgr.getRegion(I.getKey())); RegionRoots.push_back(StateMgr.getRegion(I.getKey()));
RVal X = I.getData(); RVal X = I.getData();
for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI) for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI)
@ -198,7 +198,7 @@ BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
// Remove dead variable bindings. // Remove dead variable bindings.
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) { for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
const VarRegion* R = cast<VarRegion>(StMgr.getRegion(I.getKey())); const VarRegion* R = cast<VarRegion>(StateMgr.getRegion(I.getKey()));
if (!Marked.count(R)) { if (!Marked.count(R)) {
store = Remove(store, lval::MemRegionVal(R)); store = Remove(store, lval::MemRegionVal(R));
@ -212,7 +212,7 @@ BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
return store; return store;
} }
Store BasicStoreManager::getInitialStore(GRStateManager& StateMgr) { Store BasicStoreManager::getInitialStore() {
// The LiveVariables information already has a compilation of all VarDecls // The LiveVariables information already has a compilation of all VarDecls
// used in the function. Iterate through this set, and "symbolicate" // used in the function. Iterate through this set, and "symbolicate"
// any VarDecl whose value originally comes from outside the function. // any VarDecl whose value originally comes from outside the function.
@ -240,14 +240,14 @@ Store BasicStoreManager::getInitialStore(GRStateManager& StateMgr) {
? RVal::GetSymbolValue(StateMgr.getSymbolManager(), VD) ? RVal::GetSymbolValue(StateMgr.getSymbolManager(), VD)
: UndefinedVal(); : UndefinedVal();
St = SetRVal(St, StMgr.getLVal(VD), X); St = SetRVal(St, StateMgr.getLVal(VD), X);
} }
} }
} }
return St; return St;
} }
Store BasicStoreManager::AddDecl(Store store, GRStateManager& StateMgr, Store BasicStoreManager::AddDecl(Store store,
const VarDecl* VD, Expr* Ex, const VarDecl* VD, Expr* Ex,
RVal InitVal, unsigned Count) { RVal InitVal, unsigned Count) {
@ -280,16 +280,16 @@ Store BasicStoreManager::AddDecl(Store store, GRStateManager& StateMgr,
if (!Ex) { if (!Ex) {
QualType T = VD->getType(); QualType T = VD->getType();
if (LVal::IsLValType(T)) if (LVal::IsLValType(T))
store = SetRVal(store, StMgr.getLVal(VD), store = SetRVal(store, StateMgr.getLVal(VD),
lval::ConcreteInt(BasicVals.getValue(0, T))); lval::ConcreteInt(BasicVals.getValue(0, T)));
else if (T->isIntegerType()) else if (T->isIntegerType())
store = SetRVal(store, StMgr.getLVal(VD), store = SetRVal(store, StateMgr.getLVal(VD),
nonlval::ConcreteInt(BasicVals.getValue(0, T))); nonlval::ConcreteInt(BasicVals.getValue(0, T)));
else { else {
// assert(0 && "ignore other types of variables"); // assert(0 && "ignore other types of variables");
} }
} else { } else {
store = SetRVal(store, StMgr.getLVal(VD), InitVal); store = SetRVal(store, StateMgr.getLVal(VD), InitVal);
} }
} }
} else { } else {
@ -307,7 +307,7 @@ Store BasicStoreManager::AddDecl(Store store, GRStateManager& StateMgr,
: cast<RVal>(nonlval::SymbolVal(Sym)); : cast<RVal>(nonlval::SymbolVal(Sym));
} }
store = SetRVal(store, StMgr.getLVal(VD), V); store = SetRVal(store, StateMgr.getLVal(VD), V);
} }
} }
@ -337,7 +337,7 @@ void BasicStoreManager::iterBindings(Store store, BindingsHandler& f) {
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I) { for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I) {
f.HandleBinding(*this, store, StMgr.getRegion(I.getKey()),I.getData()); f.HandleBinding(*this, store, StateMgr.getRegion(I.getKey()),I.getData());
} }
} }

View File

@ -79,10 +79,10 @@ const GRState* GRStateManager::AddDecl(const GRState* St, const VarDecl* VD,
Store NewStore; Store NewStore;
if (Ex) if (Ex)
NewStore = StMgr->AddDecl(OldStore, *this, VD, Ex, NewStore = StMgr->AddDecl(OldStore, VD, Ex,
GetRVal(St, Ex), Count); GetRVal(St, Ex), Count);
else else
NewStore = StMgr->AddDecl(OldStore, *this, VD, Ex); NewStore = StMgr->AddDecl(OldStore, VD, Ex);
if (NewStore == OldStore) if (NewStore == OldStore)
return St; return St;
@ -107,7 +107,7 @@ const GRState* GRStateManager::Unbind(const GRState* St, LVal LV) {
const GRState* GRStateManager::getInitialState() { const GRState* GRStateManager::getInitialState() {
GRState StateImpl(EnvMgr.getInitialEnvironment(), GRState StateImpl(EnvMgr.getInitialEnvironment(),
StMgr->getInitialStore(*this), StMgr->getInitialStore(),
GDMFactory.GetEmptyMap()); GDMFactory.GetEmptyMap());
return getPersistentState(StateImpl); return getPersistentState(StateImpl);