@@ -227,7 +227,8 @@ def process_attribute_references(line, attribute_namer):
227
227
components = ATTR_RE .split (line )
228
228
for component in components :
229
229
m = ATTR_RE .match (component )
230
- if m :
230
+ # Only use attribute alias if one exists.
231
+ if m and attribute_namer .get_name (m .group (1 )) != '?' :
231
232
output_line += '#[[' + attribute_namer .get_name (m .group (1 )) + ']]'
232
233
output_line += component [len (m .group ()):]
233
234
else :
@@ -237,9 +238,12 @@ def process_attribute_references(line, attribute_namer):
237
238
# Pre-process a line of input to remove any character sequences that will be
238
239
# problematic with FileCheck.
239
240
def preprocess_line (line ):
241
+ # If input line has `{{` i.e. in a StrAttr with serialized proto.
242
+ output_line = line .replace ("{{" , "{{\\ {\\ {}}" )
243
+
240
244
# Replace any double brackets, '[[' with escaped replacements. '[['
241
245
# corresponds to variable names in FileCheck.
242
- output_line = line .replace ("[[" , "{{\\ [\\ [}}" )
246
+ output_line = output_line .replace ("[[" , "{{\\ [\\ [}}" )
243
247
244
248
# Replace any single brackets that are followed by an SSA identifier, the
245
249
# identifier will be replace by a variable; Creating the same situation as
@@ -328,6 +332,11 @@ def main():
328
332
if not input_line :
329
333
continue
330
334
335
+ # When using `--starts_from_scope=0` to capture module lines, the file
336
+ # split needs to be skipped, otherwise a `CHECK: // -----` is inserted.
337
+ if input_line .startswith ("// -----" ):
338
+ continue
339
+
331
340
# Check if this is an attribute definition and process it
332
341
process_attribute_definition (input_line , attribute_namer , output )
333
342
0 commit comments