Skip to content

Commit

Permalink
[libc++] First attempt to regroup a few modules in the modulemap (#98214
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
ldionne authored Aug 30, 2024
1 parent 982d244 commit 57fe53c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 50 deletions.
66 changes: 20 additions & 46 deletions libcxx/include/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down Expand Up @@ -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" }

Expand Down Expand Up @@ -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 *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 57fe53c

Please sign in to comment.