[compiler-rt] 07892aa - [NFC][sanitizer] Clang format sanitizer_thread_registry.cpp

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 12:36:38 PDT 2024


Author: Vitaly Buka
Date: 2024-10-10T12:36:26-07:00
New Revision: 07892aaf04032e7a18368bc8320f93f7d46ab20f

URL: https://github.com/llvm/llvm-project/commit/07892aaf04032e7a18368bc8320f93f7d46ab20f
DIFF: https://github.com/llvm/llvm-project/commit/07892aaf04032e7a18368bc8320f93f7d46ab20f.diff

LOG: [NFC][sanitizer] Clang format sanitizer_thread_registry.cpp

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp
index 741e0731c41559..df04822b28851c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp
@@ -18,9 +18,16 @@
 namespace __sanitizer {
 
 ThreadContextBase::ThreadContextBase(u32 tid)
-    : tid(tid), unique_id(0), reuse_count(), os_id(0), user_id(0),
-      status(ThreadStatusInvalid), detached(false),
-      thread_type(ThreadType::Regular), parent_tid(0), next(0) {
+    : tid(tid),
+      unique_id(0),
+      reuse_count(),
+      os_id(0),
+      user_id(0),
+      status(ThreadStatusInvalid),
+      detached(false),
+      thread_type(ThreadType::Regular),
+      parent_tid(0),
+      next(0) {
   name[0] = '\0';
   atomic_store(&thread_destroyed, 0, memory_order_release);
 }
@@ -39,8 +46,7 @@ void ThreadContextBase::SetName(const char *new_name) {
 }
 
 void ThreadContextBase::SetDead() {
-  CHECK(status == ThreadStatusRunning ||
-        status == ThreadStatusFinished);
+  CHECK(status == ThreadStatusRunning || status == ThreadStatusFinished);
   status = ThreadStatusDead;
   user_id = 0;
   OnDead();
@@ -68,7 +74,8 @@ void ThreadContextBase::SetFinished() {
   // for a thread that never actually started.  In that case the thread
   // should go to ThreadStatusFinished regardless of whether it was created
   // as detached.
-  if (!detached || status == ThreadStatusCreated) status = ThreadStatusFinished;
+  if (!detached || status == ThreadStatusCreated)
+    status = ThreadStatusFinished;
   OnFinished();
 }
 
@@ -124,8 +131,10 @@ void ThreadRegistry::GetNumberOfThreads(uptr *total, uptr *running,
   ThreadRegistryLock l(this);
   if (total)
     *total = threads_.size();
-  if (running) *running = running_threads_;
-  if (alive) *alive = alive_threads_;
+  if (running)
+    *running = running_threads_;
+  if (alive)
+    *alive = alive_threads_;
 }
 
 uptr ThreadRegistry::GetMaxAliveThreads() {
@@ -150,8 +159,10 @@ u32 ThreadRegistry::CreateThread(uptr user_id, bool detached, u32 parent_tid,
     Report("%s: Thread limit (%u threads) exceeded. Dying.\n",
            SanitizerToolName, max_threads_);
 #else
-    Printf("race: limit on %u simultaneously alive goroutines is exceeded,"
-        " dying\n", max_threads_);
+    Printf(
+        "race: limit on %u simultaneously alive goroutines is exceeded,"
+        " dying\n",
+        max_threads_);
 #endif
     Die();
   }
@@ -170,8 +181,7 @@ u32 ThreadRegistry::CreateThread(uptr user_id, bool detached, u32 parent_tid,
     // positives later (e.g. if we join a wrong thread).
     CHECK(live_.try_emplace(user_id, tid).second);
   }
-  tctx->SetCreated(user_id, total_threads_++, detached,
-                   parent_tid, arg);
+  tctx->SetCreated(user_id, total_threads_++, detached, parent_tid, arg);
   return tid;
 }
 
@@ -196,8 +206,8 @@ u32 ThreadRegistry::FindThread(FindThreadCallback cb, void *arg) {
   return kInvalidTid;
 }
 
-ThreadContextBase *
-ThreadRegistry::FindThreadContextLocked(FindThreadCallback cb, void *arg) {
+ThreadContextBase *ThreadRegistry::FindThreadContextLocked(
+    FindThreadCallback cb, void *arg) {
   CheckLocked();
   for (u32 tid = 0; tid < threads_.size(); tid++) {
     ThreadContextBase *tctx = threads_[tid];
@@ -210,7 +220,7 @@ ThreadRegistry::FindThreadContextLocked(FindThreadCallback cb, void *arg) {
 static bool FindThreadContextByOsIdCallback(ThreadContextBase *tctx,
                                             void *arg) {
   return (tctx->os_id == (uptr)arg && tctx->status != ThreadStatusInvalid &&
-      tctx->status != ThreadStatusDead);
+          tctx->status != ThreadStatusDead);
 }
 
 ThreadContextBase *ThreadRegistry::FindThreadContextByOsIDLocked(tid_t os_id) {


        


More information about the llvm-commits mailing list