[Mlir-commits] [mlir] [emitC]Option to mlir-translate class instead of function (PR #141158)
Mehdi Amini
llvmlistbot at llvm.org
Thu May 29 12:26:48 PDT 2025
================
@@ -1149,23 +1253,37 @@ static LogicalResult printOperation(CppEmitter &emitter,
if (failed(emitter.emitTypes(functionOp.getLoc(),
functionOp.getFunctionType().getResults())))
return failure();
+ // TODO: We may wanna consider having the name of the function be execute in
+ // the case that we want to emit a class instead of main. Leaving as is for
+ // now to make the change smaller.
os << " " << functionOp.getName();
os << "(";
- Operation *operation = functionOp.getOperation();
- if (functionOp.isExternal()) {
- if (failed(printFunctionArgs(emitter, operation,
- functionOp.getArgumentTypes())))
+
+ if (!emitter.shouldPrintClass()) {
+ if (functionOp.isExternal()) {
----------------
joker-eph wrote:
```suggestion
if (!emitter.shouldPrintClass() && functionOp.isExternal()) {
```
https://github.com/llvm/llvm-project/pull/141158
More information about the Mlir-commits
mailing list