[PATCH] D132786: [clang-tidy] Fix a false positive in bugprone-assignment-in-if-condition

dodohand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 29 06:57:45 PDT 2022


dodohand added a comment.

IMO you have just introduced a bug, not fixed one.
A lambda expression in an if statement condition clause is exactly the kind of thing that this checker was designed to flag.
The BARR group coding guideline, with which this is intended to comply in spirit, makes no exception for lambda expressions. (see 8.2c of https://barrgroup.com/sites/default/files/barr_c_coding_standard_2018.pdf)

It would seem to me that rather than this change as a default behavior, it would be better if @njames93 created an option flag for this checker which enabled this exclusion as a special case. This would preserve the intent of the original check, while also allowing the use case which njames93 has in mind.

Is it possible to retroactively reject/un-commit a contribution?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132786



More information about the cfe-commits mailing list