[cfe-commits] r74361 - in /cfe/trunk: include/clang/Analysis/PathSensitive/GRState.h lib/Analysis/GRState.cpp

Ted Kremenek kremenek at apple.com
Fri Jun 26 17:24:54 PDT 2009


Author: kremenek
Date: Fri Jun 26 19:24:54 2009
New Revision: 74361

URL: http://llvm.org/viewvc/llvm-project?rev=74361&view=rev
Log:
Remove the last 'GetXXX' methods from GRStateManager.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
    cfe/trunk/lib/Analysis/GRState.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h?rev=74361&r1=74360&r2=74361&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h Fri Jun 26 19:24:54 2009
@@ -508,43 +508,6 @@
     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 @@
   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 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 {

Modified: cfe/trunk/lib/Analysis/GRState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRState.cpp?rev=74361&r1=74360&r2=74361&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRState.cpp (original)
+++ cfe/trunk/lib/Analysis/GRState.cpp Fri Jun 26 19:24:54 2009
@@ -85,6 +85,37 @@
   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(),





More information about the cfe-commits mailing list