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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 14 07:16:25 PDT 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In D81272#2218090 <https://reviews.llvm.org/D81272#2218090>, @baloghadamsoftware wrote:

> In D81272#2218050 <https://reviews.llvm.org/D81272#2218050>, @aaron.ballman wrote:
>
>> Thanks to the new info, I think the check basically LGTM. Can you add some negative tests and documentation wording to make it clear that the check doesn't currently handle all logically equivalent predicates, like:
>>
>>   if (foo) {
>>   } else {
>>     if (!foo) {
>>     }
>>   }
>>   
>>   // or
>>   if (foo > 5) {
>>     if (foo > 3) {
>>     }
>>   }
>>   
>>   // or
>>   if (foo > 5) {
>>     if (5 < foo) {
>>     }
>>   }
>>
>> (I'm assuming these cases aren't handled currently and that handling them isn't necessary to land the patch.)
>
> Not even equality is handled yet, just single booleans.

That's what I was understanding too, thanks! LG with additional negative tests + doc changes.


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

https://reviews.llvm.org/D81272



More information about the cfe-commits mailing list