forked from OSchip/llvm-project
[NFC] Replace hasName in loop for hasAnyName
This commit is contained in:
parent
63bc5d7863
commit
01bc708126
|
@ -119,16 +119,11 @@ AST_MATCHER_P(QualType, isSugarFor, Matcher<QualType>, SugarMatcher) {
|
|||
/// \endcode
|
||||
///
|
||||
/// namedDecl(hasStdIteratorName()) matches \c I and \c CI.
|
||||
AST_MATCHER(NamedDecl, hasStdIteratorName) {
|
||||
static const char *const IteratorNames[] = {"iterator", "reverse_iterator",
|
||||
Matcher<NamedDecl> hasStdIteratorName() {
|
||||
static const StringRef IteratorNames[] = {"iterator", "reverse_iterator",
|
||||
"const_iterator",
|
||||
"const_reverse_iterator"};
|
||||
|
||||
for (const char *Name : IteratorNames) {
|
||||
if (hasName(Name).matches(Node, Finder, Builder))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return hasAnyName(IteratorNames);
|
||||
}
|
||||
|
||||
/// Matches named declarations that have one of the standard container
|
||||
|
@ -143,9 +138,8 @@ AST_MATCHER(NamedDecl, hasStdIteratorName) {
|
|||
///
|
||||
/// recordDecl(hasStdContainerName()) matches \c vector and \c forward_list
|
||||
/// but not \c my_vec.
|
||||
AST_MATCHER(NamedDecl, hasStdContainerName) {
|
||||
static const char *const ContainerNames[] = {
|
||||
"array", "deque",
|
||||
Matcher<NamedDecl> hasStdContainerName() {
|
||||
static StringRef ContainerNames[] = {"array", "deque",
|
||||
"forward_list", "list",
|
||||
"vector",
|
||||
|
||||
|
@ -158,11 +152,7 @@ AST_MATCHER(NamedDecl, hasStdContainerName) {
|
|||
"queue", "priority_queue",
|
||||
"stack"};
|
||||
|
||||
for (const char *Name : ContainerNames) {
|
||||
if (hasName(Name).matches(Node, Finder, Builder))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return hasAnyName(ContainerNames);
|
||||
}
|
||||
|
||||
/// Matches declarations whose declaration context is the C++ standard library
|
||||
|
|
Loading…
Reference in New Issue