Skip to content

Commit 0dd14df

Browse files
committed
[libc++] First attempt to regroup a few modules in the modulemap
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.
1 parent 45fc655 commit 0dd14df

File tree

4 files changed

+23
-49
lines changed

4 files changed

+23
-49
lines changed

libcxx/include/module.modulemap

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,15 @@ module std_stdexcept [system] {
245245
header "stdexcept"
246246
export *
247247
}
248-
module std_stop_token {
248+
module std_stop_token [system] {
249249
header "stop_token"
250+
private header "__stop_token/atomic_unique_lock.h"
251+
private header "__stop_token/intrusive_list_view.h"
252+
private header "__stop_token/intrusive_shared_ptr.h"
253+
private header "__stop_token/stop_callback.h"
254+
private header "__stop_token/stop_source.h"
255+
private header "__stop_token/stop_state.h"
256+
private header "__stop_token/stop_token.h"
250257
export *
251258
}
252259
module std_streambuf [system] {
@@ -1584,41 +1591,25 @@ module std_private_numeric_transform_exclusive_scan [system] { header "__numeric
15841591
module std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" }
15851592
module std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" }
15861593

1587-
module std_private_pstl_backend [system] {
1594+
module std_private_pstl [system] {
15881595
header "__pstl/backend.h"
1589-
export *
1590-
}
1591-
module std_private_pstl_backend_fwd [system] {
15921596
header "__pstl/backend_fwd.h"
1593-
export *
1594-
}
1595-
module std_private_pstl_backends_default [system] {
15961597
header "__pstl/backends/default.h"
1597-
export *
1598-
}
1599-
module std_private_pstl_backends_libdispatch [system] {
16001598
header "__pstl/backends/libdispatch.h"
1601-
export *
1602-
}
1603-
module std_private_pstl_backends_serial [system] {
16041599
header "__pstl/backends/serial.h"
1605-
export *
1606-
}
1607-
module std_private_pstl_backends_std_thread [system] {
16081600
header "__pstl/backends/std_thread.h"
1609-
export *
1601+
header "__pstl/cpu_algos/any_of.h"
1602+
header "__pstl/cpu_algos/cpu_traits.h"
1603+
header "__pstl/cpu_algos/fill.h"
1604+
header "__pstl/cpu_algos/find_if.h"
1605+
header "__pstl/cpu_algos/for_each.h"
1606+
header "__pstl/cpu_algos/merge.h"
1607+
header "__pstl/cpu_algos/stable_sort.h"
1608+
header "__pstl/cpu_algos/transform.h"
1609+
header "__pstl/cpu_algos/transform_reduce.h"
1610+
header "__pstl/dispatch.h"
1611+
header "__pstl/handle_exception.h"
16101612
}
1611-
module std_private_pstl_cpu_algos_any_of [system] { header "__pstl/cpu_algos/any_of.h" }
1612-
module std_private_pstl_cpu_algos_cpu_traits [system] { header "__pstl/cpu_algos/cpu_traits.h" }
1613-
module std_private_pstl_cpu_algos_fill [system] { header "__pstl/cpu_algos/fill.h" }
1614-
module std_private_pstl_cpu_algos_find_if [system] { header "__pstl/cpu_algos/find_if.h" }
1615-
module std_private_pstl_cpu_algos_for_each [system] { header "__pstl/cpu_algos/for_each.h" }
1616-
module std_private_pstl_cpu_algos_merge [system] { header "__pstl/cpu_algos/merge.h" }
1617-
module std_private_pstl_cpu_algos_stable_sort [system] { header "__pstl/cpu_algos/stable_sort.h" }
1618-
module std_private_pstl_cpu_algos_transform [system] { header "__pstl/cpu_algos/transform.h" }
1619-
module std_private_pstl_cpu_algos_transform_reduce [system] { header "__pstl/cpu_algos/transform_reduce.h" }
1620-
module std_private_pstl_dispatch [system] { header "__pstl/dispatch.h" }
1621-
module std_private_pstl_handle_exception [system] { header "__pstl/handle_exception.h" }
16221613

16231614
module std_private_queue_fwd [system] { header "__fwd/queue.h" }
16241615

@@ -1773,23 +1764,6 @@ module std_private_span_span_fwd [system] { header "__fwd/span.h" }
17731764

17741765
module std_private_stack_fwd [system] { header "__fwd/stack.h" }
17751766

1776-
module std_private_stop_token_atomic_unique_lock [system] { header "__stop_token/atomic_unique_lock.h" }
1777-
module std_private_stop_token_intrusive_list_view [system] { header "__stop_token/intrusive_list_view.h" }
1778-
module std_private_stop_token_intrusive_shared_ptr [system] { header "__stop_token/intrusive_shared_ptr.h" }
1779-
module std_private_stop_token_stop_callback [system] { header "__stop_token/stop_callback.h" }
1780-
module std_private_stop_token_stop_source [system] {
1781-
header "__stop_token/stop_source.h"
1782-
export *
1783-
}
1784-
module std_private_stop_token_stop_state [system] {
1785-
header "__stop_token/stop_state.h"
1786-
export *
1787-
}
1788-
module std_private_stop_token_stop_token [system] {
1789-
header "__stop_token/stop_token.h"
1790-
export *
1791-
}
1792-
17931767
module std_private_string_char_traits [system] {
17941768
header "__string/char_traits.h"
17951769
export *

libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// UNSUPPORTED: c++03, c++11, c++14, c++17
1414

15-
#include <__stop_token/atomic_unique_lock.h>
15+
#include <stop_token>
1616
#include <atomic>
1717
#include <cassert>
1818
#include <chrono>

libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// UNSUPPORTED: c++03, c++11, c++14, c++17
1111

12-
#include <__stop_token/intrusive_list_view.h>
12+
#include <stop_token>
1313
#include <cassert>
1414

1515
#include "test_macros.h"

libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// UNSUPPORTED: c++03, c++11, c++14, c++17
1111

12-
#include <__stop_token/intrusive_shared_ptr.h>
12+
#include <stop_token>
1313
#include <atomic>
1414
#include <cassert>
1515
#include <utility>

0 commit comments

Comments
 (0)