[libcxx-commits] [libcxx] 34f7380 - [libc++] Remove unused __functional includes
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat May 28 01:12:49 PDT 2022
Author: Nikolas Klauser
Date: 2022-05-28T10:12:39+02:00
New Revision: 34f73804ed60e90276e2303398162c2fc05f47ec
URL: https://github.com/llvm/llvm-project/commit/34f73804ed60e90276e2303398162c2fc05f47ec
DIFF: https://github.com/llvm/llvm-project/commit/34f73804ed60e90276e2303398162c2fc05f47ec.diff
LOG: [libc++] Remove unused __functional includes
Reviewed By: ldionne, #libc
Spies: arichardson, smeenai, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D126098
Added:
Modified:
libcxx/include/__algorithm/sort.h
libcxx/include/__format/format_arg.h
libcxx/include/experimental/coroutine
libcxx/include/ext/hash_map
libcxx/include/ext/hash_set
libcxx/include/iterator
libcxx/include/map
libcxx/include/memory
libcxx/include/queue
libcxx/include/set
libcxx/include/string
libcxx/include/string_view
libcxx/include/tuple
libcxx/include/typeindex
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/variant
libcxx/include/vector
libcxx/test/libcxx/algorithms/debug_less.pass.cpp
libcxx/test/libcxx/algorithms/sort_stability.pass.cpp
libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp
libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
libcxx/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
libcxx/test/std/ranges/range.adaptors/range.join.view/sentinel/eq.pass.cpp
libcxx/test/std/ranges/range.adaptors/range.zip/types.h
libcxx/test/support/deduction_guides_sfinae_checks.h
Removed:
################################################################################
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index a6ff5e3ac54a..b5eaf75055ff 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -16,6 +16,7 @@
#include <__algorithm/unwrap_iter.h>
#include <__bits>
#include <__config>
+#include <__functional/operations.h>
#include <__utility/swap.h>
#include <climits>
#include <memory>
diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 3c61446378b5..3f2afc898d2c 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -16,7 +16,9 @@
#include <__format/format_error.h>
#include <__format/format_fwd.h>
#include <__format/format_parse_context.h>
+#include <__functional/invoke.h>
#include <__memory/addressof.h>
+#include <__utility/forward.h>
#include <__utility/unreachable.h>
#include <__variant/monostate.h>
#include <string>
diff --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine
index 9fc9d19276fd..111073bb6d67 100644
--- a/libcxx/include/experimental/coroutine
+++ b/libcxx/include/experimental/coroutine
@@ -47,6 +47,7 @@ template <class P> struct hash<coroutine_handle<P>>;
#include <__assert> // all public C++ headers provide the assertion handler
#include <__functional/hash.h>
+#include <__functional/operations.h>
#include <cstddef>
#include <experimental/__config>
#include <memory> // for hash<T*>
diff --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map
index ccc82ca8e336..92572c08c24c 100644
--- a/libcxx/include/ext/hash_map
+++ b/libcxx/include/ext/hash_map
@@ -206,6 +206,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__hash_table>
#include <algorithm>
#include <ext/__hash>
+#include <functional>
#include <stdexcept>
#include <type_traits>
diff --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set
index a4aff6ece60e..eb6193940668 100644
--- a/libcxx/include/ext/hash_set
+++ b/libcxx/include/ext/hash_set
@@ -197,6 +197,7 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__hash_table>
#include <algorithm>
#include <ext/__hash>
+#include <functional>
#if defined(__DEPRECATED) && __DEPRECATED
#if defined(_LIBCPP_WARNING)
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index e98372527cc0..30c9a10139ff 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -724,12 +724,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
#include <version>
// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/operations.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/unary_function.h>
-#include <__functional/weak_result_type.h>
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
#include <exception>
diff --git a/libcxx/include/map b/libcxx/include/map
index c6c8e8c09c4f..d48f3a25646e 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -532,7 +532,9 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
#include <__algorithm/lexicographical_compare.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__functional/binary_function.h>
#include <__functional/is_transparent.h>
+#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
#include <__node_handle>
#include <__tree>
diff --git a/libcxx/include/memory b/libcxx/include/memory
index ffc674c2a3fb..1360f9da8be8 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -872,14 +872,6 @@ template<size_t N, class T>
#include <typeinfo>
#include <version>
-// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/operations.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/unary_function.h>
-#include <__functional/weak_result_type.h>
-
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
# include <__memory/auto_ptr.h>
#endif
diff --git a/libcxx/include/queue b/libcxx/include/queue
index bd3a39f49436..da5d63077b26 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -222,6 +222,7 @@ template <class T, class Container, class Compare>
#include <__algorithm/push_heap.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
#include <__memory/uses_allocator.h>
#include <__utility/forward.h>
diff --git a/libcxx/include/set b/libcxx/include/set
index 6aeddc862b14..be7af622880d 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -476,6 +476,7 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__functional/is_transparent.h>
+#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
#include <__node_handle>
#include <__tree>
diff --git a/libcxx/include/string b/libcxx/include/string
index 1ccf4862bb50..e3fe06b50d2b 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -524,6 +524,7 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );
#include <__config>
#include <__debug>
#include <__format/enable_insertable.h>
+#include <__functional/unary_function.h>
#include <__ios/fpos.h>
#include <__iterator/wrap_iter.h>
#include <__memory/allocate_at_least.h>
@@ -547,12 +548,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );
#include <version>
// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/operations.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/unary_function.h>
-#include <__functional/weak_result_type.h>
#include <new>
#include <typeinfo>
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index bd31b8739d48..776baf291202 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -199,6 +199,7 @@ namespace std {
#include <__algorithm/min.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__functional/unary_function.h>
#include <__fwd/string_view.h>
#include <__ranges/concepts.h>
#include <__ranges/data.h>
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 76297dd76e5b..cc08d8c2af32 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -185,12 +185,6 @@ template <class... Types>
#include <version>
// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/operations.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/unary_function.h>
-#include <__functional/weak_result_type.h>
#include <exception>
#include <new>
#include <typeinfo>
diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex
index 0b61f28b96eb..8da8f58c53b5 100644
--- a/libcxx/include/typeindex
+++ b/libcxx/include/typeindex
@@ -52,11 +52,6 @@ struct hash<type_index>
#include <version>
// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/operations.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/weak_result_type.h>
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
#include <new>
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index e5741b054660..16b843b944ae 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -519,6 +519,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__config>
#include <__debug>
#include <__functional/is_transparent.h>
+#include <__functional/operations.h>
#include <__hash_table>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index de0e12197d16..890475f36f7a 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -464,6 +464,7 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__config>
#include <__debug>
#include <__functional/is_transparent.h>
+#include <__functional/operations.h>
#include <__hash_table>
#include <__memory/addressof.h>
#include <__node_handle>
diff --git a/libcxx/include/variant b/libcxx/include/variant
index b1800ed63b96..16fcede8756f 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -221,10 +221,6 @@ namespace std {
#include <version>
// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/weak_result_type.h>
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
#include <typeinfo>
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 5238ac58481d..d327e2827938 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -285,6 +285,7 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20
#include <__debug>
#include <__format/enable_insertable.h>
#include <__functional/hash.h>
+#include <__functional/unary_function.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/wrap_iter.h>
#include <__memory/allocate_at_least.h>
@@ -305,12 +306,6 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20
#include <version>
// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/operations.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/unary_function.h>
-#include <__functional/weak_result_type.h>
#include <typeinfo>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
index 05ba0f196435..6caad3ad1176 100644
--- a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
@@ -17,8 +17,9 @@
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
#include <algorithm>
-#include <iterator>
#include <cassert>
+#include <functional>
+#include <iterator>
#include "test_macros.h"
#include "check_assertion.h"
diff --git a/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp b/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp
index 54563a924c24..8b3ec2b68652 100644
--- a/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/sort_stability.pass.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <array>
#include <cassert>
+#include <functional>
#include <iterator>
#include <vector>
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
index 45ec2f425881..6eb5c247a211 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cassert>
+#include <functional>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
index f5a00f86d9ac..9b9bac27174e 100644
--- a/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
@@ -13,6 +13,7 @@
#include <chrono>
#include <concepts>
+#include <functional>
#include <memory>
#include <random>
#include <type_traits>
diff --git a/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
index 4d546054e6d9..bfd20751861d 100644
--- a/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
@@ -13,6 +13,7 @@
#include <chrono>
#include <concepts>
+#include <functional>
#include <memory>
#include <random>
#include <type_traits>
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
index 589ae66f4364..7142c8afe77e 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
@@ -15,6 +15,7 @@
#include <iterator>
#include <cassert>
#include <cstddef>
+#include <functional>
#include "test_macros.h"
#include "min_allocator.h"
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
index ce0e1efa3cf6..bfadd6febc01 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
@@ -11,9 +11,10 @@
// template <class BinaryPredicate> void unique(BinaryPredicate binary_pred); // C++17 and before
// template <class BinaryPredicate> size_type unique(BinaryPredicate binary_pred); // C++20 and after
+#include <cassert>
#include <forward_list>
+#include <functional>
#include <iterator>
-#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
index 75f8c7b12571..8139ddd36c19 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
@@ -13,6 +13,7 @@
#include <list>
#include <cassert>
+#include <functional>
#include "test_macros.h"
#include "min_allocator.h"
diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp
index 06ada6a54576..0fd56b3c7544 100644
--- a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp
+++ b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp
@@ -23,6 +23,7 @@
#include <utility>
#include <cstdint>
#include <cassert>
+#include <functional>
#include "test_macros.h"
diff --git a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
index f262b4d29eeb..5676564a8446 100644
--- a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
@@ -24,6 +24,7 @@
// using reference = iter_rvalue_reference_t<Iterator>; // Until C++20, value_type&&
// };
+#include <functional>
#include <iterator>
#include <type_traits>
diff --git a/libcxx/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp b/libcxx/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
index a51519ed71db..347d3755a07c 100644
--- a/libcxx/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
@@ -16,6 +16,7 @@
#include <numeric>
#include <cassert>
+#include <functional>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/ranges/range.adaptors/range.join.view/sentinel/eq.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.join.view/sentinel/eq.pass.cpp
index 7f1ce0b45250..c85f52e92adc 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.join.view/sentinel/eq.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.join.view/sentinel/eq.pass.cpp
@@ -15,6 +15,7 @@
#include <cassert>
#include <concepts>
+#include <functional>
#include <ranges>
#include "../types.h"
diff --git a/libcxx/test/std/ranges/range.adaptors/range.zip/types.h b/libcxx/test/std/ranges/range.adaptors/range.zip/types.h
index 662b87577675..47c88e9787fe 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.zip/types.h
+++ b/libcxx/test/std/ranges/range.adaptors/range.zip/types.h
@@ -9,6 +9,7 @@
#ifndef TEST_STD_RANGES_RANGE_ADAPTORS_RANGE_ZIP_TYPES_H
#define TEST_STD_RANGES_RANGE_ADAPTORS_RANGE_ZIP_TYPES_H
+#include <functional>
#include <ranges>
#include "test_macros.h"
diff --git a/libcxx/test/support/deduction_guides_sfinae_checks.h b/libcxx/test/support/deduction_guides_sfinae_checks.h
index f1f31c8e8c38..a4910a1e8ad6 100644
--- a/libcxx/test/support/deduction_guides_sfinae_checks.h
+++ b/libcxx/test/support/deduction_guides_sfinae_checks.h
@@ -9,6 +9,7 @@
#ifndef TEST_SUPPORT_DEDUCTION_GUIDES_SFINAE_CHECKS_H
#define TEST_SUPPORT_DEDUCTION_GUIDES_SFINAE_CHECKS_H
+#include <functional>
#include <initializer_list>
#include <memory>
#include <type_traits>
More information about the libcxx-commits
mailing list