Skip to content

Commit 9e41d6e

Browse files
committed
[mlir] Add support for broader range of input files in generate-test-checks.py
1 parent b17bd73 commit 9e41d6e

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
@@ -236,9 +236,12 @@ def process_attribute_references(line, attribute_namer):
236236
# Pre-process a line of input to remove any character sequences that will be
237237
# problematic with FileCheck.
238238
def preprocess_line(line):
239+
# If input line has `{{` i.e. in a StrAttr with serialized proto.
240+
output_line = line.replace("{{", "{{\\{\\{}}")
241+
239242
# Replace any double brackets, '[[' with escaped replacements. '[['
240243
# corresponds to variable names in FileCheck.
241-
output_line = line.replace("[[", "{{\\[\\[}}")
244+
output_line = output_line.replace("[[", "{{\\[\\[}}")
242245

243246
# Replace any single brackets that are followed by an SSA identifier, the
244247
# identifier will be replace by a variable; Creating the same situation as
@@ -327,6 +330,11 @@ def main():
327330
if not input_line:
328331
continue
329332

333+
# When using `--starts_from_scope=0` to capture module lines, the file
334+
# split needs to be skipped, otherwise a `CHECK: // -----` is inserted.
335+
if input_line.startswith("// -----"):
336+
continue
337+
330338
# Check if this is an attribute definition and process it
331339
process_attribute_definition(input_line, attribute_namer, output)
332340

0 commit comments

Comments
 (0)