Skip to content

Commit 2f82f95

Browse files
authored
Revert "Reland: [clang][test] add testing for the AST matcher reference (#112…"
This reverts commit 53e92e4.
1 parent 42be165 commit 2f82f95

File tree

8 files changed

+3941
-11405
lines changed

8 files changed

+3941
-11405
lines changed

clang/docs/LibASTMatchersReference.html

Lines changed: 2270 additions & 5677 deletions
Large diffs are not rendered by default.

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,9 +858,6 @@ AST Matchers
858858
- Ensure ``hasName`` matches template specializations across inline namespaces,
859859
making `matchesNodeFullSlow` and `matchesNodeFullFast` consistent.
860860

861-
- The examples in the AST matcher reference are now tested and additional
862-
examples and descriptions were added.
863-
864861
clang-format
865862
------------
866863

clang/docs/doxygen.cfg.in

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,7 @@ TAB_SIZE = 2
220220
# "Side Effects:". You can put \n's in the value part of an alias to insert
221221
# newlines.
222222

223-
ALIASES += compile_args{1}="Compiled with <tt>\1</tt>.\n"
224-
ALIASES += matcher{1}="<tt>\1</tt>"
225-
ALIASES += matcher{2$}="<tt>\2</tt>"
226-
ALIASES += match{1}="<tt>\1</tt>"
227-
ALIASES += match{2$}="<tt>\2</tt>"
228-
ALIASES += nomatch{1}="<tt>\1</tt>"
229-
ALIASES += header{1}="\code"
230-
ALIASES += endheader="\endcode"
223+
ALIASES =
231224

232225
# This tag can be used to specify a number of word-keyword mappings (TCL only).
233226
# A mapping has the form "name=value". For example adding "class=itcl::class"

clang/docs/tools/dump_ast_matchers.py

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -100,72 +100,15 @@ def extract_result_types(comment):
100100
comment = m.group(1)
101101

102102

103-
def find_next_closing_rbrace(
104-
data: str, start_pos: int, braces_to_be_matched: int
105-
) -> int:
106-
"""Finds the location of the closing rbrace '}' inside of data."""
107-
"""'start_pos' should be one past the opening lbrace and braces_to_be_matched is initialized with 0"""
108-
next_lbrace = data.find("{", start_pos)
109-
next_rbrace = data.find("}", start_pos)
110-
if next_lbrace != -1:
111-
if next_lbrace < next_rbrace:
112-
return find_next_closing_rbrace(
113-
data, next_lbrace + 1, braces_to_be_matched + 1
114-
)
115-
if braces_to_be_matched == 0:
116-
return next_rbrace
117-
return find_next_closing_rbrace(data, next_rbrace + 1, braces_to_be_matched - 1)
118-
119-
if braces_to_be_matched > 0:
120-
return find_next_closing_rbrace(data, next_rbrace + 1, braces_to_be_matched - 1)
121-
122-
return next_rbrace
123-
124-
125103
def strip_doxygen(comment):
126104
"""Returns the given comment without \-escaped words."""
105+
# If there is only a doxygen keyword in the line, delete the whole line.
106+
comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M)
107+
127108
# If there is a doxygen \see command, change the \see prefix into "See also:".
128109
# FIXME: it would be better to turn this into a link to the target instead.
129110
comment = re.sub(r"\\see", r"See also:", comment)
130111

131-
commands: list[str] = [
132-
"\\compile_args{",
133-
"\\matcher{",
134-
"\\match{",
135-
"\\nomatch{",
136-
]
137-
138-
for command in commands:
139-
delete_command = command == "\\compile_args{"
140-
command_begin_loc = comment.find(command)
141-
while command_begin_loc != -1:
142-
command_end_loc = command_begin_loc + len(command)
143-
end_brace_loc = find_next_closing_rbrace(comment, command_end_loc + 1, 0)
144-
if end_brace_loc == -1:
145-
print("found unmatched {")
146-
command_begin_loc = comment.find(command, command_end_loc)
147-
continue
148-
149-
if delete_command:
150-
comment = comment[0:command_begin_loc] + comment[end_brace_loc + 1 :]
151-
command_begin_loc = comment.find(command, command_begin_loc)
152-
continue
153-
154-
tag_seperator_loc = comment.find("$", command_end_loc)
155-
if tag_seperator_loc != -1 and tag_seperator_loc < end_brace_loc:
156-
command_end_loc = tag_seperator_loc + 1
157-
158-
comment = (
159-
comment[0:command_begin_loc]
160-
+ comment[command_end_loc:end_brace_loc]
161-
+ comment[end_brace_loc + 1 :]
162-
)
163-
164-
command_begin_loc = comment.find(command, command_begin_loc)
165-
166-
# If there is only a doxygen keyword in the line, delete the whole line.
167-
comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M)
168-
169112
# Delete the doxygen command and the following whitespace.
170113
comment = re.sub(r"\\[^\s]+\s+", r"", comment)
171114
return comment
@@ -248,9 +191,8 @@ def act_on_decl(declaration, comment, allowed_types):
248191
definition.
249192
"""
250193
if declaration.strip():
251-
if re.match(
252-
r"^\s?(#|namespace|using|template <typename NodeType> using|})", declaration
253-
):
194+
195+
if re.match(r"^\s?(#|namespace|using|template <typename NodeType> using|})", declaration):
254196
return
255197

256198
# Node matchers are defined by writing:

0 commit comments

Comments
 (0)