Skip to content

[libc++][doc] Update the release notes for LLVM 18 #78324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libcxx/docs/Hardening.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _hardening-modes:

===============
Hardening Modes
===============
Expand Down
88 changes: 70 additions & 18 deletions libcxx/docs/ReleaseNotes/18.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,26 @@ see the `releases page <https://llvm.org/releases/>`_.
What's New in Libc++ 18.0.0?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also include the additions to the release notes from #78561 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean adding the committed changes or separate changes?

==============================

- A new debug mode has been added, replacing the legacy debug mode that was
removed in the LLVM 17 release. See ``libcxx/docs/Hardening.rst`` for more
details.
The main focus of the libc++ team has been to implement new C++20, C++23,
and C++26 features.

New hardened modes for the library have been added, replacing the legacy debug mode that was
removed in the LLVM 17 release. Unlike the legacy debug mode, some of these hardening modes are
also intended to be used in production. See :ref:`hardening-modes` for more details.

Work on the ranges support has progressed. See
:ref:`ranges-status` for the current status.

Work on the experimental C++23 module support has progressed. The ``std.compat``
module is available and the feature is retroactively available in C++20. See
:ref:`ModulesInLibcxx` for more information.

Work on the experimental C++17 Parallel STL has progressed. See
:ref:`pstl-status` for the current status.

Work on the experimental C++17 SIMD support has progressed. See
:ref:`parallelism-status` for the current status.


Implemented Papers
------------------
Expand Down Expand Up @@ -68,8 +85,9 @@ Implemented Papers
Improvements and New Features
-----------------------------

- ``std::ranges::count`` is now optimized for ``vector<bool>::iterator``, which
can lead up to 350x performance improvements.
- ``std::ranges::count`` and ``std::ranges::find`` are now optimized for
``std::vector<bool>::iterator``, which can lead up to 350x performance
improvements.

- ``std::for_each`` has been optimized for segmented iterators like ``std::deque::iterator`` in C++23 and
later, which can lead up to 40x performance improvements.
Expand Down Expand Up @@ -106,6 +124,11 @@ Improvements and New Features
``-DLIBCXX_INSTALL_MODULE_DIR=<path>``. The default location is
``${PREFIX}/share/libc++/v1``.

- AddressSanitizer annotations have been added to ``std::basic_string``.

- The libc++ source code has been formatted with ``clang-format``. This
`discourse thread <https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all>`_
contains information how to rebase downstream patches.

Deprecations and Removals
-------------------------
Expand All @@ -118,7 +141,7 @@ Deprecations and Removals
- The non-conforming constructor ``std::future_error(std::error_code)`` has been removed. Please use the
``std::future_error(std::future_errc)`` constructor provided in C++17 instead.

- `P1957 <https://wg21.link/P1957>` has been implemented in Clang and libc++ removed a code path that led to
- `P1957 <https://wg21.link/P1957>`_ has been implemented in Clang and libc++ removed a code path that led to
narrowing conversions in ``std::variant`` behaving in a non-standard way. This may change how some uses of
``std::variant``'s constructor behave in user code. The ``_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT``
macro is provided to restore the previous behavior, and it will be supported in the LLVM 18 release only.
Expand Down Expand Up @@ -155,6 +178,14 @@ Deprecations and Removals
that were removed in the C++17 and C++20 standards. Instead of using these
macros, please use the macros to re-enable individual features.

- The macro ``_LIBCPP_INLINE_VISIBILITY`` has been deprecated in LLVM 18 and
will be removed entirely in LLVM 19. The macro ``_LIBCPP_HIDE_FROM_ABI`` is
the drop-in replacement.

- The macro ``_VSTD`` has been deprecated in LLVM 18 and will be removed
entirely in LLVM 19. The code ``std`` is the drop-in replacement.


Upcoming Deprecations and Removals
----------------------------------

Expand All @@ -163,6 +194,9 @@ Upcoming Deprecations and Removals
LLVM 19
~~~~~~~

- The ``LIBCXX_EXECUTOR`` CMake variable has been deprecated. LLVM 19 will
completely remove support for the ``*_EXECUTOR`` variables.

