[compiler-rt] [scudo] Add two missing locks to enable/disable. (PR #79670)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 16:37:49 PST 2024


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 d9a9872ec4760762fdc467ef283cea302a3742e5 cccdbb69ed588099aa1366c17514a1c4bfb97367 -- compiler-rt/lib/scudo/standalone/combined.h compiler-rt/lib/scudo/standalone/primary32.h compiler-rt/lib/scudo/standalone/primary64.h compiler-rt/lib/scudo/standalone/release.h compiler-rt/lib/scudo/standalone/stack_depot.h
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/release.h b/compiler-rt/lib/scudo/standalone/release.h
index 6e90ec97e0..a444a2ce3d 100644
--- a/compiler-rt/lib/scudo/standalone/release.h
+++ b/compiler-rt/lib/scudo/standalone/release.h
@@ -168,13 +168,9 @@ public:
     return Buf.BufferIndex != StaticBufferCount;
   }
 
-  void disable() NO_THREAD_SAFETY_ANALYSIS {
-    Mutex.lock();
-  }
+  void disable() NO_THREAD_SAFETY_ANALYSIS { Mutex.lock(); }
 
-  void enable() NO_THREAD_SAFETY_ANALYSIS {
-    Mutex.unlock();
-  }
+  void enable() NO_THREAD_SAFETY_ANALYSIS { Mutex.unlock(); }
 
 private:
   Buffer getDynamicBuffer(const uptr NumElements) {
@@ -333,13 +329,9 @@ public:
 
   uptr getBufferNumElements() const { return BufferNumElements; }
 
-  static void disable() NO_THREAD_SAFETY_ANALYSIS {
-    Buffers.disable();
-  }
+  static void disable() NO_THREAD_SAFETY_ANALYSIS { Buffers.disable(); }
 
-  static void enable() NO_THREAD_SAFETY_ANALYSIS {
-    Buffers.enable();
-  }
+  static void enable() NO_THREAD_SAFETY_ANALYSIS { Buffers.enable(); }
 
 private:
   // We may consider making this configurable if there are cases which may
diff --git a/compiler-rt/lib/scudo/standalone/stack_depot.h b/compiler-rt/lib/scudo/standalone/stack_depot.h
index ab5e96680c..bad30bdd85 100644
--- a/compiler-rt/lib/scudo/standalone/stack_depot.h
+++ b/compiler-rt/lib/scudo/standalone/stack_depot.h
@@ -137,13 +137,9 @@ public:
     return atomic_load_relaxed(&Ring[RingPos & RingMask]);
   }
 
-  void disable() NO_THREAD_SAFETY_ANALYSIS {
-    RingEndMu.lock();
-  }
+  void disable() NO_THREAD_SAFETY_ANALYSIS { RingEndMu.lock(); }
 
-  void enable() NO_THREAD_SAFETY_ANALYSIS {
-    RingEndMu.unlock();
-  }
+  void enable() NO_THREAD_SAFETY_ANALYSIS { RingEndMu.unlock(); }
 };
 
 } // namespace scudo

``````````

</details>


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


More information about the llvm-commits mailing list