[libcxx-commits] [libcxx] [libc++] Remove <tuple> include from <__format/concepts.h> (PR #80214)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 31 17:06:50 PST 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/80214
>From 904d8abfbec0427938361c25ae6225418a325b68 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 1 Feb 2024 00:20:27 +0100
Subject: [PATCH] [libc++] Remove <tuple> include from <__format/concepts.h>
---
libcxx/include/__format/concepts.h | 4 +++-
libcxx/include/__tuple/tuple_size.h | 7 ++++++-
libcxx/include/tuple | 3 ---
libcxx/include/vector | 1 +
libcxx/test/libcxx/transitive_includes/cxx26.csv | 1 -
.../tuple/tuple.tuple/tuple.helper/tuple_size_v.verify.cpp | 2 +-
libcxx/test/tools/clang_tidy_checks/CMakeLists.txt | 2 +-
7 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/libcxx/include/__format/concepts.h b/libcxx/include/__format/concepts.h
index 299c5f40ee35b..37181d837ebf2 100644
--- a/libcxx/include/__format/concepts.h
+++ b/libcxx/include/__format/concepts.h
@@ -15,10 +15,12 @@
#include <__config>
#include <__format/format_fwd.h>
#include <__format/format_parse_context.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 b8320106fb269..18a17fd4d5878 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/tuple b/libcxx/include/tuple
index 0e5f0b4831b41..a293f978c9f6f 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -1410,9 +1410,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 e9dd57055cb11..e6fcf9c2e92a9 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -2972,6 +2972,7 @@ _LIBCPP_POP_MACROS
# include <atomic>
# include <concepts>
# include <cstdlib>
+# include <tuple>
# include <type_traits>
# include <typeinfo>
# include <utility>
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 94c67307cc2f1..b0affe6d97fb7 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -673,5 +673,4 @@ vector new
vector stdexcept
vector string
vector string_view
-vector tuple
vector version
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 7570230b4b074..573d973b706c2 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
@@ -20,5 +20,5 @@ 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}}
+ // expected-error@*:* 3 {{implicit instantiation of undefined template}}
}
diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
index 978e709521652..ab448061f52dc 100644
--- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
+++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
@@ -5,7 +5,7 @@
set(LLVM_DIR_SAVE ${LLVM_DIR})
set(Clang_DIR_SAVE ${Clang_DIR})
-find_package(Clang 18)
+find_package(Clang 19)
if (NOT Clang_FOUND)
find_package(Clang 17)
endif()
More information about the libcxx-commits
mailing list