diff options
author | Florian Mayer <fmayer@google.com> | 2025-05-12 10:50:03 -0700 |
---|---|---|
committer | Florian Mayer <fmayer@google.com> | 2025-05-12 10:50:03 -0700 |
commit | bc2acaef6b5a1128f7f2f873649351c78a1d5cd6 (patch) | |
tree | bc6bd524a61f89a01d29fb9ce1d94db262328f07 | |
parent | d6c3712f07864040c1a6f28033da02dbc30cad22 (diff) | |
download | llvm-users/fmayer/spr/clang-add-hasanynameinvector-matcher.zip llvm-users/fmayer/spr/clang-add-hasanynameinvector-matcher.tar.gz llvm-users/fmayer/spr/clang-add-hasanynameinvector-matcher.tar.bz2 |
[𝘀𝗽𝗿] initial versionusers/fmayer/spr/clang-add-hasanynameinvector-matcher
Created using spr 1.3.4
-rw-r--r-- | clang/include/clang/ASTMatchers/ASTMatchers.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index e6b684b..255f7d3 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -3144,6 +3144,24 @@ extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef, internal::hasAnyNameFunc> hasAnyName; +/// Matches NamedDecl nodes that have any of the names in vector. +/// +/// This is useful for matching a list of names that are only known at runtime, +/// e.g. through a command line argument. +/// +/// \code +/// hasAnyName({a, b, c}) +/// \endcode +/// is equivalent to +/// \code +/// anyOf(hasName(a), hasName(b), hasName(c)) +/// \endcode +inline internal::Matcher<NamedDecl> +hasAnyNameInVector(std::vector<std::string> Names) { + return internal::Matcher<NamedDecl>( + new internal::HasNameMatcher(std::move(Names))); +} + /// Matches NamedDecl nodes whose fully qualified names contain /// a substring matched by the given RegExp. /// |