Skip to content

Commit 1358b29

Browse files
committed
fix(clang/**.py): fix invalid escape sequences
1 parent a7ba73b commit 1358b29

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clang/docs/tools/dump_ast_matchers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ def extract_result_types(comment):
8686
parsed.
8787
"""
8888
result_types = []
89-
m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S)
89+
m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S)
9090
if m:
9191
return ["*"]
9292
while True:
93-
m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S)
93+
m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S)
9494
if not m:
9595
if re.search(r"Usable as:\s*$", comment):
9696
return result_types
@@ -101,9 +101,9 @@ def extract_result_types(comment):
101101

102102

103103
def strip_doxygen(comment):
104-
"""Returns the given comment without \-escaped words."""
104+
r"""Returns the given comment without \-escaped words."""
105105
# 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)
106+
comment = re.sub("^\\\\[^\\s]+\n", r"", comment, flags=re.M)
107107

108108
# If there is a doxygen \see command, change the \see prefix into "See also:".
109109
# FIXME: it would be better to turn this into a link to the target instead.
@@ -236,7 +236,7 @@ def act_on_decl(declaration, comment, allowed_types):
236236

237237
# Parse the various matcher definition macros.
238238
m = re.match(
239-
""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\(
239+
r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\(
240240
\s*([^\s,]+\s*),
241241
\s*(?:[^\s,]+\s*),
242242
\s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\)

clang/test/Analysis/check-analyzer-fixit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def run_test_once(args, extra_args):
5555
# themselves. We need to keep the comments to preserve line numbers while
5656
# avoiding empty lines which could potentially trigger formatting-related
5757
# checks.
58-
cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text)
58+
cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text)
5959
write_file(temp_file_name, cleaned_test)
6060

6161
original_file_name = temp_file_name + ".orig"

0 commit comments

Comments
 (0)