[PATCH] D75911: [clang-tidy] Added hasAnyListedName matcher

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 10 08:40:00 PDT 2020


gribozavr2 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/utils/Matchers.cpp:17
+
+Matcher<NamedDecl> hasAnyListedName(std::vector<std::string> Names) {
+  return Matcher<NamedDecl>(new HasNameMatcher(std::move(Names)));
----------------
njames93 wrote:
> gribozavr2 wrote:
> > This matcher sounds generally useful. I think it would be better placed in ASTMatchers.h, WDYT? Can we make it an overload of `hasAnyName`?
> `hasAnyName` is a const variable who's type is `VariadicFunction` so it can't be overloaded unfortunately. I personally didn't want it in ASTMatchers.h as its mainly useful for `clang-tidy` checks that load in configurations. It doesn't have a place in say `clang-query`.
> hasAnyName is a const variable who's type is VariadicFunction so it can't be overloaded unfortunately.

I thought we had facilities to declare polymorphic matchers that could help here.

> I personally didn't want it in ASTMatchers.h as its mainly useful for clang-tidy checks that load in configurations.

A lot of user-defined tools are quite similar.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75911





More information about the cfe-commits mailing list