[libcxx-commits] [libcxx] [libc++] Refactor some forward declarations to avoid unnecessary dependencies (PR #81368)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Feb 10 09:44:58 PST 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/81368
>From 6ecdccf411e0a70c7268895a645541425be42ca7 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sat, 10 Feb 2024 18:32:48 +0100
Subject: [PATCH] [libc++] Refactor some forward declarations to avoid
unnecessary dependencies
---
libcxx/include/CMakeLists.txt | 2 -
libcxx/include/__fwd/array.h | 22 +++++
libcxx/include/__fwd/get.h | 99 -----------------------
libcxx/include/__fwd/pair.h | 27 +++++++
libcxx/include/__fwd/subrange.h | 19 ++++-
libcxx/include/__fwd/tuple.h | 37 +++++++++
libcxx/include/__memory/compressed_pair.h | 1 -
libcxx/include/__ranges/elements_view.h | 3 +-
libcxx/include/__ranges/subrange.h | 1 -
libcxx/include/__tuple/pair_like.h | 2 +-
libcxx/include/__tuple/tuple_like.h | 51 ------------
libcxx/include/__utility/pair.h | 1 -
libcxx/include/istream | 1 +
libcxx/include/libcxx.imp | 1 -
libcxx/include/streambuf | 1 +
libcxx/include/tuple | 1 -
libcxx/modules/std.compat.cppm.in | 10 +--
libcxx/modules/std.cppm.in | 10 +--
18 files changed, 117 insertions(+), 172 deletions(-)
delete mode 100644 libcxx/include/__fwd/get.h
delete mode 100644 libcxx/include/__tuple/tuple_like.h
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 6ded426640f0d0..e1afb8679b1a97 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -427,7 +427,6 @@ set(files
__fwd/array.h
__fwd/bit_reference.h
__fwd/fstream.h
- __fwd/get.h
__fwd/hash.h
__fwd/ios.h
__fwd/istream.h
@@ -703,7 +702,6 @@ set(files
__tuple/sfinae_helpers.h
__tuple/tuple_element.h
__tuple/tuple_indices.h
- __tuple/tuple_like.h
__tuple/tuple_like_ext.h
__tuple/tuple_size.h
__tuple/tuple_types.h
diff --git a/libcxx/include/__fwd/array.h b/libcxx/include/__fwd/array.h
index 9a79effb617d26..c4eac16c40a2ea 100644
--- a/libcxx/include/__fwd/array.h
+++ b/libcxx/include/__fwd/array.h
@@ -10,6 +10,7 @@
#define _LIBCPP___FWD_ARRAY_H
#include <__config>
+#include <__fwd/tuple.h>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -21,6 +22,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_TEMPLATE_VIS array;
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Tp, size_t _Size>
+inline constexpr bool __is_tuple_like_v<array<_Tp, _Size>> = true;
+
+#endif
+
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT;
+
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT;
+
+#ifndef _LIBCPP_CXX03_LANG
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT;
+
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT;
+#endif
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___FWD_ARRAY_H
diff --git a/libcxx/include/__fwd/get.h b/libcxx/include/__fwd/get.h
deleted file mode 100644
index e7261b826953d7..00000000000000
--- a/libcxx/include/__fwd/get.h
+++ /dev/null
@@ -1,99 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___FWD_GET_H
-#define _LIBCPP___FWD_GET_H
-
-#include <__concepts/copyable.h>
-#include <__config>
-#include <__fwd/array.h>
-#include <__fwd/pair.h>
-#include <__fwd/subrange.h>
-#include <__fwd/tuple.h>
-#include <__tuple/tuple_element.h>
-#include <cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(tuple<_Tp...>&) _NOEXCEPT;
-
-template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(const tuple<_Tp...>&) _NOEXCEPT;
-
-template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(tuple<_Tp...>&&) _NOEXCEPT;
-
-template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(const tuple<_Tp...>&&) _NOEXCEPT;
-
-#endif //_LIBCPP_CXX03_LANG
-
-template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
-get(pair<_T1, _T2>&) _NOEXCEPT;
-
-template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
-get(const pair<_T1, _T2>&) _NOEXCEPT;
-
-#ifndef _LIBCPP_CXX03_LANG
-template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
-get(pair<_T1, _T2>&&) _NOEXCEPT;
-
-template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
-get(const pair<_T1, _T2>&&) _NOEXCEPT;
-#endif
-
-template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT;
-
-template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT;
-
-#ifndef _LIBCPP_CXX03_LANG
-template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT;
-
-template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT;
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
-_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange);
-
-template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires(_Index < 2)
-_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange);
-
-} // namespace ranges
-
-using ranges::get;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___FWD_GET_H
diff --git a/libcxx/include/__fwd/pair.h b/libcxx/include/__fwd/pair.h
index 3844014de3adbd..7ec0949d385343 100644
--- a/libcxx/include/__fwd/pair.h
+++ b/libcxx/include/__fwd/pair.h
@@ -10,6 +10,8 @@
#define _LIBCPP___FWD_PAIR_H
#include <__config>
+#include <__fwd/tuple.h>
+#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -20,6 +22,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class, class>
struct _LIBCPP_TEMPLATE_VIS pair;
+#if _LIBCPP_STD_VER >= 20
+
+template <class _T1, class _T2>
+inline constexpr bool __is_tuple_like_v<pair<_T1, _T2>> = true;
+
+#endif
+
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(pair<_T1, _T2>&) _NOEXCEPT;
+
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(const pair<_T1, _T2>&) _NOEXCEPT;
+
+#ifndef _LIBCPP_CXX03_LANG
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(pair<_T1, _T2>&&) _NOEXCEPT;
+
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(const pair<_T1, _T2>&&) _NOEXCEPT;
+#endif
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___FWD_PAIR_H
diff --git a/libcxx/include/__fwd/subrange.h b/libcxx/include/__fwd/subrange.h
index d09b9b1c5b97bc..61f3c3a62a9511 100644
--- a/libcxx/include/__fwd/subrange.h
+++ b/libcxx/include/__fwd/subrange.h
@@ -9,7 +9,11 @@
#ifndef _LIBCPP___FWD_SUBRANGE_H
#define _LIBCPP___FWD_SUBRANGE_H
+#include <__concepts/copyable.h>
#include <__config>
+#include <__fwd/tuple.h>
+#include <__iterator/concepts.h>
+#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -17,8 +21,6 @@
#if _LIBCPP_STD_VER >= 20
-# include <__iterator/concepts.h>
-
_LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
@@ -29,8 +31,21 @@ template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent, subrange_ki
requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
class _LIBCPP_TEMPLATE_VIS subrange;
+template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
+ requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
+_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>&);
+
+template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
+ requires(_Index < 2)
+_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&&);
+
} // namespace ranges
+using ranges::get;
+
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
+inline constexpr bool __is_tuple_like_v<ranges::subrange<_Ip, _Sp, _Kp>> = true;
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__fwd/tuple.h b/libcxx/include/__fwd/tuple.h
index 16b3fabbb99516..96ad09f1c65228 100644
--- a/libcxx/include/__fwd/tuple.h
+++ b/libcxx/include/__fwd/tuple.h
@@ -10,6 +10,8 @@
#define _LIBCPP___FWD_TUPLE_H
#include <__config>
+#include <__type_traits/remove_cvref.h>
+#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -22,6 +24,41 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class...>
class _LIBCPP_TEMPLATE_VIS tuple;
+template <size_t, class>
+struct _LIBCPP_TEMPLATE_VIS tuple_element;
+
+template <class>
+struct _LIBCPP_TEMPLATE_VIS tuple_size;
+
+# if _LIBCPP_STD_VER >= 20
+
+template <class _Tp>
+inline constexpr bool __is_tuple_like_v = false;
+
+template <class... _Types>
+inline constexpr bool __is_tuple_like_v<tuple<_Types...>> = true;
+
+template <class _Tp>
+concept __tuple_like = __is_tuple_like_v<remove_cvref_t<_Tp>>;
+
+# endif // _LIBCPP_STD_VER >= 20
+
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(tuple<_Tp...>&) _NOEXCEPT;
+
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(const tuple<_Tp...>&) _NOEXCEPT;
+
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(tuple<_Tp...>&&) _NOEXCEPT;
+
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(const tuple<_Tp...>&&) _NOEXCEPT;
+
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h
index e9faada2f0b23b..a28f8525f6aeaa 100644
--- a/libcxx/include/__memory/compressed_pair.h
+++ b/libcxx/include/__memory/compressed_pair.h
@@ -11,7 +11,6 @@
#define _LIBCPP___MEMORY_COMPRESSED_PAIR_H
#include <__config>
-#include <__fwd/get.h>
#include <__fwd/tuple.h>
#include <__tuple/tuple_indices.h>
#include <__type_traits/decay.h>
diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h
index 989d36fbcaaae5..d7428102199b58 100644
--- a/libcxx/include/__ranges/elements_view.h
+++ b/libcxx/include/__ranges/elements_view.h
@@ -16,7 +16,7 @@
#include <__concepts/derived_from.h>
#include <__concepts/equality_comparable.h>
#include <__config>
-#include <__fwd/get.h>
+#include <__fwd/tuple.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/access.h>
@@ -27,7 +27,6 @@
#include <__ranges/size.h>
#include <__ranges/view_interface.h>
#include <__tuple/tuple_element.h>
-#include <__tuple/tuple_like.h>
#include <__tuple/tuple_size.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/maybe_const.h>
diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h
index a41978275b787f..bb4411cf355497 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -17,7 +17,6 @@
#include <__concepts/derived_from.h>
#include <__concepts/different_from.h>
#include <__config>
-#include <__fwd/get.h>
#include <__fwd/subrange.h>
#include <__iterator/advance.h>
#include <__iterator/concepts.h>
diff --git a/libcxx/include/__tuple/pair_like.h b/libcxx/include/__tuple/pair_like.h
index 192682dc7eb598..e1b489dc19a57a 100644
--- a/libcxx/include/__tuple/pair_like.h
+++ b/libcxx/include/__tuple/pair_like.h
@@ -10,7 +10,7 @@
#define _LIBCPP___TUPLE_PAIR_LIKE_H
#include <__config>
-#include <__tuple/tuple_like.h>
+#include <__fwd/tuple.h>
#include <__tuple/tuple_size.h>
#include <__type_traits/remove_cvref.h>
diff --git a/libcxx/include/__tuple/tuple_like.h b/libcxx/include/__tuple/tuple_like.h
deleted file mode 100644
index dab395be616b7d..00000000000000
--- a/libcxx/include/__tuple/tuple_like.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TUPLE_TUPLE_LIKE_H
-#define _LIBCPP___TUPLE_TUPLE_LIKE_H
-
-#include <__config>
-#include <__fwd/array.h>
-#include <__fwd/pair.h>
-#include <__fwd/subrange.h>
-#include <__fwd/tuple.h>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/remove_cvref.h>
-#include <cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _Tp>
-struct __tuple_like_impl : false_type {};
-
-template <class... _Tp>
-struct __tuple_like_impl<tuple<_Tp...> > : true_type {};
-
-template <class _T1, class _T2>
-struct __tuple_like_impl<pair<_T1, _T2> > : true_type {};
-
-template <class _Tp, size_t _Size>
-struct __tuple_like_impl<array<_Tp, _Size> > : true_type {};
-
-template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct __tuple_like_impl<ranges::subrange<_Ip, _Sp, _Kp> > : true_type {};
-
-template <class _Tp>
-concept __tuple_like = __tuple_like_impl<remove_cvref_t<_Tp>>::value;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TUPLE_TUPLE_LIKE_H
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 577e23198812b4..0db6f7f6021347 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -14,7 +14,6 @@
#include <__concepts/different_from.h>
#include <__config>
#include <__fwd/array.h>
-#include <__fwd/get.h>
#include <__fwd/pair.h>
#include <__fwd/subrange.h>
#include <__fwd/tuple.h>
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 1c7fb992dff429..0d05a26091a4b3 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -167,6 +167,7 @@ template <class Stream, class T>
#include <__type_traits/is_base_of.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
+#include <bitset>
#include <ostream>
#include <version>
diff --git a/libcxx/include/libcxx.imp b/libcxx/include/libcxx.imp
index 69de4705f37886..e1508648df3f8b 100644
--- a/libcxx/include/libcxx.imp
+++ b/libcxx/include/libcxx.imp
@@ -698,7 +698,6 @@
{ include: [ "<__tuple/sfinae_helpers.h>", "private", "<tuple>", "public" ] },
{ include: [ "<__tuple/tuple_element.h>", "private", "<tuple>", "public" ] },
{ include: [ "<__tuple/tuple_indices.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/tuple_like.h>", "private", "<tuple>", "public" ] },
{ include: [ "<__tuple/tuple_like_ext.h>", "private", "<tuple>", "public" ] },
{ include: [ "<__tuple/tuple_size.h>", "private", "<tuple>", "public" ] },
{ include: [ "<__tuple/tuple_types.h>", "private", "<tuple>", "public" ] },
diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index 577ad340d03335..aad7686a435cbc 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -110,6 +110,7 @@ protected:
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__fwd/streambuf.h>
+#include <__type_traits/is_same.h>
#include <climits>
#include <ios>
#include <iosfwd>
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index c41e9242a5a870..cb20d274309740 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -211,7 +211,6 @@ template <class... Types>
#include <__config>
#include <__functional/invoke.h>
#include <__fwd/array.h>
-#include <__fwd/get.h>
#include <__fwd/tuple.h>
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in
index 16363711ac7627..683883b12decc1 100644
--- a/libcxx/modules/std.compat.cppm.in
+++ b/libcxx/modules/std.compat.cppm.in
@@ -47,11 +47,11 @@ module;
// *** Headers not yet available ***
//
-// This validation is mainly to aid libc++ developers to add modules for new
-// headers. On Windows the Windows SDK can be in the include path. This SDK
-// contains the MSVC STL headers. This may give false positives when MSVC STL
-// provides a header libc++ has not implemented yet. Therefore this validation
-// is not done on Windows.
+// This validation is mainly to catch when a new header is added but adding the
+// corresponding .inc file is forgotten. However, the check based on __has_include
+// alone doesn't work on Windows because the Windows SDK is on the include path,
+// and that means the MSVC STL headers can be found as well, tricking __has_include
+// into thinking that libc++ provides the header.
//
#ifndef _WIN32
# if __has_include(<debugging>)
diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in
index 3b59c28482b113..1ab6a68d3d55f8 100644
--- a/libcxx/modules/std.cppm.in
+++ b/libcxx/modules/std.cppm.in
@@ -169,11 +169,11 @@ module;
// *** Headers not yet available ***
//
-// This validation is mainly to aid libc++ developers to add modules for new
-// headers. On Windows the Windows SDK can be in the include path. This SDK
-// contains the MSVC STL headers. This may give false positives when MSVC STL
-// provides a header libc++ has not implemented yet. Therefore this validation
-// is not done on Windows.
+// This validation is mainly to catch when a new header is added but adding the
+// corresponding .inc file is forgotten. However, the check based on __has_include
+// alone doesn't work on Windows because the Windows SDK is on the include path,
+// and that means the MSVC STL headers can be found as well, tricking __has_include
+// into thinking that libc++ provides the header.
//
#ifndef _WIN32
# if __has_include(<debugging>)
More information about the libcxx-commits
mailing list