[libcxx-commits] [libcxx] 57fe53c - [libc++] First attempt to regroup a few modules in the modulemap (#98214)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 30 13:54:12 PDT 2024
Author: Louis Dionne
Date: 2024-08-30T16:54:09-04:00
New Revision: 57fe53cae40351ebd079a9a0105addf4ad2e97dd
URL: https://github.com/llvm/llvm-project/commit/57fe53cae40351ebd079a9a0105addf4ad2e97dd
DIFF: https://github.com/llvm/llvm-project/commit/57fe53cae40351ebd079a9a0105addf4ad2e97dd.diff
LOG: [libc++] First attempt to regroup a few modules in the modulemap (#98214)
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.
Added:
Modified:
libcxx/include/module.modulemap
libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp
libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp
libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 13d0dce34d97e3..f193b5d95f49f5 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] {
@@ -1592,41 +1599,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" }
@@ -1781,23 +1772,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 2a9b828f4389ce..44d51921ac74ad 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
@@ -5,12 +5,11 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-//
-// UNSUPPORTED: no-threads
-
-// XFAIL: availability-synchronization_library-missing
+// UNSUPPORTED: no-threads
// UNSUPPORTED: c++03, c++11, c++14, c++17
+// XFAIL: availability-synchronization_library-missing
+// ADDITIONAL_COMPILE_FLAGS: -Wno-private-header
#include <__stop_token/atomic_unique_lock.h>
#include <atomic>
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 85cd9786258955..d8cd2fb68e132e 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
@@ -8,6 +8,7 @@
//
// UNSUPPORTED: c++03, c++11, c++14, c++17
+// ADDITIONAL_COMPILE_FLAGS: -Wno-private-header
#include <__stop_token/intrusive_list_view.h>
#include <cassert>
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 47440015f2c50c..99d4226662a0b7 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
@@ -8,6 +8,7 @@
//
// UNSUPPORTED: c++03, c++11, c++14, c++17
+// ADDITIONAL_COMPILE_FLAGS: -Wno-private-header
#include <__stop_token/intrusive_shared_ptr.h>
#include <atomic>
More information about the libcxx-commits
mailing list