[all-commits] [llvm/llvm-project] 279d29: Use consistent spacing before custom directives fo...

Kevin Gleason via All-commits all-commits at lists.llvm.org
Tue Dec 6 12:13:17 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 279d294d26c39e86dd7baabf5cd3385676d9a7a4
      https://github.com/llvm/llvm-project/commit/279d294d26c39e86dd7baabf5cd3385676d9a7a4
  Author: Kevin Gleason <gleasonk at google.com>
  Date:   2022-12-06 (Tue, 06 Dec 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.td
    M mlir/test/lib/Dialect/Test/TestAttrDefs.td
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/lib/Dialect/Test/TestTypeDefs.td
    M mlir/test/lib/Dialect/Test/TestTypes.cpp
    M mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir
    M mlir/test/mlir-tblgen/op-format.mlir
    M mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp

  Log Message:
  -----------
  Use consistent spacing before custom directives for op and attr/type assemblyFormat.

Currently, assemblyFormat `custom<A>($a) custom<B>($b)` has different spacing
if used for Ops vs Attrs/Types. Ops insert a space if needed before the custom directive,
while attributes and types do not.

This leads to the following two patterns in attributes / types:

```
# 1. Whitespace literal
let assemblyFormat = "... ` ` custom<A>($a)"

# 2. Custom printer code includes spacing
void printB(...) {
  printer << ' ' << b;
}
```

Moving this spacing into the generated code allows for some cleanup in mlir and
improves the consistency of custom directives.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D138235




More information about the All-commits mailing list