[libcxx-commits] [libcxx] [libc++] First attempt to regroup a few modules in the modulemap (PR #98214)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 15 11:09:34 PDT 2024


================
@@ -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"
----------------
ldionne wrote:

This seems like a surprising best practice. Aren't we trying to stop building so many small modules in the first place? The way I understand it:

- `stop_token` is a module, and it has both public APIs and private APIs, as denoted by the public/private headers declared in that module
- `type_traits` is a module, but it has almost exclusively public headers because `__type_traits/xxxxx.h` are meant to be included directly from other parts of the code.

Either way -- we don't currently expect other parts of the code to include implementation details of `<stop_token>`. If they did, I would argue for moving these parts (e.g. `intrusive_shared_ptr`) to another module that contains generally-useful utilities, or to `memory`, or something. But obviously `<stop_token>` should stay a leaf module whatever happens, and in that sense I think it makes most sense to define it the way it is currently defined (with private headers).

https://github.com/llvm/llvm-project/pull/98214


More information about the libcxx-commits mailing list