diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-10-03 16:57:03 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-10-03 16:57:03 +0000 |
commit | d000b852022bcd4fc14029b48d2fa873f63e4032 (patch) | |
tree | 8e7074d806e0394c61202003dfc801e539de900c /docs/analyzer | |
parent | c23cb2d3e8af8354d43517283d3efb2cb0681f49 (diff) |
[analyzer] Add new debug helper clang_analyzer_warnIfReached.
This will emit a warning if a call to clang_analyzer_warnIfReached is
executed, printing REACHABLE. This is a more explicit way to declare
expected reachability than using clang_analyzer_eval or triggering
a bug (divide-by-zero or null dereference), and unlike the former will
work the same in inlined functions and top-level functions. Like the
other debug helpers, it is part of the debug.ExprInspection checker.
Patch by Jared Grubb!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/analyzer')
-rw-r--r-- | docs/analyzer/DebugChecks.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/analyzer/DebugChecks.rst b/docs/analyzer/DebugChecks.rst index a0f2a07a00..14d6ae4c4c 100644 --- a/docs/analyzer/DebugChecks.rst +++ b/docs/analyzer/DebugChecks.rst @@ -125,6 +125,19 @@ ExprInspection checks clang_analyzer_eval(value == 42); // expected-warning{{TRUE}} } +- void clang_analyzer_warnIfReached(); + + Generate a warning if this line of code gets reached by the analyzer. + + Example usage:: + + if (true) { + clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} + } + else { + clang_analyzer_warnIfReached(); // no-warning + } + Statistics ========== |