aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
diff options
context:
space:
mode:
authorRahul Kayaith <rkayaith@gmail.com>2023-02-25 02:30:46 -0500
committerRahul Kayaith <rkayaith@gmail.com>2023-03-01 17:14:59 -0500
commitf5f8a46bb0ce3dd2f3e024696d5a0aef5fb12a29 (patch)
tree49b4a08e5417e0d89192faeacb9f5fe8796a70fa /mlir/lib/Bytecode/Reader/BytecodeReader.cpp
parentbd6eb1423c38ef14014b8ddacb42326bd9f38af4 (diff)
downloadllvm-f5f8a46bb0ce3dd2f3e024696d5a0aef5fb12a29.zip
llvm-f5f8a46bb0ce3dd2f3e024696d5a0aef5fb12a29.tar.gz
llvm-f5f8a46bb0ce3dd2f3e024696d5a0aef5fb12a29.tar.bz2
[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
Diffstat (limited to 'mlir/lib/Bytecode/Reader/BytecodeReader.cpp')
-rw-r--r--mlir/lib/Bytecode/Reader/BytecodeReader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index 4a09cb7..f009621 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -1031,9 +1031,9 @@ LogicalResult AttrTypeReader::parseAsmEntry(T &result, EncodingReader &reader,
size_t numRead = 0;
MLIRContext *context = fileLoc->getContext();
if constexpr (std::is_same_v<T, Type>)
- result = ::parseType(asmStr, context, numRead);
+ result = ::parseType(asmStr, context, &numRead);
else
- result = ::parseAttribute(asmStr, context, numRead);
+ result = ::parseAttribute(asmStr, context, Type(), &numRead);
if (!result)
return failure();