[compiler-rt] [compiler-rt] Use __atomic builtins whenever possible (PR #84439)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 23:38:50 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 bfa6444a332f82843f9fa44821d68fcc772e0272 5a369e9d783eed20e104bca4c8495ef383ab6eca -- compiler-rt/lib/sanitizer_common/sanitizer_atomic.h compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_mips.h compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_x86.h compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
index ed82f62a1c..d80bfdbf6a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
@@ -70,8 +70,8 @@ inline void proc_yield(int cnt) {
template<typename T>
inline typename T::Type atomic_load(
const volatile T *a, memory_order mo) {
- DCHECK(mo == memory_order_relaxed || mo == memory_order_consume
- || mo == memory_order_acquire || mo == memory_order_seq_cst);
+ DCHECK(mo == memory_order_relaxed || mo == memory_order_consume ||
+ mo == memory_order_acquire || mo == memory_order_seq_cst);
DCHECK(!((uptr)a % sizeof(*a)));
typename T::Type v;
// FIXME(dvyukov): 64-bit load is not atomic on 32-bits.
@@ -87,7 +87,8 @@ inline typename T::Type atomic_load(
template<typename T>
inline void atomic_store(volatile T *a, typename T::Type v, memory_order mo) {
- DCHECK(mo == memory_order_relaxed || mo == memory_order_release || mo == memory_order_seq_cst);
+ DCHECK(mo == memory_order_relaxed || mo == memory_order_release ||
+ mo == memory_order_seq_cst);
DCHECK(!((uptr)a % sizeof(*a)));
// FIXME(dvyukov): 64-bit store is not atomic on 32-bits.
if (mo == memory_order_relaxed) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/84439
More information about the llvm-commits
mailing list