diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-11-10 09:39:04 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-11-10 09:39:04 +0000 |
commit | 8916d5b90985bdeb10d2af676d74d9815f4bc8fa (patch) | |
tree | ebbdfe6ebea3d7b18b304c095c59c41c275d6cf7 /lib/Analysis/RegionStore.cpp | |
parent | 526d9271ad059071d24d59efeae17ecb03e91418 (diff) |
Implement RegionStoreManager::RemoveDeadBindings(). This prunes several false warning caused by removal of symbolic constraints. Currently we just mark all symbols live. Further optimization for dead binding removal needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58982 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 20a8ae0d05..8372a1023e 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -83,10 +83,7 @@ public: Store RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live, llvm::SmallVectorImpl<const MemRegion*>& RegionRoots, - LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols) { - // FIXME: Implement this. - return store; - } + LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols); Store BindDecl(Store store, const VarDecl* VD, Expr* Ex, SVal InitVal, unsigned Count); @@ -432,6 +429,25 @@ Store RegionStoreManager::BindCompoundLiteral(Store store, return store; } +Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc, + const LiveVariables& Live, + llvm::SmallVectorImpl<const MemRegion*>& RegionRoots, + LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols) { + + RegionBindingsTy B = GetRegionBindings(store); + typedef SVal::symbol_iterator symbol_iterator; + + // FIXME: Mark all region binding value's symbol as live. We also omit symbols + // in SymbolicRegions. + for (RegionBindingsTy::iterator I = B.begin(), E = B.end(); I != E; ++I) { + SVal X = I.getData(); + for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI) + LSymbols.insert(*SI); + } + + return store; +} + void RegionStoreManager::print(Store store, std::ostream& Out, const char* nl, const char *sep) { llvm::raw_os_ostream OS(Out); |