diff options
author | Anna Zaks <ganna@apple.com> | 2012-04-20 21:59:08 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-04-20 21:59:08 +0000 |
commit | 0b3ade86a1c60cf0c7b56aa238aff458eb7f5974 (patch) | |
tree | 870a9b3597eaabc3fd9a6a3c18b91b0f450b5a17 /include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h | |
parent | 39b73411313b1204601755e8c4813853f30b9a33 (diff) |
[analyzer] Run remove dead bindings right before leaving a function.
This is needed to ensure that we always report issues in the correct
function. For example, leaks are identified when we call remove dead
bindings. In order to make sure we report a callee's leak in the callee,
we have to run the operation in the callee's context.
This change required quite a bit of infrastructure work since:
- We used to only run remove dead bindings before a given statement;
here we need to run it after the last statement in the function. For
this, we added additional Program Point and special mode in the
SymbolReaper to remove all symbols in context lower than the current
one.
- The call exit operation turned into a sequence of nodes, which are
now guarded by CallExitBegin and CallExitEnd nodes for clarity and
convenience.
(Sorry for the long diff.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h')
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h index 69f5e7ca6b..4d329d2f10 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h @@ -553,6 +553,7 @@ public: BasicValueFactory &getBasicVals() { return BV; } }; +/// \class A class responsible for cleaning up unused symbols. class SymbolReaper { enum SymbolStatus { NotProcessed, @@ -576,6 +577,11 @@ class SymbolReaper { llvm::DenseMap<const MemRegion *, unsigned> includedRegionCache; public: + /// \brief Construct a reaper object, which removes everything which is not + /// live before we execute statement s in the given location context. + /// + /// If the statement is NULL, everything is this and parent contexts is + /// considered live. SymbolReaper(const LocationContext *ctx, const Stmt *s, SymbolManager& symmgr, StoreManager &storeMgr) : LCtx(ctx), Loc(s), SymMgr(symmgr), reapedStore(0, storeMgr) {} |