- The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable that was used to enable the safe mode will be deprecated and setting
it will trigger an error; use the ``LIBCXX_HARDENING_MODE`` variable with the value ``extensive`` instead. Similarly,
the ``_LIBCPP_ENABLE_ASSERTIONS`` macro will be deprecated (setting it to ``1`` still enables the extensive mode in
Expand All @@ -187,6 +221,12 @@ LLVM 19
``_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES`` macros have been deprecated
in LLVM 18 and will be removed entirely in LLVM 19.

- The macro ``_LIBCPP_INLINE_VISIBILITY`` has been deprecated in LLVM 18 and
will be removed entirely in LLVM 19.

- The macro ``_VSTD`` has been deprecated in LLVM 18 and will be removed
entirely in LLVM 19.

LLVM 20
~~~~~~~

Expand All @@ -203,12 +243,12 @@ ABI Affecting Changes
- This release of libc++ added missing visibility annotations on some types in the library. Users compiling with
``-fvisbility=hidden`` may notice that additional type infos from libc++ are being exported from their ABI. This is
the correct behavior in almost all cases since exporting the RTTI is required for these types to work properly with
dynamic_cast, exceptions and other mechanisms across binaries. However, if you intend to use libc++ purely as an
``dynamic_cast``, exceptions and other mechanisms across binaries. However, if you intend to use libc++ purely as an
internal implementation detail (i.e. you use libc++ as a static archive and never export libc++ symbols from your ABI)
and you notice changes to your exported symbols list, then this means that you were not properly preventing libc++
symbols from being part of your ABI.

- The name mangling for intantiations of ``std::projected`` has changed in order to implement P2538R1. This technically
- The name mangling for instantiations of ``std::projected`` has changed in order to implement P2538R1. This technically
results in an ABI break, however in practice we expect uses of ``std::projected`` in ABI-sensitive places to be
extremely rare. Any error resulting from this change should result in a link-time error.

Expand All @@ -219,18 +259,30 @@ ABI Affecting Changes
to throw a different exception when attempting allocations that are too large
(``std::bad_alloc`` vs ``std::length_error``).

- The layout of some views inside ``std::ranges`` that use the ``movable-box`` exposition-only type as an implementation
detail has changed in order to fix a bug which could result in overwriting user data following the ``movable-box``
<https://github.com/llvm/llvm-project/issues/70506>.
This was caused by incorrect usage of the ``[[no_unique_address]]`` attribute inside the implementation of ``movable-box``.
This only affects the layout of the following views: ``take_while_view``, ``filter_view``, ``single_view``, ``drop_while_view``,
``repeat_view``, ``transform_view``, ``chunk_by_view``. In order to avoid silent breakage, an ABI tag has been added to
these views such that their mangled name will be different starting in this version of libc++.
As a result, attempting to call a function that expects one of these views will fail to link until the code has been rebuilt
against a matching version of libc++. In practice, we believe it is unusual for these views to appear at ABI boundaries so this
should not be a major problem for most users. However it is probably worth auditing ranges-heavy code for ABI boundaries that
- The layout of some range adaptors that use the ``movable-box`` exposition-only type as an implementation
detail has changed in order to fix a `bug <https://github.com/llvm/llvm-project/issues/70506>`_ which could result in
overwriting user data following the ``movable-box``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
overwriting user data following the ``movable-box``.
overwriting user data following the *``movable-box``*.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've omitted this one too.

This bug was caused by incorrect usage of the ``[[no_unique_address]]`` attribute inside the implementation of ``movable-box``.
This fix affects the layout of the following views: ``take_while_view``, ``filter_view``, ``single_view``, ``drop_while_view``,
``repeat_view``, ``transform_view``, ``chunk_by_view``. In order to avoid silent breakage as a result of this fix, an ABI tag has been added to
these views such that their mangled name will be different starting in this version of libc++.
As a result, attempting to call a function that expects one of these views will fail to link until the code has been rebuilt
against a matching version of libc++. In practice, we believe it is unusual for these views to appear at ABI boundaries so this
should not be a major problem for most users. However it is probably worth auditing ranges-heavy code for ABI boundaries that
would contain these views, or for types that contain these views as members and which are passed across ABI boundaries.

- Some properties of libc++ may cause ODR-violations when mixing multiple libc++
instances. To avoid these, often benign, ODR-violations the ODR-affecting
properties are now part of the ABI tag. The ODR-affecting properties are:

- library version (This was part of the ABI tag prior to LLVM 18.)
- exceptions vs no-exceptions
- hardening mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add:

This should not be ABI-affecting except that libc++ will be more robust against different configurations of it being used in different translation units.

Also, the library version was already part of the ABI tag, so that property wasn't added in LLVM 18.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment regarding the version too.


This should not be ABI-affecting except that libc++ will be more robust
against different configurations of it being used in different translation
units.

Build System Changes
--------------------

Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Parallelism.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. parallelism-status:
.. _parallelism-status:

====================================
libc++ Parallelism TS Status (N4808)
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Ranges.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. ranges-status:
.. _ranges-status:

================================
libc++ Ranges Status
Expand Down