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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 15 07:00:47 PDT 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.

In D81272#2218246 <https://reviews.llvm.org/D81272#2218246>, @whisperity wrote:

> 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.).

Great, then we're on the same page!

The new documentation and test cases LG, so re-approving. Thank you!


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

https://reviews.llvm.org/D81272



More information about the cfe-commits mailing list