Skip to content

Commit e7dc07d

Browse files
committed
fix(llvm/**.py): fix invalid escape sequences
1 parent 70965ef commit e7dc07d

11 files changed

+19
-19
lines changed

llvm/test/CodeGen/NVPTX/wmma.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ def gen_check_unsupported_ops(items):
847847
)
848848
print("; INTRINSICS: {{^; INTRINSICS_LIST_BEGIN}}")
849849
print(
850-
"""
850+
r"""
851851
852852
; NOEXTGEOM-NOT: {{m8n32|m32n8}}
853853
; NOINT-NOT: .{{s32|s8}}

llvm/tools/opt-viewer/opt-viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def render_inline_remarks(self, r, line):
135135
# Column is the number of characters *including* tabs, keep those and
136136
# replace everything else with spaces.
137137
indent = line[: max(r.Column, 1) - 1]
138-
indent = re.sub("\S", " ", indent)
138+
indent = re.sub(r"\S", " ", indent)
139139

140140
# Create expanded message and link if we have a multiline message.
141141
lines = r.message.split("\n")

llvm/utils/DSAclean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# it would kill old computers
2525
buffer = input.readline()
2626
while buffer != "":
27-
if re.compile('label(\s*)=(\s*)"\s%tmp(.\w*)*(\s*)"').search(buffer):
27+
if re.compile(r'label(\s*)=(\s*)"\s%tmp(.\w*)*(\s*)"').search(buffer):
2828
# skip next line, write neither this line nor the next
2929
buffer = input.readline()
3030
else:

llvm/utils/DSAextract.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
# if this name is for the current node, add the dot variable name
7070
# for the node (it will be Node(hex number)) to our set of nodes
7171
if regexp.search(buffer):
72-
node_set |= set([re.split("\s+", buffer, 2)[1]])
72+
node_set |= set([re.split(r"\s+", buffer, 2)[1]])
7373
break
7474
buffer = input.readline()
7575

@@ -105,7 +105,7 @@
105105
if nodes[0][:13] in node_set and nodes[1][:13] in node_set:
106106
output.write(buffer)
107107
elif nodeexp.search(buffer): # this is a node line
108-
node = re.split("\s+", buffer, 2)[1]
108+
node = re.split(r"\s+", buffer, 2)[1]
109109
if node in node_set:
110110
output.write(buffer)
111111
else: # this is a support line

llvm/utils/add_argument_names.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def fix_string(s):
66
TYPE = re.compile(
7-
'\s*(i[0-9]+|float|double|x86_fp80|fp128|ppc_fp128|\[\[.*?\]\]|\[2 x \[\[[A-Z_0-9]+\]\]\]|<.*?>|{.*?}|\[[0-9]+ x .*?\]|%["a-z:A-Z0-9._]+({{.*?}})?|%{{.*?}}|{{.*?}}|\[\[.*?\]\])(\s*(\*|addrspace\(.*?\)|dereferenceable\(.*?\)|byval\(.*?\)|sret|zeroext|inreg|returned|signext|nocapture|align \d+|swiftself|swifterror|readonly|noalias|inalloca|nocapture))*\s*'
7+
r'\s*(i[0-9]+|float|double|x86_fp80|fp128|ppc_fp128|\[\[.*?\]\]|\[2 x \[\[[A-Z_0-9]+\]\]\]|<.*?>|{.*?}|\[[0-9]+ x .*?\]|%["a-z:A-Z0-9._]+({{.*?}})?|%{{.*?}}|{{.*?}}|\[\[.*?\]\])(\s*(\*|addrspace\(.*?\)|dereferenceable\(.*?\)|byval\(.*?\)|sret|zeroext|inreg|returned|signext|nocapture|align \d+|swiftself|swifterror|readonly|noalias|inalloca|nocapture))*\s*'
88
)
99

1010
counter = 0

llvm/utils/convert-constraint-log-to-z3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def main():
4646
content = f.read()
4747

4848
groups = content.split("---")
49-
var_re = re.compile("x\d+")
49+
var_re = re.compile(r"x\d+")
5050

5151
print("from z3 import *")
5252
for group in groups:

llvm/utils/extract_vplan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
matches = re.findall(pattern, sys.stdin.read())
2525

2626
for vplan in matches:
27-
m = re.search("graph \[.+(VF=.+,UF.+)", vplan)
27+
m = re.search(r"graph \[.+(VF=.+,UF.+)", vplan)
2828
if not m:
2929
raise ValueError("Can't get the right VPlan name")
3030
name = re.sub("[^a-zA-Z0-9]", "", m.group(1))

llvm/utils/git/github-automation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ def escape_description(str):
5353
# https://github.com/github/markup/issues/1168#issuecomment-494946168
5454
str = html.escape(str, False)
5555
# '@' followed by alphanum is a user name
56-
str = re.sub("@(?=\w)", "@<!-- -->", str)
56+
str = re.sub(r"@(?=\w)", "@<!-- -->", str)
5757
# '#' followed by digits is considered an issue number
58-
str = re.sub("#(?=\d)", "#<!-- -->", str)
58+
str = re.sub(r"#(?=\d)", "#<!-- -->", str)
5959
return str
6060

6161

@@ -474,7 +474,7 @@ def issue_remove_cherry_pick_failed_label(self):
474474
def get_main_commit(self, cherry_pick_sha: str) -> github.Commit.Commit:
475475
commit = self.repo.get_commit(cherry_pick_sha)
476476
message = commit.commit.message
477-
m = re.search("\(cherry picked from commit ([0-9a-f]+)\)", message)
477+
m = re.search(r"\(cherry picked from commit ([0-9a-f]+)\)", message)
478478
if not m:
479479
return None
480480
return self.repo.get_commit(m.group(1))

llvm/utils/indirect_calls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def look_for_indirect(file):
3333
for line in stdout.splitlines():
3434
if not line.startswith(" "):
3535
function = line
36-
result = re.search("(call|jmp).*\*", line)
36+
result = re.search(r"(call|jmp).*\*", line)
3737
if result is not None:
3838
# TODO: Perhaps use cxxfilt to demangle functions?
3939
print(function)

llvm/utils/relative_lines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
USAGE = """Example usage:
1818
find -type f clang/test/CodeCompletion | grep -v /Inputs/ | \\
1919
xargs relative_lines.py --dry-run --verbose --near=100 \\
20-
--pattern='-code-completion-at[ =]%s:(\d+)' \\
21-
--pattern='requires fix-it: {(\d+):\d+-(\d+):\d+}'
20+
--pattern='-code-completion-at[ =]%s:(\\d+)' \\
21+
--pattern='requires fix-it: {(\\d+):\\d+-(\\d+):\\d+}'
2222
"""
2323

2424
import argparse

llvm/utils/update_test_prefix.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ def remove_prefix(i, d=0):
1717
p = r.group(1)
1818
s = re.sub("=" + p + ",", "=", s)
1919
s = re.sub("," + p + "([, \n])", "\\1", s)
20-
s = re.sub("\s+-?-check-prefix=" + p + "([ \n])", "\\1", s)
20+
s = re.sub("\\s+-?-check-prefix=" + p + "([ \n])", "\\1", s)
2121
else:
2222
s = re.sub(
23-
"-?-check-prefixes=([\w-]+)(\Z|[ \t\n])", "--check-prefix=\\1\\2", s
23+
"-?-check-prefixes=([\\w-]+)(\\Z|[ \t\n])", "--check-prefix=\\1\\2", s
2424
)
2525
t = re.search(
26-
"-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
26+
r"-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
2727
s,
2828
)
2929
while t:
3030
s = re.sub(
3131
t.group(), "--check-prefixes=" + t.group(1) + "," + t.group(2), s
3232
)
3333
t = re.search(
34-
"-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
34+
r"-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
3535
s,
3636
)
37-
s = re.sub("\s+-?-check-prefix=CHECK[ \t]*\n", "\n", s)
37+
s = re.sub("\\s+-?-check-prefix=CHECK[ \t]*\n", "\n", s)
3838
f.truncate(0)
3939
f.seek(0)
4040
f.write(s)

0 commit comments

Comments
 (0)