[llvm] fix(llvm/**.py): fix invalid escape sequences (PR #94035)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 05:39:16 PST 2025
================
@@ -17,24 +17,24 @@ def remove_prefix(i, d=0):
p = r.group(1)
s = re.sub("=" + p + ",", "=", s)
s = re.sub("," + p + "([, \n])", "\\1", s)
- s = re.sub("\s+-?-check-prefix=" + p + "([ \n])", "\\1", s)
+ s = re.sub("\\s+-?-check-prefix=" + p + "([ \n])", "\\1", s)
else:
s = re.sub(
- "-?-check-prefixes=([\w-]+)(\Z|[ \t\n])", "--check-prefix=\\1\\2", s
+ "-?-check-prefixes=([\\w-]+)(\\Z|[ \t\n])", "--check-prefix=\\1\\2", s
)
t = re.search(
- "-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
+ r"-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
s,
)
while t:
s = re.sub(
t.group(), "--check-prefixes=" + t.group(1) + "," + t.group(2), s
)
t = re.search(
- "-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
+ r"-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
s,
)
- s = re.sub("\s+-?-check-prefix=CHECK[ \t]*\n", "\n", s)
+ s = re.sub("\\s+-?-check-prefix=CHECK[ \t]*\n", "\n", s)
----------------
nikic wrote:
```suggestion
s = re.sub(r"\s+-?-check-prefix=CHECK[ \t]*\n", "\n", s)
```
https://github.com/llvm/llvm-project/pull/94035
More information about the llvm-commits
mailing list