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

Ted Kremenek kremenek at apple.com
Tue Jun 23 10:55:07 PDT 2009


Author: kremenek
Date: Tue Jun 23 12:55:07 2009
New Revision: 73968

URL: http://llvm.org/viewvc/llvm-project?rev=73968&view=rev
Log:
API cleanup: move more methods from GRStateManager to GRState.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
    cfe/trunk/lib/Analysis/BugReporter.cpp
    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=73968&r1=73967&r2=73968&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h Tue Jun 23 12:55:07 2009
@@ -530,21 +530,6 @@
   
 private:
 
-  // Methods that query & manipulate the Environment.  
-  SVal GetSVal(const GRState* St, const Stmt* Ex) {
-    return St->getEnvironment().GetSVal(Ex, ValueMgr);
-  }
-  
-  SVal GetSValAsScalarOrLoc(const GRState* state, const Stmt *S) {
-    if (const Expr *Ex = dyn_cast<Expr>(S)) {
-      QualType T = Ex->getType();
-      if (Loc::IsLocType(T) || T->isIntegerType())
-        return GetSVal(state, S);
-    }
-    
-    return UnknownVal();
-  }
-
   SVal GetBlkExprSVal(const GRState* St, const Stmt* Ex) {
     return St->getEnvironment().GetBlkExprSVal(Ex, ValueMgr);
   }
@@ -599,11 +584,6 @@
   void iterBindings(const GRState* state, StoreManager::BindingsHandler& F) {
     StoreMgr->iterBindings(state->getStore(), F);
   }
-    
-  
-  SVal GetSVal(const GRState* state, Loc LV, QualType T = QualType()) {
-    return StoreMgr->Retrieve(state, LV, T);
-  }
   
   SVal GetSVal(const GRState* state, const MemRegion* R) {
     return StoreMgr->Retrieve(state, loc::MemRegionVal(R));
@@ -781,19 +761,25 @@
 }
   
 inline SVal GRState::getSVal(const Stmt* Ex) const {
-  return Mgr->GetSVal(this, Ex);
+  return getEnvironment().GetSVal(Ex, Mgr->ValueMgr);
 }
 
 inline SVal GRState::getBlkExprSVal(const Stmt* Ex) const {  
   return Mgr->GetBlkExprSVal(this, Ex);
 }
 
-inline SVal GRState::getSValAsScalarOrLoc(const Stmt *Ex) const {
-  return Mgr->GetSValAsScalarOrLoc(this, Ex);
+inline SVal GRState::getSValAsScalarOrLoc(const Stmt *S) const {
+  if (const Expr *Ex = dyn_cast<Expr>(S)) {
+    QualType T = Ex->getType();
+    if (Loc::IsLocType(T) || T->isIntegerType())
+      return getSVal(S);
+  }
+    
+  return UnknownVal();
 }
 
 inline SVal GRState::getSVal(Loc LV, QualType T) const {
-  return Mgr->GetSVal(this, LV, T);
+  return Mgr->StoreMgr->Retrieve(this, LV, T);
 }
 
 inline SVal GRState::getSVal(const MemRegion* R) const {

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

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Tue Jun 23 12:55:07 2009
@@ -380,7 +380,7 @@
       return true;
     
     // Check if the previous state has this binding.    
-    SVal X = VMgr.GetSVal(PrevSt, loc::MemRegionVal(R));
+    SVal X = PrevSt->getSVal(loc::MemRegionVal(R));
     
     if (X == V) // Same binding?
       return true;

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRState.cpp (original)
+++ cfe/trunk/lib/Analysis/GRState.cpp Tue Jun 23 12:55:07 2009
@@ -282,7 +282,7 @@
 bool GRStateManager::isEqual(const GRState* state, Expr* Ex,
                              const llvm::APSInt& Y) {
   
-  SVal V = GetSVal(state, Ex);
+  SVal V = state->getSVal(Ex);
   
   if (loc::ConcreteInt* X = dyn_cast<loc::ConcreteInt>(&V))
     return X->getValue() == Y;





More information about the cfe-commits mailing list