This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Tutorial] Make parsing an empty file print a better error.
ClosedPublic

Authored by matthiaskramm on Mar 3 2020, 8:34 AM.

Details

Summary

Previously, we would, for an empty file, print the somewhat confusing

Assertion `tok == curTok [...]' failed.

With this change, we now print

Parse error [...]: expected 'def' [...]

This only affects the parser from chapters 1-6, since the more advanced
chapter 7 parser is actually able to generate an empty module from an
empty file. Nonetheless, this commit also adds the additional check to
the chapter 7 parser, for consistency.

Diff Detail

Event Timeline

matthiaskramm created this revision.Mar 3 2020, 8:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2020, 8:34 AM
rriddle accepted this revision.Mar 3 2020, 1:15 PM
This revision is now accepted and ready to land.Mar 3 2020, 1:15 PM
This revision was automatically updated to reflect the committed changes.