Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion mlir/utils/generate-test-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,12 @@ def process_attribute_references(line, attribute_namer):
# Pre-process a line of input to remove any character sequences that will be
# problematic with FileCheck.
def preprocess_line(line):
# If input line has `{{` i.e. in a StrAttr with serialized proto.
output_line = line.replace("{{", "{{\\{\\{}}")

# Replace any double brackets, '[[' with escaped replacements. '[['
# corresponds to variable names in FileCheck.
output_line = line.replace("[[", "{{\\[\\[}}")
output_line = output_line.replace("[[", "{{\\[\\[}}")

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

# When using `--starts_from_scope=0` to capture module lines, the file
# split needs to be skipped, otherwise a `CHECK: // -----` is inserted.
if input_line.startswith("// -----"):
continue

# Check if this is an attribute definition and process it
process_attribute_definition(input_line, attribute_namer, output)

Expand Down