diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -1236,7 +1236,7 @@ #pragma omp parallel ``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``, -``default(private)`` and ``default(firstprivate)`` +`` default(private)`` and ``default(firstprivate)`` @@ -4716,8 +4716,8 @@ -
Matches if the OpenMP ``default`` clause has ``private`` kind ++ Matcher<OMPDefaultClause> isFirstPrivateKind - Matches if the OpenMP ``default`` clause has ``firstprivate`` kind specified. Given @@ -4729,12 +4729,12 @@ #pragma omp parallel default(firstprivate) ``ompDefaultClause(isFirstPrivateKind())`` matches only -``default(private)``. +``default(firstprivate)``.- Matcher<OMPDefaultClause> isFirstPrivateKind Matches if the OpenMP ``default`` clause has ``firstprivate`` kind -specified. + ++ Matcher<OMPDefaultClause> isNoneKind - Matches if the OpenMP ``default`` clause has ``none`` kind specified. Given @@ -4744,13 +4744,13 @@ #pragma omp parallel default(private) #pragma omp parallel default(firstprivate) -``ompDefaultClause(isFirstPrivateKind())`` matches only -``default(firstprivate)``. +``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.- Matcher<OMPDefaultClause> isNoneKind - Matches if the OpenMP ``default`` clause has ``none`` kind specified. ++ Matcher<OMPDefaultClause> isPrivateKind @@ -7411,8 +7412,9 @@ Matches if the OpenMP ``default`` clause has ``private`` kind +specified. Given @@ -4760,7 +4760,8 @@ #pragma omp parallel default(private) #pragma omp parallel default(firstprivate) -``ompDefaultClause(isNoneKind())`` matches only ``default(none)``. +``ompDefaultClause(isPrivateKind())`` matches only +``default(private)``.- Matcher<ClassTemplateSpecializationDecl> forEachTemplateArgument Matcher<TemplateArgument> InnerMatcher Matches classTemplateSpecialization, templateSpecializationType and functionDecl nodes where the template argument matches the inner matcher. ++ Matcher<ClassTemplateSpecializationDecl> forEachTemplateArgument clang::ast_matchers::Matcher<TemplateArgument> InnerMatcher + Matches classTemplateSpecialization, templateSpecializationType and +functionDecl nodes where the template argument matches the inner matcher. This matcher may produce multiple matches. Given @@ -7427,10 +7429,8 @@ bool B = false; f(R, B); - templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) matches twice, with expr() matching 'R * 2' and 'R * 4' - functionDecl(forEachTemplateArgument(refersToType(builtinType()))) matches the specialization f<unsigned, bool> twice, for 'unsigned' and 'bool' @@ -8180,6 +8180,31 @@+ Matcher<FunctionDecl> forEachTemplateArgument clang::ast_matchers::Matcher<TemplateArgument> InnerMatcher + + Matches classTemplateSpecialization, templateSpecializationType and +functionDecl nodes where the template argument matches the inner matcher. +This matcher may produce multiple matches. + +Given + template <typename T, unsigned N, unsigned M> + struct Matrix {}; + + constexpr unsigned R = 2; + Matrix<int, R * 2, R * 4> M; + + template <typename T, typename U> + void f(T&& t, U&& u) {} + + bool B = false; + f(R, B); +templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) + matches twice, with expr() matching 'R * 2' and 'R * 4' +functionDecl(forEachTemplateArgument(refersToType(builtinType()))) + matches the specialization f<unsigned, bool> twice, for 'unsigned' + and 'bool' +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 @@ -8227,32 +8252,6 @@- Matcher<FunctionDecl> forEachTemplateArgument Matcher<TemplateArgument> InnerMatcher - - Matches classTemplateSpecialization, templateSpecializationType and functionDecl nodes where the template argument matches the inner matcher. -This matcher may produce multiple matches. - -Given - template <typename T, unsigned N, unsigned M> - struct Matrix {}; - - constexpr unsigned R = 2; - Matrix<int, R * 2, R * 4> M; - - template <typename T, typename U> - void f(T&& t, U&& u) {} - - bool B = false; - f(R, B); - -templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) - matches twice, with expr() matching 'R * 2' and 'R * 4' - -functionDecl(forEachTemplateArgument(refersToType(builtinType()))) - matches the specialization f<unsigned, bool> twice, for 'unsigned' - and 'bool' -Matcher<FunctionDecl> hasAnyTemplateArgument Matcher<TemplateArgument> InnerMatcher - Matches classTemplateSpecializations, templateSpecializationType and functionDecl that have at least one TemplateArgument matching the given @@ -9477,11 +9476,11 @@- Matcher<TemplateSpecializationType> forEachTemplateArgument Matcher<TemplateArgument> InnerMatcher Matches classTemplateSpecialization, templateSpecializationType and functionDecl nodes where the template argument matches the inner matcher. ++ Matcher<TemplateSpecializationType> forEachTemplateArgument clang::ast_matchers::Matcher<TemplateArgument> InnerMatcher Matches classTemplateSpecialization, templateSpecializationType and +functionDecl nodes where the template argument matches the inner matcher. This matcher may produce multiple matches. - Given template <typename T, unsigned N, unsigned M> struct Matrix {}; @@ -9494,10 +9493,8 @@ bool B = false; f(R, B); - templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) matches twice, with expr() matching 'R * 2' and 'R * 4' - functionDecl(forEachTemplateArgument(refersToType(builtinType()))) matches the specialization f<unsigned, bool> twice, for 'unsigned' and 'bool' diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -12,7 +12,7 @@ CLASS_INDEX_PAGE_URL = 'https://clang.llvm.org/doxygen/classes.html' try: - CLASS_INDEX_PAGE = urlopen(CLASS_INDEX_PAGE_URL).read() + CLASS_INDEX_PAGE = str(urlopen(CLASS_INDEX_PAGE_URL).read()) except Exception as e: raise Exception('Unable to get %s: %s' % (CLASS_INDEX_PAGE_URL, e)) @@ -403,7 +403,7 @@ # Parse free standing matcher functions, like: # MatcherName(Matcher InnerMatcher) { - m = re.match(r"""^\s*(?:template\s+<\s*(?:class|typename)\s+(.+)\s*>\s+)? + m = re.match(r"""^\s*(?:template\s+<\s*(?:class|typename)\s+(.+)\s*>\s+)? (.*)\s+ ([^\s\(]+)\s*\( (.*) @@ -422,7 +422,7 @@ m = re.match(r'(?:^|.*\s+)internal::(?:Bindable)?Matcher<([^>]+)>$', result) if m: result_types = [m.group(1)] - if template_name and len(result_types) is 1 and result_types[0] == template_name: + if template_name and len(result_types) == 1 and result_types[0] == template_name: result_types = ['*'] else: result_types = extract_result_types(comment) @@ -479,7 +479,7 @@ comment += re.sub(r'^/+\s?', '', line) + '\n' else: declaration += ' ' + line - if ((not line.strip()) or + if ((not line.strip()) or line.rstrip()[-1] == ';' or (line.rstrip()[-1] == '{' and line.rstrip()[-3:] != '= {')): if line.strip() and line.rstrip()[-1] == '{': @@ -502,6 +502,5 @@ reference = re.sub(r'', traversal_matcher_table, reference, flags=re.S) -with open('../LibASTMatchersReference.html', 'wb') as output: +with open('../LibASTMatchersReference.html', 'w') as output: output.write(reference) -