Static Analyzer: Replace LiveSymbols/DeadSymbols sets with a new object called "SymbolReaper". Right now it just consolidates the two and cleans up some client code, but shortly it will be used to enable "lazy computation" of live symbols for use with RegionStore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62722 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/Environment.cpp b/lib/Analysis/Environment.cpp
index 5f9e97e..c4ed349 100644
--- a/lib/Analysis/Environment.cpp
+++ b/lib/Analysis/Environment.cpp
@@ -108,9 +108,8 @@
Environment
EnvironmentManager::RemoveDeadBindings(Environment Env, Stmt* Loc,
- const LiveVariables& Liveness,
- llvm::SmallVectorImpl<const MemRegion*>& DRoots,
- StoreManager::LiveSymbolsTy& LSymbols) {
+ SymbolReaper& SymReaper,
+ llvm::SmallVectorImpl<const MemRegion*>& DRoots) {
// Drop bindings for subexpressions.
Env = RemoveSubExprBindings(Env);
@@ -120,19 +119,18 @@
I != E; ++I) {
Stmt* BlkExpr = I.getKey();
- if (Liveness.isLive(Loc, BlkExpr)) {
+ if (SymReaper.isLive(Loc, BlkExpr)) {
SVal X = I.getData();
// If the block expr's value is a memory region, then mark that region.
if (isa<loc::MemRegionVal>(X))
DRoots.push_back(cast<loc::MemRegionVal>(X).getRegion());
-
// Mark all symbols in the block expr's value.
for (SVal::symbol_iterator SI = X.symbol_begin(), SE = X.symbol_end();
- SI != SE; ++SI) {
- LSymbols.insert(*SI);
- }
+ SI != SE; ++SI)
+ SymReaper.markLive(*SI);
+
} else {
// The block expr is dead.
SVal X = I.getData();