diff options
| author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-05-26 03:27:35 +0000 | 
|---|---|---|
| committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-05-26 03:27:35 +0000 | 
| commit | d4f1294f1ecd333fbd18bef9a01176e3abdd9d0a (patch) | |
| tree | 58c79d5e6c5de4e83eda16cf121aa1498b4e3f73 /clang/lib/Checker | |
| parent | 0568ca0ddcc3cf3adf56b1a6b7c435e1a739f938 (diff) | |
| download | bcm5719-llvm-d4f1294f1ecd333fbd18bef9a01176e3abdd9d0a.tar.gz bcm5719-llvm-d4f1294f1ecd333fbd18bef9a01176e3abdd9d0a.zip | |
Remove extents of dead symbolic regions when RemoveDeadBindings.
This requires creating new persistent states due to the nature of GDM.
llvm-svn: 104668
Diffstat (limited to 'clang/lib/Checker')
| -rw-r--r-- | clang/lib/Checker/BasicStore.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Checker/FlatStore.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Checker/GRState.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/Checker/RegionStore.cpp | 22 | 
4 files changed, 25 insertions, 16 deletions
| diff --git a/clang/lib/Checker/BasicStore.cpp b/clang/lib/Checker/BasicStore.cpp index 34470af29f4..5be5ca615ed 100644 --- a/clang/lib/Checker/BasicStore.cpp +++ b/clang/lib/Checker/BasicStore.cpp @@ -72,7 +72,7 @@ public:    /// RemoveDeadBindings - Scans a BasicStore of 'state' for dead values.    ///  It updatees the GRState object in place with the values removed. -  Store RemoveDeadBindings(Store store, Stmt* Loc,  +  const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,                              const StackFrameContext *LCtx,                             SymbolReaper& SymReaper,                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots); @@ -251,11 +251,12 @@ Store BasicStoreManager::Remove(Store store, Loc loc) {    }  } -Store BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc, +const GRState *BasicStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,                                              const StackFrameContext *LCtx,                                              SymbolReaper& SymReaper,                             llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)  { +  Store store = state.getStore();    BindingsTy B = GetBindings(store);    typedef SVal::symbol_iterator symbol_iterator; @@ -329,7 +330,8 @@ Store BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,      }    } -  return store; +  state.setStore(store); +  return StateMgr.getPersistentState(state);  }  Store BasicStoreManager::scanForIvars(Stmt *B, const Decl* SelfDecl, diff --git a/clang/lib/Checker/FlatStore.cpp b/clang/lib/Checker/FlatStore.cpp index 2af9ffa4a4d..7f1c579c6ed 100644 --- a/clang/lib/Checker/FlatStore.cpp +++ b/clang/lib/Checker/FlatStore.cpp @@ -44,11 +44,11 @@ public:    }    SVal ArrayToPointer(Loc Array); -  Store RemoveDeadBindings(Store store, Stmt* Loc,  +  const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,                              const StackFrameContext *LCtx,                             SymbolReaper& SymReaper,                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots){ -    return store; +    return StateMgr.getPersistentState(state);    }    Store BindDecl(Store store, const VarRegion *VR, SVal initVal); diff --git a/clang/lib/Checker/GRState.cpp b/clang/lib/Checker/GRState.cpp index f68e10b0cbc..b16e922776e 100644 --- a/clang/lib/Checker/GRState.cpp +++ b/clang/lib/Checker/GRState.cpp @@ -51,11 +51,10 @@ GRStateManager::RemoveDeadBindings(const GRState* state, Stmt* Loc,                                             state, RegionRoots);    // Clean up the store. -  NewState.St = StoreMgr->RemoveDeadBindings(NewState.St, Loc, LCtx, SymReaper,  -                                             RegionRoots); +  const GRState *s = StoreMgr->RemoveDeadBindings(NewState, Loc, LCtx,  +                                                  SymReaper, RegionRoots); -  return ConstraintMgr->RemoveDeadBindings(getPersistentState(NewState), -                                           SymReaper); +  return ConstraintMgr->RemoveDeadBindings(s, SymReaper);  }  const GRState *GRState::unbindLoc(Loc LV) const { diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp index 0e4c4439f34..f0b61a4ba3f 100644 --- a/clang/lib/Checker/RegionStore.cpp +++ b/clang/lib/Checker/RegionStore.cpp @@ -352,9 +352,9 @@ 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. -  Store RemoveDeadBindings(Store store, Stmt* Loc,  -                           const StackFrameContext *LCtx, -                           SymbolReaper& SymReaper, +  const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,  +                                    const StackFrameContext *LCtx, +                                    SymbolReaper& SymReaper,                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);    const GRState *EnterStackFrame(const GRState *state, @@ -1822,12 +1822,12 @@ bool RemoveDeadBindingsWorker::UpdatePostponed() {    return changed;  } -Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc, +const GRState *RegionStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,                                               const StackFrameContext *LCtx,                                               SymbolReaper& SymReaper,                             llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)  { -  RegionBindings B = GetRegionBindings(store); +  RegionBindings B = GetRegionBindings(state.getStore());    RemoveDeadBindingsWorker W(*this, StateMgr, B, SymReaper, Loc, LCtx);    W.GenerateClusters(); @@ -1860,8 +1860,16 @@ Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,      for (; SI != SE; ++SI)        SymReaper.maybeDead(*SI);    } - -  return B.getRoot(); +  state.setStore(B.getRoot()); +  const GRState *s = StateMgr.getPersistentState(state); +  // Remove the extents of dead symbolic regions. +  llvm::ImmutableMap<const MemRegion*,SVal> Extents =state.get<RegionExtents>(); +  for (llvm::ImmutableMap<const MemRegion *, SVal>::iterator I=Extents.begin(), +         E = Extents.end(); I != E; ++I) { +    if (!W.isVisited(I->first)) +      s = s->remove<RegionExtents>(I->first); +  } +  return s;  } | 

