[libc++] Granularize <utility> includes
authorNikolas Klauser <nikolasklauser@berlin.de>
Sat, 5 Mar 2022 18:17:07 +0000 (19:17 +0100)
committerNikolas Klauser <nikolasklauser@berlin.de>
Sat, 5 Mar 2022 18:31:46 +0000 (19:31 +0100)
Reviewed By: ldionne, #libc

Spies: EricWF, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D120466

41 files changed:
libcxx/include/__algorithm/rotate.h
libcxx/include/__format/formatter.h
libcxx/include/__functional/function.h
libcxx/include/__hash_table
libcxx/include/__locale
libcxx/include/__memory/shared_ptr.h
libcxx/include/__tree
libcxx/include/algorithm
libcxx/include/any
libcxx/include/array
libcxx/include/deque
libcxx/include/experimental/memory_resource
libcxx/include/experimental/propagate_const
libcxx/include/fstream
libcxx/include/functional
libcxx/include/future
libcxx/include/ios
libcxx/include/iterator
libcxx/include/list
libcxx/include/map
libcxx/include/memory
libcxx/include/optional
libcxx/include/regex
libcxx/include/sstream
libcxx/include/string
libcxx/include/tuple
libcxx/include/typeindex
libcxx/include/variant
libcxx/include/vector
libcxx/test/libcxx/ranges/range.access/end.incomplete_type.pass.cpp
libcxx/test/std/ranges/range.adaptors/range.drop/ctad.compile.pass.cpp
libcxx/test/std/ranges/range.adaptors/range.join.view/ctad.compile.pass.cpp
libcxx/test/std/ranges/range.adaptors/range.take/ctad.compile.pass.cpp
libcxx/test/std/ranges/range.adaptors/range.transform/ctad.compile.pass.cpp
libcxx/test/std/ranges/range.factories/range.iota.view/begin.pass.cpp
libcxx/test/std/ranges/range.factories/range.iota.view/end.pass.cpp
libcxx/test/std/ranges/range.factories/range.single.view/assign.pass.cpp
libcxx/test/std/ranges/range.factories/range.single.view/ctor.in_place.pass.cpp
libcxx/test/std/ranges/range.factories/range.single.view/ctor.value.pass.cpp
libcxx/test/std/ranges/range.utility/range.subrange/structured_bindings.pass.cpp
libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/optional_U.pass.cpp

index 344c2f8..ec7b999 100644 (file)
@@ -16,6 +16,7 @@
 #include <__iterator/iterator_traits.h>
 #include <__iterator/next.h>
 #include <__iterator/prev.h>
+#include <__utility/move.h>
 #include <__utility/swap.h>
 #include <iterator>
 
index f9e0b6c..44769c5 100644 (file)
@@ -20,6 +20,7 @@
 #include <__format/format_fwd.h>
 #include <__format/format_string.h>
 #include <__format/parser_std_format_spec.h>
+#include <__utility/move.h>
 #include <__utility/unreachable.h>
 #include <string_view>
 
index 4698c8c..5e734d0 100644 (file)
@@ -22,6 +22,7 @@
 #include <__memory/shared_ptr.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
+#include <__utility/swap.h>
 #include <exception>
 #include <memory> // TODO: replace with <__memory/__builtin_new_allocator.h>
 #include <type_traits>
index 5de00a3..eae111b 100644 (file)
 #include <__config>
 #include <__debug>
 #include <__functional/hash.h>
+#include <__utility/swap.h>
 #include <cmath>
 #include <initializer_list>
 #include <iterator>
 #include <memory>
 #include <type_traits>
-#include <utility>
+
+#include <utility> // TODO: Remove this
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index e178198..a31112d 100644 (file)
@@ -18,7 +18,8 @@
 #include <memory>
 #include <mutex>
 #include <string>
-#include <utility>
+
+#include <utility> // TODO: Remove this
 
 #if defined(_LIBCPP_MSVCRT_LIKE)
 # include <__support/win32/locale_win32.h>
index 0f28bcd..7401d3a 100644 (file)
@@ -24,6 +24,7 @@
 #include <__memory/unique_ptr.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
