[OpAsmParser] Refactor parseOptionalInteger to support wide integers, NFC.
authorChris Lattner <clattner@nondot.org>
Sun, 9 May 2021 01:46:30 +0000 (18:46 -0700)
committerChris Lattner <clattner@nondot.org>
Tue, 11 May 2021 05:35:42 +0000 (22:35 -0700)
commit2b09a89daf956795d82076d983c3d78b96e1af4b
tree463ed7c48bb6d2861805558aa56cab73d4906d62
parentad558a4ff7cd61081cfeaabff1dbc8c0a9afa92b
[OpAsmParser] Refactor parseOptionalInteger to support wide integers, NFC.

OpAsmParser (and DialectAsmParser) supports a pair of
parseInteger/parseOptionalInteger methods, which allow parsing a bare
integer into a C type of your choice (e.g. int8_t) using templates.  It
was implemented in terms of a virtual method call that is hard coded to
int64_t because "that should be big enough".

Change the virtual method hook to return an APInt instead.  This allows
asmparsers for custom ops to parse large integers if they want to, without
changing any of the clients of the fixed size C API.

Differential Revision: https://reviews.llvm.org/D102120
mlir/include/mlir/IR/DialectImplementation.h
mlir/include/mlir/IR/OpImplementation.h
mlir/lib/Parser/DialectSymbolParser.cpp
mlir/lib/Parser/Parser.cpp
mlir/lib/Parser/Parser.h