[Mlir-commits] [mlir] [emitC]Option to mlir-translate class instead of function (PR #141158)
Jaden Angella
llvmlistbot at llvm.org
Fri Jun 13 17:00:27 PDT 2025
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jaddyen <ajaden at google.com>,Jaddyen
<ajaden at google.com>,Jaddyen <ajaden at google.com>,Jaddyen <ajaden at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/141158 at github.com>
================
@@ -1140,6 +1220,30 @@ static LogicalResult printOperation(CppEmitter &emitter,
CppEmitter::Scope scope(emitter);
raw_indented_ostream &os = emitter.ostream();
+ Operation *operation = functionOp.getOperation();
+ if (emitter.shouldPrintClass()) {
+ if (functionOp.isExternal()) {
+ // TODO: Determine the best long-term strategy for external functions.
+ // Currently, we're skipping over this functionOp.
+ // We have considered using emitWarning() which would return
+ // InFlightDiagnostic which seems can be automatically converted to
+ // LogicalResult since this is done in emitAttributes where emitError is
+ // converted to LogicalResult. However, it requires that we pass in a
+ // location which at first glance we don't have in this scope. Open to
+ // further discussion on this.
+ os << "Warning: Cannot process external function '"
+ << functionOp.getName() << "'. "
+ << "This functionOp lacks a body so we will skip over it.";
+ return success();
+ }
+ os << "class " << emitter.getClassName() << " final {\n";
----------------
Jaddyen wrote:
To do in next step.
https://github.com/llvm/llvm-project/pull/141158
More information about the Mlir-commits
mailing list