]> granicus.if.org Git - clang/commitdiff
More GRState* -> Store changes.
authorZhongxing Xu <xuzhongxing@gmail.com>
Fri, 5 Feb 2010 05:34:29 +0000 (05:34 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Fri, 5 Feb 2010 05:34:29 +0000 (05:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95365 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Checker/PathSensitive/Store.h
lib/Checker/BasicStore.cpp
lib/Checker/FlatStore.cpp
lib/Checker/GRState.cpp
lib/Checker/RegionStore.cpp

index 64650e58b3173df99138012c5274c06d11d99d62..3121e461bca75a3a7d552b38f6a3cef228d42a14 100644 (file)
@@ -132,8 +132,8 @@ public:
     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;
index 2c83ed9687159e2506e835fa4e2b34cc61552fb3..e2c96759a4eeb4c350279c4eff85b09bcbb2dfef 100644 (file)
@@ -82,7 +82,7 @@ public:
 
   /// 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 @@ Store BasicStoreManager::Remove(Store store, Loc loc) {
   }
 }
 
-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 @@ BasicStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
           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 @@ BasicStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
     }
   }
 
-  // Write the store back.
-  state.setStore(store);
+  return store;
 }
 
 Store BasicStoreManager::scanForIvars(Stmt *B, const Decl* SelfDecl,
index c4f37dff658233f53b8043305dceb3fdd0da17de..4622f47877f3c9b612cc5ff6167a133d6ff304ef 100644 (file)
@@ -48,9 +48,10 @@ public:
   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 @@ SVal FlatStoreManager::ArrayToPointer(Loc Array) {
   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;
index 3abc6d29011371200398acdac8947d86bc759f33..592f930316e1717f7567ff80c76f1da07169c5ea 100644 (file)
@@ -50,7 +50,8 @@ GRStateManager::RemoveDeadBindings(const GRState* state, Stmt* Loc,
                                            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);
index 348450e233190f2b06daff65a4bd328417ac4174..528419f0a886cf21de4da28893c50bc06f5102b7 100644 (file)
@@ -389,7 +389,7 @@ public: // Part of public interface to class.
 
   /// 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 @@ Store RegionStoreManager::Remove(Store store, BindingKey K) {
 // 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 @@ tryAgain:
       SymReaper.maybeDead(*SI);
   }
 
-  // Write the store back.
-  state.setStore(new_store);
+  return new_store;
 }
 
 GRState const *RegionStoreManager::EnterStackFrame(GRState const *state,