diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2015-12-10 09:28:06 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2015-12-10 09:28:06 +0000 |
commit | 733e71b73b35eccd467c50baf12214d85941f0b0 (patch) | |
tree | d817b5cda01584f26d1cc933c984924fb7a551fe /clang/docs | |
parent | a5fbebc2065d12a403f82380cbe0c3a571cfccbe (diff) | |
download | bcm5719-llvm-733e71b73b35eccd467c50baf12214d85941f0b0.tar.gz bcm5719-llvm-733e71b73b35eccd467c50baf12214d85941f0b0.zip |
[analyzer] Fix symbolic element index lifetime.
SymbolReaper was destroying the symbol too early when it was referenced only
from an index SVal of a live ElementRegion.
In order to test certain aspects of this patch, extend the debug.ExprInspection
checker to allow testing SymbolReaper in a direct manner.
Differential Revision: http://reviews.llvm.org/D12726
llvm-svn: 255236
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/analyzer/DebugChecks.rst | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/docs/analyzer/DebugChecks.rst b/clang/docs/analyzer/DebugChecks.rst index 14d6ae4c4c9..771e39fc439 100644 --- a/clang/docs/analyzer/DebugChecks.rst +++ b/clang/docs/analyzer/DebugChecks.rst @@ -138,6 +138,29 @@ ExprInspection checks clang_analyzer_warnIfReached(); // no-warning } +- void clang_analyzer_warnOnDeadSymbol(int); + + Subscribe for a delayed warning when the symbol that represents the value of + the argument is garbage-collected by the analyzer. + + When calling 'clang_analyzer_warnOnDeadSymbol(x)', if value of 'x' is a + symbol, then this symbol is marked by the ExprInspection checker. Then, + during each garbage collection run, the checker sees if the marked symbol is + being collected and issues the 'SYMBOL DEAD' warning if it does. + This way you know where exactly, up to the line of code, the symbol dies. + + It is unlikely that you call this function after the symbol is already dead, + because the very reference to it as the function argument prevents it from + dying. However, if the argument is not a symbol but a concrete value, + no warning would be issued. + + Example usage:: + + do { + int x = generate_some_integer(); + clang_analyzer_warnOnDeadSymbol(x); + } while(0); // expected-warning{{SYMBOL DEAD}} + Statistics ========== |