diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-06-27 00:24:54 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-06-27 00:24:54 +0000 |
commit | 4f596c2263e2e3be3000e10017cc0351eb8bb399 (patch) | |
tree | 12947c6a024e7a4906820ada317200955f02cc11 | |
parent | b10d2fbe98767e7477c0e05f67d9055a560049c5 (diff) |
Remove the last 'GetXXX' methods from GRStateManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74361 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Analysis/PathSensitive/GRState.h | 51 | ||||
-rw-r--r-- | lib/Analysis/GRState.cpp | 31 |
2 files changed, 33 insertions, 49 deletions
diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index 4fea4a18c9..0da8f5243e 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -508,43 +508,6 @@ public: return getPersistentState(NewSt); } -private: - - SVal GetBlkExprSVal(const GRState* St, const Stmt* Ex) { - return St->getEnvironment().GetBlkExprSVal(Ex, ValueMgr); - } - - const GRState* BindExpr(const GRState* St, const Stmt* Ex, SVal V, - bool isBlkExpr, bool Invalidate) { - - const Environment& OldEnv = St->getEnvironment(); - Environment NewEnv = EnvMgr.BindExpr(OldEnv, Ex, V, isBlkExpr, Invalidate); - - if (NewEnv == OldEnv) - return St; - - GRState NewSt = *St; - NewSt.Env = NewEnv; - return getPersistentState(NewSt); - } - - const GRState* BindExpr(const GRState* St, const Stmt* Ex, SVal V, - bool Invalidate = true) { - - bool isBlkExpr = false; - - if (Ex == CurrentStmt) { - // FIXME: Should this just be an assertion? When would we want to set - // the value of a block-level expression if it wasn't CurrentStmt? - isBlkExpr = cfg.isBlkExpr(Ex); - - if (!isBlkExpr) - return St; - } - - return BindExpr(St, Ex, V, isBlkExpr, Invalidate); - } - public: SVal ArrayToPointer(Loc Array) { @@ -675,16 +638,6 @@ inline const GRState *GRState::bindDeclWithNoInit(const VarDecl* VD) const { return Mgr->StoreMgr->BindDeclWithNoInit(this, VD); } -inline const GRState *GRState::bindExpr(const Stmt* Ex, SVal V, bool isBlkExpr, - bool Invalidate) const { - return Mgr->BindExpr(this, Ex, V, isBlkExpr, Invalidate); -} - -inline const GRState *GRState::bindExpr(const Stmt* Ex, SVal V, - bool Invalidate) const { - return Mgr->BindExpr(this, Ex, V, Invalidate); -} - inline const GRState *GRState::bindLoc(Loc LV, SVal V) const { return Mgr->StoreMgr->Bind(this, LV, V); } @@ -722,11 +675,11 @@ inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) const { } inline SVal GRState::getSVal(const Stmt* Ex) const { - return getEnvironment().GetSVal(Ex, Mgr->ValueMgr); + return Env.GetSVal(Ex, Mgr->ValueMgr); } inline SVal GRState::getBlkExprSVal(const Stmt* Ex) const { - return Mgr->GetBlkExprSVal(this, Ex); + return Env.GetBlkExprSVal(Ex, Mgr->ValueMgr); } inline SVal GRState::getSValAsScalarOrLoc(const Stmt *S) const { diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index 5ee4e6ff4b..493edc37ba 100644 --- a/lib/Analysis/GRState.cpp +++ b/lib/Analysis/GRState.cpp @@ -85,6 +85,37 @@ SVal GRState::getSValAsScalarOrLoc(const MemRegion *R) const { return UnknownVal(); } + +const GRState *GRState::bindExpr(const Stmt* Ex, SVal V, bool isBlkExpr, + bool Invalidate) const { + + Environment NewEnv = Mgr->EnvMgr.BindExpr(Env, Ex, V, isBlkExpr, Invalidate); + + if (NewEnv == Env) + return this; + + GRState NewSt = *this; + NewSt.Env = NewEnv; + return Mgr->getPersistentState(NewSt); +} + +const GRState *GRState::bindExpr(const Stmt* Ex, SVal V, + bool Invalidate) const { + + bool isBlkExpr = false; + + if (Ex == Mgr->CurrentStmt) { + // FIXME: Should this just be an assertion? When would we want to set + // the value of a block-level expression if it wasn't CurrentStmt? + isBlkExpr = Mgr->cfg.isBlkExpr(Ex); + + if (!isBlkExpr) + return this; + } + + return bindExpr(Ex, V, isBlkExpr, Invalidate); +} + const GRState* GRStateManager::getInitialState() { GRState StateImpl(this, EnvMgr.getInitialEnvironment(), StoreMgr->getInitialStore(), |