[libcxx-commits] [libcxx] faef447 - [libc++] Granularize <functional> includes

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 20 13:49:25 PDT 2022


Author: Nikolas Klauser
Date: 2022-04-20T22:49:18+02:00
New Revision: faef447e72a5c63dfb12bb7b02d44c3c916d31cd

URL: https://github.com/llvm/llvm-project/commit/faef447e72a5c63dfb12bb7b02d44c3c916d31cd
DIFF: https://github.com/llvm/llvm-project/commit/faef447e72a5c63dfb12bb7b02d44c3c916d31cd.diff

LOG: [libc++] Granularize <functional> includes

Reviewed By: Mordante, #libc

Spies: libcxx-commits, miyuki

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

Added: 
    

Modified: 
    libcxx/include/__ranges/join_view.h
    libcxx/include/algorithm
    libcxx/include/experimental/coroutine
    libcxx/include/experimental/propagate_const
    libcxx/include/experimental/simd
    libcxx/include/ext/hash_map
    libcxx/include/ext/hash_set
    libcxx/include/map
    libcxx/include/mutex
    libcxx/include/numeric
    libcxx/include/optional
    libcxx/include/queue
    libcxx/include/regex
    libcxx/include/set
    libcxx/include/thread
    libcxx/include/unordered_map
    libcxx/include/unordered_set
    libcxx/include/valarray
    libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/ranges.transform.pass.cpp
    libcxx/test/std/algorithms/alg.nonmodifying/mismatch/ranges_mismatch.pass.cpp
    libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max.pass.cpp
    libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max_element.pass.cpp
    libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min.pass.cpp
    libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min_element.pass.cpp
    libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax.pass.cpp
    libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax_element.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.lazy.split/constraints.compile.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__ranges/join_view.h b/libcxx/include/__ranges/join_view.h
index 1a1dfad1d2b06..b95db5bb30fe6 100644
--- a/libcxx/include/__ranges/join_view.h
+++ b/libcxx/include/__ranges/join_view.h
@@ -9,8 +9,15 @@
 #ifndef _LIBCPP___RANGES_JOIN_VIEW_H
 #define _LIBCPP___RANGES_JOIN_VIEW_H
 
+#include <__concepts/constructible.h>
+#include <__concepts/convertible_to.h>
+#include <__concepts/copyable.h>
+#include <__concepts/derived_from.h>
+#include <__concepts/equality_comparable.h>
 #include <__config>
 #include <__iterator/concepts.h>
+#include <__iterator/iter_move.h>
+#include <__iterator/iter_swap.h>
 #include <__iterator/iterator_traits.h>
 #include <__ranges/access.h>
 #include <__ranges/all.h>

diff  --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 9feb59b3a1a7e..ff2a54ef33827 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -881,7 +881,7 @@ template <class BidirectionalIterator, class Compare>
 #include <__debug>
 #include <cstddef>
 #include <cstring>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <initializer_list>
 #include <iterator>
 #include <memory>

diff  --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine
index e94450b1438ac..50c7fcf613d85 100644
--- a/libcxx/include/experimental/coroutine
+++ b/libcxx/include/experimental/coroutine
@@ -46,9 +46,10 @@ template <class P> struct hash<coroutine_handle<P>>;
  */
 
 #include <__assert> // all public C++ headers provide the assertion handler
+#include <__functional/hash.h>
 #include <cstddef>
 #include <experimental/__config>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <memory> // for hash<T*>
 #include <new>
 #include <type_traits>

diff  --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 7c9b783f4163c..2ed17c7613012 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -108,10 +108,12 @@
 */
 
 #include <__assert> // all public C++ headers provide the assertion handler
+#include <__functional/operations.h>
+#include <__utility/forward.h>
 #include <__utility/move.h>
 #include <__utility/swap.h>
 #include <experimental/__config>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <type_traits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index 7fa185f4f3955..cf255b8a37f8c 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -650,10 +650,12 @@ public:
 */
 
 #include <__assert> // all public C++ headers provide the assertion handler
