summaryrefslogtreecommitdiffstats
path: root/clang/docs/tools/dump_ast_matchers.py
diff options
context:
space:
mode:
authorSamuel Benzaquen <sbenza@google.com>2013-08-27 15:11:16 +0000
committerSamuel Benzaquen <sbenza@google.com>2013-08-27 15:11:16 +0000
commit85ec25d21c69bc90a8d4e8fb2c36b408bfec8e32 (patch)
tree822b5bebbe5e8d057e07b80c3073d831602ae9d0 /clang/docs/tools/dump_ast_matchers.py
parentacab30e927d0bcfb17e18b41c55d0d6f105ab659 (diff)
downloadbcm5719-llvm-85ec25d21c69bc90a8d4e8fb2c36b408bfec8e32.tar.gz
bcm5719-llvm-85ec25d21c69bc90a8d4e8fb2c36b408bfec8e32.zip
Rewrite eachOf/allOf/anyOf to use a variadic operator.
Summary: Rewrite eachOf/allOf/anyOf to use a variadic operator, instead of hand-written calls to Polymorphic matchers. This simplifies their definition and future changes to add them to the dynamic registry. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1427 llvm-svn: 189357
Diffstat (limited to 'clang/docs/tools/dump_ast_matchers.py')
-rw-r--r--clang/docs/tools/dump_ast_matchers.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py
index e72426eafbf..6a8687715f6 100644
--- a/clang/docs/tools/dump_ast_matchers.py
+++ b/clang/docs/tools/dump_ast_matchers.py
@@ -239,6 +239,15 @@ def act_on_decl(declaration, comment, allowed_types):
add_matcher('*', name, 'Matcher<*>', comment)
return
+ # Parse Variadic operator matchers.
+ m = re.match(
+ r"""^.*VariadicOperatorMatcherFunc\s*([a-zA-Z]*)\s*=\s*{.*};$""",
+ declaration, flags=re.X)
+ if m:
+ name = m.groups()[0]
+ add_matcher('*', name, 'Matcher<*>, ..., Matcher<*>', comment)
+ return
+
# Parse free standing matcher functions, like:
# Matcher<ResultType> Name(Matcher<ArgumentType> InnerMatcher) {
@@ -309,7 +318,7 @@ for line in open(MATCHERS_FILE).read().splitlines():
declaration += ' ' + line
if ((not line.strip()) or
line.rstrip()[-1] == ';' or
- line.rstrip()[-1] == '{'):
+ (line.rstrip()[-1] == '{' and line.rstrip()[-3:] != '= {')):
if line.strip() and line.rstrip()[-1] == '{':
body = True
else:
OpenPOWER on IntegriCloud