ArrayRef<TemplateArgument> List =
internal::getTemplateSpecializationArgs(Node);
return matchesFirstInRange(InnerMatcher, List.begin(), List.end(), Finder,
- Builder);
+ Builder) != List.end();
}
/// Causes all nested matchers to be matched with the specified traversal kind.
AST_MATCHER_P(CXXRecordDecl, hasMethod, internal::Matcher<CXXMethodDecl>,
InnerMatcher) {
return matchesFirstInPointerRange(InnerMatcher, Node.method_begin(),
- Node.method_end(), Finder, Builder);
+ Node.method_end(), Finder,
+ Builder) != Node.method_end();
}
/// Matches the generated class of lambda expressions.
AST_MATCHER_P(OverloadExpr, hasAnyDeclaration, internal::Matcher<Decl>,
InnerMatcher) {
return matchesFirstInPointerRange(InnerMatcher, Node.decls_begin(),
- Node.decls_end(), Finder, Builder);
+ Node.decls_end(), Finder,
+ Builder) != Node.decls_end();
}
/// Matches the Decl of a DeclStmt which has a single declaration.
AST_MATCHER_P(CXXConstructorDecl, hasAnyConstructorInitializer,
internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
return matchesFirstInPointerRange(InnerMatcher, Node.init_begin(),
- Node.init_end(), Finder, Builder);
+ Node.init_end(), Finder,
+ Builder) != Node.init_end();
}
/// Matches the field declaration of a constructor initializer.
internal::Matcher<ParmVarDecl>,
InnerMatcher) {
return matchesFirstInPointerRange(InnerMatcher, Node.param_begin(),
- Node.param_end(), Finder, Builder);
+ Node.param_end(), Finder,
+ Builder) != Node.param_end();
}
/// Matches \c FunctionDecls and \c FunctionProtoTypes that have a
internal::Matcher<Stmt>, InnerMatcher) {
const CompoundStmt *CS = CompoundStmtMatcher<NodeType>::get(Node);
return CS && matchesFirstInPointerRange(InnerMatcher, CS->body_begin(),
- CS->body_end(), Finder, Builder);
+ CS->body_end(), Finder,
+ Builder) != CS->body_end();
}
/// Checks that a compound statement contains a specific number of
AST_MATCHER_P(UsingDecl, hasAnyUsingShadowDecl,
internal::Matcher<UsingShadowDecl>, InnerMatcher) {
return matchesFirstInPointerRange(InnerMatcher, Node.shadow_begin(),
- Node.shadow_end(), Finder, Builder);
+ Node.shadow_end(), Finder,
+ Builder) != Node.shadow_end();
}
/// Matches a using shadow declaration where the target declaration is
internal::Matcher<OMPClause>, InnerMatcher) {
ArrayRef<OMPClause *> Clauses = Node.clauses();
return matchesFirstInPointerRange(InnerMatcher, Clauses.begin(),
- Clauses.end(), Finder, Builder);
+ Clauses.end(), Finder,
+ Builder) != Clauses.end();
}
/// Matches OpenMP ``default`` clause.
/// Finds the first node in a range that matches the given matcher.
template <typename MatcherT, typename IteratorT>
-bool matchesFirstInRange(const MatcherT &Matcher, IteratorT Start,
- IteratorT End, ASTMatchFinder *Finder,
- BoundNodesTreeBuilder *Builder) {
+IteratorT matchesFirstInRange(const MatcherT &Matcher, IteratorT Start,
+ IteratorT End, ASTMatchFinder *Finder,
+ BoundNodesTreeBuilder *Builder) {
for (IteratorT I = Start; I != End; ++I) {
BoundNodesTreeBuilder Result(*Builder);
if (Matcher.matches(*I, Finder, &Result)) {
*Builder = std::move(Result);
- return true;
+ return I;
}
}
- return false;
+ return End;
}
/// Finds the first node in a pointer range that matches the given
/// matcher.
template <typename MatcherT, typename IteratorT>
-bool matchesFirstInPointerRange(const MatcherT &Matcher, IteratorT Start,
- IteratorT End, ASTMatchFinder *Finder,
- BoundNodesTreeBuilder *Builder) {
+IteratorT matchesFirstInPointerRange(const MatcherT &Matcher, IteratorT Start,
+ IteratorT End, ASTMatchFinder *Finder,
+ BoundNodesTreeBuilder *Builder) {
for (IteratorT I = Start; I != End; ++I) {
BoundNodesTreeBuilder Result(*Builder);
if (Matcher.matches(**I, Finder, &Result)) {
*Builder = std::move(Result);
- return true;
+ return I;
}
}
- return false;
+ return End;
}
// Metafunction to determine if type T has a member called getDecl.