From dfe2be47d8dfef3190459d024252576197ed63c9 Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Wed, 4 May 2016 20:45:00 +0000 Subject: [PATCH] Fix the doc extraction script to work with hasAnyName and with equalsNode. The change from llvm::VariadicFunction to internal::VariadicFunction broke the extraction of hasAnyName(). equalsNode was broken because the argument type is 'const XXXX*' and the internal space caused a failure on the regex. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268548 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LibASTMatchersReference.html | 37 ++++++++++++++++++++++++++++--- docs/tools/dump_ast_matchers.py | 6 ++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html index d17a32d7a4..bd0f53f5b1 100644 --- a/docs/LibASTMatchersReference.html +++ b/docs/LibASTMatchersReference.html @@ -410,7 +410,7 @@ decl(hasDeclContext(translationUnitDecl())) Given typedef int X; - using Y = int; + using Y = int; typeAliasDecl() matches "using Y = int", but not "typedef int X" @@ -421,7 +421,7 @@ typeAliasDecl() Given typedef int X; - using Y = int; + using Y = int; typedefDecl() matches "typedef int X", but not "using Y = int" @@ -432,7 +432,7 @@ typedefDecl() Given typedef int X; - using Y = int; + using Y = int; typedefNameDecl() matches "typedef int X" and "using Y = int" @@ -2238,6 +2238,13 @@ and reference to that variable declaration within a compound statement. +Matcher<Decl>equalsNodeconst Decl* Other +
Matches if a node equals another node.
+
+Decl has pointer identity in the AST.
+
+ + Matcher<Decl>hasAttrattr::Kind AttrKind
Matches declaration that has a given attribute.
 
@@ -2898,6 +2905,13 @@ and reference to that variable declaration within a compound statement.
 
+Matcher<Stmt>equalsNodeconst Stmt* Other +
Matches if a node equals another node.
+
+Stmt has pointer identity in the AST.
+
+ + Matcher<Stmt>isExpansionInFileMatchingstd::string RegExp
Matches AST nodes that were expanded within files whose name is
 partially matching a given regex.
@@ -3072,6 +3086,13 @@ and reference to that variable declaration within a compound statement.
 
+Matcher<Type>equalsNodeconst Type* Other +
Matches if a node equals another node.
+
+Type has pointer identity in the AST.
+
+ + Matcher<Type>realFloatingPointType
Matches any real floating-point type (float, double, long double).
 
@@ -3286,6 +3307,16 @@ expr(nullPointerConstant())
 
+Matcher<internal::Matcher<NamedDecl>>hasAnyNameStringRef, ..., StringRef +
Matches NamedDecl nodes that have any of the specified names.
+
+This matcher is only provided as a performance optimization of hasName.
+    hasAnyName(a, b, c)
+ is equivalent to, but faster than
+    anyOf(hasName(a), hasName(b), hasName(c))
+
+ + Matcher<internal::Matcher<Stmt>>isInTemplateInstantiation
Matches statements inside of a template instantiation.
 
diff --git a/docs/tools/dump_ast_matchers.py b/docs/tools/dump_ast_matchers.py
index 104189c4af..45540405de 100644
--- a/docs/tools/dump_ast_matchers.py
+++ b/docs/tools/dump_ast_matchers.py
@@ -95,7 +95,7 @@ def strip_doxygen(comment):
 def unify_arguments(args):
   """Gets rid of anything the user doesn't care about in the argument list."""
   args = re.sub(r'internal::', r'', args)
-  args = re.sub(r'const\s+', r'', args)
+  args = re.sub(r'const\s+(.*)&', r'\1 ', args)
   args = re.sub(r'&', r' ', args)
   args = re.sub(r'(^|\s)M\d?(\s)', r'\1Matcher<*>\2', args)
   return args
@@ -231,7 +231,7 @@ def act_on_decl(declaration, comment, allowed_types):
     m = re.match(r"""^\s*AST_MATCHER(_P)?(.?)(?:_OVERLOAD)?\(
                        (?:\s*([^\s,]+)\s*,)?
                           \s*([^\s,]+)\s*
-                       (?:,\s*([^\s,]+)\s*
+                       (?:,\s*([^,]+)\s*
                           ,\s*([^\s,]+)\s*)?
                        (?:,\s*([^\s,]+)\s*
                           ,\s*([^\s,]+)\s*)?
@@ -266,7 +266,7 @@ def act_on_decl(declaration, comment, allowed_types):
 
     # Parse Variadic functions.
     m = re.match(
-        r"""^.*llvm::VariadicFunction\s*<\s*([^,]+),\s*([^,]+),\s*[^>]+>\s*
+        r"""^.*internal::VariadicFunction\s*<\s*([^,]+),\s*([^,]+),\s*[^>]+>\s*
               ([a-zA-Z]*)\s*=\s*{.*};$""",
         declaration, flags=re.X)
     if m:
-- 
2.40.0