[clang] [CIR] Function type return type improvements (PR #128787)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 25 16:07:56 PST 2025


================
@@ -282,40 +283,55 @@ FuncType FuncType::clone(TypeRange inputs, TypeRange results) const {
   return get(llvm::to_vector(inputs), results[0], isVarArg());
 }
 
-mlir::ParseResult parseFuncTypeArgs(mlir::AsmParser &p,
-                                    llvm::SmallVector<mlir::Type> &params,
-                                    bool &isVarArg) {
+// A special parser is needed for function returning void to handle the missing
+// type.
+static mlir::ParseResult parseFuncTypeReturn(mlir::AsmParser &p,
+                                             mlir::Type &optionalReturnType) {
+  if (succeeded(p.parseOptionalArrow())) {
----------------
erichkeane wrote:

```suggestion
    // If `->` is found, it must be followed by the return type.
  if (succeeded(p.parseOptionalArrow()))
    return p.parseType(optionalReturnType);
    
```

https://github.com/llvm/llvm-project/pull/128787


More information about the cfe-commits mailing list