Index: docs/LibASTMatchersReference.html =================================================================== --- docs/LibASTMatchersReference.html +++ docs/LibASTMatchersReference.html @@ -3066,6 +3066,13 @@ +Matcher<NamedDecl>hasAnyNameInstd::vector<std::string> Names +
Matches NamedDecl nodes that have any of the names specified in
+`Names`. Functionally identical to `hasAnyName`, but allows the caller
+to pass in a container directly.
+
+ + Matcher<NamedDecl>hasExternalFormalLinkage
Matches a declaration that has external formal linkage.
 
@@ -3153,6 +3160,17 @@
 
+Matcher<ObjCMessageExpr>hasAnySelectorInstd::vector<std::string> Matches +
Matches when Selector.getAsString() is inside of the supplied
+vector of strings.
+
+ matcher = objCMessageExpr(hasSelectorIn({"methodA:", "methodB:"}));
+ matches both of the expressions below:
+    [myObj methodA:argA];
+    [myObj methodB:argB];
+
+ + Matcher<ObjCMessageExpr>hasKeywordSelector
Matches when the selector is a keyword selector
 
@@ -3932,6 +3950,19 @@
 
+Matcher<internal::Matcher<ObjCMessageExpr>>hasAnySelectorStringRef, ..., StringRef +
A variant of `hasAnySelectorIn` accepting a variadic number of
+arguments, useful for dynamic matching.
+Matches when at least one of the supplied string equals to the selector
+name.
+
+ matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
+ matches both of the expressions below:
+    [myObj methodA:argA];
+    [myObj methodB:argB];
+
+ + Matcher<internal::Matcher<Stmt>>isInTemplateInstantiation
Matches statements inside of a template instantiation.
 
Index: include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -2297,6 +2297,14 @@
       allOf(ofKind(UETT_SizeOf), InnerMatcher)));
 }
 
+/// \brief Matches NamedDecl nodes that have any of the names specified in
+/// `Names`. Functionally identical to `hasAnyName`, but allows the caller
+/// to pass in a container directly.
+inline internal::Matcher
+hasAnyNameIn(std::vector Names) {
+  return internal::Matcher(new internal::HasNameMatcher(Names));
+}
+
 /// \brief Matches NamedDecl nodes that have the specified name.
 ///
 /// Supports specifying enclosing namespaces or classes by prefixing the name
@@ -2313,9 +2321,7 @@
 ///   namespace a { namespace b { class X; } }
 /// \endcode
 inline internal::Matcher hasName(const std::string &Name) {
-  std::vector Names;
-  Names.push_back(Name);
-  return internal::Matcher(new internal::HasNameMatcher(Names));
+  return hasAnyNameIn({Name});
 }
 
 /// \brief Matches NamedDecl nodes that have any of the specified names.
Index: lib/ASTMatchers/ASTMatchersInternal.cpp
===================================================================
--- lib/ASTMatchers/ASTMatchersInternal.cpp
+++ lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -325,8 +325,7 @@
 
 Matcher hasAnyNameFunc(ArrayRef NameRefs) {
   std::vector Names = vectorFromRefs(NameRefs);
-  return internal::Matcher(
-      new internal::HasNameMatcher(std::move(Names)));
+  return hasAnyNameIn(Names);
 }
 
 Matcher hasAnySelectorFunc(
Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===================================================================
--- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1291,8 +1291,10 @@
   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("a::b::C", "XX"))));
   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX::C", "a::b::C"))));
   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "C"))));
+  EXPECT_TRUE(matches(Code, recordDecl(hasAnyNameIn({"XX", "C"}))));
 
   EXPECT_TRUE(notMatches(Code, recordDecl(hasAnyName("::C", "::b::C"))));
+  EXPECT_TRUE(notMatches(Code, recordDecl(hasAnyNameIn({"::C", "::b::C"}))));
   EXPECT_TRUE(
     matches(Code, recordDecl(hasAnyName("::C", "::b::C", "::a::b::C"))));