From 243cd0afadc7b406ed6c314f7645b1d72748ddd1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 13 Jan 2021 03:07:03 +0000 Subject: [PATCH] [ASTMatchers] Make Param functors variadic Differential Revision: https://reviews.llvm.org/D97156 --- clang/docs/tools/dump_ast_matchers.py | 12 ++- clang/include/clang/ASTMatchers/ASTMatchers.h | 78 +++++++--------- .../clang/ASTMatchers/ASTMatchersInternal.h | 93 +++++++------------ .../clang/ASTMatchers/ASTMatchersMacros.h | 73 +++++++-------- 4 files changed, 115 insertions(+), 141 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 18afbdd36c6e..2a26d10f7a04 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -351,13 +351,17 @@ Flags can be combined with '|' example \"IgnoreCase | BasicRegex\" m = re.match( r"""^.*internal::VariadicFunction\s*<\s* - internal::PolymorphicMatcherWithParam1<[\S\s]+ - AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\)>,\s*([^,]+), - \s*[^>]+>\s*([a-zA-Z]*);$""", + internal::PolymorphicMatcher<[\S\s]+ + AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\),\s*(.*);$""", declaration, flags=re.X) if m: - results, arg, name = m.groups()[:3] + results, trailing = m.groups() + trailing, name = trailing.rsplit(">", 1) + name = name.strip() + trailing, _ = trailing.rsplit(",", 1) + _, arg = trailing.rsplit(",", 1) + arg = arg.strip() result_types = [r.strip() for r in results.split(',')] for result_type in result_types: diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index b82929019f6c..885bc74ad3ea 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -835,26 +835,16 @@ traverse(TraversalKind TK, const internal::ArgumentAdaptingMatcherFuncAdaptor< ToTypes>>(TK, InnerMatcher); } -template