[libcxx-commits] [libcxx] [libc++][modules] Remove a dependency of __type_traits/invoke.h on __utility (PR #106795)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 3 11:38:32 PDT 2024


ldionne wrote:

> I think I'd rather go for having an extra module for now. I have a feeling that we can absorb most of the modulemap into a single large module, which would make the cross-module dependencies not a problem.

I just tried and this actually doesn't solve the problem after all. The problem is that:
- `<__utility/forward.h>` uses `<__type_traits/is_reference.h>` and `<__type_traits/remove_reference.h>`
- `<__type_traits/something>` uses `<__utility/forward.h>`

That's the cycle, and even if `__utility/forward.h` is alone in its own module, it still creates a loop with `__type_traits`. So either we break `<__type_traits/invoke.h>` out of `__type_traits`, or we remove the dependency (which can be done like this patch does, or by not including `__type_traits` from `forward.h` but that seems more complicated).

Also note that the moment we make `__type_traits/` its own top-level module, this failure stops being theoretical -- we would catch it in the CI.

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


More information about the libcxx-commits mailing list