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

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 07:38:28 PDT 2020


baloghadamsoftware marked 11 inline comments as done.
baloghadamsoftware added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/RedundantConditionCheck.cpp:39
+                 declRefExpr(hasDeclaration(varDecl().bind("cond_var"))),
+                 binaryOperator(hasOperatorName("&&"),
+                                hasEitherOperand(declRefExpr(hasDeclaration(
----------------
njames93 wrote:
> Recursive matchers are a pain, but this will miss:
>  ```
> if (A && B && ... Y && Z)
> ```
> 
I suppose that for this purpose we have to make our own matcher? Right? This also makes the fixits more complex. I think this could be done in a later phase. I added a `FIXME` now.


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

https://reviews.llvm.org/D81272





More information about the cfe-commits mailing list