Index: clang/docs/LibASTMatchersReference.html =================================================================== --- clang/docs/LibASTMatchersReference.html +++ clang/docs/LibASTMatchersReference.html @@ -1455,6 +1455,16 @@ +
Matches coroutine body statements. + +coroutineBodyStmt() matches the coroutine below + generator<int> gen() { + co_return; + } +
Matches co_yield expressions. @@ -3037,10 +3047,11 @@- Matcher<CXXConstructExpr> argumentCountAtLeast unsigned N Checks that a call expression or a constructor call expression has -at least the specified number of arguments (including absent default arguments). + Checks that a call expression or a constructor call expression has at least +the specified number of arguments (including absent default arguments). -Example matches f(0, 0) and g(0, 0, 0) (matcher = callExpr(argumentCountAtLeast(2))) +Example matches f(0, 0) and g(0, 0, 0) +(matcher = callExpr(argumentCountAtLeast(2))) void f(int x, int y); void g(int x, int y, int z); f(0, 0); @@ -3706,10 +3717,11 @@- Matcher<CXXUnresolvedConstructExpr> argumentCountAtLeast unsigned N Checks that a call expression or a constructor call expression has -at least the specified number of arguments (including absent default arguments). + Checks that a call expression or a constructor call expression has at least +the specified number of arguments (including absent default arguments). -Example matches f(0, 0) and g(0, 0, 0) (matcher = callExpr(argumentCountAtLeast(2))) +Example matches f(0, 0) and g(0, 0, 0) +(matcher = callExpr(argumentCountAtLeast(2))) void f(int x, int y); void g(int x, int y, int z); f(0, 0); @@ -3728,10 +3740,11 @@- Matcher<CallExpr> argumentCountAtLeast unsigned N Checks that a call expression or a constructor call expression has -at least the specified number of arguments (including absent default arguments). + Checks that a call expression or a constructor call expression has at least +the specified number of arguments (including absent default arguments). -Example matches f(0, 0) and g(0, 0, 0) (matcher = callExpr(argumentCountAtLeast(2))) +Example matches f(0, 0) and g(0, 0, 0) +(matcher = callExpr(argumentCountAtLeast(2))) void f(int x, int y); void g(int x, int y, int z); f(0, 0); @@ -4897,10 +4910,11 @@- Matcher<ObjCMessageExpr> argumentCountAtLeast unsigned N Checks that a call expression or a constructor call expression has -at least the specified number of arguments (including absent default arguments). + Checks that a call expression or a constructor call expression has at least +the specified number of arguments (including absent default arguments). -Example matches f(0, 0) and g(0, 0, 0) (matcher = callExpr(argumentCountAtLeast(2))) +Example matches f(0, 0) and g(0, 0, 0) +(matcher = callExpr(argumentCountAtLeast(2))) void f(int x, int y); void g(int x, int y, int z); f(0, 0); @@ -6795,9 +6809,10 @@- Matcher<CXXForRangeStmt> hasBody Matcher<Stmt> InnerMatcher Matches a 'for', 'while', 'do' statement or a function definition that has -a given body. Note that in case of functions this matcher only matches the -definition itself and not the other declarations of the same function. ++ Matches a 'for', 'while', 'while' statement or a function or coroutine +definition that has a given body. Note that in case of functions or +coroutines this matcher only matches the definition itself and not the +other declarations of the same function or coroutine. Given for (;;) {} @@ -7682,6 +7697,30 @@+ Matcher<CoroutineBodyStmt> hasBody Matcher<Stmt> InnerMatcher + + Matches a 'for', 'while', 'while' statement or a function or coroutine +definition that has a given body. Note that in case of functions or +coroutines this matcher only matches the definition itself and not the +other declarations of the same function or coroutine. + +Given + for (;;) {} +forStmt(hasBody(compoundStmt())) + matches 'for (;;) {}' +with compoundStmt() + matching '{}' + +Given + void f(); + void f() {} +functionDecl(hasBody(compoundStmt())) + matches 'void f() {}' +with compoundStmt() + matching '{}' + but does not match 'void f();' +Matcher<DecayedType> hasDecayedType Matcher<QualType> InnerType @@ -7890,9 +7929,10 @@ Matches the decayed type, whoes decayed type matches InnerMatcher- Matcher<DoStmt> hasBody Matcher<Stmt> InnerMatcher Matches a 'for', 'while', 'do' statement or a function definition that has -a given body. Note that in case of functions this matcher only matches the -definition itself and not the other declarations of the same function. + Matches a 'for', 'while', 'while' statement or a function or coroutine +definition that has a given body. Note that in case of functions or +coroutines this matcher only matches the definition itself and not the +other declarations of the same function or coroutine. Given for (;;) {} @@ -8226,9 +8266,10 @@- Matcher<ForStmt> hasBody Matcher<Stmt> InnerMatcher Matches a 'for', 'while', 'do' statement or a function definition that has -a given body. Note that in case of functions this matcher only matches the -definition itself and not the other declarations of the same function. + Matches a 'for', 'while', 'while' statement or a function or coroutine +definition that has a given body. Note that in case of functions or +coroutines this matcher only matches the definition itself and not the +other declarations of the same function or coroutine. Given for (;;) {} @@ -8420,9 +8461,10 @@- Matcher<FunctionDecl> hasBody Matcher<Stmt> InnerMatcher Matches a 'for', 'while', 'do' statement or a function definition that has -a given body. Note that in case of functions this matcher only matches the -definition itself and not the other declarations of the same function. + Matches a 'for', 'while', 'while' statement or a function or coroutine +definition that has a given body. Note that in case of functions or +coroutines this matcher only matches the definition itself and not the +other declarations of the same function or coroutine. Given for (;;) {} @@ -10082,9 +10124,10 @@- Matcher<WhileStmt> hasBody Matcher<Stmt> InnerMatcher Matches a 'for', 'while', 'do' statement or a function definition that has -a given body. Note that in case of functions this matcher only matches the -definition itself and not the other declarations of the same function. + Matches a 'for', 'while', 'while' statement or a function or coroutine +definition that has a given body. Note that in case of functions or +coroutines this matcher only matches the definition itself and not the +other declarations of the same function or coroutine. Given for (;;) {} Index: clang/docs/tools/dump_ast_matchers.py =================================================================== --- clang/docs/tools/dump_ast_matchers.py +++ clang/docs/tools/dump_ast_matchers.py @@ -15,7 +15,8 @@ try: CLASS_INDEX_PAGE = urlopen(CLASS_INDEX_PAGE_URL).read().decode("utf-8") except Exception as e: - raise Exception("Unable to get %s: %s" % (CLASS_INDEX_PAGE_URL, e)) + CLASS_INDEX_PAGE = None + print("Unable to get %s: %s" % (CLASS_INDEX_PAGE_URL, e)) MATCHERS_FILE = "../../include/clang/ASTMatchers/ASTMatchers.h" @@ -58,7 +59,10 @@ url = "https://clang.llvm.org/doxygen/classclang_1_1%s.html" % name if url not in doxygen_probes: search_str = 'href="classclang_1_1%s.html"' % name - doxygen_probes[url] = search_str in CLASS_INDEX_PAGE + if CLASS_INDEX_PAGE is not None: + doxygen_probes[url] = search_str in CLASS_INDEX_PAGE + else: + doxygen_probes[url] = True if not doxygen_probes[url]: print("Did not find %s in class index page" % name) if doxygen_probes[url]: @@ -186,7 +190,7 @@ """ if declaration.strip(): - if re.match(r"^\s?(#|namespace|using)", declaration): + if re.match(r"^\s?(#|namespace|using|templateusing|})", declaration): return # Node matchers are defined by writing: