[libcxx-commits] [libcxx] db1978b - [libc++] Mark standard-mandated includes as such
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 17 11:43:46 PDT 2022
Author: Nikolas Klauser
Date: 2022-06-17T20:43:33+02:00
New Revision: db1978b67431ca3462ad8935bf662c15750b8252
URL: https://github.com/llvm/llvm-project/commit/db1978b67431ca3462ad8935bf662c15750b8252
DIFF: https://github.com/llvm/llvm-project/commit/db1978b67431ca3462ad8935bf662c15750b8252.diff
LOG: [libc++] Mark standard-mandated includes as such
Reviewed By: ldionne, Mordante, #libc, saugustine
Spies: saugustine, MaskRay, arichardson, mstorsjo, jloser, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D127953
Added:
Modified:
libcxx/include/algorithm
libcxx/include/array
libcxx/include/bitset
libcxx/include/coroutine
libcxx/include/deque
libcxx/include/filesystem
libcxx/include/forward_list
libcxx/include/ios
libcxx/include/iostream
libcxx/include/list
libcxx/include/map
libcxx/include/memory
libcxx/include/optional
libcxx/include/queue
libcxx/include/random
libcxx/include/regex
libcxx/include/set
libcxx/include/span
libcxx/include/stack
libcxx/include/string
libcxx/include/string_view
libcxx/include/system_error
libcxx/include/thread
libcxx/include/tuple
libcxx/include/typeindex
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/utility
libcxx/include/valarray
libcxx/include/variant
libcxx/include/vector
Removed:
################################################################################
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index d5ec99388f549..3db67affcabdd 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -1093,7 +1093,6 @@ template <class BidirectionalIterator, class Compare>
#include <__debug>
#include <cstddef>
#include <cstring>
-#include <initializer_list>
#include <memory>
#include <type_traits>
#include <version>
@@ -1238,6 +1237,9 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/unwrap_iter.h>
#include <__algorithm/upper_bound.h>
+// standard-mandated includes
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/array b/libcxx/include/array
index a058f423174e5..ab919309b966d 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -119,11 +119,23 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#include <__utility/integer_sequence.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
-#include <compare>
#include <stdexcept>
#include <type_traits>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [array.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index 32567be60b3f5..999363d209645 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -120,11 +120,13 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <__functional/unary_function.h>
#include <climits>
#include <cstddef>
-#include <iosfwd>
#include <stdexcept>
-#include <string>
#include <version>
+// standard-mandated includes
+#include <iosfwd>
+#include <string>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index 11b2863e66663..a96c4a7a5af86 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -46,6 +46,9 @@ struct suspend_always;
#include <__coroutine/trivial_awaitables.h>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
#endif
diff --git a/libcxx/include/deque b/libcxx/include/deque
index e0a0ef00b1d92..27cd7b213e811 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -180,13 +180,24 @@ template <class T, class Allocator, class Predicate>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <compare>
-#include <initializer_list>
#include <limits>
#include <stdexcept>
#include <type_traits>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [deque.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem
index fd20ec44576bb..87de8861ea422 100644
--- a/libcxx/include/filesystem
+++ b/libcxx/include/filesystem
@@ -257,9 +257,11 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
#include <__filesystem/recursive_directory_iterator.h>
#include <__filesystem/space_info.h>
#include <__filesystem/u8path.h>
-#include <compare>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
# error "The <filesystem> library is not supported since libc++ has been configured without support for a filesystem."
#endif
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index e34fa790ad9c5..4600d82ecdd86 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -189,12 +189,24 @@ template <class T, class Allocator, class Predicate>
#include <__iterator/move_iterator.h>
#include <__iterator/next.h>
#include <__utility/forward.h>
-#include <initializer_list>
#include <limits>
#include <memory>
#include <type_traits>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [forward.list.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/ios b/libcxx/include/ios
index d1b8c43a8ac9c..7140e00b406a4 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -220,10 +220,12 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__ios/fpos.h>
#include <__locale>
#include <__utility/swap.h>
-#include <iosfwd>
#include <system_error>
#include <version>
+// standard-mandated includes
+#include <iosfwd>
+
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#include <atomic> // for __xindex_
#endif
diff --git a/libcxx/include/iostream b/libcxx/include/iostream
index b5aef3efaa596..13d4ac3cadae4 100644
--- a/libcxx/include/iostream
+++ b/libcxx/include/iostream
@@ -35,11 +35,13 @@ extern wostream wclog;
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <version>
+
+// standard-mandated includes
#include <ios>
#include <istream>
#include <ostream>
#include <streambuf>
-#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/list b/libcxx/include/list
index 9c646561f709e..7ae1bc897ce01 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -197,12 +197,24 @@ template <class T, class Allocator, class Predicate>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <initializer_list>
#include <limits>
#include <memory>
#include <type_traits>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [list.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/map b/libcxx/include/map
index 36a99037b6f9e..03ae15417c777 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -542,12 +542,23 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
#include <__tree>
#include <__utility/forward.h>
#include <__utility/swap.h>
-#include <compare>
-#include <initializer_list>
#include <memory>
#include <type_traits>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [associative.map.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/memory b/libcxx/include/memory
index d0bb99933d253..199ebe8c33eb9 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -859,7 +859,6 @@ template<size_t N, class T>
#include <__memory/uninitialized_algorithms.h>
#include <__memory/unique_ptr.h>
#include <__memory/uses_allocator.h>
-#include <compare>
#include <cstddef>
#include <cstdint>
#include <cstring>
@@ -871,6 +870,9 @@ template<size_t N, class T>
#include <typeinfo>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
# include <__memory/auto_ptr.h>
#endif
diff --git a/libcxx/include/optional b/libcxx/include/optional
index ec01af47684bf..73e902dc84bef 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -171,13 +171,15 @@ template<class T>
#include <__utility/in_place.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <compare>
#include <initializer_list>
#include <new>
#include <stdexcept>
#include <type_traits>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/queue b/libcxx/include/queue
index da5d63077b26b..a6e8a52e19b51 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -226,12 +226,15 @@ template <class T, class Container, class Compare>
#include <__iterator/iterator_traits.h>
#include <__memory/uses_allocator.h>
#include <__utility/forward.h>
-#include <compare>
#include <deque>
#include <type_traits>
#include <vector>
#include <version>
+// standard-mandated includes
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/random b/libcxx/include/random
index a2e1719b86213..b0817dd3a7cc2 100644
--- a/libcxx/include/random
+++ b/libcxx/include/random
@@ -1716,9 +1716,11 @@ class piecewise_linear_distribution
#include <__random/uniform_random_bit_generator.h>
#include <__random/uniform_real_distribution.h>
#include <__random/weibull_distribution.h>
-#include <initializer_list>
#include <version>
+// standard-mandated includes
+#include <initializer_list>
+
#include <cmath> // for backward compatibility; TODO remove it
#include <cstddef> // for backward compatibility; TODO remove it
#include <cstdint> // for backward compatibility; TODO remove it
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 88acb5554e856..a0a6561ef0308 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -766,21 +766,31 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <__algorithm/search.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
-#include <__iterator/access.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/wrap_iter.h>
#include <__locale>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <compare>
#include <deque>
-#include <initializer_list>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [re.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/set b/libcxx/include/set
index 7cd4fe21ee0e5..3c062a1231253 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -483,9 +483,20 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
#include <__node_handle>
#include <__tree>
#include <__utility/forward.h>
+#include <version>
+
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [associative.set.syn]
#include <compare>
#include <initializer_list>
-#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/span b/libcxx/include/span
index e60f22a1c8812..4d95d3640db71 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -132,9 +132,7 @@ template<class R>
#include <__debug>
#include <__fwd/span.h>
#include <__iterator/concepts.h>
-#include <__iterator/data.h>
#include <__iterator/iterator_traits.h>
-#include <__iterator/size.h>
#include <__iterator/wrap_iter.h>
#include <__memory/pointer_traits.h>
#include <__ranges/concepts.h>
@@ -149,6 +147,15 @@ template<class R>
#include <type_traits> // for remove_cv, etc
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/stack b/libcxx/include/stack
index 7405896001643..59878c1d84df8 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -107,6 +107,10 @@ template <class T, class Container>
#include <type_traits>
#include <version>
+// standard-mandated includes
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/string b/libcxx/include/string
index 47cccc7320f3b..ac0721f292b1f 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -539,12 +539,10 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );
#include <__utility/swap.h>
#include <__utility/unreachable.h>
#include <climits>
-#include <compare>
#include <cstdint>
#include <cstdio> // EOF
#include <cstdlib>
#include <cstring>
-#include <initializer_list>
#include <iosfwd>
#include <limits>
#include <memory>
@@ -557,6 +555,19 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );
# include <cwchar>
#endif
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [string.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 851cbf7765040..1f64802e817f3 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -212,13 +212,24 @@ namespace std {
#include <__ranges/enable_view.h>
#include <__ranges/size.h>
#include <__string/char_traits.h>
-#include <compare>
#include <iosfwd>
#include <limits>
#include <stdexcept>
#include <type_traits>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [string.view.synop]
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/system_error b/libcxx/include/system_error
index 770092ebe6845..d9fe8b211bd73 100644
--- a/libcxx/include/system_error
+++ b/libcxx/include/system_error
@@ -147,12 +147,14 @@ template <> struct hash<std::error_condition>;
#include <__errc>
#include <__functional/hash.h>
#include <__functional/unary_function.h>
-#include <compare>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/thread b/libcxx/include/thread
index 4bb3c7a004c7b..b4f782455e526 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -98,6 +98,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <type_traits>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 8c5b24e7ad6ce..251b685912b61 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -179,11 +179,13 @@ template <class... Types>
#include <__utility/pair.h>
#include <__utility/piecewise_construct.h>
#include <__utility/swap.h>
-#include <compare>
#include <cstddef>
#include <type_traits>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex
index a92375ab75174..416e48b8d398f 100644
--- a/libcxx/include/typeindex
+++ b/libcxx/include/typeindex
@@ -47,10 +47,12 @@ struct hash<type_index>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__functional/unary_function.h>
-#include <compare>
#include <typeinfo>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index cf51ca0fdbf0b..12b4e5af63f56 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -527,11 +527,23 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__memory/addressof.h>
#include <__node_handle>
#include <__utility/forward.h>
-#include <compare>
#include <stdexcept>
#include <tuple>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [unord.map.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index d12185a9061f2..3fc686c8d354e 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -472,9 +472,21 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__memory/addressof.h>
#include <__node_handle>
#include <__utility/forward.h>
-#include <compare>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [unord.set.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/utility b/libcxx/include/utility
index 9fa867f96cac6..fc7909aef11af 100644
--- a/libcxx/include/utility
+++ b/libcxx/include/utility
@@ -240,11 +240,13 @@ template <class T>
#include <__utility/to_underlying.h>
#include <__utility/transaction.h>
#include <__utility/unreachable.h>
-#include <compare>
-#include <initializer_list>
#include <type_traits>
#include <version>
+// standard-mandated includes
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index 23c07fa49d3a0..5e601758e041f 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -357,10 +357,12 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <__utility/swap.h>
#include <cmath>
#include <cstddef>
-#include <initializer_list>
#include <new>
#include <version>
+// standard-mandated includes
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/variant b/libcxx/include/variant
index f15d600a6fd5d..5f8c06510d917 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -211,7 +211,6 @@ namespace std {
#include <__utility/move.h>
#include <__utility/swap.h>
#include <__variant/monostate.h>
-#include <compare>
#include <exception>
#include <initializer_list>
#include <limits>
@@ -220,6 +219,9 @@ namespace std {
#include <type_traits>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 73806b906f59a..0abf521e4337b 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -296,10 +296,8 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20
#include <__utility/move.h>
#include <__utility/swap.h>
#include <climits>
-#include <compare>
#include <cstdlib>
#include <cstring>
-#include <initializer_list>
#include <iosfwd> // for forward declaration of vector
#include <limits>
#include <memory>
@@ -307,6 +305,19 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20
#include <type_traits>
#include <version>
+// standard-mandated includes
+
+// [iterator.range]
+#include <__iterator/access.h>
+#include <__iterator/data.h>
+#include <__iterator/empty.h>
+#include <__iterator/reverse_access.h>
+#include <__iterator/size.h>
+
+// [vector.syn]
+#include <compare>
+#include <initializer_list>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
More information about the libcxx-commits
mailing list