[PATCH] D127114: new clang-tidy checker for assignments within condition clause of if statement

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 07:55:34 PDT 2022


gribozavr2 added inline comments.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-assignment-in-if-clause.rst:9
+Finds these assignments even within multiple sets of parentheses which is often appropriate to structure multi-part condition statements.
+Finds these assignments even within multiple sets of paretheses which disables the compiler -Wparentheses check which one would otherwise like to rely on to find accidental assignment.
+The identified assignments violate BARR group "Rule 8.2.c". See: https://barrgroup.com/embedded-systems/books/embedded-c-coding-standard/statement-rules/if-else-statements
----------------
Why not improve `-Wparentheses` to catch these cases too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127114



More information about the cfe-commits mailing list