+#include <__functional/operations.h>
 #include <array>
 #include <cstddef>
 #include <experimental/__config>
-#include <functional>
+#include <functional> // TODO: Remove this include
+#include <tuple>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header

diff  --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map
index 92572c08c24cc..79198784a8ec4 100644
--- a/libcxx/include/ext/hash_map
+++ b/libcxx/include/ext/hash_map
@@ -206,7 +206,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
 #include <__hash_table>
 #include <algorithm>
 #include <ext/__hash>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <stdexcept>
 #include <type_traits>
 

diff  --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set
index eb61939406682..76631daddddcb 100644
--- a/libcxx/include/ext/hash_set
+++ b/libcxx/include/ext/hash_set
@@ -197,7 +197,7 @@ template <class Value, class Hash, class Pred, class Alloc>
 #include <__hash_table>
 #include <algorithm>
 #include <ext/__hash>
-#include <functional>
+#include <functional> // TODO: Remove this include
 
 #if defined(__DEPRECATED) && __DEPRECATED
 #if defined(_LIBCPP_WARNING)

diff  --git a/libcxx/include/map b/libcxx/include/map
index 7371d5182c0db..346fa89a19f18 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -539,7 +539,7 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);  // C++20
 #include <__utility/forward.h>
 #include <__utility/swap.h>
 #include <compare>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <initializer_list>
 #include <iterator> // __libcpp_erase_if_container
 #include <memory>

diff  --git a/libcxx/include/mutex b/libcxx/include/mutex
index a94e3b7daef92..7368887b43211 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -192,7 +192,7 @@ template<class Callable, class ...Args>
 #include <__threading_support>
 #include <__utility/forward.h>
 #include <cstdint>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <memory>
 #ifndef _LIBCPP_CXX03_LANG
 # include <tuple>

diff  --git a/libcxx/include/numeric b/libcxx/include/numeric
index ef963365ae71d..d9265da429d6c 100644
--- a/libcxx/include/numeric
+++ b/libcxx/include/numeric
@@ -147,7 +147,7 @@ template<class T>
 #include <__assert> // all public C++ headers provide the assertion handler
 #include <__config>
 #include <cmath> // for isnormal
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <iterator>
 #include <version>
 

diff  --git a/libcxx/include/optional b/libcxx/include/optional
index 8dc1a136fdafc..48a1a5f94fecb 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -162,10 +162,17 @@ template<class T>
 #include <__availability>
 #include <__concepts/invocable.h>
 #include <__config>
+#include <__functional/hash.h>
+#include <__functional/invoke.h>
+#include <__functional/unary_function.h>
+#include <__memory/construct_at.h>
+#include <__tuple>
+#include <__utility/forward.h>
 #include <__utility/in_place.h>
+#include <__utility/move.h>
 #include <__utility/swap.h>
 #include <compare>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <initializer_list>
 #include <new>
 #include <stdexcept>

diff  --git a/libcxx/include/queue b/libcxx/include/queue
index d15c141920e8e..4074460e8e2d9 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -227,7 +227,7 @@ template <class T, class Container, class Compare>
 #include <__utility/forward.h>
 #include <compare>
 #include <deque>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <type_traits>
 #include <vector>
 #include <version>

diff  --git a/libcxx/include/regex b/libcxx/include/regex
index 456f34d451779..5d078744c5d84 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -763,6 +763,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
 */
 
 #include <__algorithm/find.h>
+#include <__algorithm/search.h>
 #include <__assert> // all public C++ headers provide the assertion handler
 #include <__config>
 #include <__iterator/wrap_iter.h>

diff  --git a/libcxx/include/set b/libcxx/include/set
index a2d43cd883e35..baad39616ae33 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -481,7 +481,7 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred);  // C++20
 #include <__tree>
 #include <__utility/forward.h>
 #include <compare>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <initializer_list>
 #include <iterator> // __libcpp_erase_if_container
 #include <version>

