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 - Matcher<CXXUnresolvedConstructExpr> argumentCountAtLeast unsigned N - Matcher<CallExpr> argumentCountAtLeast unsigned N - Matcher<ObjCMessageExpr> argumentCountAtLeast unsigned N - Matcher<CXXForRangeStmt> 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 (;;) {} @@ -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 @@ - Matcher<DoStmt> 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 (;;) {} @@ -8226,9 +8266,10 @@- Matcher<ForStmt> 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 (;;) {} @@ -8420,9 +8461,10 @@- Matcher<FunctionDecl> 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 (;;) {} @@ -10082,9 +10124,10 @@- Matcher<WhileStmt> 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 (;;) {} 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,7 @@ 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)) + print("Unable to get %s: %s" % (CLASS_INDEX_PAGE_URL, e)) MATCHERS_FILE = "../../include/clang/ASTMatchers/ASTMatchers.h" @@ -58,7 +58,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 + try: + doxygen_probes[url] = search_str in CLASS_INDEX_PAGE + except: + 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 +189,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: