From 8485ec6a1d7d7f25ea680ea3740bc1a11d2bb7cd Mon Sep 17 00:00:00 2001 From: Zhongxing Xu Date: Tue, 21 Oct 2008 06:27:32 +0000 Subject: [PATCH] Modify Store interface: GetSVal/SetSVal => Retrieve/Bind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57896 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../clang/Analysis/PathSensitive/GRState.h | 4 ++-- include/clang/Analysis/PathSensitive/Store.h | 6 ++--- lib/Analysis/BasicStore.cpp | 22 ++++++++--------- lib/Analysis/GRState.cpp | 2 +- lib/Analysis/RegionStore.cpp | 24 +++++++++---------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index 334fc9adeb..1b3b4a599e 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -422,7 +422,7 @@ public: SVal GetSVal(const GRState* St, Loc LV, QualType T = QualType()) { - return StoreMgr->GetSVal(St->getStore(), LV, T); + return StoreMgr->Retrieve(St->getStore(), LV, T); } SVal GetSVal(const GRState* St, const MemRegion* R) { @@ -430,7 +430,7 @@ public: } void SetSVal(GRState& St, Loc LV, SVal V) { - St.St = StoreMgr->SetSVal(St.St, LV, V); + St.St = StoreMgr->Bind(St.St, LV, V); } const GRState* SetSVal(const GRState* St, Loc LV, SVal V); diff --git a/include/clang/Analysis/PathSensitive/Store.h b/include/clang/Analysis/PathSensitive/Store.h index d4f152dea7..e6599ef078 100644 --- a/include/clang/Analysis/PathSensitive/Store.h +++ b/include/clang/Analysis/PathSensitive/Store.h @@ -39,13 +39,13 @@ public: typedef llvm::DenseSet DeadSymbolsTy; virtual ~StoreManager() {} - virtual SVal GetSVal(Store St, Loc LV, QualType T = QualType()) = 0; + virtual SVal Retrieve(Store St, Loc LV, QualType T = QualType()) = 0; virtual SVal GetRegionSVal(Store St, const MemRegion* R) { - return GetSVal(St, loc::MemRegionVal(R)); + return Retrieve(St, loc::MemRegionVal(R)); } - virtual Store SetSVal(Store St, Loc LV, SVal V) = 0; + virtual Store Bind(Store St, Loc LV, SVal V) = 0; virtual Store Remove(Store St, Loc LV) = 0; virtual Store getInitialStore() = 0; virtual MemRegionManager& getRegionManager() = 0; diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index 8fc438d6a5..c37db36640 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -34,8 +34,8 @@ public: virtual ~BasicStoreManager() {} - virtual SVal GetSVal(Store St, Loc LV, QualType T); - virtual Store SetSVal(Store St, Loc LV, SVal V); + virtual SVal Retrieve(Store St, Loc LV, QualType T); + virtual Store Bind(Store St, Loc LV, SVal V); virtual Store Remove(Store St, Loc LV); virtual Store getInitialStore(); @@ -133,7 +133,7 @@ SVal BasicStoreManager::getLValueElement(const GRState* St, SVal Base, return Base; } -SVal BasicStoreManager::GetSVal(Store St, Loc LV, QualType T) { +SVal BasicStoreManager::Retrieve(Store St, Loc LV, QualType T) { if (isa(LV)) return UnknownVal(); @@ -177,7 +177,7 @@ SVal BasicStoreManager::GetSVal(Store St, Loc LV, QualType T) { return UnknownVal(); } -Store BasicStoreManager::SetSVal(Store store, Loc LV, SVal V) { +Store BasicStoreManager::Bind(Store store, Loc LV, SVal V) { switch (LV.getSubKind()) { case loc::MemRegionKind: { const VarRegion* R = @@ -315,7 +315,7 @@ Store BasicStoreManager::getInitialStore() { ? SVal::GetSymbolValue(StateMgr.getSymbolManager(), VD) : UndefinedVal(); - St = SetSVal(St, loc::MemRegionVal(MRMgr.getVarRegion(VD)), X); + St = Bind(St, loc::MemRegionVal(MRMgr.getVarRegion(VD)), X); } } } @@ -355,16 +355,16 @@ Store BasicStoreManager::AddDecl(Store store, if (!Ex) { QualType T = VD->getType(); if (Loc::IsLocType(T)) - store = SetSVal(store, getLoc(VD), - loc::ConcreteInt(BasicVals.getValue(0, T))); + store = Bind(store, getLoc(VD), + loc::ConcreteInt(BasicVals.getValue(0, T))); else if (T->isIntegerType()) - store = SetSVal(store, getLoc(VD), - nonloc::ConcreteInt(BasicVals.getValue(0, T))); + store = Bind(store, getLoc(VD), + nonloc::ConcreteInt(BasicVals.getValue(0, T))); else { // assert(0 && "ignore other types of variables"); } } else { - store = SetSVal(store, getLoc(VD), InitVal); + store = Bind(store, getLoc(VD), InitVal); } } } else { @@ -382,7 +382,7 @@ Store BasicStoreManager::AddDecl(Store store, : cast(nonloc::SymbolVal(Sym)); } - store = SetSVal(store, getLoc(VD), V); + store = Bind(store, getLoc(VD), V); } } diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index 09275e28a7..828be2229f 100644 --- a/lib/Analysis/GRState.cpp +++ b/lib/Analysis/GRState.cpp @@ -63,7 +63,7 @@ const GRState* GRStateManager::SetSVal(const GRState* St, Loc LV, SVal V) { Store OldStore = St->getStore(); - Store NewStore = StoreMgr->SetSVal(OldStore, LV, V); + Store NewStore = StoreMgr->Bind(OldStore, LV, V); if (NewStore == OldStore) return St; diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 905370720b..f936fff1b9 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -38,8 +38,8 @@ public: virtual ~RegionStoreManager() {} - SVal GetSVal(Store S, Loc L, QualType T); - Store SetSVal(Store St, Loc LV, SVal V); + SVal Retrieve(Store S, Loc L, QualType T); + Store Bind(Store St, Loc LV, SVal V); Store getInitialStore(); @@ -65,7 +65,7 @@ Loc RegionStoreManager::getElementLoc(const VarDecl* VD, SVal Idx) { return loc::MemRegionVal(ER); } -SVal RegionStoreManager::GetSVal(Store S, Loc L, QualType T) { +SVal RegionStoreManager::Retrieve(Store S, Loc L, QualType T) { assert(!isa(L) && "location unknown"); assert(!isa(L) && "location undefined"); @@ -97,7 +97,7 @@ SVal RegionStoreManager::GetSVal(Store S, Loc L, QualType T) { } } -Store RegionStoreManager::SetSVal(Store store, Loc LV, SVal V) { +Store RegionStoreManager::Bind(Store store, Loc LV, SVal V) { assert(LV.getSubKind() == loc::MemRegionKind); const MemRegion* R = cast(LV).getRegion(); @@ -135,7 +135,7 @@ Store RegionStoreManager::getInitialStore() { ? SVal::GetSymbolValue(StateMgr.getSymbolManager(), VD) : UndefinedVal(); - St = SetSVal(St, getVarLoc(VD), X); + St = Bind(St, getVarLoc(VD), X); } } } @@ -160,16 +160,16 @@ Store RegionStoreManager::AddDecl(Store store, QualType T = VD->getType(); if (Loc::IsLocType(T)) - store = SetSVal(store, getVarLoc(VD), - loc::ConcreteInt(BasicVals.getValue(0, T))); + store = Bind(store, getVarLoc(VD), + loc::ConcreteInt(BasicVals.getValue(0, T))); else if (T->isIntegerType()) - store = SetSVal(store, getVarLoc(VD), - loc::ConcreteInt(BasicVals.getValue(0, T))); + store = Bind(store, getVarLoc(VD), + loc::ConcreteInt(BasicVals.getValue(0, T))); else assert("ignore other types of variables"); } else { - store = SetSVal(store, getVarLoc(VD), InitVal); + store = Bind(store, getVarLoc(VD), InitVal); } } } else { @@ -186,7 +186,7 @@ Store RegionStoreManager::AddDecl(Store store, ? cast(loc::SymbolVal(Sym)) : cast(nonloc::SymbolVal(Sym)); } - store = SetSVal(store, getVarLoc(VD), V); + store = Bind(store, getVarLoc(VD), V); } else if (T->isArrayType()) { // Only handle constant size array. @@ -197,7 +197,7 @@ Store RegionStoreManager::AddDecl(Store store, for (llvm::APInt i = llvm::APInt::getNullValue(Size.getBitWidth()); i != Size; ++i) { nonloc::ConcreteInt Idx(BasicVals.getValue(llvm::APSInt(i))); - store = SetSVal(store, getElementLoc(VD, Idx), UndefinedVal()); + store = Bind(store, getElementLoc(VD, Idx), UndefinedVal()); } } } else if (T->isStructureType()) { -- 2.40.0