[libcxx-commits] [libcxx] [libc++] IWYU `<optional>` include in system_error.cpp (PR #215288)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 20 05:15:38 PDT 2026


philnik777 wrote:

> > Before doing anything like this I think we should come to a conclusion on whether we want to use granular headers for public types in the built library or not. This sort of thing can be done in lots of places in the built library.
> > FWIW I don't think we want to do that, since our internal headers change relatively frequently and including detail headers in the built library has very limited utility AFAICT.
> 
> I was actually neutral on this until it occurred to me that doing so would be consistent with what we do in our headers. I think the main benefit here is for contributors, they know that from within the library we always strive to include granular headers.
> 
> The status quo (we include granular headers in our headers but not in source files) is a weird convention.
> 
> Also, the nice side effect is that for compile-test loops, this will recompile fewer .cpp files (although this is already quite fast).
> 
> So, I'm weakly in favour here.
> 
> @smallp-o-p please wait until @philnik777 has chimed in before merging

My main concern is that we don't build the library with modules, so we will really fast rely on transitive includes. I don't know whether we care too much though.

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


More information about the libcxx-commits mailing list