[libcxx-commits] [libcxx] [libc++][RFC] Only include what is required by-version in the umbrella headers (PR #83740)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 7 04:38:00 PST 2024
philnik777 wrote:
> As mentioned earlier I had a patch on Phab with a slightly different approach. So yes in general I like the idea of reducing the size of the includes.
>
> I wonder about the approach you take; your examples only show how to handle granularized headers. I wonder what do you propose for non-granularized headers?
>
> For example, `<ostream>` includes `<print>` the `<print>` header has been introduced in C++23. This header has some includes not used in `<ostream>`.
>
> Do you propose to keep the `<ostream>` header unchanged or do you want to guard the include of `<print>` with C++23?
I propose to either keep them unchanged, or to granularize it if we think it's worth the reduced include size. IIUC the main problem we have is `<format>` and the different `formatter` specializations that have to be provided through different headers resulting in huge amounts of transitive includes. Since they can be implemented separately from the rest of the files, we can simply move them into new detail headers and include these detail headers conditionally in the umbrella header.
In essence, I want the only place where we conditionally include headers to be the umbrella headers.
https://github.com/llvm/llvm-project/pull/83740
More information about the libcxx-commits
mailing list