[libc++] Re-add transitive includes that had been removed since LLVM 14
This commit re-adds transitive includes that had been removed by
4cd04d1687f1, c36870c8e79c, a83f4b9cda57, 1458458b558d, 2e2f3158c604,
and 489637e66dd3. This should cover almost all the includes that had
been removed since LLVM 14 and that would contribute to breaking user
code when releasing LLVM 15.
It is possible to disable the inclusion of these headers by defining
_LIBCPP_REMOVE_TRANSITIVE_INCLUDES. The intent is that vendors will
enable that macro and start fixing downstream issues immediately. We
can then remove the macro (and the transitive includes) by default in
a future release. That way, we will break users only once by removing
transitive includes in bulk instead of doing it bit by bit a every
release, which is more disruptive for users.
Note 1: The set of headers to re-add was found by re-generating the
transitive include test on a checkout of release/14.x, which
provided the list of all transitive includes we used to provide.
Note 2: Several includes of <vector>, <optional>, <array> and <unordered_map>
have been added in this commit. These transitive inclusions were
added when we implemented boyer_moore_searcher in <functional>.
Note 3: This is a best effort patch to try and resolve downstream breakage
caused since branching LLVM 14. I wasn't able to perfectly mirror
transitive includes in LLVM 14 for a few headers, so I added a
release note explaining it. To summarize, adding boyer_moore_searcher
created a bunch of circular dependencies, so we have to break
backwards compatibility in a few cases.
Differential Revision: https://reviews.llvm.org/D128661
NOKEYCHECK=True
GitOrigin-RevId: de4a57cb21a19179d7be830967e642b868a05a91
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index c7f9cb3..dfc849c 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -97,19 +97,15 @@
``<filesystem>`` header. The associated macro
``_LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM`` has also been removed.
-- Some libc++ headers no longer transitively include all of:
- - ``<algorithm>``
- - ``<chrono>``
- - ``<exception>``
- - ``<functional>``
- - ``<iterator>``
- - ``<new>``
- - ``<typeinfo>``
- - ``<utility>``
+- Libc++ is getting ready to remove unnecessary transitive inclusions. This may
+ break your code in the future. To future-proof your code to these removals,
+ please compile your code with ``_LIBCPP_REMOVE_TRANSITIVE_INCLUDES`` defined
+ and fix any compilation error resulting from missing includes.
- If, after updating libc++, you see compiler errors related to missing declarations
- in namespace ``std``, it might be because one of your source files now needs to
- include one or more of the headers listed above.
+- The ``<algorithm>``, ``<array>``, ``<optional>``, ``<unordered_map>`` and ``<vector>``
+ headers no longer transitively include the ``<functional>`` header. If you see compiler
+ errors related to missing declarations in namespace ``std``, make sure you have the
+ necessary includes.
- The integer distributions ``binomial_distribution``, ``discrete_distribution``,
``geometric_distribution``, ``negative_binomial_distribution``, ``poisson_distribution``,