njames93 added inline comments.
================
Comment at:
clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp:586
+
+ auto Not = hasOperatorName("!");
+ auto Or = hasOperatorName("||");
----------------
njames93 wrote:
> This whole implementation would be alot simpler(and likely faster) if you
> matched on the generic case then in the check callback work out what
> replacement you need.
> ```lang=c++
> Finder->addMatcher(
> unaryOperator(
> Not,
> hasUnaryOperand(binaryOperator(
> hasAnyOperatorName("&&", "||"),
> hasEitherOperand(unaryOperator(Not))))).bind(Demorgan),
> this);
> ```
Come to think of it, you wouldn't even need to work out which. Just remove the
outer `!`, Exchange `||` with `&&` and invert each side of the binary operator.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124650/new/
https://reviews.llvm.org/D124650
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits