Skip to content

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

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
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions libcxx/include/__fwd/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
99 changes: 0 additions & 99 deletions libcxx/include/__fwd/get.h

This file was deleted.

20 changes: 20 additions & 0 deletions libcxx/include/__fwd/pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
15 changes: 13 additions & 2 deletions libcxx/include/__fwd/subrange.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
#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
#endif

#if _LIBCPP_STD_VER >= 20

# include <__iterator/concepts.h>

_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
Expand All @@ -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
Expand Down
23 changes: 23 additions & 0 deletions libcxx/include/__fwd/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,41 @@
#define _LIBCPP___FWD_TUPLE_H

#include <__config>
#include <cstddef>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

_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
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__memory/compressed_pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__ranges/elements_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__ranges/subrange.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__tuple/tuple_like.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__utility/pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/istream
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 0 additions & 1 deletion libcxx/include/module.modulemap.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/streambuf
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/tuple
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx03.csv
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx11.csv
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx14.csv
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx17.csv
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx20.csv
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream concepts
istream cstddef
istream iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx23.csv
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream cstddef
istream ostream
istream version
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx26.csv
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
istream bitset
istream cstddef
istream ostream
istream version
Expand Down