-
Notifications
You must be signed in to change notification settings - Fork 13.6k
fix(llvm/**.py): fix invalid escape sequences #94035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to use raw strings here as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
f.truncate(0) | ||||||
f.seek(0) | ||||||
f.write(s) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use raw string here as well if you replace the existing
\\
with\
?