[all-commits] [llvm/llvm-project] 67f0e8: [mlir][ods] Fix verification of attribute + colon ...

Jeff Niu via All-commits all-commits at lists.llvm.org
Mon May 16 14:15:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 67f0e8eec33812fdd531f9d4776ddfe5cabec5c3
      https://github.com/llvm/llvm-project/commit/67f0e8eec33812fdd531f9d4776ddfe5cabec5c3
  Author: Mogball <jeffniu22 at gmail.com>
  Date:   2022-05-16 (Mon, 16 May 2022)

  Changed paths:
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/mlir-tblgen/op-format-spec.td
    A mlir/test/mlir-tblgen/op-format-verify.td
    M mlir/test/mlir-tblgen/op-format.mlir
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][ods] Fix verification of attribute + colon type ambiguity

An attribute without a type builder followed by a colon in an assembly format is potentially ambiguous because the parser will read ahead to parse the colon-type and pass this as the type argument to the attribute's constructor.

However, the previous verifier that checks for this ambiguity erroneously produces an error in the case of

```
let assemblyFormat = "( `(` $attr `)` )? `:`";
```

This patch fixes the bug by implementing a checker that correctly handles all edge cases, including very strange assembly formats like:

```
let assemblyFormat = "( `(` $attr ) : (`>`)? attr-dict (`>` $a^) : (`<`)? `:`";
```

Reviewed By: rriddle

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




More information about the All-commits mailing list