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

Ian Anderson via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 15 11:23:08 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"
----------------
ian-twilightcoder wrote:

Submodules only control visibility. If you make a submodule for all of the __stop_token header, it'll still build all of them into a single pcm. It only controls what's visible when something includes __stop_token/atomic_unique_lock.h. i.e. if you have this.

```
module std_stop_token [system] {
  header "stop_token"
  module atomic_unique_lock { private header "__stop_token/atomic_unique_lock.h" }
}
```

Then std_stop_token builds the same as it does the way you have it right now and still cuts down on all the module builds/pcms. The difference is that if something includes __stop_token/atomic_unique_lock.h, then it behaves like non-modular C and you only get __stop_token/atomic_unique_lock.h. But the way you have it, if you build with modules then you _also_ get stop_token and all of the other __stop_token headers, which is pretty unintuitive.

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


More information about the libcxx-commits mailing list