[clang] [llvm] [Clang][Driver] Add jobserver support for --offload-jobs (PR #145131)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 18:56:55 PDT 2025


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 HEAD~1 HEAD --extensions c,h,inc,cpp -- llvm/include/llvm/Support/Jobserver.h llvm/lib/Support/Jobserver.cpp llvm/lib/Support/Unix/Jobserver.inc llvm/lib/Support/Windows/Jobserver.inc llvm/unittests/Support/JobserverTest.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/linker-wrapper.c clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp llvm/include/llvm/Support/ThreadPool.h llvm/include/llvm/Support/Threading.h llvm/lib/Support/Parallel.cpp llvm/lib/Support/ThreadPool.cpp llvm/lib/Support/Threading.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Support/Unix/Jobserver.inc b/llvm/lib/Support/Unix/Jobserver.inc
index 48599cf11..c22e99baa 100644
--- a/llvm/lib/Support/Unix/Jobserver.inc
+++ b/llvm/lib/Support/Unix/Jobserver.inc
@@ -14,9 +14,9 @@
 #include <cassert>
 #include <cerrno>
 #include <fcntl.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <string.h>
 
 namespace {
 /// Returns true if the given file descriptor is a FIFO (named pipe).
@@ -166,8 +166,8 @@ void JobserverClientImpl::release(JobSlot Slot) {
   }
 
   uint8_t Token = Slot.getExplicitValue();
-  LLVM_DEBUG(dbgs() << "Releasing explicit token '" << (char)Token
-                    << "' to FD " << WriteFD << ".\n");
+  LLVM_DEBUG(dbgs() << "Releasing explicit token '" << (char)Token << "' to FD "
+                    << WriteFD << ".\n");
 
   // For FIFO-based jobservers, the write FD might not be open yet.
   // Open it on the first release.
diff --git a/llvm/lib/Support/Windows/Jobserver.inc b/llvm/lib/Support/Windows/Jobserver.inc
index f7fd6cf89..b73e98932 100644
--- a/llvm/lib/Support/Windows/Jobserver.inc
+++ b/llvm/lib/Support/Windows/Jobserver.inc
@@ -21,7 +21,7 @@
 /// successfully, the client is marked as initialized.
 JobserverClientImpl::JobserverClientImpl(const JobserverConfig &Config) {
   Semaphore = (void *)::OpenSemaphoreA(SEMAPHORE_MODIFY_STATE | SYNCHRONIZE,
-                                      FALSE, Config.Path.c_str());
+                                       FALSE, Config.Path.c_str());
   if (Semaphore != nullptr)
     IsInitialized = true;
 }
@@ -39,7 +39,8 @@ JobserverClientImpl::~JobserverClientImpl() {
 /// If the wait times out, it means no slots are available, and an invalid
 /// slot is returned.
 JobSlot JobserverClientImpl::tryAcquire() {
-  if (!IsInitialized) return JobSlot();
+  if (!IsInitialized)
+    return JobSlot();
 
   // First, grant the implicit slot.
   if (HasImplicitSlot.exchange(false, std::memory_order_acquire)) {
@@ -61,7 +62,8 @@ JobSlot JobserverClientImpl::tryAcquire() {
 /// by one using `ReleaseSemaphore`, making the slot available to other
 /// processes.
 void JobserverClientImpl::release(JobSlot Slot) {
-  if (!IsInitialized || !Slot.isValid()) return;
+  if (!IsInitialized || !Slot.isValid())
+    return;
 
   if (Slot.isImplicit()) {
     [[maybe_unused]] bool was_already_released =

``````````

</details>


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


More information about the llvm-commits mailing list