[Mlir-commits] [mlir] [mlir][emitc]: support method calls in CallOpaqueOp (PR #200057)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu May 28 13:46:50 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- mlir/lib/Dialect/EmitC/IR/EmitC.cpp mlir/lib/Target/Cpp/TranslateToCpp.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index 9b66aec09..d57bf5e2f 100644
--- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
+++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
@@ -340,11 +340,11 @@ bool CastOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
 // CallOpaqueOp
 //===----------------------------------------------------------------------===//
 
-static LogicalResult verifyOpaqueCallCommon(Operation *op, StringRef callee,
-                                            std::optional<ArrayAttr> args,
-                                            std::optional<ArrayAttr> templateArgs,
-                                            TypeRange resultTypes,
-                                            size_t numArgsOperands) {
+static LogicalResult
+verifyOpaqueCallCommon(Operation *op, StringRef callee,
+                       std::optional<ArrayAttr> args,
+                       std::optional<ArrayAttr> templateArgs,
+                       TypeRange resultTypes, size_t numArgsOperands) {
   // Callee must not be empty.
   if (callee.empty())
     return op->emitOpError("callee must not be empty");
diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
index a34685ab0..595ff07f9 100644
--- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp
+++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
@@ -909,12 +909,11 @@ static LogicalResult printOperation(CppEmitter &emitter, emitc::CallOp callOp) {
   return printCallOperation(emitter, operation, callee);
 }
 
-static LogicalResult printOpaqueCallCommon(CppEmitter &emitter, Operation &op,
-                                            StringRef callee,
-                                            std::optional<ArrayAttr> templateArgs,
-                                            std::optional<ArrayAttr> args,
-                                            bool isMemberCall,
-                                            Value receiver = nullptr) {
+static LogicalResult
+printOpaqueCallCommon(CppEmitter &emitter, Operation &op, StringRef callee,
+                      std::optional<ArrayAttr> templateArgs,
+                      std::optional<ArrayAttr> args, bool isMemberCall,
+                      Value receiver = nullptr) {
   raw_ostream &os = emitter.ostream();
 
   if (failed(emitter.emitAssignPrefix(op)))
@@ -985,22 +984,20 @@ static LogicalResult printOpaqueCallCommon(CppEmitter &emitter, Operation &op,
 
 static LogicalResult printOperation(CppEmitter &emitter,
                                     emitc::CallOpaqueOp callOpaqueOp) {
-  return printOpaqueCallCommon(emitter, *callOpaqueOp.getOperation(),
-                                callOpaqueOp.getCallee(),
-                                callOpaqueOp.getTemplateArgs(),
-                                callOpaqueOp.getArgs(),
-                                /*isMemberCall=*/false);
+  return printOpaqueCallCommon(
+      emitter, *callOpaqueOp.getOperation(), callOpaqueOp.getCallee(),
+      callOpaqueOp.getTemplateArgs(), callOpaqueOp.getArgs(),
+      /*isMemberCall=*/false);
 }
 
 static LogicalResult
 printOperation(CppEmitter &emitter,
                emitc::MemberCallOpaqueOp memberCallOpaqueOp) {
-  return printOpaqueCallCommon(emitter, *memberCallOpaqueOp.getOperation(),
-                                memberCallOpaqueOp.getCallee(),
-                                memberCallOpaqueOp.getTemplateArgs(),
-                                memberCallOpaqueOp.getArgs(),
-                                /*isMemberCall=*/true,
-                                memberCallOpaqueOp.getReceiver());
+  return printOpaqueCallCommon(
+      emitter, *memberCallOpaqueOp.getOperation(),
+      memberCallOpaqueOp.getCallee(), memberCallOpaqueOp.getTemplateArgs(),
+      memberCallOpaqueOp.getArgs(),
+      /*isMemberCall=*/true, memberCallOpaqueOp.getReceiver());
 }
 
 static LogicalResult printOperation(CppEmitter &emitter,

``````````

</details>


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


More information about the Mlir-commits mailing list