[all-commits] [llvm/llvm-project] cb530e: [mlir][Tutorial] Make parsing an empty file print ...

Matthias Kramm via All-commits all-commits at lists.llvm.org
Tue Mar 3 13:24:07 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cb530ec8b841b8033032a8bf88d93f7d6df2dbe0
      https://github.com/llvm/llvm-project/commit/cb530ec8b841b8033032a8bf88d93f7d6df2dbe0
  Author: Matthias Kramm <kramm at google.com>
  Date:   2020-03-03 (Tue, 03 Mar 2020)

  Changed paths:
    M mlir/examples/toy/Ch1/include/toy/Parser.h
    M mlir/examples/toy/Ch2/include/toy/Parser.h
    M mlir/examples/toy/Ch3/include/toy/Parser.h
    M mlir/examples/toy/Ch4/include/toy/Parser.h
    M mlir/examples/toy/Ch5/include/toy/Parser.h
    M mlir/examples/toy/Ch6/include/toy/Parser.h
    M mlir/examples/toy/Ch7/include/toy/Parser.h
    A mlir/test/Examples/Toy/Ch1/empty.toy
    A mlir/test/Examples/Toy/Ch2/empty.toy
    A mlir/test/Examples/Toy/Ch3/empty.toy
    A mlir/test/Examples/Toy/Ch4/empty.toy
    A mlir/test/Examples/Toy/Ch5/empty.toy
    A mlir/test/Examples/Toy/Ch6/empty.toy
    A mlir/test/Examples/Toy/Ch7/empty.toy

  Log Message:
  -----------
  [mlir][Tutorial] Make parsing an empty file print a better error.

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.

Differential Revision: https://reviews.llvm.org/D75534




More information about the All-commits mailing list