aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorAdam Balogh <adam.balogh@ericsson.com>2020-06-05 13:27:09 +0200
committerAdam Balogh <adam.balogh@ericsson.com>2020-08-31 16:00:59 +0200
commit14dd0737822ba476803320a2ff37a1012174d312 (patch)
treefccd5b3ed2082dbdc78aa307499107dd11438fac /clang/lib/CodeGen/CodeGenFunction.h
parentf5fd7486d6c0debb465de3e927fcc31884874280 (diff)
downloadllvm-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