[PATCH] D76779: [mlir] Provide CustomOpAsmParser::parseOptionalOperand
Alex Zinenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 25 13:33:16 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGec74867c5e6a: [mlir] Provide CustomOpAsmParser::parseOptionalOperand (authored by ftynse).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76779/new/
https://reviews.llvm.org/D76779
Files:
mlir/include/mlir/IR/OpImplementation.h
mlir/lib/Parser/Parser.cpp
Index: mlir/lib/Parser/Parser.cpp
===================================================================
--- mlir/lib/Parser/Parser.cpp
+++ mlir/lib/Parser/Parser.cpp
@@ -4253,6 +4253,13 @@
return success();
}
+ /// Parse a single operand if present.
+ OptionalParseResult parseOptionalOperand(OperandType &result) override {
+ if (parser.getToken().is(Token::percent_identifier))
+ return parseOperand(result);
+ return llvm::None;
+ }
+
/// Parse zero or more SSA comma-separated operand references with a specified
/// surrounding delimiter, and an optional required operand count.
ParseResult parseOperandList(SmallVectorImpl<OperandType> &result,
Index: mlir/include/mlir/IR/OpImplementation.h
===================================================================
--- mlir/include/mlir/IR/OpImplementation.h
+++ mlir/include/mlir/IR/OpImplementation.h
@@ -452,6 +452,9 @@
/// Parse a single operand.
virtual ParseResult parseOperand(OperandType &result) = 0;
+ /// Parse a single operand if present.
+ virtual OptionalParseResult parseOptionalOperand(OperandType &result) = 0;
+
/// These are the supported delimiters around operand lists and region
/// argument lists, used by parseOperandList and parseRegionArgumentList.
enum class Delimiter {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76779.252660.patch
Type: text/x-patch
Size: 1299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200325/7b646dc8/attachment.bin>
More information about the llvm-commits
mailing list