[mlir][AsmParser] Improve parse{Attribute,Type} error handling
authorRahul Kayaith <rkayaith@gmail.com>
Sat, 25 Feb 2023 07:30:46 +0000 (02:30 -0500)
committerRahul Kayaith <rkayaith@gmail.com>
Wed, 1 Mar 2023 22:14:59 +0000 (17:14 -0500)
commitf5f8a46bb0ce3dd2f3e024696d5a0aef5fb12a29
tree49b4a08e5417e0d89192faeacb9f5fe8796a70fa
parentbd6eb1423c38ef14014b8ddacb42326bd9f38af4
[mlir][AsmParser] Improve parse{Attribute,Type} error handling

Currently these functions report errors directly to stderr, this updates
them to use diagnostics instead. This also makes partially-consumed
strings an error if the `numRead` parameter isn't provided (the
docstrings already claimed this happened, but it didn't.)

While here I also tried to reduce the number of overloads by switching
to using default parameters.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D144804
mlir/include/mlir/AsmParser/AsmParser.h
mlir/lib/AsmParser/DialectSymbolParser.cpp
mlir/lib/Bytecode/Reader/BytecodeReader.cpp
mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
mlir/test/Dialect/Linalg/transform-op-pad.mlir
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
mlir/unittests/Parser/ParserTest.cpp