[libcxx-commits] [libcxx] [libc++] First attempt to regroup a few modules in the modulemap (PR #98214)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 9 13:25:38 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
We split up all the headers into top-level modules when we broke up cycles with the C compatibility headers. However, this resulted in a large number of small modules, which is awkward and clearly against the philosophy of Clang modules. This was necessary to make things work.
This patch regroups a few headers from two leaf modules: stop_token and pstl. It should be pretty uncontroversial that grouping these headers into a single module doesn't introduce any cyclic dependency, yet it's a first step towards reducing the number of top-level modules we have in our modulemap.
---
Full diff: https://github.com/llvm/llvm-project/pull/98214.diff
4 Files Affected:
- (modified) libcxx/include/module.modulemap (+20-46)
- (modified) libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp (+1-1)
- (modified) libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp (+1-1)
- (modified) libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp (+1-1)
``````````diff
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 9ffccf66ff094..59ad740ac164a 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -245,8 +245,15 @@ module std_stdexcept [system] {
header "stdexcept"
export *
}
-module std_stop_token {
+module std_stop_token [system] {
header "stop_token"
+ private header "__stop_token/atomic_unique_lock.h"
+ private header "__stop_token/intrusive_list_view.h"
+ private header "__stop_token/intrusive_shared_ptr.h"
+ private header "__stop_token/stop_callback.h"
+ private header "__stop_token/stop_source.h"
+ private header "__stop_token/stop_state.h"
+ private header "__stop_token/stop_token.h"
export *
}
module std_streambuf [system] {
@@ -1584,41 +1591,25 @@ module std_private_numeric_transform_exclusive_scan [system] { header "__numeric
module std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" }
module std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" }
-module std_private_pstl_backend [system] {
+module std_private_pstl [system] {
header "__pstl/backend.h"
- export *
-}
-module std_private_pstl_backend_fwd [system] {
header "__pstl/backend_fwd.h"
- export *
-}
-module std_private_pstl_backends_default [system] {
header "__pstl/backends/default.h"
- export *
-}
-module std_private_pstl_backends_libdispatch [system] {
header "__pstl/backends/libdispatch.h"
- export *
-}
-module std_private_pstl_backends_serial [system] {
header "__pstl/backends/serial.h"
- export *
-}
-module std_private_pstl_backends_std_thread [system] {
header "__pstl/backends/std_thread.h"
- export *
+ header "__pstl/cpu_algos/any_of.h"
+ header "__pstl/cpu_algos/cpu_traits.h"
+ header "__pstl/cpu_algos/fill.h"
+ header "__pstl/cpu_algos/find_if.h"
+ header "__pstl/cpu_algos/for_each.h"
+ header "__pstl/cpu_algos/merge.h"
+ header "__pstl/cpu_algos/stable_sort.h"
+ header "__pstl/cpu_algos/transform.h"
+ header "__pstl/cpu_algos/transform_reduce.h"
+ header "__pstl/dispatch.h"
+ header "__pstl/handle_exception.h"
}
-module std_private_pstl_cpu_algos_any_of [system] { header "__pstl/cpu_algos/any_of.h" }
-module std_private_pstl_cpu_algos_cpu_traits [system] { header "__pstl/cpu_algos/cpu_traits.h" }
-module std_private_pstl_cpu_algos_fill [system] { header "__pstl/cpu_algos/fill.h" }
-module std_private_pstl_cpu_algos_find_if [system] { header "__pstl/cpu_algos/find_if.h" }
-module std_private_pstl_cpu_algos_for_each [system] { header "__pstl/cpu_algos/for_each.h" }
-module std_private_pstl_cpu_algos_merge [system] { header "__pstl/cpu_algos/merge.h" }
-module std_private_pstl_cpu_algos_stable_sort [system] { header "__pstl/cpu_algos/stable_sort.h" }
-module std_private_pstl_cpu_algos_transform [system] { header "__pstl/cpu_algos/transform.h" }
-module std_private_pstl_cpu_algos_transform_reduce [system] { header "__pstl/cpu_algos/transform_reduce.h" }
-module std_private_pstl_dispatch [system] { header "__pstl/dispatch.h" }
-module std_private_pstl_handle_exception [system] { header "__pstl/handle_exception.h" }
module std_private_queue_fwd [system] { header "__fwd/queue.h" }
@@ -1773,23 +1764,6 @@ module std_private_span_span_fwd [system] { header "__fwd/span.h" }
module std_private_stack_fwd [system] { header "__fwd/stack.h" }
-module std_private_stop_token_atomic_unique_lock [system] { header "__stop_token/atomic_unique_lock.h" }
-module std_private_stop_token_intrusive_list_view [system] { header "__stop_token/intrusive_list_view.h" }
-module std_private_stop_token_intrusive_shared_ptr [system] { header "__stop_token/intrusive_shared_ptr.h" }
-module std_private_stop_token_stop_callback [system] { header "__stop_token/stop_callback.h" }
-module std_private_stop_token_stop_source [system] {
- header "__stop_token/stop_source.h"
- export *
-}
-module std_private_stop_token_stop_state [system] {
- header "__stop_token/stop_state.h"
- export *
-}
-module std_private_stop_token_stop_token [system] {
- header "__stop_token/stop_token.h"
- export *
-}
-
module std_private_string_char_traits [system] {
header "__string/char_traits.h"
export *
diff --git a/libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp b/libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp
index 2a9b828f4389c..bd08ac17e9964 100644
--- a/libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp
@@ -12,7 +12,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
-#include <__stop_token/atomic_unique_lock.h>
+#include <stop_token>
#include <atomic>
#include <cassert>
#include <chrono>
diff --git a/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp b/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp
index 85cd978625895..35b96c0d84fea 100644
--- a/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp
@@ -9,7 +9,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
-#include <__stop_token/intrusive_list_view.h>
+#include <stop_token>
#include <cassert>
#include "test_macros.h"
diff --git a/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp b/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
index 47440015f2c50..3ba8f484d0c64 100644
--- a/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
@@ -9,7 +9,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
-#include <__stop_token/intrusive_shared_ptr.h>
+#include <stop_token>
#include <atomic>
#include <cassert>
#include <utility>
``````````
</details>
https://github.com/llvm/llvm-project/pull/98214
More information about the libcxx-commits
mailing list