diff  --git a/libcxx/include/thread b/libcxx/include/thread
index 540f591f9d131..55e6fba8e68ff 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -90,7 +90,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
 #include <__threading_support>
 #include <__utility/forward.h>
 #include <cstddef>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <iosfwd>
 #include <memory>
 #include <system_error>

diff  --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index b7acfc3c8d00e..9b58995687704 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -525,7 +525,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
 #include <__node_handle>
 #include <__utility/forward.h>
 #include <compare>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <iterator> // __libcpp_erase_if_container
 #include <stdexcept>
 #include <tuple>

diff  --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index f4ec9f5d5e1c5..c3955bad0a29f 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -469,7 +469,7 @@ template <class Value, class Hash, class Pred, class Alloc>
 #include <__node_handle>
 #include <__utility/forward.h>
 #include <compare>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <iterator> // __libcpp_erase_if_container
 #include <version>
 

diff  --git a/libcxx/include/valarray b/libcxx/include/valarray
index d79b0b21da069..fc044f48d2a39 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -350,9 +350,14 @@ template <class T> unspecified2 end(const valarray<T>& v);
 #include <__algorithm/unwrap_iter.h>
 #include <__assert> // all public C++ headers provide the assertion handler
 #include <__config>
+#include <__functional/operations.h>
+#include <__memory/allocator.h>
+#include <__memory/uninitialized_algorithms.h>
+#include <__utility/move.h>
+#include <__utility/swap.h>
 #include <cmath>
 #include <cstddef>
-#include <functional>
+#include <functional> // TODO: Remove this include
 #include <initializer_list>
 #include <new>
 #include <version>

diff  --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/ranges.transform.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/ranges.transform.pass.cpp
index a589b9e7c5150..c30ef250237b3 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/ranges.transform.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/ranges.transform.pass.cpp
@@ -40,6 +40,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <ranges>
 
 #include "test_iterators.h"

diff  --git a/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/ranges_mismatch.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/ranges_mismatch.pass.cpp
index aa66ed9a3a500..64b1c0520346c 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/ranges_mismatch.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/ranges_mismatch.pass.cpp
@@ -24,6 +24,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <ranges>
 
 #include "test_iterators.h"

diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max.pass.cpp
index e1a478907fab5..a284fd61f0949 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max.pass.cpp
@@ -28,6 +28,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <ranges>
 
 #include "almost_satisfies_types.h"

diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max_element.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max_element.pass.cpp
index 48f5c197312df..95ef0e5e7e317 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max_element.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.max_element.pass.cpp
@@ -22,6 +22,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <random>
 #include <ranges>
 

diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min.pass.cpp
index 696961d7de7a9..b68b9a70723b3 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min.pass.cpp
@@ -26,6 +26,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <ranges>
 
 #include "almost_satisfies_types.h"

diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min_element.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min_element.pass.cpp
index 7a14f33045924..8acb571a5fd63 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min_element.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min_element.pass.cpp
@@ -22,6 +22,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <random>
 #include <ranges>
 

diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax.pass.cpp
index 15753e0e84969..76a49bca0a225 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax.pass.cpp
@@ -28,6 +28,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <ranges>
 
 #include "test_iterators.h"

diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax_element.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax_element.pass.cpp
index a9253db61b16c..4c571abb9d4c0 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax_element.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax_element.pass.cpp
@@ -23,6 +23,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <functional>
 #include <ranges>
 
 #include "almost_satisfies_types.h"

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/constraints.compile.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/constraints.compile.pass.cpp
index 783d700d0eba7..bc98d3fb584d4 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/constraints.compile.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/constraints.compile.pass.cpp
@@ -15,6 +15,7 @@
 //            (forward_range<V> || tiny-range<Pattern>)
 // class lazy_split_view;
 
+#include <functional>
 #include <ranges>
 
 #include "test_iterators.h"


        


More information about the libcxx-commits mailing list