]> granicus.if.org Git - clang/commitdiff
StoreManager::RemoveDeadBindings() can take a Store instead of an entire GRState...
authorZhongxing Xu <xuzhongxing@gmail.com>
Sun, 15 Aug 2010 12:45:09 +0000 (12:45 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Sun, 15 Aug 2010 12:45:09 +0000 (12:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111103 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 dfe1e22f86abd61b6f0d64f4a0d3f1838ef20046..a1a41847a206abf9814f5b7d78a29810598e84cc 100644 (file)
@@ -149,9 +149,8 @@ public:
     return UnknownVal();
   }
 
-  virtual const GRState *RemoveDeadBindings(GRState &state,
-                                            const StackFrameContext *LCtx,
-                                            SymbolReaper& SymReaper,
+  virtual Store RemoveDeadBindings(Store store, const StackFrameContext *LCtx,
+                                   SymbolReaper& SymReaper,
                       llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) = 0;
 
   virtual Store BindDecl(Store store, const VarRegion *VR, SVal initVal) = 0;
index 0c42eb1256338dc0b02e621742caab5377c65d98..943d64e2b667af1c22ea6f14dadd015b918bf462 100644 (file)
@@ -77,9 +77,8 @@ public:
 
   /// RemoveDeadBindings - Scans a BasicStore of 'state' for dead values.
   ///  It updatees the GRState object in place with the values removed.
-  const GRState *RemoveDeadBindings(GRState &state,
-                                    const StackFrameContext *LCtx,
-                                    SymbolReaper& SymReaper,
+  Store RemoveDeadBindings(Store store, const StackFrameContext *LCtx,
+                           SymbolReaper& SymReaper,
                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
 
   void iterBindings(Store store, BindingsHandler& f);
@@ -281,12 +280,11 @@ Store BasicStoreManager::Remove(Store store, Loc loc) {
   }
 }
 
-const GRState *BasicStoreManager::RemoveDeadBindings(GRState &state,
+Store BasicStoreManager::RemoveDeadBindings(Store store,
                                             const StackFrameContext *LCtx,
                                             SymbolReaper& SymReaper,
                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)
 {
-  Store store = state.getStore();
   BindingsTy B = GetBindings(store);
   typedef SVal::symbol_iterator symbol_iterator;
 
@@ -361,8 +359,7 @@ const GRState *BasicStoreManager::RemoveDeadBindings(GRState &state,
     }
   }
 
-  state.setStore(store);
-  return StateMgr.getPersistentState(state);
+  return store;
 }
 
 Store BasicStoreManager::scanForIvars(Stmt *B, const Decl* SelfDecl,
index 46e24773dbbef1bbf8bcaadc44dbb49777e1e1bc..7c986a71df503f49447643038c94ab97cefa833d 100644 (file)
@@ -44,11 +44,10 @@ public:
   }
 
   SVal ArrayToPointer(Loc Array);
-  const GRState *RemoveDeadBindings(GRState &state, 
-                           const StackFrameContext *LCtx,
+  Store RemoveDeadBindings(Store store, const StackFrameContext *LCtx,
                            SymbolReaper& SymReaper,
                          llvm::SmallVectorImpl<const MemRegion*>& RegionRoots){
-    return StateMgr.getPersistentState(state);
+    return store;
   }
 
   Store BindDecl(Store store, const VarRegion *VR, SVal initVal);
index bb76328c2291b049e3de6131c5377dcf642c7f40..7d0b8745bb9001454cbb1d0d33c34717b9b53dcd 100644 (file)
@@ -51,10 +51,10 @@ GRStateManager::RemoveDeadBindings(const GRState* state,
                                            state, RegionRoots);
 
   // Clean up the store.
-  const GRState *s = StoreMgr->RemoveDeadBindings(NewState, LCtx, 
-                                                  SymReaper, RegionRoots);
-
-  return ConstraintMgr->RemoveDeadBindings(s, SymReaper);
+  NewState.St = StoreMgr->RemoveDeadBindings(NewState.St, LCtx, 
+                                             SymReaper, RegionRoots);
+  state = getPersistentState(NewState);
+  return ConstraintMgr->RemoveDeadBindings(state, SymReaper);
 }
 
 const GRState *GRStateManager::MarshalState(const GRState *state,
index e5c75b9371f9e9325e97a601bd43da26dc4aaf96..b6ea696c4e1495c1931fa117559b6b453d6eeda0 100644 (file)
@@ -347,9 +347,8 @@ 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.
-  const GRState *RemoveDeadBindings(GRState &state, 
-                                    const StackFrameContext *LCtx,
-                                    SymbolReaper& SymReaper,
+  Store RemoveDeadBindings(Store store, const StackFrameContext *LCtx,
+                           SymbolReaper& SymReaper,
                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
 
   Store EnterStackFrame(const GRState *state, const StackFrameContext *frame);
@@ -1792,12 +1791,12 @@ bool RemoveDeadBindingsWorker::UpdatePostponed() {
   return changed;
 }
 
-const GRState *RegionStoreManager::RemoveDeadBindings(GRState &state,
+Store RegionStoreManager::RemoveDeadBindings(Store store,
                                              const StackFrameContext *LCtx,
                                              SymbolReaper& SymReaper,
                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)
 {
-  RegionBindings B = GetRegionBindings(state.getStore());
+  RegionBindings B = GetRegionBindings(store);
   RemoveDeadBindingsWorker W(*this, StateMgr, B, SymReaper, LCtx);
   W.GenerateClusters();
 
@@ -1830,9 +1829,8 @@ const GRState *RegionStoreManager::RemoveDeadBindings(GRState &state,
     for (; SI != SE; ++SI)
       SymReaper.maybeDead(*SI);
   }
-  state.setStore(B.getRoot());
-  const GRState *s = StateMgr.getPersistentState(state);
-  return s;
+
+  return B.getRoot();
 }