[llvm] [update_test_checks] Generate multiple SAME lines to avoid back-reference issues. (PR #172452)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 16 02:27:53 PST 2025
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 origin/main...HEAD llvm/utils/UpdateTestChecks/common.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- common.py 2025-12-16 10:24:58.000000 +0000
+++ common.py 2025-12-16 10:27:21.459178 +0000
@@ -2206,15 +2206,22 @@
# Split into multiple args_and_sig lines to avoid having more than 9 backreferences which
# are currently not supported.
# Find the start positions of the [[ markers.
BRACKET_SUFFIX = "]]"
- split_marker_positions = [idx for idx in range(len(args_and_sig)) if args_and_sig.startswith(BRACKET_PREFIX, idx)]
+ split_marker_positions = [
+ idx
+ for idx in range(len(args_and_sig))
+ if args_and_sig.startswith(BRACKET_PREFIX, idx)
+ ]
# Divide the marker array into chunks of size 10 so we can cut off the current substring and put the remainder
# into a new line.
CHUNK_SIZE = 9
- split_marker_chunks = [split_marker_positions[idx:idx + CHUNK_SIZE] for idx in range(0, len(split_marker_positions), CHUNK_SIZE)]
+ split_marker_chunks = [
+ split_marker_positions[idx : idx + CHUNK_SIZE]
+ for idx in range(0, len(split_marker_positions), CHUNK_SIZE)
+ ]
next_start = 0
for chunk_idx, chunk in enumerate(split_marker_chunks):
# Find the first closing bracket pair at the end position of this chunk.
if chunk_idx == len(split_marker_chunks) - 1:
@@ -2226,11 +2233,11 @@
# Starting from this index in the substring, take the matching ]].
end_pos = args_and_sig.find(BRACKET_SUFFIX, last_chunk_idx)
end_pos += len(BRACKET_SUFFIX)
# Take the position after since this is usually a closing parenthesis or a white space.
end_pos += 1
- # Slice from the start point to the last ]] and put it in the current SAME line.
+ # Slice from the start point to the last ]] and put it in the current SAME line.
current_substr = args_and_sig[next_start:end_pos]
# Start again from the end position.
next_start = end_pos
output_lines.append(
``````````
</details>
https://github.com/llvm/llvm-project/pull/172452
More information about the llvm-commits
mailing list