[libc++] Move the contents of __fwd/get.h into the forward declaration headers they actually belong to (#81368)

This brings us closer to one forward declaring header per public header.
This commit is contained in:
Nikolas Klauser 2024-02-12 08:32:28 +01:00 committed by GitHub
parent 373d9d7214
commit f9d6d6fbcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 79 additions and 109 deletions

View File

@ -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

View File

@ -21,6 +21,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_TEMPLATE_VIS array;
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

View File

@ -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

View File

@ -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,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class, class>
struct _LIBCPP_TEMPLATE_VIS pair;
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

View File

@ -9,7 +9,10 @@
#ifndef _LIBCPP___FWD_SUBRANGE_H
#define _LIBCPP___FWD_SUBRANGE_H
#include <__concepts/copyable.h>
#include <__config>
#include <__iterator/concepts.h>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -17,8 +20,6 @@
#if _LIBCPP_STD_VER >= 20
# include <__iterator/concepts.h>
_LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
@ -29,8 +30,18 @@ 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;
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER >= 20

View File

@ -10,6 +10,7 @@
#define _LIBCPP___FWD_TUPLE_H
#include <__config>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -17,11 +18,33 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t, class>
struct _LIBCPP_TEMPLATE_VIS tuple_element;
#ifndef _LIBCPP_CXX03_LANG
template <class...>
class _LIBCPP_TEMPLATE_VIS tuple;
template <class>
struct _LIBCPP_TEMPLATE_VIS tuple_size;
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

View File

@ -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>

View File

@ -16,7 +16,6 @@
#include <__concepts/derived_from.h>
#include <__concepts/equality_comparable.h>
#include <__config>
#include <__fwd/get.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/access.h>

View File

@ -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>

View File

@ -16,7 +16,6 @@
#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

View File

@ -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>

View File

@ -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>

View File

@ -1790,7 +1790,6 @@ module std_private_thread_thread [system] {
}
module std_private_thread_timed_backoff_policy [system] { header "__thread/timed_backoff_policy.h" }
module std_private_tuple_get_fwd [system] { header "__fwd/get.h" }
module std_private_tuple_make_tuple_types [system] { header "__tuple/make_tuple_types.h" }
module std_private_tuple_pair_like [system] {
header "__tuple/pair_like.h"

View File

@ -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>

View File

@ -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>

View File

@ -393,6 +393,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd

1 algorithm atomic
393 iostream ostream
394 iostream streambuf
395 iostream version
396 istream bitset
397 istream concepts
398 istream cstddef
399 istream iosfwd

View File

@ -396,6 +396,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd

1 algorithm atomic
396 iostream ostream
397 iostream streambuf
398 iostream version
399 istream bitset
400 istream concepts
401 istream cstddef
402 istream iosfwd

View File

@ -398,6 +398,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd

1 algorithm atomic
398 iostream ostream
399 iostream streambuf
400 iostream version
401 istream bitset
402 istream concepts
403 istream cstddef
404 istream iosfwd

View File

@ -398,6 +398,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd

1 algorithm atomic
398 iostream ostream
399 iostream streambuf
400 iostream version
401 istream bitset
402 istream concepts
403 istream cstddef
404 istream iosfwd

View File

@ -403,6 +403,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd

1 algorithm atomic
403 iostream ostream
404 iostream streambuf
405 iostream version
406 istream bitset
407 istream concepts
408 istream cstddef
409 istream iosfwd

View File

@ -282,6 +282,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream cstddef
istream ostream
istream version

1 algorithm climits
282 iostream ostream
283 iostream streambuf
284 iostream version
285 istream bitset
286 istream cstddef
287 istream ostream
288 istream version

View File

@ -282,6 +282,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream cstddef
istream ostream
istream version

1 algorithm climits
282 iostream ostream
283 iostream streambuf
284 iostream version
285 istream bitset
286 istream cstddef
287 istream ostream
288 istream version