[mlir:Parser] Don't use strings for the "ugly" form of Attribute/Type syntax
authorRiver Riddle <riddleriver@gmail.com>
Tue, 5 Jul 2022 23:20:30 +0000 (16:20 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Tue, 5 Jul 2022 23:20:30 +0000 (16:20 -0700)
commitab9cdf09f4f03259e7e75c5187139e6628a37815
treef85f8eea2a760ff22e252b52d8419c1ee6ccd39c
parent43d5c4d5394e522be87a9a1dfda24f5ce0e3a855
[mlir:Parser] Don't use strings for the "ugly" form of Attribute/Type syntax

This commit refactors the syntax of "ugly" attribute/type formats to not use
strings for wrapping. This means that moving forward attirbutes and type formats
will always need to be in some recognizable form, i.e. if they use incompatible
characters they will need to manually wrap those in a string, the framework will
no longer do it automatically.

This has the benefit of greatly simplifying how parsing attributes/types work, given
that we currently rely on some extremely complicated nested parser logic which is
quite problematic for a myriad of reasons; unecessary complexity(we create a nested
source manager/lexer/etc.), diagnostic locations can be off/wrong given string escaping,
etc.

Differential Revision: https://reviews.llvm.org/D118505
22 files changed:
flang/lib/Optimizer/Dialect/FIRType.cpp
mlir/docs/LangRef.md
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/Parser/DialectSymbolParser.cpp
mlir/lib/Parser/Parser.h
mlir/lib/Parser/ParserState.h
mlir/test/Dialect/EmitC/types.mlir
mlir/test/Dialect/GPU/invalid.mlir
mlir/test/Dialect/OpenACC/ops.mlir
mlir/test/Dialect/OpenMP/ops.mlir
mlir/test/Dialect/Quant/parse-any-invalid.mlir
mlir/test/Dialect/Quant/parse-calibrated-invalid.mlir
mlir/test/Dialect/Quant/parse-uniform-invalid.mlir
mlir/test/IR/enum-attr-invalid.mlir
mlir/test/IR/enum-attr-roundtrip.mlir
mlir/test/IR/invalid.mlir
mlir/test/IR/parser.mlir
mlir/test/Target/Cpp/types.mlir
mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir
mlir/test/mlir-tblgen/attr-or-type-format.mlir
mlir/test/mlir-tblgen/testdialect-attrdefs.mlir
mlir/test/python/ir/attributes.py