Skip to content

Commit

Permalink
[libc++] Replace includes of <utility> with specific detail headers
Browse files Browse the repository at this point in the history
Basically a rebase of D104980; most of that patch had already happened
via gradual drive-by changes, but this finishes it up.
Don't touch the inclusions from `<__functional_base>`, `<__hash_table>`,
or `<__locale>`; those could be removed if we propagated the
inclusions up to the includers of those files, but there are lots
of those includers.

`<algorithm>`, `<functional>`, and `<memory>` already include `<utility>`
at the top level. `<iterator>` did not, so I've added it there.

Differential Revision: https://reviews.llvm.org/D119020
  • Loading branch information
Arthur O'Dwyer committed Feb 4, 2022
1 parent a27304c commit ea2206d
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/minmax.h
Expand Up @@ -11,8 +11,8 @@

#include <__algorithm/comp.h>
#include <__config>
#include <__utility/pair.h>
#include <initializer_list>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/minmax_element.h
Expand Up @@ -12,7 +12,7 @@
#include <__algorithm/comp.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <utility>
#include <__utility/pair.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/mismatch.h
Expand Up @@ -13,7 +13,7 @@
#include <__algorithm/comp.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <utility>
#include <__utility/pair.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__algorithm/move.h
Expand Up @@ -14,7 +14,6 @@
#include <__utility/move.h>
#include <cstring>
#include <type_traits>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/move_backward.h
Expand Up @@ -11,9 +11,9 @@

#include <__algorithm/unwrap_iter.h>
#include <__config>
#include <__utility/move.h>
#include <cstring>
#include <type_traits>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/partition_copy.h
Expand Up @@ -11,7 +11,7 @@

#include <__config>
#include <__iterator/iterator_traits.h>
#include <utility> // pair
#include <__utility/pair.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/remove_if.h
Expand Up @@ -11,7 +11,7 @@

#include <__algorithm/find_if.h>
#include <__config>
#include <utility>
#include <__utility/move.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/search.h
Expand Up @@ -13,7 +13,7 @@
#include <__algorithm/comp.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <utility>
#include <__utility/pair.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__algorithm/unique_copy.h
Expand Up @@ -12,7 +12,6 @@
#include <__algorithm/comp.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__functional/bind_front.h
Expand Up @@ -13,8 +13,8 @@
#include <__config>
#include <__functional/invoke.h>
#include <__functional/perfect_forward.h>
#include <__utility/forward.h>
#include <type_traits>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__functional/default_searcher.h
Expand Up @@ -14,7 +14,7 @@
#include <__config>
#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
#include <utility>
#include <__utility/pair.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
3 changes: 2 additions & 1 deletion libcxx/include/__functional/function.h
Expand Up @@ -20,10 +20,11 @@
#include <__memory/allocator_traits.h>
#include <__memory/compressed_pair.h>
#include <__memory/shared_ptr.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <exception>
#include <memory> // TODO: replace with <__memory/__builtin_new_allocator.h>
#include <type_traits>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__functional/identity.h
Expand Up @@ -11,7 +11,7 @@
#define _LIBCPP___FUNCTIONAL_IDENTITY_H

#include <__config>
#include <utility>
#include <__utility/forward.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
3 changes: 2 additions & 1 deletion libcxx/include/__functional/mem_fn.h
Expand Up @@ -14,7 +14,8 @@
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
#include <__functional/weak_result_type.h>
#include <utility>
#include <__utility/forward.h>
#include <type_traits>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
3 changes: 2 additions & 1 deletion libcxx/include/__functional/not_fn.h
Expand Up @@ -13,7 +13,8 @@
#include <__config>
#include <__functional/invoke.h>
#include <__functional/perfect_forward.h>
#include <utility>
#include <__utility/forward.h>
#include <type_traits>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__functional/ranges_operations.h
Expand Up @@ -11,8 +11,8 @@
#define _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H

#include <__config>
#include <__utility/forward.h>
#include <concepts>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__iterator/iter_move.h
Expand Up @@ -13,9 +13,9 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <concepts> // __class_or_enum
#include <type_traits>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__memory/allocation_guard.h
Expand Up @@ -12,8 +12,8 @@

#include <__config>
#include <__memory/allocator_traits.h>
#include <__utility/move.h>
#include <cstddef>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__memory/compressed_pair.h
Expand Up @@ -12,9 +12,9 @@

#include <__config>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <tuple> // needed in c++03 for some constructors
#include <type_traits>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__memory/construct_at.h
Expand Up @@ -16,8 +16,8 @@
#include <__memory/addressof.h>
#include <__memory/voidify.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <type_traits>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__memory/raw_storage_iterator.h
Expand Up @@ -12,9 +12,9 @@

#include <__config>
#include <__memory/addressof.h>
#include <__utility/move.h>
#include <cstddef>
#include <iterator>
#include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__memory/shared_ptr.h
Expand Up @@ -24,13 +24,13 @@
#include <__memory/pointer_traits.h>
#include <__memory/unique_ptr.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <cstddef>
#include <cstdlib> // abort
#include <iosfwd>
#include <stdexcept>
#include <type_traits>
#include <typeinfo>
#include <utility>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__memory/temporary_buffer.h
Expand Up @@ -11,9 +11,9 @@
#define _LIBCPP___MEMORY_TEMPORARY_BUFFER_H

#include <__config>
#include <__utility/pair.h>
#include <cstddef>
#include <new>
#include <utility> // pair

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
5 changes: 3 additions & 2 deletions libcxx/include/__memory/uninitialized_algorithms.h
Expand Up @@ -11,11 +11,12 @@
#define _LIBCPP___MEMORY_UNINITIALIZED_ALGORITHMS_H

#include <__config>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include <__memory/construct_at.h>
#include <__memory/voidify.h>
#include <iterator>
#include <utility>
#include <__utility/move.h>
#include <__utility/pair.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__memory/unique_ptr.h
Expand Up @@ -17,9 +17,9 @@
#include <__memory/allocator_traits.h> // __pointer
#include <__memory/compressed_pair.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <cstddef>
#include <type_traits>
#include <utility>

#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
# include <__memory/auto_ptr.h>
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/algorithm
Expand Up @@ -662,7 +662,7 @@ template<class InputIterator, class OutputIterator>
*/

#include <__bits> // __libcpp_clz
#include <__bits>
#include <__config>
#include <__debug>
#include <cstddef>
Expand All @@ -672,7 +672,7 @@ template<class InputIterator, class OutputIterator>
#include <iterator>
#include <memory>
#include <type_traits>
#include <utility> // swap_ranges
#include <utility>
#include <version>

#include <__algorithm/adjacent_find.h>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/iterator
Expand Up @@ -628,12 +628,12 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
#include <__iterator/wrap_iter.h>
#include <__memory/addressof.h>
#include <__memory/pointer_traits.h>
#include <__utility/forward.h>
#include <compare>
#include <concepts> // Mandated by the Standard.
#include <cstddef>
#include <initializer_list>
#include <type_traits>
#include <utility>
#include <version>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Expand Down

0 comments on commit ea2206d

Please sign in to comment.