Closed
Description
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.