[libcxx-commits] [PATCH] D120466: [libc++] Granularize <utility> includes

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 1 10:09:59 PST 2022


ldionne added a comment.

In D120466#3351831 <https://reviews.llvm.org/D120466#3351831>, @EricWF wrote:

> Do we have a document describing why we're doing this?

Eric, we've been doing this for roughly 1 year now. Arthur has already explained some of the reasons to you, like reducing/removing circular dependencies and being easier to understand (now you don't have to wonder why in the world is `std::swap` defined in `<type_traits>`. As a side benefit, it also makes our headers include fewer things transitively, which enforces slightly better IWYU for users.

Regarding compile-times: the right way to speed things up is to use modules and have more minimal headers, not to try to reduce the number of filesystem accesses by reducing the number of files.
Regarding diagnostics, I'm not sure how they are really made worse by this. If we wanted, we could also piggy-back on the `include_instead` pragma to tweak error messages. Clang fix-it should definitely listen to `include_instead`, at the very least.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120466/new/

https://reviews.llvm.org/D120466



More information about the libcxx-commits mailing list