Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dffb796

Browse files
author
git apple-llvm automerger
committed
Merge commit '76d2e0881e19' from llvm.org/main into next
2 parents a7736d6 + 76d2e08 commit dffb796

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mlir/utils/generate-test-checks.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,9 @@ def generate_name(self, source_attribute_name):
145145
return attribute_name
146146

147147
# Get the saved substitution name for the given attribute name. If no name
148-
# has been generated for the given attribute yet, the source attribute name
149-
# itself is returned.
148+
# has been generated for the given attribute yet, None is returned.
150149
def get_name(self, source_attribute_name):
151-
return self.map[source_attribute_name] if source_attribute_name in self.map else '?'
150+
return self.map.get(source_attribute_name)
152151

153152
# Return the number of SSA results in a line of type
154153
# %0, %1, ... = ...
@@ -227,9 +226,9 @@ def process_attribute_references(line, attribute_namer):
227226
components = ATTR_RE.split(line)
228227
for component in components:
229228
m = ATTR_RE.match(component)
230-
if m:
231-
output_line += '#[[' + attribute_namer.get_name(m.group(1)) + ']]'
232-
output_line += component[len(m.group()):]
229+
attribute_name = attribute_namer.get_name(m.group(1)) if m else None
230+
if attribute_name:
231+
output_line += f"#[[{attribute_name}]]{component[len(m.group()):]}"
233232
else:
234233
output_line += component
235234
return output_line

0 commit comments

Comments
 (0)