[PATCH] D81272: [clang-tidy] New check `bugprone-redundant-branch-condition`

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 14 08:09:41 PDT 2020


whisperity added a comment.

In D81272#2218175 <https://reviews.llvm.org/D81272#2218175>, @aaron.ballman wrote:

> While I agree with your observation about data and flow sensitivity, I approved on the belief that the check as-is provides enough utility to warrant adding it as-is. If someone wants to improve the check into being a CSA check, we can always deprecate this one at that point. However, if there are strong opinions that the check should start out as a CSA check because it requires that sensitivity for your needs, now's a good time to bring up those concerns.

It's generally harder to create big logic mistakes when it comes to more complex expressions, assuming the user does't copy-paste (which I might have done, in the above example). We do not need to solve //every// potentially equivalent conditional (it is unsolvable in the generic case anyways). I'm sure this check can be improved later with handling trivial comparisons (such as standard library `int` results not being 0, -1, etc.).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81272/new/

https://reviews.llvm.org/D81272



More information about the cfe-commits mailing list