[libcxx-commits] [libcxx] [libc++] Put _LIBCPP_NODEBUG on allocator trait aliases. (PR #118835)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 5 09:22:44 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 2fea1ccb6221238674562533684c51b63de248d4 09b144cd4db08100a27278cfa4d04c1153621500 --extensions h -- libcxx/include/__memory/allocator_traits.h libcxx/include/__memory/unique_ptr.h libcxx/include/__type_traits/detected_or.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index f56982e865..834326d862 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -47,9 +47,7 @@ template <class _Tp>
using __pointer_member _LIBCPP_NODEBUG = typename _Tp::pointer;
template <class _Tp, class _Alloc>
-using __pointer _LIBCPP_NODEBUG =
- __detected_or_t<_Tp *, __pointer_member,
- __libcpp_remove_reference_t<_Alloc>>;
+using __pointer _LIBCPP_NODEBUG = __detected_or_t<_Tp*, __pointer_member, __libcpp_remove_reference_t<_Alloc>>;
// __const_pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_pointer, const_pointer);
@@ -60,8 +58,7 @@ struct __const_pointer {
template <class _Tp, class _Ptr, class _Alloc>
struct __const_pointer<_Tp, _Ptr, _Alloc, false> {
#ifdef _LIBCPP_CXX03_LANG
- using type _LIBCPP_NODEBUG =
- typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
#else
using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
#endif
@@ -102,8 +99,7 @@ template <class _Tp>
using __size_type_member _LIBCPP_NODEBUG = typename _Tp::size_type;
template <class _Alloc, class _DiffType>
-using __size_type _LIBCPP_NODEBUG =
- __detected_or_t<__make_unsigned_t<_DiffType>, __size_type_member, _Alloc>;
+using __size_type _LIBCPP_NODEBUG = __detected_or_t<__make_unsigned_t<_DiffType>, __size_type_member, _Alloc>;
// __alloc_traits_difference_type
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_alloc_traits_difference_type, difference_type);
@@ -123,8 +119,7 @@ using __propagate_on_container_copy_assignment_member _LIBCPP_NODEBUG =
template <class _Alloc>
using __propagate_on_container_copy_assignment _LIBCPP_NODEBUG =
- __detected_or_t<false_type, __propagate_on_container_copy_assignment_member,
- _Alloc>;
+ __detected_or_t<false_type, __propagate_on_container_copy_assignment_member, _Alloc>;
// __propagate_on_container_move_assignment
template <class _Tp>
@@ -133,13 +128,11 @@ using __propagate_on_container_move_assignment_member _LIBCPP_NODEBUG =
template <class _Alloc>
using __propagate_on_container_move_assignment _LIBCPP_NODEBUG =
- __detected_or_t<false_type, __propagate_on_container_move_assignment_member,
- _Alloc>;
+ __detected_or_t<false_type, __propagate_on_container_move_assignment_member, _Alloc>;
// __propagate_on_container_swap
template <class _Tp>
-using __propagate_on_container_swap_member _LIBCPP_NODEBUG =
- typename _Tp::propagate_on_container_swap;
+using __propagate_on_container_swap_member _LIBCPP_NODEBUG = typename _Tp::propagate_on_container_swap;
template <class _Alloc>
using __propagate_on_container_swap _LIBCPP_NODEBUG =
@@ -151,8 +144,7 @@ using __is_always_equal_member _LIBCPP_NODEBUG = typename _Tp::is_always_equal;
template <class _Alloc>
using __is_always_equal _LIBCPP_NODEBUG =
- __detected_or_t<typename is_empty<_Alloc>::type, __is_always_equal_member,
- _Alloc>;
+ __detected_or_t<typename is_empty<_Alloc>::type, __is_always_equal_member, _Alloc>;
// __allocator_traits_rebind
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
@@ -177,8 +169,7 @@ struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> {
_LIBCPP_SUPPRESS_DEPRECATED_POP
template <class _Alloc, class _Tp>
-using __allocator_traits_rebind_t _LIBCPP_NODEBUG =
- typename __allocator_traits_rebind<_Alloc, _Tp>::type;
+using __allocator_traits_rebind_t _LIBCPP_NODEBUG = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
@@ -245,43 +236,34 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result);
template <class _Alloc>
struct _LIBCPP_TEMPLATE_VIS allocator_traits {
- using allocator_type _LIBCPP_NODEBUG = _Alloc;
- using value_type _LIBCPP_NODEBUG = typename allocator_type::value_type;
- using pointer _LIBCPP_NODEBUG = __pointer<value_type, allocator_type>;
- using const_pointer _LIBCPP_NODEBUG =
- typename __const_pointer<value_type, pointer, allocator_type>::type;
- using void_pointer _LIBCPP_NODEBUG =
- typename __void_pointer<pointer, allocator_type>::type;
- using const_void_pointer _LIBCPP_NODEBUG =
- typename __const_void_pointer<pointer, allocator_type>::type;
- using difference_type _LIBCPP_NODEBUG =
- typename __alloc_traits_difference_type<allocator_type, pointer>::type;
- using size_type _LIBCPP_NODEBUG =
- __size_type<allocator_type, difference_type>;
+ using allocator_type _LIBCPP_NODEBUG = _Alloc;
+ using value_type _LIBCPP_NODEBUG = typename allocator_type::value_type;
+ using pointer _LIBCPP_NODEBUG = __pointer<value_type, allocator_type>;
+ using const_pointer _LIBCPP_NODEBUG = typename __const_pointer<value_type, pointer, allocator_type>::type;
+ using void_pointer _LIBCPP_NODEBUG = typename __void_pointer<pointer, allocator_type>::type;
+ using const_void_pointer _LIBCPP_NODEBUG = typename __const_void_pointer<pointer, allocator_type>::type;
+ using difference_type _LIBCPP_NODEBUG = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
+ using size_type _LIBCPP_NODEBUG = __size_type<allocator_type, difference_type>;
using propagate_on_container_copy_assignment _LIBCPP_NODEBUG =
__propagate_on_container_copy_assignment<allocator_type>;
using propagate_on_container_move_assignment _LIBCPP_NODEBUG =
__propagate_on_container_move_assignment<allocator_type>;
- using propagate_on_container_swap _LIBCPP_NODEBUG =
- __propagate_on_container_swap<allocator_type>;
- using is_always_equal _LIBCPP_NODEBUG = __is_always_equal<allocator_type>;
+ using propagate_on_container_swap _LIBCPP_NODEBUG = __propagate_on_container_swap<allocator_type>;
+ using is_always_equal _LIBCPP_NODEBUG = __is_always_equal<allocator_type>;
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
- using rebind_alloc _LIBCPP_NODEBUG =
- __allocator_traits_rebind_t<allocator_type, _Tp>;
+ using rebind_alloc _LIBCPP_NODEBUG = __allocator_traits_rebind_t<allocator_type, _Tp>;
template <class _Tp>
using rebind_traits _LIBCPP_NODEBUG = allocator_traits<rebind_alloc<_Tp>>;
#else // _LIBCPP_CXX03_LANG
template <class _Tp>
struct rebind_alloc {
- using other _LIBCPP_NODEBUG =
- __allocator_traits_rebind_t<allocator_type, _Tp>;
+ using other _LIBCPP_NODEBUG = __allocator_traits_rebind_t<allocator_type, _Tp>;
};
template <class _Tp>
struct rebind_traits {
- using other _LIBCPP_NODEBUG =
- allocator_traits<typename rebind_alloc<_Tp>::other>;
+ using other _LIBCPP_NODEBUG = allocator_traits<typename rebind_alloc<_Tp>::other>;
};
#endif // _LIBCPP_CXX03_LANG
@@ -379,8 +361,7 @@ template <class _Traits, class _Tp>
using __rebind_alloc _LIBCPP_NODEBUG = typename _Traits::template rebind_alloc<_Tp>;
#else
template <class _Traits, class _Tp>
-using __rebind_alloc _LIBCPP_NODEBUG =
- typename _Traits::template rebind_alloc<_Tp>::other;
+using __rebind_alloc _LIBCPP_NODEBUG = typename _Traits::template rebind_alloc<_Tp>::other;
#endif
template <class _Alloc>
diff --git a/libcxx/include/__type_traits/detected_or.h b/libcxx/include/__type_traits/detected_or.h
index f939a85842..49c0c7111a 100644
--- a/libcxx/include/__type_traits/detected_or.h
+++ b/libcxx/include/__type_traits/detected_or.h
@@ -29,8 +29,7 @@ struct __detector<_Default, __void_t<_Op<_Args...> >, _Op, _Args...> {
};
template <class _Default, template <class...> class _Op, class... _Args>
-using __detected_or_t _LIBCPP_NODEBUG =
- typename __detector<_Default, void, _Op, _Args...>::type;
+using __detected_or_t _LIBCPP_NODEBUG = typename __detector<_Default, void, _Op, _Args...>::type;
_LIBCPP_END_NAMESPACE_STD
``````````
</details>
https://github.com/llvm/llvm-project/pull/118835
More information about the libcxx-commits
mailing list