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

Vassil Vassilev via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 3 11:16:32 PDT 2024


vgvassilev wrote:

> > Thanks for clarifying. Unfortunately that's not a workable solution for us. We would like to have a way to build a single module as per other discussion threads. What would be a way forward to implement that upstream? I still think that we can use cmake to build a std.modulemap file which wraps the content of the default modulemap.
> 
> A single module can never work. For example libc++'s `math.h` includes the base system's `math.h` header, but other parts of the system module will include e.g. libc++'s `stddef.h`. So if libc++'s `math.h` and libc++'s `stddef.h` are in the same module, we automatically have a cycle. This doesn't show up unless you have a properly modularized SDK, which might be why this hasn't been a problem for you so far.

I am stuck understanding this. We do have one of the best modularized framework infrastructure (claim is entirely mine here). I do not see the problem you are describing. The one I think you might refer to is/was solved by `[no_undeclared_includes]`. I cannot reproduce the setup you are referring to and this never was a problem with the old approach. Can you build a reproducer for me?

> While we can't have the C compatibility headers in a single top-level module, I actually don't see why we couldn't have the other libc++ headers in a single top-level module. I think that would be doable.

I am not sure I follow but how single top-level module per header file does not fall into your description for a cycle above?

> I'm not sure what people are trying to do with modules outside of Swift/Apple environments. There are very few other environments that have any module support at the libc layer so it doesn't really make sense to try to use the libc++ module. I think most people just want pch...

We do need modules because PCH does not scale beyond 512 Mb due to the offsets in the AST reader.

I'd like to extend that discussion by pinging @ChuanqiXu9, @zygoloid and @Bigcheese. There must that I or you guys are missing...


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


More information about the libcxx-commits mailing list