Skip to content

Commit f941771

Browse files
author
Michael Maitland
committed
[mlir] generate-test-checks.py does not double insert note.
When we generate test checks into the original test file (inplace), it was incorrectly
1 parent 4f428d3 commit f941771

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mlir/utils/generate-test-checks.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,18 @@ def process_source_lines(source_lines, note, args):
234234
source_split_re = re.compile(args.source_delim_regex)
235235

236236
source_segments = [[]]
237+
skip_next_empty_line = False
237238
for line in source_lines:
238239
# Remove previous note.
239-
if line in note:
240+
if line and line in note:
241+
skip_next_empty_line = True
240242
continue
243+
# Skip the first empty line after the note
244+
if skip_next_empty_line and not line:
245+
skip_next_empty_line = False
246+
continue
247+
if line:
248+
skip_next_empty_line = False
241249
# Remove previous CHECK lines.
242250
if line.find(args.check_prefix) != -1:
243251
continue

0 commit comments

Comments
 (0)