[libcxx-commits] [libcxx] [libc++] Stabilize transitive includes for C++23 (PR #134143)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 15 12:26:16 PDT 2025
philnik777 wrote:
> > > > I think the rationale makes sense, but I'm not actually sure the solution is the right one. Would keeping the public headers actually help with the breakages you've seen?
> > >
> > >
> > > I think it would, as with all the other transitive includes breakages? You seem to imply that we'd want another solution, but I'm not certain I follow your thought here. Can you elaborate?
> >
> >
> > We're not including top-level headers anymore in most of places. Consider for example `<functional>`. The header provides `vector`, but `<vector>` isn't listed in the transitive includes of `<functional>` in C++23, since we only include `<__vector/vector.h>`. That means that if we managed to remove that dependency, the transitive includes test would be completely happy, even though we've probably broken some user by removing it. This change will make it less likely that we're breaking someone through granularizing non-granular headers, but that basically doesn't happen anymore anyways. We're more likely to move some code around and remove a dependency that way I think.
>
> I see what you mean now, thanks for explaining. However, taking the `<functional>` example: `std::vector` must have been provided by `<functional>` pretty recently, no earlier than since we started splitting headers, right? Because if it was provided before then, the only way it would have been provided is via `#include <vector>`, and that would have been preserved through our transitive inclusion stability.
`std::vector` doesn't have to be a recent addition. Remember, we've removed transitive includes in C++23 until now, so we've removed dependencies that were there before the header split. The C++20 transitive includes list does have `<vector>` as a dependency on `<functional>`. That's why I'm not convinced the current solution is actually that helpful for C++23.
https://github.com/llvm/llvm-project/pull/134143
More information about the libcxx-commits
mailing list