[all-commits] [llvm/llvm-project] 1155c1: [mlir:Parser] Emit a better diagnostic when a cust...

River Riddle via All-commits all-commits at lists.llvm.org
Wed May 11 22:55:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1155c1fe6589492fa3b3cf4d871c0749736b40c0
      https://github.com/llvm/llvm-project/commit/1155c1fe6589492fa3b3cf4d871c0749736b40c0
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-05-11 (Wed, 11 May 2022)

  Changed paths:
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/IR/invalid.mlir

  Log Message:
  -----------
  [mlir:Parser] Emit a better diagnostic when a custom operation is unknown

When a custom operation is unknown and does not have a dialect prefix, we currently
emit an error using the name of the operation with the default dialect prefix. This
leads to a confusing error message, especially when operations get moved between dialects.
For example, `func` was recently moved out of `builtin` and to the `func` dialect. The current
error message we get is:

```
func @foo()
^ custom op 'builtin.func' is unknown
```

This could lead users to believe that there is supposed to be a `builtin.func`,
because there used to be. This commit adds a better error message that does
not assume that the operation is supposed to be in the default dialect:

```
func @foo()
^ custom op 'func' is unknown (tried 'builtin.func' as well)
```

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




More information about the All-commits mailing list