Expose a minimal type parser to dialects.
authorNicolas Vasilache <ntv@google.com>
Mon, 10 Jun 2019 20:12:32 +0000 (13:12 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Tue, 11 Jun 2019 17:13:02 +0000 (10:13 -0700)
commit3148d60e605a8eff4607ed8a1613bd00ed579630
tree1c413749038176532c390bd406677ce0aca8904e
parente5c8bed43abfc808e140899e74d89d0198148281
Expose a minimal type parser to dialects.

This CL exposes a parseType method which allows standalone reuse of the MLIR type parsing mechanism. This is a free function for now because the underlying MLIR parser is not guaranteed to receive a StringRef which lives in the proper MemBuffer. This requires building a new MemBuffer/SourceMgr and modifying the Parser constructor to not require an mlir::Module.

The error diagnostic emitted by parseType has context limited to the local string.
For now the dialect has the additional option to emit its own extra error that has the FileLineColLoc context.

In the future, both error messages should be combined into a single error.

PiperOrigin-RevId: 252468911
mlir/include/mlir/Parser.h
mlir/lib/Linalg/IR/LinalgOps.cpp
mlir/lib/Linalg/IR/LinalgTypes.cpp
mlir/lib/Parser/Parser.cpp
mlir/test/Linalg/roundtrip.mlir