diff options
author | Adam Balogh <adam.balogh@ericsson.com> | 2020-06-05 13:27:09 +0200 |
---|---|---|
committer | Adam Balogh <adam.balogh@ericsson.com> | 2020-08-31 16:00:59 +0200 |
commit | 14dd0737822ba476803320a2ff37a1012174d312 (patch) | |
tree | fccd5b3ed2082dbdc78aa307499107dd11438fac /clang/lib/CodeGen/CodeGenFunction.h | |
parent | f5fd7486d6c0debb465de3e927fcc31884874280 (diff) | |
download | llvm-14dd0737822ba476803320a2ff37a1012174d312.zip llvm-14dd0737822ba476803320a2ff37a1012174d312.tar.gz llvm-14dd0737822ba476803320a2ff37a1012174d312.tar.bz2 |
[Clang-Tidy] New check `bugprone-redundant-branch-condition`
Checking the same condition again in a nested `if` usually make no sense,
except if the value of the expression could have been changed between
the two checks. Although compilers may optimize this out, such code is
suspicious: the programmer may have meant to check something else.
Therefore it is worth to find such places in the code and notify the
user about the problem.
This patch implements a basic check for this problem. Currently it
only detects redundant conditions where the condition is a variable of
integral type. It also detects the possible bug if the variable is in an
//or// or //and// logical expression in the inner if and/or the variable
is in an //and// logical expression in the outer if statement. Negated
cases are not handled yet.
Differential Revision: https://reviews.llvm.org/D81272
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
0 files changed, 0 insertions, 0 deletions