[mlir] Fix emitting an error at EOF
authorMogball <jeffniu22@gmail.com>
Wed, 23 Mar 2022 08:00:46 +0000 (08:00 +0000)
committerMogball <jeffniu22@gmail.com>
Wed, 23 Mar 2022 20:23:01 +0000 (20:23 +0000)
commit7c72f55ea84a59957ae0a00394c953088fc543e8
tree9a70a4ca825c00e7ce489a706753ddc73285d8b0
parent88da78ddd0019755ee7f9f4279b909193c5f86af
[mlir] Fix emitting an error at EOF

Emitting at error at EOF will emit the diagnostic past the end of the file. When emitting an error during parsing at EOF, emit it at the previous character.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D122295
mlir/lib/Parser/Parser.h
mlir/test/IR/invalid.mlir