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

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 09:09:35 PDT 2020


baloghadamsoftware added a comment.

I tested this check on several open-source projects: //BitCoin//, //CURL//, //OpenSSL//, //PostGreS/, //TMux/ and //Xerces//. I only got two warnings issued by this checker, the first one in //BitCoin//:

  src/checkqueue.h:93:25: redundant condition 'fMaster' [misc-redundant-condition]
                          if (fMaster)
                          ^

And indeed, this was a true positive that is fixed by now by this Commit <https://github.com/bitcoin/bitcoin/commit/e80317be5fc6f6a04ea3b35bfe9991b3a5d29f7a>. (I do not update these projects very often since I only use them for testing checks.)

The other one is in //PostGreS//:

  src/backend/access/transam/xlog.c:7231:6: redundant condition 'switchedTLI' [misc-redundant-condition]
            if (switchedTLI && AllowCascadeReplication())
            ^

Althought the line numbers are changed by now, the bug is still there <https://github.com/postgres/postgres/blob/master/src/backend/access/transam/xlog.c#L7364-L7379>.

Thus the result is zero false positives and two true positives so far.


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

https://reviews.llvm.org/D81272





More information about the cfe-commits mailing list