[Mlir-commits] [mlir] [MLIR][Python] Add llvm raw fd ostream c api (PR #179770)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Feb 4 11:54:16 PST 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 h,cpp -- mlir/include/mlir-c/Support.h mlir/include/mlir/Bindings/Python/NanobindUtils.h mlir/include/mlir/CAPI/Support.h mlir/lib/CAPI/IR/Support.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/include/mlir-c/Support.h b/mlir/include/mlir-c/Support.h
index 3e1baa1cf..450af9573 100644
--- a/mlir/include/mlir-c/Support.h
+++ b/mlir/include/mlir-c/Support.h
@@ -164,13 +164,13 @@ MLIR_CAPI_EXPORTED void mlirLlvmThreadPoolDestroy(MlirLlvmThreadPool pool);
 /// std::ostream does not provide the file sharing semantics required on
 /// Windows. On failure, returns a null stream and invokes the optional error
 /// callback with the error message.
-MLIR_CAPI_EXPORTED MlirLlvmRawFdOstream mlirLlvmRawFdOstreamCreate(
-    const char *path, bool binary, MlirStringCallback errorCallback,
-    void *userData);
+MLIR_CAPI_EXPORTED MlirLlvmRawFdOstream
+mlirLlvmRawFdOstreamCreate(const char *path, bool binary,
+                           MlirStringCallback errorCallback, void *userData);
 
 /// Write a string to a raw_fd_ostream created with mlirLlvmRawFdOstreamCreate.
-MLIR_CAPI_EXPORTED void mlirLlvmRawFdOstreamWrite(
-    MlirLlvmRawFdOstream stream, MlirStringRef string);
+MLIR_CAPI_EXPORTED void mlirLlvmRawFdOstreamWrite(MlirLlvmRawFdOstream stream,
+                                                  MlirStringRef string);
 
 /// Checks if a raw_fd_ostream is null.
 MLIR_CAPI_EXPORTED bool mlirLlvmRawFdOstreamIsNull(MlirLlvmRawFdOstream stream);
diff --git a/mlir/lib/CAPI/IR/Support.cpp b/mlir/lib/CAPI/IR/Support.cpp
index 0e8eceed0..c2a70aa22 100644
--- a/mlir/lib/CAPI/IR/Support.cpp
+++ b/mlir/lib/CAPI/IR/Support.cpp
@@ -39,9 +39,9 @@ void mlirLlvmThreadPoolDestroy(MlirLlvmThreadPool threadPool) {
 // LLVM raw_fd_ostream API.
 //===----------------------------------------------------------------------===//
 
-MlirLlvmRawFdOstream mlirLlvmRawFdOstreamCreate(
-    const char *path, bool binary, MlirStringCallback errorCallback,
-    void *userData) {
+MlirLlvmRawFdOstream
+mlirLlvmRawFdOstreamCreate(const char *path, bool binary,
+                           MlirStringCallback errorCallback, void *userData) {
   std::error_code ec;
   auto flags = binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text;
   auto *stream = new llvm::raw_fd_ostream(path, ec, flags);

``````````

</details>


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


More information about the Mlir-commits mailing list