Skip to content

[libc++][NFC] Remove dead code implementing some tuple SFINAE checks #79871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Jan 29, 2024

Some of the checks in sfinae_helpers.h were not used anymore since we refactored the std::tuple implementation and were now dead code. This patch removes the code.

Some of the checks in sfinae_helpers.h were not used anymore since we
refactored the std::tuple implementation and were now dead code. This
patch removes the code.
@ldionne ldionne requested a review from a team as a code owner January 29, 2024 17:50
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 29, 2024
@llvmbot
Copy link
Member

llvmbot commented Jan 29, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

Some of the checks in sfinae_helpers.h were not used anymore since we refactored the std::tuple implementation and were now dead code. This patch removes the code.


Full diff: https://github.com/llvm/llvm-project/pull/79871.diff

2 Files Affected:

  • (modified) libcxx/include/__tuple/sfinae_helpers.h (-32)
  • (modified) libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp (+1-1)
diff --git a/libcxx/include/__tuple/sfinae_helpers.h b/libcxx/include/__tuple/sfinae_helpers.h
index b57f2a4c2e754b0..90e9b1e5800478e 100644
--- a/libcxx/include/__tuple/sfinae_helpers.h
+++ b/libcxx/include/__tuple/sfinae_helpers.h
@@ -18,9 +18,7 @@
 #include <__tuple/tuple_types.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_assignable.h>
 #include <__type_traits/is_constructible.h>
-#include <__type_traits/is_convertible.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/remove_reference.h>
@@ -49,25 +47,8 @@ struct __tuple_sfinae_base {
 
   template <class _FromArgs, class _ToArgs>
   using __constructible = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{}));
-  template <class _FromArgs, class _ToArgs>
-  using __convertible = decltype(__do_test<is_convertible>(_FromArgs{}, _ToArgs{}));
-  template <class _FromArgs, class _ToArgs>
-  using __assignable = decltype(__do_test<is_assignable>(_ToArgs{}, _FromArgs{}));
 };
 
-// __tuple_convertible
-
-template <class _Tp,
-          class _Up,
-          bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
-          bool = __tuple_like_ext<_Up>::value>
-struct __tuple_convertible : public false_type {};
-
-template <class _Tp, class _Up>
-struct __tuple_convertible<_Tp, _Up, true, true>
-    : public __tuple_sfinae_base::__convertible< typename __make_tuple_types<_Tp>::type,
-                                                 typename __make_tuple_types<_Up>::type > {};
-
 // __tuple_constructible
 
 template <class _Tp,
@@ -81,19 +62,6 @@ struct __tuple_constructible<_Tp, _Up, true, true>
     : public __tuple_sfinae_base::__constructible< typename __make_tuple_types<_Tp>::type,
                                                    typename __make_tuple_types<_Up>::type > {};
 
-// __tuple_assignable
-
-template <class _Tp,
-          class _Up,
-          bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
-          bool = __tuple_like_ext<_Up>::value>
-struct __tuple_assignable : public false_type {};
-
-template <class _Tp, class _Up>
-struct __tuple_assignable<_Tp, _Up, true, true>
-    : public __tuple_sfinae_base::__assignable< typename __make_tuple_types<_Tp>::type,
-                                                typename __make_tuple_types<_Up&>::type > {};
-
 template <size_t _Ip, class... _Tp>
 struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > {
   typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
diff --git a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
index 3d4262f9a4211fb..b5a234ef20ffb9e 100644
--- a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
+++ b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
@@ -12,7 +12,7 @@
 
 // template <class... Types> class tuple;
 
-// template <class Tuple, __tuple_assignable<Tuple, tuple> >
+// template <tuple-like Tuple>
 //   tuple & operator=(Tuple &&);
 
 // This test checks that we do not evaluate __make_tuple_types

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming green CI.

@ldionne ldionne merged commit e37a600 into llvm:main Jan 30, 2024
@ldionne ldionne deleted the review/remove-dead-code-tuple_convertible branch January 30, 2024 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants