[libc++] Remove the chrono include from algorithm
authorIan Anderson <iana@apple.com>
Sat, 15 Apr 2023 00:51:41 +0000 (17:51 -0700)
committerIan Anderson <iana@apple.com>
Sat, 22 Apr 2023 18:31:19 +0000 (11:31 -0700)
commit1eb74f7e83ffb3f9d00e5987cead3b12e00bbe82
tree17cf2d400aa7fe2521d6687b4bbe6ac4280f997d
parentf639a17892d0b3ffbd062596d360d30213aa1d15
[libc++] Remove the chrono include from algorithm

algorithm's include of chrono causes include cycles:

```
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> algorithm

algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> array -> algorithm

algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> unordered_map -> algorithm

algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> vector -> algorithm
```

This is a problem for clang modules after the std mega module is broken up, because it becomes a module cycle which is a hard error.

All of the includes in the `__chrono` and `__format` headers are being used and so can't be removed. algorithm's include of chrono is already removed in C++20, whereas the array, string_view, unordered_map, vector includes of algorithm aren't removed until C++23 (and it's 4x the includes that would need removing). Unconditionally remove the chrono include from algorithm in all versions, so that the module breakup can happen (the module has to apply to all C++ versions).

Reviewed By: Mordante, #libc

Differential Revision: https://reviews.llvm.org/D148405
libcxx/docs/ReleaseNotes.rst
libcxx/include/algorithm
libcxx/test/libcxx/transitive_includes/cxx03.csv
libcxx/test/libcxx/transitive_includes/cxx11.csv
libcxx/test/libcxx/transitive_includes/cxx14.csv
libcxx/test/libcxx/transitive_includes/cxx17.csv