[libcxx-commits] [libcxx] 4528c44 - [libc++] Remove <tuple> include from <__format/concepts.h> (#80214)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 14 04:04:45 PDT 2024
Author: Nikolas Klauser
Date: 2024-03-14T12:04:41+01:00
New Revision: 4528c44d0a82f2b5fe25757b28b185c3c880cfb2
URL: https://github.com/llvm/llvm-project/commit/4528c44d0a82f2b5fe25757b28b185c3c880cfb2
DIFF: https://github.com/llvm/llvm-project/commit/4528c44d0a82f2b5fe25757b28b185c3c880cfb2.diff
LOG: [libc++] Remove <tuple> include from <__format/concepts.h> (#80214)
This also moves `tuple_size_v` into `tuple_size` as a drive-by.
Added:
Modified:
libcxx/include/__format/concepts.h
libcxx/include/__tuple/tuple_size.h
libcxx/include/chrono
libcxx/include/tuple
libcxx/include/vector
libcxx/test/libcxx/transitive_includes/cxx23.csv
libcxx/test/libcxx/transitive_includes/cxx26.csv
libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.verify.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__format/concepts.h b/libcxx/include/__format/concepts.h
index d7b5a9d16df70a..13380e9b91aff8 100644
--- a/libcxx/include/__format/concepts.h
+++ b/libcxx/include/__format/concepts.h
@@ -15,10 +15,12 @@
#include <__config>
#include <__format/format_parse_context.h>
#include <__fwd/format.h>
+#include <__fwd/tuple.h>
+#include <__tuple/tuple_size.h>
#include <__type_traits/is_specialization.h>
#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_reference.h>
#include <__utility/pair.h>
-#include <tuple>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__tuple/tuple_size.h b/libcxx/include/__tuple/tuple_size.h
index b8320106fb2694..668be13a5c841f 100644
--- a/libcxx/include/__tuple/tuple_size.h
+++ b/libcxx/include/__tuple/tuple_size.h
@@ -43,7 +43,7 @@ struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< volatile _Tp,
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS
- tuple_size<__enable_if_tuple_size_imp< const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+ tuple_size<__enable_if_tuple_size_imp<const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
#else
@@ -63,6 +63,11 @@ struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > : public integral_constan
template <class... _Tp>
struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
+# if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
+# endif
+
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index b3b260c2a998e6..0320c1dc4c2f96 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -878,6 +878,7 @@ constexpr chrono::year operator ""y(unsigned lo
# include <cstring>
# include <forward_list>
# include <string>
+# include <tuple>
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index e63e4e25a7d2bd..02ace66542feb8 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -1369,9 +1369,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_T1, _T2>::pair(
second(std::forward<_Args2>(std::get<_I2>(__second_args))...) {}
# if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
-
# define _LIBCPP_NOEXCEPT_RETURN(...) \
noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 89cbdf0b3ff747..90507e6baaf243 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -2990,6 +2990,7 @@ _LIBCPP_POP_MACROS
# include <concepts>
# include <cstdlib>
# include <locale>
+# include <tuple>
# include <type_traits>
# include <typeinfo>
# include <utility>
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index daa3e17698bbed..142204c4477cde 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -85,7 +85,6 @@ chrono sstream
chrono stdexcept
chrono string
chrono string_view
-chrono tuple
chrono vector
chrono version
cinttypes cstdint
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index daa3e17698bbed..142204c4477cde 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -85,7 +85,6 @@ chrono sstream
chrono stdexcept
chrono string
chrono string_view
-chrono tuple
chrono vector
chrono version
cinttypes cstdint
diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.verify.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.verify.cpp
index 7570230b4b0748..149890499678d6 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.verify.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.verify.cpp
@@ -17,8 +17,8 @@
#include <tuple>
void f() {
- (void)std::tuple_size_v<std::tuple<> &>; // expected-note {{requested here}}
- (void)std::tuple_size_v<int>; // expected-note {{requested here}}
- (void)std::tuple_size_v<std::tuple<>*>; // expected-note {{requested here}}
- // expected-error at tuple:* 3 {{implicit instantiation of undefined template}}
+ (void)std::tuple_size_v<std::tuple<>&>; // expected-note {{requested here}}
+ (void)std::tuple_size_v<int>; // expected-note {{requested here}}
+ (void)std::tuple_size_v<std::tuple<>*>; // expected-note {{requested here}}
+ // expected-error@*:* 3 {{implicit instantiation of undefined template}}
}
More information about the libcxx-commits
mailing list