diff options
author | Kristof Umann <kristof.umann@ericsson.com> | 2019-09-03 15:22:43 +0000 |
---|---|---|
committer | Kristof Umann <kristof.umann@ericsson.com> | 2019-09-03 15:22:43 +0000 |
commit | cfb041434e33a16d7ba0ba4576194a7d42b2f3f8 (patch) | |
tree | 05d02c1eabecf0df731d8b6f230b347265f530fe /docs/analyzer | |
parent | c5183658b794a017ec1451e84bc701ef46208abe (diff) | |
download | clang-cfb041434e33a16d7ba0ba4576194a7d42b2f3f8.tar.gz |
[analyzer] Add a checker option to detect nested dead stores
Enables the users to specify an optional flag which would warn for more dead
stores.
Previously it ignored if the dead store happened e.g. in an if condition.
if ((X = generate())) { // dead store to X
}
This patch introduces the `WarnForDeadNestedAssignments` option to the checker,
which is `false` by default - so this change would not affect any previous
users.
I have updated the code, tests and the docs as well. If I missed something, tell
me.
I also ran the analysis on Clang which generated 14 more reports compared to the
unmodified version. All of them seemed reasonable for me.
Related previous patches:
rGf224820b45c6847b91071da8d7ade59f373b96f3
Reviewers: NoQ, krememek, Szelethus, baloghadamsoftware
Reviewed By: Szelethus
Patch by Balázs Benics!
Differential Revision: https://reviews.llvm.org/D66733
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/analyzer')
-rw-r--r-- | docs/analyzer/checkers.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/analyzer/checkers.rst b/docs/analyzer/checkers.rst index f50fff918c..a751b14809 100644 --- a/docs/analyzer/checkers.rst +++ b/docs/analyzer/checkers.rst @@ -319,6 +319,15 @@ Check for values stored to variables that are never read afterwards. x = 1; // warn } +The ``WarnForDeadNestedAssignments`` option enables the checker to emit +warnings for nested dead assignments. You can disable with the +``-analyzer-config deadcode.DeadStores:WarnForDeadNestedAssignments=false``. +*Defaults to true*. + +Would warn for this e.g.: +if ((y = make_int())) { +} + .. _nullability-checkers: nullability |