diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index 314c89932ae0..ce922598135b 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -2043,24 +2043,6 @@ Usable as: Any Matcher -
Matches AST nodes that have child AST nodes that match the -provided matcher. - -Example matches X, Y (matcher = recordDecl(forEach(recordDecl(hasName("X"))) - class X {}; Matches X, because X::X is a class of name X inside X. - class Y { class X {}; }; - class Z { class Y { class X {}; }; }; Does not match Z. - -ChildT must be an AST base type. - -As opposed to 'has', 'forEach' will cause a match for each result that -matches instead of only on the first one. - -Usable as: Any Matcher -
Matches AST nodes that have descendant AST nodes that match the provided matcher. @@ -2085,17 +2067,20 @@ Usable as: Any Matcher
Matches AST nodes that have child AST nodes that match the ++ Matcher<*> forEach Matcher<*> @@ -2129,6 +2114,21 @@ Usable as: Any Matcher Matches AST nodes that have child AST nodes that match the provided matcher. -Example matches X, Y (matcher = recordDecl(has(recordDecl(hasName("X"))) +Example matches X, Y (matcher = recordDecl(forEach(recordDecl(hasName("X"))) class X {}; Matches X, because X::X is a class of name X inside X. class Y { class X {}; }; class Z { class Y { class X {}; }; }; Does not match Z. ChildT must be an AST base type. +As opposed to 'has', 'forEach' will cause a match for each result that +matches instead of only on the first one. + Usable as: Any Matcher
Matches AST nodes that have child AST nodes that match the +provided matcher. + +Example matches X, Y (matcher = recordDecl(has(recordDecl(hasName("X"))) + class X {}; Matches X, because X::X is a class of name X inside X. + class Y { class X {}; }; + class Z { class Y { class X {}; }; }; Does not match Z. + +ChildT must be an AST base type. + +Usable as: Any Matcher +
Matches AST nodes that have a parent that matches the provided matcher. @@ -2403,6 +2403,10 @@ matches 'int x' in
Matches on the implicit object argument of a member call expression. @@ -2414,15 +2418,17 @@ FIXME: Overload to allow directly matching types?
Overloaded to match the type's declaration.
Matches if the expression's type either matches the specified +matcher, or is a pointer to a type that matches the InnerMatcher. +
Matches the class declaration that the given method declaration belongs to. @@ -2491,6 +2497,24 @@ Example matches y.x() (matcher = callExpr(callee(methodDecl(hasName("x")))))
Matches if the call expression's callee expression matches. + +Given + class Y { void x() { this->x(); x(); Y y; y.x(); } }; + void f() { f(); } +callExpr(callee(expr())) + matches this->x(), x(), y.x(), f() +with callee(...) + matching this->x, x, y.x, f respectively + +Note: Callee cannot take the more general internal::Matcher<Expr> +because this introduces ambiguous overloads with calls to Callee taking a +internal::Matcher<Decl>, as the matcher hierarchy is purely +implemented in terms of implicit casts. +
Matches any argument of a call expression or a constructor call expression. @@ -2871,6 +2895,17 @@ Usable as: Matcher<Expr>
Matches if the expression's or declaration's type matches a type +matcher. + +Example matches x (matcher = expr(hasType(recordDecl(hasName("X"))))) + and z (matcher = varDecl(hasType(recordDecl(hasName("X"))))) + class X {}; + void y(X &x) { x; X z; } +
Matches expressions that match InnerMatcher after any implicit casts are stripped off. @@ -3318,11 +3353,36 @@ Usable as: Matcher<QualType>
Matches if the matched type is a pointer type and the pointee type +matches the specified matcher. + +Example matches y->x() + (matcher = callExpr(on(hasType(pointsTo(recordDecl(hasName("Y"))))))) + class Y { public: void x(); }; + void z() { Y *y; y->x(); } +
Overloaded to match the referenced type's declaration.
Matches if the matched type is a reference type and the referenced +type matches the specified matcher. + +Example matches X &x and const X &y + (matcher = varDecl(hasType(references(recordDecl(hasName("X")))))) + class X { + void a(X b) { + X &x = b; + const X &y = b; + }; +
Matches a node if the declaration associated with that node matches the given matcher. @@ -3662,6 +3722,17 @@ Usable as: Matcher<ValueDecl>
Matches if the expression's or declaration's type matches a type +matcher. + +Example matches x (matcher = expr(hasType(recordDecl(hasName("X"))))) + and z (matcher = varDecl(hasType(recordDecl(hasName("X"))))) + class X {}; + void y(X &x) { x; X z; } +
Matches a variable declaration that has an initializer expression that matches the given matcher. diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 7f8751ea654d..c04df8573a50 100644 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -119,9 +119,9 @@ def add_matcher(result_type, name, args, comment, is_dyncast=False): # arguments. elif ('Matcher<' not in args or name in ['allOf', 'anyOf', 'anything', 'unless']): - narrowing_matchers[result_type + name] = matcher_html + narrowing_matchers[result_type + name + esc(args)] = matcher_html else: - traversal_matchers[result_type + name] = matcher_html + traversal_matchers[result_type + name + esc(args)] = matcher_html def act_on_decl(declaration, comment, allowed_types): """Parse the matcher out of the given declaration and comment.