[Mlir-commits] [mlir] [mlir][EmitC] Add support for external functions (PR #80547)
Simon Camphausen
llvmlistbot at llvm.org
Mon Feb 5 02:30:37 PST 2024
================
@@ -771,6 +771,22 @@ static LogicalResult printOperation(CppEmitter &emitter, ModuleOp moduleOp) {
return success();
}
+static LogicalResult printFunctionArgs(CppEmitter &emitter,
+ Operation *functionOp,
+ ArrayRef<Type> arguments) {
+ raw_indented_ostream &os = emitter.ostream();
+
+ if (failed(interleaveCommaWithError(
+ arguments, os, [&](Type arg) -> LogicalResult {
+ if (failed(emitter.emitType(functionOp->getLoc(), arg)))
+ return failure();
+ return success();
+ })))
+ return failure();
+
+ return success();
----------------
simon-camp wrote:
Just return the LogicalResult directly instead of
```c++
if (failed(...)) {
return failure();
}
return success();
```
```suggestion
return interleaveCommaWithError(
arguments, os, [&](Type arg) -> LogicalResult {
return emitter.emitType(functionOp->getLoc(), arg);
});
```
https://github.com/llvm/llvm-project/pull/80547
More information about the Mlir-commits
mailing list