[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 08:23:37 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:
Does this need the new `resultOptional` option? Does it work if you do something like:
```cpp
argumentType = resultType = nullptr;
bool hasLParen = parser.parseOptionalLParen().succeeded();
if (parser.parseType(argumentType).failed())
return failure();
if (!hasLParen)
return success(parser.parseRParen().failed() ||
parser.parseArrow().failed() ||
parser.parseType(resultType).failed());
return failure(parser.parseRParen().failed() ||
parser.parseArrow().failed() ||
parser.parseType(resultType).failed());
```
https://github.com/llvm/llvm-project/pull/110365
More information about the Mlir-commits
mailing list