[PATCH] D96223: [clang-tidy] Simplify static assert check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 12 08:34:12 PST 2021


njames93 accepted this revision.
njames93 added a comment.
This revision is now accepted and ready to land.

LG with a few nits.



================
Comment at: clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp:49-51
+      expr(anyOf(expr(anyOf(AssertExprRoot,
+                            unaryOperator(hasUnaryOperand(AssertExprRoot)))),
+                 anything()),
----------------
Can this be cleaned up to use `optionally` matcher.


================
Comment at: clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp:60-63
   Finder->addMatcher(
-      ifStmt(hasCondition(Condition), unless(isInTemplateInstantiation()))
-          .bind("condStmt"),
-      this);
+      conditionalOperator(hasCondition(Condition)).bind("condStmt"), this);
+
+  Finder->addMatcher(ifStmt(hasCondition(Condition)).bind("condStmt"), this);
----------------
Can't you use the `mapAnyOf` matcher here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96223



More information about the cfe-commits mailing list