[MLIR] Add note for file-line numbers in tablegen errors for assembly formats
Error messages for the custom assembly format are difficult to understand because there are no line numbers. This happens because the assembly format is parsed as a standalone line, separate from it's parent file, with no useful location information. Fixing this properly probably requires quite a bit of invasive plumbing through the SourceMgr, similar to how included files are handled This proposal is a less invasive short term solution. When generating an error message we generate an additional note which at least properly describes the operation definition the error occured in, if not the actual line number of the assemblyFormat definition. A typical message is like: error: type of operand #0, named 'operand', is not buildable and a buildable type cannot be inferred $operand type($result) attr-dict ^ /src/llvm-project/mlir/test/mlir-tblgen/op-format-spec.td:296:1: note: in custom assembly format for this operation def ZCoverageInvalidC : TestFormat_Op<"variable_invalid_c", [{ ^ note: suggest adding a type constraint to the operation or adding a 'type($operand)' directive to the custom assembly format $operand type($result) attr-dict ^ Differential Revision: https://reviews.llvm.org/D77488
Loading
Please register or sign in to comment