Issue 145695
Summary [mlir] prop-dict printout sometimes starts with `<{`, but sometimes with `< {`
Labels mlir
Assignees
Reporter peledins-zimperium
    This happens, because:
```
void OpState::genericPrintProperties(OpAsmPrinter &p, Attribute properties,
 ArrayRef<StringRef> elidedProps) {
...
if (dictAttr && !elidedProps.empty()) {
...
    if (atLeastOneAttr) {
      p << "<";
 p.printOptionalAttrDict(dictAttr.getValue(), elidedProps); // "< {" - has space
      p << ">";
    }
  } else {
    p << "<" << properties << ">"; // "<{" - no space
  }
...
```

This depends on whether there are ellided properties being specified in printout or not:
In "< {" case the end result is:
```
AsmPrinter::Impl::printOptionalAttrDict
...
 // Otherwise, print them all out in braces.
    os << " {"; //// THE SPACE IS COMING FROM HERE
    interleaveComma(filteredAttrs,
 [&](NamedAttribute attr) { printNamedAttribute(attr); });
    os << '}';
```
But in other case

```
void AsmPrinter::Impl::printAttributeImpl(Attribute attr,
 AttrTypeElision typeElision) {
  if (!isa<BuiltinDialect>(attr.getDialect())) {
...
  } else if (auto dictAttr = llvm::dyn_cast<DictionaryAttr>(attr)) {
    os << '{';
 interleaveComma(dictAttr.getValue(),
                    [&](NamedAttribute attr) { printNamedAttribute(attr); });
    os << '}';
```

It would be great to be consistent.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to