[cfe-commits] r95365 - in /cfe/trunk: include/clang/Checker/PathSensitive/Store.h lib/Checker/BasicStore.cpp lib/Checker/FlatStore.cpp lib/Checker/GRState.cpp lib/Checker/RegionStore.cpp

Zhongxing Xu xuzhongxing at gmail.com
Thu Feb 4 21:34:29 PST 2010


Author: zhongxingxu
Date: Thu Feb  4 23:34:29 2010
New Revision: 95365

URL: http://llvm.org/viewvc/llvm-project?rev=95365&view=rev
Log:
More GRState* -> Store changes.

Modified:
    cfe/trunk/include/clang/Checker/PathSensitive/Store.h
    cfe/trunk/lib/Checker/BasicStore.cpp
    cfe/trunk/lib/Checker/FlatStore.cpp
    cfe/trunk/lib/Checker/GRState.cpp
    cfe/trunk/lib/Checker/RegionStore.cpp

Modified: cfe/trunk/include/clang/Checker/PathSensitive/Store.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/Store.h?rev=95365&r1=95364&r2=95365&view=diff

==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/Store.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/Store.h Thu Feb  4 23:34:29 2010
@@ -132,8 +132,8 @@
     return UnknownVal();
   }
 
-  virtual void RemoveDeadBindings(GRState &state, Stmt* Loc,
-                                  SymbolReaper& SymReaper,
+  virtual Store RemoveDeadBindings(Store store, Stmt* Loc,
+                                   SymbolReaper& SymReaper,
                       llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) = 0;
 
   virtual Store BindDecl(Store store, const VarRegion *VR, SVal initVal) = 0;

Modified: cfe/trunk/lib/Checker/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BasicStore.cpp?rev=95365&r1=95364&r2=95365&view=diff

==============================================================================
--- cfe/trunk/lib/Checker/BasicStore.cpp (original)
+++ cfe/trunk/lib/Checker/BasicStore.cpp Thu Feb  4 23:34:29 2010
@@ -82,7 +82,7 @@
 
   /// RemoveDeadBindings - Scans a BasicStore of 'state' for dead values.
   ///  It updatees the GRState object in place with the values removed.
-  void RemoveDeadBindings(GRState &state, Stmt* Loc, SymbolReaper& SymReaper,
+  Store RemoveDeadBindings(Store store, Stmt* Loc, SymbolReaper& SymReaper,
                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
 
   void iterBindings(Store store, BindingsHandler& f);
@@ -343,12 +343,10 @@
   }
 }
 
-void
-BasicStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
-                                      SymbolReaper& SymReaper,
+Store BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
+                                            SymbolReaper& SymReaper,
                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)
 {
-  Store store = state.getStore();
   BindingsTy B = GetBindings(store);
   typedef SVal::symbol_iterator symbol_iterator;
 
@@ -389,7 +387,7 @@
           break;
 
         Marked.insert(MR);
-        SVal X = Retrieve(state.getStore(), loc::MemRegionVal(MR));
+        SVal X = Retrieve(store, loc::MemRegionVal(MR));
 
         // FIXME: We need to handle symbols nested in region definitions.
         for (symbol_iterator SI=X.symbol_begin(),SE=X.symbol_end();SI!=SE;++SI)
@@ -422,8 +420,7 @@
     }
   }
 
-  // Write the store back.
-  state.setStore(store);
+  return store;
 }
 
 Store BasicStoreManager::scanForIvars(Stmt *B, const Decl* SelfDecl,

Modified: cfe/trunk/lib/Checker/FlatStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/FlatStore.cpp?rev=95365&r1=95364&r2=95365&view=diff

==============================================================================
--- cfe/trunk/lib/Checker/FlatStore.cpp (original)
+++ cfe/trunk/lib/Checker/FlatStore.cpp Thu Feb  4 23:34:29 2010
@@ -48,9 +48,10 @@
   SVal getLValueField(const FieldDecl* D, SVal Base);
   SVal getLValueElement(QualType elementType, SVal offset, SVal Base);
   SVal ArrayToPointer(Loc Array);
-  void RemoveDeadBindings(GRState &state, Stmt* Loc,
-                          SymbolReaper& SymReaper,
-                          llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
+  Store RemoveDeadBindings(Store store, Stmt* Loc, SymbolReaper& SymReaper,
+                         llvm::SmallVectorImpl<const MemRegion*>& RegionRoots){
+    return store;
+  }
 
   Store BindDecl(Store store, const VarRegion *VR, SVal initVal);
 
@@ -116,11 +117,6 @@
   return Array;
 }
 
-void FlatStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
-                                          SymbolReaper& SymReaper,
-                         llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) {
-}
-
 Store FlatStoreManager::BindDecl(Store store, const VarRegion *VR, 
                                  SVal initVal) {
   return store;

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

==============================================================================
--- cfe/trunk/lib/Checker/GRState.cpp (original)
+++ cfe/trunk/lib/Checker/GRState.cpp Thu Feb  4 23:34:29 2010
@@ -50,7 +50,8 @@
                                            state, RegionRoots);
 
   // Clean up the store.
-  StoreMgr->RemoveDeadBindings(NewState, Loc, SymReaper, RegionRoots);
+  NewState.St = StoreMgr->RemoveDeadBindings(NewState.St, Loc, SymReaper, 
+                                             RegionRoots);
 
   return ConstraintMgr->RemoveDeadBindings(getPersistentState(NewState),
                                            SymReaper);

Modified: cfe/trunk/lib/Checker/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/RegionStore.cpp?rev=95365&r1=95364&r2=95365&view=diff

==============================================================================
--- cfe/trunk/lib/Checker/RegionStore.cpp (original)
+++ cfe/trunk/lib/Checker/RegionStore.cpp Thu Feb  4 23:34:29 2010
@@ -389,7 +389,7 @@
 
   /// RemoveDeadBindings - Scans the RegionStore of 'state' for dead values.
   ///  It returns a new Store with these values removed.
-  void RemoveDeadBindings(GRState &state, Stmt* Loc, SymbolReaper& SymReaper,
+  Store RemoveDeadBindings(Store store, Stmt* Loc, SymbolReaper& SymReaper,
                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
 
   const GRState *EnterStackFrame(const GRState *state,
@@ -1789,13 +1789,12 @@
 // State pruning.
 //===----------------------------------------------------------------------===//
   
-void RegionStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
-                                            SymbolReaper& SymReaper,
+Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
+                                             SymbolReaper& SymReaper,
                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)
 {
   typedef std::pair<Store, const MemRegion *> RBDNode;
 
-  Store store = state.getStore();
   RegionBindings B = GetRegionBindings(store);
 
   // The backmap from regions to subregions.
@@ -1985,8 +1984,7 @@
       SymReaper.maybeDead(*SI);
   }
 
-  // Write the store back.
-  state.setStore(new_store);
+  return new_store;
 }
 
 GRState const *RegionStoreManager::EnterStackFrame(GRState const *state,





More information about the cfe-commits mailing list