[clang] [CIR] Better handling of `void` function return (PR #128089)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 21 09:52:21 PST 2025
================
@@ -375,11 +410,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p, mlir::ArrayRef<mlir::Type> params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+ mlir::Type &optionalReturnTypes,
+ llvm::SmallVector<mlir::Type> ¶ms,
+ bool &isVarArg) {
+ if (failed(parseFuncTypeReturn(p, optionalReturnTypes)))
+ return failure();
+ return parseFuncTypeArgs(p, params, isVarArg);
+}
+
+static void printFuncType(mlir::AsmPrinter &p, mlir::Type optionalReturnTypes,
+ mlir::ArrayRef<mlir::Type> params, bool isVarArg) {
+ printFuncTypeReturn(p, optionalReturnTypes);
----------------
xlauko wrote:
```suggestion
printFuncTypeReturn(p, optionalReturnType);
```
https://github.com/llvm/llvm-project/pull/128089
More information about the cfe-commits
mailing list