[PATCH] D75040: [ASTMatchers] Adds a matcher called `hasAnyOperatorName`

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 24 05:55:40 PST 2020


njames93 marked an inline comment as done.
njames93 added inline comments.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1870
+                    std::is_same<T, UnaryOperator>::value,
+                "unsupported class for matcher");
+  static_assert(std::is_same<ArgT, std::vector<std::string>>::value,
----------------
gribozavr2 wrote:
> Consider enhancing the message to say what the expected types are.
This is the reason c++17 removed the need for static_assert messages, the message isn't needed as you can figure the error from the predicate


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1880-1884
+    for (const std::string &Name : Names) {
+      if (Name == OpName)
+        return true;
+    }
+    return false;
----------------
aaron.ballman wrote:
> Can we use `llvm::find()` instead of a manual loop?
`llvm::is_contained` would be better, but they involve creating temporaries, `llvm::any_of` does it best I think


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75040





More information about the cfe-commits mailing list