This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix emitting an error at EOF
ClosedPublic

Authored by Mogball on Mar 23 2022, 1:01 AM.

Details

Summary

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.

Diff Detail

Event Timeline

Mogball created this revision.Mar 23 2022, 1:01 AM
Herald added a project: Restricted Project. · View Herald Transcript
Mogball requested review of this revision.Mar 23 2022, 1:01 AM
jpienaar accepted this revision.Mar 23 2022, 11:34 AM
jpienaar added inline comments.
mlir/lib/Parser/Parser.h
72

Could you check on an empty file what happens here?

This revision is now accepted and ready to land.Mar 23 2022, 11:34 AM
Mogball marked an inline comment as done.Mar 23 2022, 1:10 PM
Mogball added inline comments.
mlir/lib/Parser/Parser.h
72

An empty file parses as module {}. A file that has anything in it that is invalid will be fine since there's at least one more character other than EOF.

This revision was automatically updated to reflect the committed changes.
Mogball marked an inline comment as done.