[libc-commits] [libc] [llvm] [libc] Rewrite libc GPU code to use rpc::dispatch where possible (PR #181727)

via libc-commits libc-commits at lists.llvm.org
Mon Feb 16 11:22:39 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 -- libc/shared/rpc_dispatch.h libc/shared/rpc_util.h libc/src/__support/RPC/rpc_client.h libc/src/__support/RPC/rpc_server.h libc/src/stdio/gpu/clearerr.cpp libc/src/stdio/gpu/fclose.cpp libc/src/stdio/gpu/feof.cpp libc/src/stdio/gpu/ferror.cpp libc/src/stdio/gpu/fflush.cpp libc/src/stdio/gpu/fgets.cpp libc/src/stdio/gpu/fopen.cpp libc/src/stdio/gpu/fseek.cpp libc/src/stdio/gpu/ftell.cpp libc/src/stdio/gpu/remove.cpp libc/src/stdio/gpu/rename.cpp libc/src/stdio/gpu/ungetc.cpp libc/src/stdlib/gpu/system.cpp libc/test/integration/startup/gpu/rpc_stream_test.cpp offload/test/libc/rpc_callback.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/libc/src/__support/RPC/rpc_client.h b/libc/src/__support/RPC/rpc_client.h
index 1b5c56412..ca3de6a0b 100644
--- a/libc/src/__support/RPC/rpc_client.h
+++ b/libc/src/__support/RPC/rpc_client.h
@@ -19,13 +19,13 @@
 namespace LIBC_NAMESPACE_DECL {
 namespace rpc {
 
+using ::rpc::array_ref;
 using ::rpc::Buffer;
 using ::rpc::Client;
+using ::rpc::dispatch;
 using ::rpc::Port;
 using ::rpc::Process;
 using ::rpc::Server;
-using ::rpc::dispatch;
-using ::rpc::array_ref;
 
 static_assert(cpp::is_trivially_copyable<Client>::value &&
                   sizeof(Process<true>) == sizeof(Process<false>),
diff --git a/libc/src/stdio/gpu/ferror.cpp b/libc/src/stdio/gpu/ferror.cpp
index c009bfc33..580f1f8e6 100644
--- a/libc/src/stdio/gpu/ferror.cpp
+++ b/libc/src/stdio/gpu/ferror.cpp
@@ -16,8 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) {
   return rpc::dispatch<LIBC_FERROR>(
-      rpc::client, ferror,
-      reinterpret_cast<FILE *>(file::from_stream(stream)));
+      rpc::client, ferror, reinterpret_cast<FILE *>(file::from_stream(stream)));
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdio/gpu/fflush.cpp b/libc/src/stdio/gpu/fflush.cpp
index 056d63cd3..97c41d609 100644
--- a/libc/src/stdio/gpu/fflush.cpp
+++ b/libc/src/stdio/gpu/fflush.cpp
@@ -16,8 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) {
   return rpc::dispatch<LIBC_FFLUSH>(
-      rpc::client, fflush,
-      reinterpret_cast<FILE *>(file::from_stream(stream)));
+      rpc::client, fflush, reinterpret_cast<FILE *>(file::from_stream(stream)));
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdio/gpu/fseek.cpp b/libc/src/stdio/gpu/fseek.cpp
index 4596d04a0..7484c039c 100644
--- a/libc/src/stdio/gpu/fseek.cpp
+++ b/libc/src/stdio/gpu/fseek.cpp
@@ -16,8 +16,8 @@ namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) {
   return rpc::dispatch<LIBC_FSEEK>(
-      rpc::client, fseek,
-      reinterpret_cast<FILE *>(file::from_stream(stream)), offset, whence);
+      rpc::client, fseek, reinterpret_cast<FILE *>(file::from_stream(stream)),
+      offset, whence);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdio/gpu/ftell.cpp b/libc/src/stdio/gpu/ftell.cpp
index 459b7e5ae..81cd04c1f 100644
--- a/libc/src/stdio/gpu/ftell.cpp
+++ b/libc/src/stdio/gpu/ftell.cpp
@@ -16,8 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) {
   return rpc::dispatch<LIBC_FTELL>(
-      rpc::client, ftell,
-      reinterpret_cast<FILE *>(file::from_stream(stream)));
+      rpc::client, ftell, reinterpret_cast<FILE *>(file::from_stream(stream)));
 }
 
 } // namespace LIBC_NAMESPACE_DECL

``````````

</details>


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


More information about the libc-commits mailing list