diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-08-02 05:00:15 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-08-02 05:00:15 +0000 |
| commit | f106ab91ffd01e4570e6c92b64d36a8201a2b016 (patch) | |
| tree | 52278d560c794a4a03494d4d471dbfd5f0a5590e /clang/lib/Analysis | |
| parent | 0161419259895b9028d6c939ff912b4ed9aa4fb8 (diff) | |
| download | bcm5719-llvm-f106ab91ffd01e4570e6c92b64d36a8201a2b016.tar.gz bcm5719-llvm-f106ab91ffd01e4570e6c92b64d36a8201a2b016.zip | |
RegionStoreManager::RemoveDeadBindings() now removes dead 'default' bindings as well.
llvm-svn: 77875
Diffstat (limited to 'clang/lib/Analysis')
| -rw-r--r-- | clang/lib/Analysis/RegionStore.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp index c95f6c86f94..32a1dc01759 100644 --- a/clang/lib/Analysis/RegionStore.cpp +++ b/clang/lib/Analysis/RegionStore.cpp @@ -1763,10 +1763,40 @@ void RegionStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc, SymReaper.maybeDead(*SI); } - // FIXME: remove default bindings as well. - + // Remove dead 'default' bindings. + RegionDefaultValue::MapTy NewDVM = DVM; + RegionDefaultValue::MapTy::Factory &DVMFactory = + state.get_context<RegionDefaultValue>(); + + for (RegionDefaultValue::MapTy::iterator I = DVM.begin(), E = DVM.end(); + I != E; ++I) { + const MemRegion *R = I.getKey(); + + // If this region live? Is so, none of its symbols are dead. + if (Marked.count(R)) + continue; + + // Remove this dead region. + NewDVM = DVMFactory.Remove(NewDVM, R); + + // Mark all non-live symbols that this region references as dead. + if (const SymbolicRegion* SymR = dyn_cast<SymbolicRegion>(R)) + SymReaper.maybeDead(SymR->getSymbol()); + + SVal X = I.getData(); + SVal::symbol_iterator SI = X.symbol_begin(), SE = X.symbol_end(); + for (; SI != SE; ++SI) + SymReaper.maybeDead(*SI); + } + // Write the store back. state.setStore(store); + + // Write the updated default bindings back. + // FIXME: Right now this involves a fetching of a persistent state. + // We can do better. + if (DVM != NewDVM) + state.setGDM(state.set<RegionDefaultValue>(NewDVM)->getGDM()); } //===----------------------------------------------------------------------===// |

