[Mlir-commits] [mlir] [mlir] generate-test-checks.py does not remove blank lines (PR #166443)

Mehdi Amini llvmlistbot at llvm.org
Tue Nov 4 13:45:38 PST 2025


================
@@ -234,10 +234,17 @@ def process_source_lines(source_lines, note, args):
     source_split_re = re.compile(args.source_delim_regex)
 
     source_segments = [[]]
+    skip_next_empty_line = False
     for line in source_lines:
         # Remove previous note.
-        if line in note:
+        if line and line in note:
+            skip_next_empty_line = True
             continue
+        # Skip the first empty line after the note
+        if skip_next_empty_line and not line:
+            skip_next_empty_line = False
+            continue
+        skip_next_empty_line = False
----------------
joker-eph wrote:

```suggestion
        # Skip the first empty line after the note
        skip_next_empty_line = False
        if skip_next_empty_line and not line:
            continue
```

Nit: CSE

https://github.com/llvm/llvm-project/pull/166443


More information about the Mlir-commits mailing list