aboutsummaryrefslogtreecommitdiff
path: root/docs/tools
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tools')
-rw-r--r--docs/tools/dump_ast_matchers.py29
-rw-r--r--docs/tools/dump_format_style.py4
2 files changed, 18 insertions, 15 deletions
diff --git a/docs/tools/dump_ast_matchers.py b/docs/tools/dump_ast_matchers.py
index 45540405de97..d38977548fd9 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'\1 ', args)
+ args = re.sub(r'extern 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
@@ -150,11 +150,11 @@ def act_on_decl(declaration, comment, allowed_types):
comment, is_dyncast=True)
return
- # Parse the various matcher definition macros.
- m = re.match(""".*AST_TYPE_MATCHER\(
- \s*([^\s,]+\s*),
- \s*([^\s,]+\s*)
- \)\s*;\s*$""", declaration, flags=re.X)
+ # Special case of type matchers:
+ # AstTypeMatcher<ArgumentType> name
+ m = re.match(r""".*AstTypeMatcher\s*<
+ \s*([^\s>]+)\s*>
+ \s*([^\s;]+)\s*;\s*$""", declaration, flags=re.X)
if m:
inner, name = m.groups()
add_matcher('Type', name, 'Matcher<%s>...' % inner,
@@ -165,7 +165,8 @@ def act_on_decl(declaration, comment, allowed_types):
# comment, is_dyncast=True)
return
- m = re.match(""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER\(
+ # Parse the various matcher definition macros.
+ m = re.match(""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\(
\s*([^\s,]+\s*),
\s*(?:[^\s,]+\s*),
\s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\)
@@ -236,7 +237,7 @@ def act_on_decl(declaration, comment, allowed_types):
(?:,\s*([^\s,]+)\s*
,\s*([^\s,]+)\s*)?
(?:,\s*\d+\s*)?
- \)\s*{\s*$""", declaration, flags=re.X)
+ \)\s*{""", declaration, flags=re.X)
if m:
p, n, result, name = m.groups()[0:4]
args = m.groups()[4:]
@@ -256,8 +257,8 @@ def act_on_decl(declaration, comment, allowed_types):
# Parse ArgumentAdapting matchers.
m = re.match(
- r"""^.*ArgumentAdaptingMatcherFunc<.*>\s*(?:LLVM_ATTRIBUTE_UNUSED\s*)
- ([a-zA-Z]*)\s*=\s*{};$""",
+ r"""^.*ArgumentAdaptingMatcherFunc<.*>\s*
+ ([a-zA-Z]*);$""",
declaration, flags=re.X)
if m:
name = m.groups()[0]
@@ -267,7 +268,7 @@ def act_on_decl(declaration, comment, allowed_types):
# Parse Variadic functions.
m = re.match(
r"""^.*internal::VariadicFunction\s*<\s*([^,]+),\s*([^,]+),\s*[^>]+>\s*
- ([a-zA-Z]*)\s*=\s*{.*};$""",
+ ([a-zA-Z]*);$""",
declaration, flags=re.X)
if m:
result, arg, name = m.groups()[:3]
@@ -276,15 +277,15 @@ def act_on_decl(declaration, comment, allowed_types):
# Parse Variadic operator matchers.
m = re.match(
- r"""^.*VariadicOperatorMatcherFunc\s*<\s*([^,]+),\s*([^\s>]+)\s*>\s*
- ([a-zA-Z]*)\s*=\s*{.*};$""",
+ r"""^.*VariadicOperatorMatcherFunc\s*<\s*([^,]+),\s*([^\s]+)\s*>\s*
+ ([a-zA-Z]*);$""",
declaration, flags=re.X)
if m:
min_args, max_args, name = m.groups()[:3]
if max_args == '1':
add_matcher('*', name, 'Matcher<*>', comment)
return
- elif max_args == 'UINT_MAX':
+ elif max_args == 'std::numeric_limits<unsigned>::max()':
add_matcher('*', name, 'Matcher<*>, ..., Matcher<*>', comment)
return
diff --git a/docs/tools/dump_format_style.py b/docs/tools/dump_format_style.py
index 1ca050e062b7..3d61227f7361 100644
--- a/docs/tools/dump_format_style.py
+++ b/docs/tools/dump_format_style.py
@@ -10,6 +10,7 @@ import urllib2
CLANG_DIR = os.path.join(os.path.dirname(__file__), '../..')
FORMAT_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Format/Format.h')
+INCLUDE_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Tooling/Inclusions/IncludeStyle.h')
DOC_FILE = os.path.join(CLANG_DIR, 'docs/ClangFormatStyleOptions.rst')
@@ -115,7 +116,7 @@ def read_options(header):
for line in header:
line = line.strip()
if state == State.BeforeStruct:
- if line == 'struct FormatStyle {':
+ if line == 'struct FormatStyle {' or line == 'struct IncludeStyle {':
state = State.InStruct
elif state == State.InStruct:
if line.startswith('///'):
@@ -188,6 +189,7 @@ def read_options(header):
return options
options = read_options(open(FORMAT_STYLE_FILE))
+options += read_options(open(INCLUDE_STYLE_FILE))
options = sorted(options, key=lambda x: x.name)
options_text = '\n\n'.join(map(str, options))