[llvm] [UTC] Escape multiple {{ or }} in input for check lines. (PR #71790)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 9 08:24:31 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 129a91ec01a975e73aaaa9b5010f4085f4ad3cb9..a560cfbd2fc45ecfd7e73054d5866398b13ee162 llvm/utils/UpdateTestChecks/common.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- common.py 2023-11-09 16:11:21.000000 +0000
+++ common.py 2023-11-09 16:24:22.364380 +0000
@@ -1170,18 +1170,19 @@
# including the commas and spaces.
return match.group(1) + rv + match.group(match.lastindex)
lines_with_def = []
multiple_braces_re = re.compile(r"({{+)|(}}+)")
+
def escape_braces(match_obj):
s = match_obj.group(0)
- escaped = ''
- if s[0] == '{':
- escaped = s.replace('{', '\\{')
+ escaped = ""
+ if s[0] == "{":
+ escaped = s.replace("{", "\\{")
else:
- escaped = s.replace('}', '\\}')
- return ''.join(['{{', escaped, '}}'])
+ escaped = s.replace("}", "\\}")
+ return "".join(["{{", escaped, "}}"])
for i, line in enumerate(lines):
if not is_asm and not is_analyze:
# An IR variable named '%.' matches the FileCheck regex string.
line = line.replace("%.", "%dot")
``````````
</details>
https://github.com/llvm/llvm-project/pull/71790
More information about the llvm-commits
mailing list