[libcxx-commits] [libcxx] [libc++] Add the __is_replaceable type trait (PR #132408)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 24 12:06:22 PDT 2025


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 9c6abf02bf250da2615c1d37b8eaba299a5934a1 be5f6203ee644aa132d9acc0bb32adae9f6995e0 --extensions ,cpp,h -- libcxx/include/__type_traits/is_replaceable.h libcxx/test/libcxx/type_traits/is_replaceable.compile.pass.cpp libcxx/include/__exception/exception_ptr.h libcxx/include/__expected/expected.h libcxx/include/__locale libcxx/include/__memory/shared_ptr.h libcxx/include/__memory/unique_ptr.h libcxx/include/__split_buffer libcxx/include/__utility/pair.h libcxx/include/__vector/vector.h libcxx/include/array libcxx/include/deque libcxx/include/optional libcxx/include/string libcxx/include/tuple libcxx/include/variant
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 76d6bd7811..1e283f0e10 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -463,8 +463,8 @@ template <class _Indx, class... _Tp>
 struct __tuple_impl;
 
 template <size_t... _Indx, class... _Tp>
-struct _LIBCPP_DECLSPEC_EMPTY_BASES
-    __tuple_impl<__tuple_indices<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... {
+struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
+    : public __tuple_leaf<_Indx, _Tp>... {
   _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl() noexcept(
       __all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
 
diff --git a/libcxx/include/variant b/libcxx/include/variant
index c26c34aff1..6aeb5e1248 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -753,8 +753,8 @@ class _LIBCPP_TEMPLATE_VIS __dtor;
 
 #    define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor_definition, destroy)                             \
       template <class... _Types>                                                                                       \
-      class _LIBCPP_TEMPLATE_VIS                                                                                       \
-      __dtor<__traits<_Types...>, destructible_trait> : public __base<destructible_trait, _Types...> {                 \
+      class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, destructible_trait>                                       \
+          : public __base<destructible_trait, _Types...> {                                                             \
         using __base_type _LIBCPP_NODEBUG = __base<destructible_trait, _Types...>;                                     \
         using __index_t _LIBCPP_NODEBUG   = typename __base_type::__index_t;                                           \
                                                                                                                        \
@@ -831,8 +831,8 @@ class _LIBCPP_TEMPLATE_VIS __move_constructor;
 
 #    define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, move_constructor_definition)                    \
       template <class... _Types>                                                                                       \
-      class _LIBCPP_TEMPLATE_VIS                                                                                       \
-      __move_constructor<__traits<_Types...>, move_constructible_trait> : public __ctor<__traits<_Types...>> {         \
+      class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, move_constructible_trait>                     \
+          : public __ctor<__traits<_Types...>> {                                                                       \
         using __base_type _LIBCPP_NODEBUG = __ctor<__traits<_Types...>>;                                               \
                                                                                                                        \
       public:                                                                                                          \
@@ -958,8 +958,8 @@ class _LIBCPP_TEMPLATE_VIS __move_assignment;
 
 #    define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, move_assignment_definition)                         \
       template <class... _Types>                                                                                       \
-      class _LIBCPP_TEMPLATE_VIS                                                                                       \
-      __move_assignment<__traits<_Types...>, move_assignable_trait> : public __assignment<__traits<_Types...>> {       \
+      class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, move_assignable_trait>                         \
+          : public __assignment<__traits<_Types...>> {                                                                 \
         using __base_type _LIBCPP_NODEBUG = __assignment<__traits<_Types...>>;                                         \
                                                                                                                        \
       public:                                                                                                          \
@@ -997,8 +997,8 @@ class _LIBCPP_TEMPLATE_VIS __copy_assignment;
 
 #    define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, copy_assignment_definition)                         \
       template <class... _Types>                                                                                       \
-      class _LIBCPP_TEMPLATE_VIS                                                                                       \
-      __copy_assignment<__traits<_Types...>, copy_assignable_trait> : public __move_assignment<__traits<_Types...>> {  \
+      class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, copy_assignable_trait>                         \
+          : public __move_assignment<__traits<_Types...>> {                                                            \
         using __base_type _LIBCPP_NODEBUG = __move_assignment<__traits<_Types...>>;                                    \
                                                                                                                        \
       public:                                                                                                          \

``````````

</details>


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


More information about the libcxx-commits mailing list