Index: clang/docs/LibASTMatchersReference.html =================================================================== --- clang/docs/LibASTMatchersReference.html +++ clang/docs/LibASTMatchersReference.html @@ -516,6 +516,16 @@ +
Matches template template parameter declarations. + +Given + template <template <typename> class Z, int N> struct C {}; +templateTypeParmDecl() + matches 'Z', but not 'N'. +
Matches template type parameter declarations. @@ -661,18 +671,6 @@
Matches decomposition-declarations. - -Examples matches the declaration node with foo and bar, but not -number. -(matcher = declStmt(has(decompositionDecl()))) - - int number = 42; - auto [foo, bar] = std::make_pair{42, 42}; -
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
Matches all arguments and their respective types for a CallExpr or -CXXConstructExpr. It is very similar to forEachArgumentWithParam but -it works on calls through function pointers as well. - -The difference is, that function pointers do not provide access to a -ParmVarDecl, but only the QualType for each argument. - -Given - void f(int i); - int y; - f(y); - void (*f_ptr)(int) = f; - f_ptr(y); -callExpr( - forEachArgumentWithParamType( - declRefExpr(to(varDecl(hasName("y")))), - qualType(isInteger()).bind("type) -)) - matches f(y) and f_ptr(y) -with declRefExpr(...) - matching int y -and qualType(...) - matching int -
Matches any argument of a call expression or a constructor call expression, or an ObjC-message-send expression. @@ -5539,16 +5510,7 @@- Matcher<CXXForRangeStmt> hasBody Matcher<Stmt> InnerMatcher + Matches a 'for', 'while', 'do while' statement or a function -definition that has a given body. - -Given - for (;;) {} -hasBody(compoundStmt()) - matches 'for (;;) {}' -with compoundStmt() - matching '{}' -@@ -5955,33 +5917,6 @@ Matcher<CXXForRangeStmt> hasInitStatement Matcher<Stmt> InnerMatcher
Matches all arguments and their respective types for a CallExpr or -CXXConstructExpr. It is very similar to forEachArgumentWithParam but -it works on calls through function pointers as well. - -The difference is, that function pointers do not provide access to a -ParmVarDecl, but only the QualType for each argument. - -Given - void f(int i); - int y; - f(y); - void (*f_ptr)(int) = f; - f_ptr(y); -callExpr( - forEachArgumentWithParamType( - declRefExpr(to(varDecl(hasName("y")))), - qualType(isInteger()).bind("type) -)) - matches f(y) and f_ptr(y) -with declRefExpr(...) - matching int y -and qualType(...) - matching int -
Matches any argument of a call expression or a constructor call expression, or an ObjC-message-send expression. @@ -6154,7 +6089,7 @@- Matcher<DecayedType> hasDecayedType Matcher<QualType> InnerType + Matches the decayed type, whos decayed type matches InnerMatcher +@@ -6290,16 +6225,7 @@ Matches the decayed type, whoes decayed type matches InnerMatcher- Matcher<DoStmt> hasBody Matcher<Stmt> InnerMatcher + Matches a 'for', 'while', 'do while' statement or a function -definition that has a given body. - -Given - for (;;) {} -hasBody(compoundStmt()) - matches 'for (;;) {}' -with compoundStmt() - matching '{}' -@@ -6566,16 +6492,7 @@ Matcher<DoStmt> hasCondition Matcher<Expr> InnerMatcher - Matcher<ForStmt> hasBody Matcher<Stmt> InnerMatcher + Matches a 'for', 'while', 'do while' statement or a function -definition that has a given body. - -Given - for (;;) {} -hasBody(compoundStmt()) - matches 'for (;;) {}' -with compoundStmt() - matching '{}' -@@ -6649,6 +6566,24 @@ Matcher<ForStmt> hasCondition Matcher<Expr> InnerMatcher + Matcher<FunctionDecl> hasAnyBody Matcher<Stmt> InnerMatcher + + Matches a function declaration that has a given body present in the AST. +Note that this matcher matches all the declarations of a function whose +body is present in the AST. + +Given + void f(); + void f() {} + void g(); +hasAnyBody(functionDecl()) + matches both 'void f();' + and 'void f() {}' +with compoundStmt() + matching '{}' + but does not match 'void g();' +Matcher<FunctionDecl> hasAnyParameter Matcher<ParmVarDecl> InnerMatcher Matches any parameter of a function or an ObjC method declaration or a block. @@ -6701,16 +6636,7 @@- Matcher<FunctionDecl> hasBody Matcher<Stmt> InnerMatcher + Matches a 'for', 'while', 'do while' statement or a function -definition that has a given body. - -Given - for (;;) {} -hasBody(compoundStmt()) - matches 'for (;;) {}' -with compoundStmt() - matching '{}' -@@ -7694,7 +7620,7 @@ Matcher<FunctionDecl> hasExplicitSpecifier Matcher<Expr> InnerMatcher - Matcher<TemplateArgument> refersToIntegralType Matcher<QualType> InnerMatcher Matches a TemplateArgument that referes to an integral type. + Matches a TemplateArgument that refers to an integral type. Given template<int T> struct C {}; @@ -8068,16 +7994,7 @@- Matcher<WhileStmt> hasBody Matcher<Stmt> InnerMatcher + Matches a 'for', 'while', 'do while' statement or a function -definition that has a given body. - -Given - for (;;) {} -hasBody(compoundStmt()) - matches 'for (;;) {}' -with compoundStmt() - matching '{}' -Index: clang/include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- clang/include/clang/ASTMatchers/ASTMatchers.h +++ clang/include/clang/ASTMatchers/ASTMatchers.h @@ -1162,7 +1162,7 @@ return Node.getKind() == TemplateArgument::Integral; } -/// Matches a TemplateArgument that referes to an integral type. +/// Matches a TemplateArgument that refers to an integral type. /// /// Given /// \code @@ -6572,7 +6572,7 @@ /// \endcode extern const AstTypeMatcher Matcher<WhileStmt> hasCondition Matcher<Expr> InnerMatcher decayedType; -/// Matches the decayed type, whos decayed type matches \c InnerMatcher +/// Matches the decayed type, whoes decayed type matches \c InnerMatcher AST_MATCHER_P(DecayedType, hasDecayedType, internal::Matcher , InnerType) { return InnerType.matches(Node.getDecayedType(), Finder, Builder);