From: Zhongxing Xu Date: Mon, 10 Nov 2008 09:39:04 +0000 (+0000) Subject: Implement RegionStoreManager::RemoveDeadBindings(). This prunes several false warning... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8916d5b90985bdeb10d2af676d74d9815f4bc8fa;p=clang 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 --- 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& 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& 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);