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 c,h,cpp -- 
compiler-rt/lib/tsan_deadlock/tsan_deadlock_interceptors.cpp 
compiler-rt/lib/tsan_deadlock/tsan_deadlock_interface.cpp 
compiler-rt/lib/tsan_deadlock/tsan_deadlock_rtl.cpp 
compiler-rt/lib/tsan_deadlock/tsan_deadlock_rtl.h 
compiler-rt/test/tsan_deadlock/mutex_bad_unlock.cpp 
compiler-rt/test/tsan_deadlock/mutex_cycle2.cpp 
compiler-rt/test/tsan_deadlock/mutex_cycle_long.c 
compiler-rt/test/tsan_deadlock/mutex_destroy_locked.cpp 
compiler-rt/test/tsan_deadlock/mutex_destroy_locked2.cpp 
compiler-rt/test/tsan_deadlock/mutex_double_lock.cpp 
clang/include/clang/Driver/SanitizerArgs.h clang/lib/CodeGen/BackendUtil.cpp 
clang/lib/Driver/SanitizerArgs.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp 
clang/lib/Driver/ToolChains/Linux.cpp 
compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h 
llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h 
llvm/lib/Transforms/Instrumentation/ThreadSanitizer.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/compiler-rt/lib/tsan_deadlock/tsan_deadlock_rtl.cpp 
b/compiler-rt/lib/tsan_deadlock/tsan_deadlock_rtl.cpp
index 099ffa1b2..fd56bb81c 100644
--- a/compiler-rt/lib/tsan_deadlock/tsan_deadlock_rtl.cpp
+++ b/compiler-rt/lib/tsan_deadlock/tsan_deadlock_rtl.cpp
@@ -67,8 +67,9 @@ static void ReportDeadlock(Thread *thr, DDReport *rep) {
   Decorator d;
   Lock lock(&ctx->report_mutex);
   Printf("==================\n");
-  Printf("%sWARNING: %s: lock-order-inversion (potential deadlock) 
(pid=%d)%s\n",
-         d.Warning(), SanitizerToolName, (int)internal_getpid(), d.Default());
+  Printf(
+      "%sWARNING: %s: lock-order-inversion (potential deadlock) (pid=%d)%s\n",
+      d.Warning(), SanitizerToolName, (int)internal_getpid(), d.Default());
   Printf("  Cycle in lock order graph: ");
   for (int i = 0; i < rep->n; i++)
     Printf("%sM%d%s (0x%zx) => ", d.Mutex(), i, d.Default(),
@@ -87,8 +88,9 @@ static void ReportDeadlock(Thread *thr, DDReport *rep) {
       PrintStack(thr, rep->loop[i].stk[1]);
     }
     if (i == 0 && !flags()->second_deadlock_stack) {
-      Printf("    HINT: use TSAN_DEADLOCK_OPTIONS=second_deadlock_stack=1 to 
get "
-             "more informative warning message\n\n");
+      Printf(
+          "    HINT: use TSAN_DEADLOCK_OPTIONS=second_deadlock_stack=1 to get "
+          "more informative warning message\n\n");
     }
   }
   Printf("==================\n");
@@ -103,8 +105,8 @@ static void ReportMutexMisuse(Thread *thr, const char 
*what, uptr addr, uptr pc,
   Decorator d;
   Lock lock(&ctx->report_mutex);
   Printf("==================\n");
-  Printf("%sWARNING: %s: %s on %smutex 0x%zx%s (pid=%d)%s\n",
-         d.Warning(), SanitizerToolName, what, d.Mutex(), addr, d.Default(),
+  Printf("%sWARNING: %s: %s on %smutex 0x%zx%s (pid=%d)%s\n", d.Warning(),
+         SanitizerToolName, what, d.Mutex(), addr, d.Default(),
          (int)internal_getpid(), d.Default());
   PrintStack(thr, CurrentStackId(thr, pc));
   if (last_lock_stk) {
@@ -185,8 +187,8 @@ void ThreadInit(Thread *thr) {
   thr->unique_id = (int)id;
   thr->dd_pt = ctx->dd->CreatePhysicalThread();
   thr->dd_lt = ctx->dd->CreateLogicalThread(id);
-  thr->shadow_stack = static_cast<uptr *>(MmapNoReserveOrDie(
-      kShadowStackSize * sizeof(uptr), "shadow stack"));
+  thr->shadow_stack = static_cast<uptr *>(
+      MmapNoReserveOrDie(kShadowStackSize * sizeof(uptr), "shadow stack"));
   thr->shadow_stack_pos = thr->shadow_stack;
   thr->shadow_stack_end = thr->shadow_stack + kShadowStackSize;
   thr->is_inited = true;
@@ -250,7 +252,8 @@ void MutexBeforeLock(Thread *thr, uptr m, bool writelock, 
uptr pc) {
   }
 }
 
-void MutexAfterLock(Thread *thr, uptr m, bool writelock, bool trylock, uptr 
pc) {
+void MutexAfterLock(Thread *thr, uptr m, bool writelock, bool trylock,
+                    uptr pc) {
   if (!thr || thr->ignore_interceptors)
     return;
   Callback cb(thr, pc);
diff --git a/compiler-rt/test/tsan_deadlock/mutex_cycle_long.c 
b/compiler-rt/test/tsan_deadlock/mutex_cycle_long.c
index 0b7c489fa..587a58e45 100644
--- a/compiler-rt/test/tsan_deadlock/mutex_cycle_long.c
+++ b/compiler-rt/test/tsan_deadlock/mutex_cycle_long.c
@@ -12,7 +12,8 @@
 
 int main(int argc, char *argv[]) {
   int num_mutexes = 5;
-  if (argc > 1) num_mutexes = atoi(argv[1]);
+  if (argc > 1)
+    num_mutexes = atoi(argv[1]);
 
   pthread_mutex_t m[num_mutexes];
   for (int i = 0; i < num_mutexes; ++i)

``````````

</details>


https://github.com/llvm/llvm-project/pull/212748
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to