[Mlir-commits] [mlir] [mlir][linalg] Fix `SemiFunctionType` custom parsing crash on missing `()` (PR #110365)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 22 14:01:22 PDT 2024
================
@@ -12,9 +12,13 @@
using namespace mlir;
ParseResult mlir::parseSemiFunctionType(OpAsmParser &parser, Type &argumentType,
- Type &resultType) {
+ Type &resultType, bool resultOptional) {
argumentType = resultType = nullptr;
- bool hasLParen = parser.parseOptionalLParen().succeeded();
+
+ bool hasLParen = resultOptional ? parser.parseOptionalLParen().succeeded()
+ : parser.parseLParen().succeeded();
+ if (!resultOptional && !hasLParen)
+ return failure();
if (parser.parseType(argumentType).failed())
return failure();
if (!hasLParen)
----------------
Max191 wrote:
I see. In that case there is no way for the parser to know that the result is required. Considering that these ops must have a result, perhaps it would be better for these transform ops to use some different type of assembly format (that requires a result) instead of SemiFunctionType, but the extra option seems okay to me.
https://github.com/llvm/llvm-project/pull/110365
More information about the Mlir-commits
mailing list