+#include <__utility/swap.h>
 #include <cstddef>
 #include <cstdlib> // abort
 #include <iosfwd>
index 384d383..f8d2226 100644 (file)
@@ -13,6 +13,7 @@
 #include <__algorithm/min.h>
 #include <__config>
 #include <__utility/forward.h>
+#include <__utility/swap.h>
 #include <iterator>
 #include <limits>
 #include <memory>
index 06314bd..8bff206 100644 (file)
@@ -692,9 +692,10 @@ template <class BidirectionalIterator, class Compare>
 #include <iterator>
 #include <memory>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 #include <__algorithm/adjacent_find.h>
 #include <__algorithm/all_of.h>
 #include <__algorithm/any_of.h>
index 2a85a66..7dc50b7 100644 (file)
@@ -83,6 +83,8 @@ namespace std {
 #include <__availability>
 #include <__config>
 #include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
 #include <cstdlib>
 #include <memory>
 #include <type_traits>
index 314d249..ce41921 100644 (file)
@@ -115,13 +115,16 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
 #include <__assert>
 #include <__config>
 #include <__tuple>
+#include <__utility/integer_sequence.h>
+#include <__utility/move.h>
 #include <__utility/unreachable.h>
 #include <iterator>
 #include <stdexcept>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
index a6f2a67..537a8dd 100644 (file)
@@ -174,6 +174,8 @@ template <class T, class Allocator, class Predicate>
 #include <__iterator/iterator_traits.h>
 #include <__split_buffer>
 #include <__utility/forward.h>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <compare>
 #include <initializer_list>
 #include <iterator>
index 098e25f..359ac70 100644 (file)
@@ -66,6 +66,7 @@ namespace pmr {
 
 #include <__assert>
 #include <__tuple>
+#include <__utility/move.h>
 #include <cstddef>
 #include <cstdlib>
 #include <experimental/__config>
@@ -75,7 +76,8 @@ namespace pmr {
 #include <new>
 #include <stdexcept>
 #include <type_traits>
-#include <utility>
+
+#include <utility> // TODO: Remove this
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index c2774b1..b6c3827 100644 (file)
 
 */
 
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <experimental/__config>
 #include <functional>
 #include <type_traits>
-#include <utility>
+
+#include <utility> // TODO: Remove this
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index 80bda63..2f1cd32 100644 (file)
@@ -184,9 +184,12 @@ typedef basic_fstream<wchar_t> wfstream;
 #include <__availability>
 #include <__config>
 #include <__locale>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <__utility/unreachable.h>
 #include <cstdio>
 #include <cstdlib>
+#include <cstring>
 #include <istream>
 #include <ostream>
 #include <version>
index d488929..09f6ec5 100644 (file)
@@ -525,9 +525,10 @@ POLICY:  For non-variadic implementations, the number of arguments is limited
 #include <tuple>
 #include <type_traits>
 #include <typeinfo>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
index a4c8ccc..162d400 100644 (file)
@@ -370,6 +370,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
 #include <__memory/uses_allocator.h>
 #include <__utility/auto_cast.h>
 #include <__utility/forward.h>
+#include <__utility/move.h>
 #include <exception>
 #include <memory>
 #include <mutex>
index 874227a..15053e5 100644 (file)
@@ -213,6 +213,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
 #include <__config>
 #include <__ios/fpos.h>
 #include <__locale>
+#include <__utility/swap.h>
 #include <iosfwd>
 #include <system_error>
 #include <version>
index 6e2eb4a..3129395 100644 (file)
@@ -654,9 +654,10 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
 #include <cstddef>
 #include <initializer_list>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__functional/binary_function.h>
 #include <__functional/invoke.h>
index ac2e466..5f32b13 100644 (file)
@@ -188,6 +188,8 @@ template <class T, class Allocator, class Predicate>
 #include <__config>
 #include <__debug>
 #include <__utility/forward.h>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <initializer_list>
 #include <iterator>
 #include <limits>
index 551edc5..4aae8db 100644 (file)
@@ -537,15 +537,17 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);  // C++20
 #include <__node_handle>
 #include <__tree>
 #include <__utility/forward.h>
+#include <__utility/swap.h>
 #include <compare>
 #include <functional>
 #include <initializer_list>
 #include <iterator> // __libcpp_erase_if_container
 #include <memory>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
index 3bc31d2..1fccdac 100644 (file)
@@ -833,9 +833,10 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
 #include <tuple>
 #include <type_traits>
 #include <typeinfo>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__functional/binary_function.h>
 #include <__functional/invoke.h>
index b20081d..effee30 100644 (file)
@@ -162,15 +162,18 @@ template<class T>
 #include <__availability>
 #include <__concepts/invocable.h>
 #include <__config>
+#include <__utility/in_place.h>
+#include <__utility/swap.h>
 #include <compare>
 #include <functional>
 #include <initializer_list>
 #include <new>
 #include <stdexcept>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__memory/allocator_arg_t.h>
 #include <__memory/uses_allocator.h>
index 68922f6..944fa4a 100644 (file)
@@ -767,6 +767,8 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
 #include <__config>
 #include <__iterator/wrap_iter.h>
 #include <__locale>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <compare>
 #include <deque>
 #include <initializer_list>
@@ -774,10 +776,11 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
 #include <memory>
 #include <stdexcept>
 #include <string>
-#include <utility>
 #include <vector>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
index dd1d9c3..ba6148b 100644 (file)
@@ -181,6 +181,7 @@ typedef basic_stringstream<wchar_t> wstringstream;
 */
 
 #include <__config>
+#include <__utility/swap.h>
 #include <istream>
 #include <ostream>
 #include <string>
index 39647ff..7eadde7 100644 (file)
@@ -527,6 +527,9 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
 #include <__debug>
 #include <__ios/fpos.h>
 #include <__iterator/wrap_iter.h>
+#include <__utility/auto_cast.h>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <compare>
 #include <cstdio>  // EOF
 #include <cstdlib>
@@ -538,9 +541,10 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
 #include <stdexcept>
 #include <string_view>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__functional/binary_function.h>
 #include <__functional/invoke.h>
index 08ded9c..da5b8d4 100644 (file)
@@ -175,12 +175,16 @@ template <class... Types>
 #include <__utility/forward.h>
 #include <__utility/integer_sequence.h>
 #include <__utility/move.h>
+#include <__utility/pair.h>
+#include <__utility/piecewise_construct.h>
+#include <__utility/swap.h>
 #include <compare>
 #include <cstddef>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__functional/binary_function.h>
 #include <__functional/invoke.h>
index b5dcd84..592da67 100644 (file)
@@ -50,6 +50,8 @@ struct hash<type_index>
 #include <typeinfo>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__functional/binary_function.h>
 #include <__functional/invoke.h>
@@ -59,7 +61,6 @@ struct hash<type_index>
 #include <__memory/allocator_arg_t.h>
 #include <__memory/uses_allocator.h>
 #include <new>
-#include <utility>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index d102196..6128f2b 100644 (file)
@@ -206,6 +206,9 @@ namespace std {
 #include <__functional/unary_function.h>
 #include <__tuple>
 #include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <__variant/monostate.h>
 #include <compare>
 #include <exception>
@@ -214,9 +217,10 @@ namespace std {
 #include <new>
 #include <tuple>
 #include <type_traits>
-#include <utility>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__functional/binary_function.h>
 #include <__functional/invoke.h>
index 57d3506..2170ae6 100644 (file)
@@ -288,6 +288,8 @@ erase_if(vector<T, Allocator>& c, Predicate pred);    // C++20
 #include <__iterator/wrap_iter.h>
 #include <__split_buffer>
 #include <__utility/forward.h>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <climits>
 #include <compare>
 #include <cstdlib>
@@ -300,6 +302,8 @@ erase_if(vector<T, Allocator>& c, Predicate pred);    // C++20
 #include <type_traits>
 #include <version>
 
+#include <utility> // TODO: Remove this
+
 // TODO: remove these headers
 #include <__functional/binary_function.h>
 #include <__functional/invoke.h>
@@ -308,7 +312,6 @@ erase_if(vector<T, Allocator>& c, Predicate pred);    // C++20
 #include <__functional/unary_function.h>
 #include <__functional/weak_result_type.h>
 #include <typeinfo>
-#include <utility>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index c038fa7..8deaff3 100644 (file)
 // Test the libc++-specific behavior that we handle the IFNDR case for ranges::end
 // by being SFINAE-friendly.
 
-#include <ranges>
 #include <cassert>
+#include <ranges>
 #include <type_traits>
+#include <utility>
 
 struct Incomplete;
 
index 98e9887..c657738 100644 (file)
 // template<class R>
 //   drop_view(R&&, range_difference_t<R>) -> drop_view<views::all_t<R>>;
 
-#include <ranges>
 #include <cassert>
 #include <concepts>
+#include <ranges>
+#include <utility>
 
 struct View : std::ranges::view_base {
   int *begin() const;
index f0dd9ab..8edd40c 100644 (file)
@@ -14,6 +14,7 @@
 //   explicit join_view(R&&) -> join_view<views::all_t<R>>;
 
 #include <ranges>
+#include <utility>
 
 struct Child {
   int *begin() const;
index 419fad3..f765502 100644 (file)
 // template<class R>
 //   take_view(R&&, range_difference_t<R>) -> take_view<views::all_t<R>>;
 
-#include <ranges>
 #include <cassert>
 #include <concepts>
+#include <ranges>
+#include <utility>
 
 struct View : std::ranges::view_base {
   int *begin() const;
index 086dc2f..8f4a9db 100644 (file)
 // template<class R, class F>
 //   transform_view(R&&, F) -> transform_view<views::all_t<R>, F>;
 
-#include <ranges>
 #include <cassert>
 #include <concepts>
+#include <ranges>
+#include <utility>
 
 struct PlusOne {
     int operator()(int x) const;
index 16b80b1..e5f31b2 100644 (file)
@@ -12,8 +12,9 @@
 
 // constexpr iterator begin() const;
 
-#include <ranges>
 #include <cassert>
+#include <ranges>
+#include <utility>
 
 #include "test_macros.h"
 #include "types.h"
index dfbc588..8d32450 100644 (file)
@@ -21,8 +21,9 @@
 // constexpr auto end() const;
 // constexpr iterator end() const requires same_as<W, Bound>;
 
-#include <ranges>
 #include <cassert>
+#include <ranges>
+#include <utility>
 
 #include "types.h"
 
index a94989d..1f855bb 100644 (file)
@@ -13,8 +13,9 @@
 
 // Tests that <value_> is a <copyable-box>.
 
-#include <ranges>
 #include <cassert>
+#include <ranges>
+#include <utility>
 
 #include "test_macros.h"
 
index e2627c1..e0f7371 100644 (file)
@@ -14,8 +14,9 @@
 //   requires constructible_from<T, Args...>
 // constexpr explicit single_view(in_place_t, Args&&... args);
 
-#include <ranges>
 #include <cassert>
+#include <ranges>
+#include <utility>
 
 #include "test_macros.h"
 
index da4e86b..0a08002 100644 (file)
@@ -13,8 +13,9 @@
 // constexpr explicit single_view(const T& t);
 // constexpr explicit single_view(T&& t);
 
-#include <ranges>
 #include <cassert>
+#include <ranges>
+#include <utility>
 
 #include "test_macros.h"
 
index ed2a166..b22d9b2 100644 (file)
 
 // class std::ranges::subrange;
 
+#include <cassert>
 #include <ranges>
+#include <utility>
 
-#include <cassert>
 #include "test_macros.h"
 
 constexpr void test_sized_subrange()
index 2354bb5..14c400c 100644 (file)
 // template <class U>
 //   optional(optional<U>&& rhs);
 
+#include <cassert>
+#include <memory>
 #include <optional>
 #include <type_traits>
-#include <memory>
-#include <cassert>
+#include <utility>
 
 #include "test_macros.h"