[libcxx-commits] [libcxx] [libc++] Refactor<__type_traits/is_swappable.h> (PR #86822)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 27 08:58:23 PDT 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 b68e2eba0bc8dd70b88f4271831139ee9b6ed25c c0e4ed2c4a2ea1f833a88542822f821366c863ce -- libcxx/include/__hash_table libcxx/include/__memory/compressed_pair.h libcxx/include/__memory/unique_ptr.h libcxx/include/__split_buffer libcxx/include/__tree libcxx/include/__type_traits/is_swappable.h libcxx/include/__utility/pair.h libcxx/include/__utility/swap.h libcxx/include/array libcxx/include/experimental/propagate_const libcxx/include/map libcxx/include/queue libcxx/include/regex libcxx/include/set libcxx/include/stack libcxx/include/tuple libcxx/include/unordered_map libcxx/include/unordered_set libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
index 973970a3a0..b8e90629a6 100644
--- a/libcxx/include/__type_traits/is_swappable.h
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -50,8 +50,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __swap_result_t<_Tp>
     _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value);
 
 template <class _Tp, size_t _Np, __enable_if_t<__is_swappable_v<_Tp>, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np])
-    _NOEXCEPT_(__is_nothrow_swappable_v<_Tp>);
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable_v<_Tp>);
 
 // ALL generic swap overloads MUST already have a declaration available at this point.
 
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
index 004e1a2f9d..0b0d5d0bc2 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
@@ -28,7 +28,7 @@ int main(int, char**)
     // Use a builtin type so we don't get ADL lookup.
     typedef double T[17][29];
     {
-        LIBCPP_STATIC_ASSERT(std::__is_swappable_v<T>, "");
+      LIBCPP_STATIC_ASSERT(std::__is_swappable_v<T>, "");
 #if TEST_STD_VER > 14
         static_assert(std::is_swappable_v<T>, "");
 #endif

``````````

</details>


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


More information about the libcxx-commits mailing list