[all-commits] [llvm/llvm-project] ad3b35: [MLIR Parser] Improve QoI for "expected token" errors

Chris Lattner via All-commits all-commits at lists.llvm.org
Tue May 10 07:44:33 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ad3b358180e8e1d723b790cf5f68264e486c0b1a
      https://github.com/llvm/llvm-project/commit/ad3b358180e8e1d723b790cf5f68264e486c0b1a
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2022-05-10 (Tue, 10 May 2022)

  Changed paths:
    M mlir/lib/Parser/Parser.cpp
    M mlir/lib/Parser/Parser.h
    M mlir/test/Dialect/ControlFlow/invalid.mlir
    M mlir/test/Dialect/LLVMIR/global.mlir
    M mlir/test/Dialect/Linalg/invalid.mlir
    M mlir/test/Dialect/SPIRV/IR/control-flow-ops.mlir
    M mlir/test/Dialect/SPIRV/IR/logical-ops.mlir
    M mlir/test/Dialect/SPIRV/IR/memory-ops.mlir
    M mlir/test/Dialect/SPIRV/IR/misc-ops.mlir
    M mlir/test/IR/invalid-locations.mlir
    M mlir/test/IR/invalid.mlir

  Log Message:
  -----------
  [MLIR Parser] Improve QoI for "expected token" errors

A typical problem with missing a token is that the missing
token is at the end of a line.  The problem with this is that
the error message gets reported on the start of the following
line (which is where the next / invalid token is) which can
be confusing.

Handle this by noticing this case and backing up to the end of
the previous line.

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




More information about the All-commits mailing list