[libcxx-commits] [libcxx] [libc++] Implement C++20 atomic_ref (PR #76647)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Dec 30 19:33:35 PST 2023
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 c664a51d3439174e2973194fcabd973af658bf63 2717f45fc0130be901bbfbd90b432bc7df6bec24 -- libcxx/include/__atomic/atomic_ref.h libcxx/test/libcxx/atomics/atomics.ref/assert.compare_exchange_strong.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.compare_exchange_weak.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.ctor.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.load.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.store.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.wait.pass.cpp libcxx/test/std/atomics/atomics.ref/assign.pass.cpp libcxx/test/std/atomics/atomics.ref/bitwise_and_assign.pass.cpp libcxx/test/std/atomics/atomics.ref/bitwise_or_assign.pass.cpp libcxx/test/std/atomics/atomics.ref/bitwise_xor_assign.pass.cpp libcxx/test/std/atomics/atomics.ref/compare_exchange_strong.pass.cpp libcxx/test/std/atomics/atomics.ref/compare_exchange_weak.pass.cpp libcxx/test/std/atomics/atomics.ref/convert.pass.cpp libcxx/test/std/atomics/atomics.ref/ctor.explicit.verify.cpp libcxx/test/std/atomics/atomics.ref/ctor.pass.cpp libcxx/test/std/atomics/atomics.ref/deduction.pass.cpp libcxx/test/std/atomics/atomics.ref/exchange.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_add.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_and.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_or.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_sub.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_xor.pass.cpp libcxx/test/std/atomics/atomics.ref/increment_decrement.pass.cpp libcxx/test/std/atomics/atomics.ref/is_always_lock_free.pass.cpp libcxx/test/std/atomics/atomics.ref/load.pass.cpp libcxx/test/std/atomics/atomics.ref/member_types.pass.cpp libcxx/test/std/atomics/atomics.ref/notify_all.pass.cpp libcxx/test/std/atomics/atomics.ref/notify_one.pass.cpp libcxx/test/std/atomics/atomics.ref/operator_minus_equals.pass.cpp libcxx/test/std/atomics/atomics.ref/operator_plus_equals.pass.cpp libcxx/test/std/atomics/atomics.ref/required_alignment.pass.cpp libcxx/test/std/atomics/atomics.ref/store.pass.cpp libcxx/test/std/atomics/atomics.ref/type.verify.cpp libcxx/test/std/atomics/atomics.ref/wait.pass.cpp libcxx/include/__atomic/check_memory_order.h libcxx/include/__atomic/cxx_atomic_impl.h libcxx/include/__config libcxx/include/atomic
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h
index 6f2467cad5..b4299804ec 100644
--- a/libcxx/include/__atomic/atomic_ref.h
+++ b/libcxx/include/__atomic/atomic_ref.h
@@ -53,11 +53,9 @@ struct __atomic_ref_base {
static constexpr bool is_always_lock_free = __libcpp_is_always_lock_free<_Tp>::__value;
- _LIBCPP_HIDE_FROM_ABI
- bool is_lock_free() const noexcept { return __cxx_atomic_is_lock_free(sizeof(_Tp)); }
+ _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const noexcept { return __cxx_atomic_is_lock_free(sizeof(_Tp)); }
- _LIBCPP_HIDE_FROM_ABI
- void store(_Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept
+ _LIBCPP_HIDE_FROM_ABI void store(_Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__order) {
_LIBCPP_ASSERT_UNCATEGORIZED(
__order == memory_order::relaxed || __order == memory_order::release || __order == memory_order::seq_cst,
@@ -65,14 +63,13 @@ struct __atomic_ref_base {
__cxx_atomic_store(&__a_, __desired, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __desired) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept {
store(__desired);
return __desired;
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp load(memory_order __order = memory_order::seq_cst) const noexcept _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__order) {
+ _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __order = memory_order::seq_cst) const noexcept
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__order) {
_LIBCPP_ASSERT_UNCATEGORIZED(
__order == memory_order::relaxed || __order == memory_order::consume || __order == memory_order::acquire ||
__order == memory_order::seq_cst,
@@ -80,15 +77,12 @@ struct __atomic_ref_base {
return __cxx_atomic_load(&__a_, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- operator _Tp() const noexcept { return load(); }
+ _LIBCPP_HIDE_FROM_ABI operator _Tp() const noexcept { return load(); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp exchange(_Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept {
return __cxx_atomic_exchange(&__a_, __desired, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- bool
+ _LIBCPP_HIDE_FROM_ABI bool
compare_exchange_weak(_Tp& __expected, _Tp __desired, memory_order __success, memory_order __failure) const noexcept
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__success, __failure) {
_LIBCPP_ASSERT_UNCATEGORIZED(
@@ -97,8 +91,7 @@ struct __atomic_ref_base {
"failure memory order argument to weak atomic compare-and-exchange operation is invalid");
return __cxx_atomic_compare_exchange_weak(&__a_, &__expected, __desired, __success, __failure);
}
- _LIBCPP_HIDE_FROM_ABI
- bool
+ _LIBCPP_HIDE_FROM_ABI bool
compare_exchange_strong(_Tp& __expected, _Tp __desired, memory_order __success, memory_order __failure) const noexcept
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__success, __failure) {
_LIBCPP_ASSERT_UNCATEGORIZED(
@@ -108,19 +101,16 @@ struct __atomic_ref_base {
return __cxx_atomic_compare_exchange_strong(&__a_, &__expected, __desired, __success, __failure);
}
- _LIBCPP_HIDE_FROM_ABI
- bool
+ _LIBCPP_HIDE_FROM_ABI bool
compare_exchange_weak(_Tp& __expected, _Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept {
return __cxx_atomic_compare_exchange_weak(&__a_, &__expected, __desired, __order, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- bool
+ _LIBCPP_HIDE_FROM_ABI bool
compare_exchange_strong(_Tp& __expected, _Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept {
return __cxx_atomic_compare_exchange_strong(&__a_, &__expected, __desired, __order, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- void wait(_Tp __old, memory_order __order = memory_order::seq_cst) const noexcept
+ _LIBCPP_HIDE_FROM_ABI void wait(_Tp __old, memory_order __order = memory_order::seq_cst) const noexcept
_LIBCPP_CHECK_WAIT_MEMORY_ORDER(__order) {
_LIBCPP_ASSERT_UNCATEGORIZED(
__order == memory_order::relaxed || __order == memory_order::consume || __order == memory_order::acquire ||
@@ -128,13 +118,10 @@ struct __atomic_ref_base {
"memory order argument to atomic wait operation is invalid");
__cxx_atomic_wait(addressof(__a_), __old, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- void notify_one() const noexcept { __cxx_atomic_notify_one(addressof(__a_)); }
- _LIBCPP_HIDE_FROM_ABI
- void notify_all() const noexcept { __cxx_atomic_notify_all(addressof(__a_)); }
+ _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { __cxx_atomic_notify_one(addressof(__a_)); }
+ _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { __cxx_atomic_notify_all(addressof(__a_)); }
- _LIBCPP_HIDE_FROM_ABI
- __atomic_ref_base(_Tp& __obj) : __a_(__obj) {}
+ _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __a_(__obj) {}
};
template <class _Tp>
@@ -144,51 +131,35 @@ struct __atomic_ref_base<_Tp, /*_IsIntegral=*/true, /*_IsFloatingPoint=*/false>
using difference_type = __base::value_type;
- _LIBCPP_HIDE_FROM_ABI
- __atomic_ref_base(_Tp& __obj) : __base(__obj) {}
+ _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __base(__obj) {}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp fetch_add(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_add(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp fetch_sub(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_sub(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp fetch_and(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_and(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp fetch_or(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_or(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp fetch_xor(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_xor(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++(int) const noexcept { return fetch_add(_Tp(1)); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--(int) const noexcept { return fetch_sub(_Tp(1)); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++() const noexcept { return fetch_add(_Tp(1)) + _Tp(1); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--() const noexcept { return fetch_sub(_Tp(1)) - _Tp(1); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator+=(_Tp __arg) const noexcept { return fetch_add(__arg) + __arg; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator-=(_Tp __arg) const noexcept { return fetch_sub(__arg) - __arg; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator&=(_Tp __arg) const noexcept { return fetch_and(__arg) & __arg; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator|=(_Tp __arg) const noexcept { return fetch_or(__arg) | __arg; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator^=(_Tp __arg) const noexcept { return fetch_xor(__arg) ^ __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++(int) const noexcept { return fetch_add(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--(int) const noexcept { return fetch_sub(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++() const noexcept { return fetch_add(_Tp(1)) + _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--() const noexcept { return fetch_sub(_Tp(1)) - _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __arg) const noexcept { return fetch_add(__arg) + __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __arg) const noexcept { return fetch_sub(__arg) - __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator&=(_Tp __arg) const noexcept { return fetch_and(__arg) & __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator|=(_Tp __arg) const noexcept { return fetch_or(__arg) | __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __arg) const noexcept { return fetch_xor(__arg) ^ __arg; }
};
template <class _Tp>
@@ -198,25 +169,19 @@ struct __atomic_ref_base<_Tp, /*_IsIntegral=*/false, /*_IsFloatingPoint=*/true>
using difference_type = __base::value_type;
- _LIBCPP_HIDE_FROM_ABI
- __atomic_ref_base(_Tp& __obj) : __base(__obj) {}
+ _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __base(__obj) {}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp fetch_add(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_add(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp fetch_sub(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_sub(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator+=(_Tp __arg) const noexcept { return fetch_add(__arg) + __arg; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator-=(_Tp __arg) const noexcept { return fetch_sub(__arg) - __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __arg) const noexcept { return fetch_add(__arg) + __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __arg) const noexcept { return fetch_sub(__arg) - __arg; }
};
template <class _Tp>
@@ -225,17 +190,14 @@ struct atomic_ref : public __atomic_ref_base<_Tp> {
using __base = __atomic_ref_base<_Tp>;
- _LIBCPP_HIDE_FROM_ABI
- explicit atomic_ref(_Tp& __obj) : __base(__obj) {
+ _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
_LIBCPP_ASSERT_UNCATEGORIZED((uintptr_t)addressof(__obj) % __base::required_alignment == 0,
"atomic_ref ctor: referenced object must be aligned to required_alignment");
}
- _LIBCPP_HIDE_FROM_ABI
- atomic_ref(const atomic_ref&) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
atomic_ref& operator=(const atomic_ref&) = delete;
};
@@ -246,33 +208,23 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> {
using difference_type = ptrdiff_t;
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_add(ptrdiff_t __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_add(ptrdiff_t __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_add(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_sub(ptrdiff_t __arg, memory_order __order = memory_order_seq_cst) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __arg, memory_order __order = memory_order_seq_cst) const noexcept {
return __cxx_atomic_fetch_sub(&this->__a_, __arg, __order);
}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++(int) const noexcept { return fetch_add(1); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--(int) const noexcept { return fetch_sub(1); }
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++() const noexcept { return fetch_add(1) + 1; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--() const noexcept { return fetch_sub(1) - 1; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator+=(ptrdiff_t __arg) const noexcept { return fetch_add(__arg) + __arg; }
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator-=(ptrdiff_t __arg) const noexcept { return fetch_sub(__arg) - __arg; }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit atomic_ref(_Tp*& __ptr) : __base(__ptr) {}
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator=(_Tp* __desired) const noexcept { return __base::operator=(__desired); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++(int) const noexcept { return fetch_add(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--(int) const noexcept { return fetch_sub(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++() const noexcept { return fetch_add(1) + 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--() const noexcept { return fetch_sub(1) - 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator+=(ptrdiff_t __arg) const noexcept { return fetch_add(__arg) + __arg; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator-=(ptrdiff_t __arg) const noexcept { return fetch_sub(__arg) - __arg; }
+
+ _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp*& __ptr) : __base(__ptr) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __desired) const noexcept { return __base::operator=(__desired); }
atomic_ref& operator=(const atomic_ref&) = delete;
};
diff --git a/libcxx/test/libcxx/atomics/atomics.ref/assert.ctor.pass.cpp b/libcxx/test/libcxx/atomics/atomics.ref/assert.ctor.pass.cpp
index 6d2b7823c0..3705167181 100644
--- a/libcxx/test/libcxx/atomics/atomics.ref/assert.ctor.pass.cpp
+++ b/libcxx/test/libcxx/atomics/atomics.ref/assert.ctor.pass.cpp
@@ -22,18 +22,17 @@
int main(int, char**) {
{
char c[8];
- float *f = new(c)float(3.14f);
+ float* f = new (c) float(3.14f);
[[maybe_unused]] std::atomic_ref<float> r(*f);
}
-
+
TEST_LIBCPP_ASSERT_FAILURE(
([] {
char c[8];
- float *f = new(c+1)float(3.14f);
+ float* f = new (c + 1) float(3.14f);
[[maybe_unused]] std::atomic_ref<float> r(*f);
}()),
"atomic_ref ctor: referenced object must be aligned to required_alignment");
-
return 0;
}
diff --git a/libcxx/test/std/atomics/atomics.ref/bitwise_and_assign.pass.cpp b/libcxx/test/std/atomics/atomics.ref/bitwise_and_assign.pass.cpp
index a0cbca01ad..68c64b9ab3 100644
--- a/libcxx/test/std/atomics/atomics.ref/bitwise_and_assign.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.ref/bitwise_and_assign.pass.cpp
@@ -16,9 +16,7 @@
#include "test_macros.h"
template <typename T>
-concept has_bitwise_and_assign = requires {
- std::declval<T const>() &= std::declval<T>();
-};
+concept has_bitwise_and_assign = requires { std::declval<T const>() &= std::declval<T>(); };
static_assert(!has_bitwise_and_assign<std::atomic_ref<float>>);
static_assert(!has_bitwise_and_assign<std::atomic_ref<int*>>);
diff --git a/libcxx/test/std/atomics/atomics.ref/bitwise_or_assign.pass.cpp b/libcxx/test/std/atomics/atomics.ref/bitwise_or_assign.pass.cpp
index 45175a6c14..20ec80697c 100644
--- a/libcxx/test/std/atomics/atomics.ref/bitwise_or_assign.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.ref/bitwise_or_assign.pass.cpp
@@ -16,9 +16,7 @@
#include "test_macros.h"
template <typename T>
-concept has_bitwise_or_assign = requires {
- std::declval<T const>() |= std::declval<T>();
-};
+concept has_bitwise_or_assign = requires { std::declval<T const>() |= std::declval<T>(); };
static_assert(!has_bitwise_or_assign<std::atomic_ref<float>>);
static_assert(!has_bitwise_or_assign<std::atomic_ref<int*>>);
diff --git a/libcxx/test/std/atomics/atomics.ref/bitwise_xor_assign.pass.cpp b/libcxx/test/std/atomics/atomics.ref/bitwise_xor_assign.pass.cpp
index 808ab6dd4a..2d41bf01f9 100644
--- a/libcxx/test/std/atomics/atomics.ref/bitwise_xor_assign.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.ref/bitwise_xor_assign.pass.cpp
@@ -16,9 +16,7 @@
#include "test_macros.h"
template <typename T>
-concept has_bitwise_xor_assign = requires {
- std::declval<T const>() ^= std::declval<T>();
-};
+concept has_bitwise_xor_assign = requires { std::declval<T const>() ^= std::declval<T>(); };
static_assert(!has_bitwise_xor_assign<std::atomic_ref<float>>);
static_assert(!has_bitwise_xor_assign<std::atomic_ref<int*>>);
diff --git a/libcxx/test/std/atomics/atomics.ref/increment_decrement.pass.cpp b/libcxx/test/std/atomics/atomics.ref/increment_decrement.pass.cpp
index a743d29b6e..dd1bcaa6f5 100644
--- a/libcxx/test/std/atomics/atomics.ref/increment_decrement.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.ref/increment_decrement.pass.cpp
@@ -19,24 +19,16 @@
#include "test_macros.h"
template <typename T>
-concept has_pre_increment_operator = requires {
- ++std::declval<T const>();
-};
+concept has_pre_increment_operator = requires { ++std::declval<T const>(); };
template <typename T>
-concept has_post_increment_operator = requires {
- std::declval<T const>()++;
-};
+concept has_post_increment_operator = requires { std::declval<T const>()++; };
template <typename T>
-concept has_pre_decrement_operator = requires {
- --std::declval<T const>();
-};
+concept has_pre_decrement_operator = requires { --std::declval<T const>(); };
template <typename T>
-concept has_post_decrement_operator = requires {
- std::declval<T const>()--;
-};
+concept has_post_decrement_operator = requires { std::declval<T const>()--; };
template <typename T>
constexpr bool does_not_have_increment_nor_decrement_operators() {
diff --git a/libcxx/test/std/atomics/atomics.ref/member_types.pass.cpp b/libcxx/test/std/atomics/atomics.ref/member_types.pass.cpp
index 0b2c234686..d4e2f0126d 100644
--- a/libcxx/test/std/atomics/atomics.ref/member_types.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.ref/member_types.pass.cpp
@@ -28,9 +28,7 @@
#include "test_macros.h"
template <class T>
-concept has_difference_type = requires {
- typename T::difference_type;
-};
+concept has_difference_type = requires { typename T::difference_type; };
template <class T>
void check_member_types() {
diff --git a/libcxx/test/std/atomics/atomics.ref/operator_minus_equals.pass.cpp b/libcxx/test/std/atomics/atomics.ref/operator_minus_equals.pass.cpp
index 5776f0db30..2570d07da0 100644
--- a/libcxx/test/std/atomics/atomics.ref/operator_minus_equals.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.ref/operator_minus_equals.pass.cpp
@@ -18,9 +18,7 @@
#include "test_macros.h"
template <typename T>
-concept has_operator_minus_equals = requires {
- std::declval<T const>() -= std::declval<T>();
-};
+concept has_operator_minus_equals = requires { std::declval<T const>() -= std::declval<T>(); };
static_assert(!has_operator_minus_equals<std::atomic_ref<bool>>);
struct X {
diff --git a/libcxx/test/std/atomics/atomics.ref/operator_plus_equals.pass.cpp b/libcxx/test/std/atomics/atomics.ref/operator_plus_equals.pass.cpp
index 35f215a18f..7c097e5683 100644
--- a/libcxx/test/std/atomics/atomics.ref/operator_plus_equals.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.ref/operator_plus_equals.pass.cpp
@@ -18,9 +18,7 @@
#include "test_macros.h"
template <typename T>
-concept has_operator_plus_equals = requires {
- std::declval<T const>() += std::declval<T>();
-};
+concept has_operator_plus_equals = requires { std::declval<T const>() += std::declval<T>(); };
static_assert(!has_operator_plus_equals<std::atomic_ref<bool>>);
struct X {
``````````
</details>
https://github.com/llvm/llvm-project/pull/76647
More information about the libcxx-commits
mailing list