[libc++] Take advantage of -fexperimental-library in libc++
When -fexperimental-library is passed, libc++ will now pick up the
appropriate __has_feature flag defined by Clang to enable the
experimental library features.
As a fly-by, also update the documentation for the various TSes.
Differential Revision: https://reviews.llvm.org/D130176
NOKEYCHECK=True
GitOrigin-RevId: deb3b5552f04656dee27067b2cc68c906012cfe4
diff --git a/docs/DesignDocs/ExperimentalFeatures.rst b/docs/DesignDocs/ExperimentalFeatures.rst
index 2241496..defe0e4 100644
--- a/docs/DesignDocs/ExperimentalFeatures.rst
+++ b/docs/DesignDocs/ExperimentalFeatures.rst
@@ -143,7 +143,8 @@
`FileSystem TS <https://wg21.link/N4100>`__
-------------------------------------------
The FileSystem TS was accepted (in totality) for C++17.
-The FileSystem TS implementation was shipped in namespace ``std`` in LLVM 7.0, and will be removed in LLVM 11.0 (due to the lack of deprecation warnings before LLVM 9.0).
+The FileSystem TS implementation was shipped in namespace ``std`` in LLVM 7.0, and was
+removed in LLVM 11.0 (due to the lack of deprecation warnings before LLVM 9.0).
Parallelism TS `V1 <https://wg21.link/N4507>`__ and `V2 <https://wg21.link/N4706>`__
------------------------------------------------------------------------------------
@@ -152,8 +153,10 @@
`Coroutines TS <https://wg21.link/N4680>`__
-------------------------------------------
-The Coroutines TS is not yet part of a shipping standard.
-We are shipping (as of v5.0) an implementation of the Coroutines TS in namespace ``std::experimental``.
+The Coroutines TS was accepted for C++20.
+An implementation of the Coroutines TS was shipped in LLVM 5.0 in namespace ``std::experimental``,
+and C++20 Coroutines shipped in LLVM 14.0. The implementation of the Coroutines TS in ``std::experimental``
+will be removed in LLVM 16.0.
`Networking TS <https://wg21.link/N4656>`__
-------------------------------------------
@@ -162,13 +165,15 @@
`Ranges TS <https://wg21.link/N4685>`__
---------------------------------------
-The Ranges TS is not yet part of a shipping standard.
-We have not yet shipped an implementation of the Ranges TS.
+The Ranges TS was accepted for C++20.
+We will not ship an implementation of the Ranges TS, however we are actively working on
+the implementation of C++20 Ranges.
`Concepts TS <https://wg21.link/N4641>`__
-----------------------------------------
-The Concepts TS is not yet part of a shipping standard, but it has been adopted into the C++20 working draft.
-We have not yet shipped an implementation of the Concepts TS.
+The Concepts TS was accepted for C++20.
+We will not ship an implementation of the Concepts TS, however we are shipping an
+implementation of C++20 Concepts.
`Concurrency TS <https://wg21.link/P0159>`__
--------------------------------------------
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index 2708ff2..96e98fd 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -89,6 +89,13 @@
should include assertions or not by default. For details, see
:ref:`the documentation <assertions-mode>` about this new feature.
+- Clang now implements the ``-fexperimental-library`` flag. This flag can be used to
+ enable experimental library features such as TSes and other in-progress work like
+ ``<ranges>`` and ``<format>``. Using this flag makes it unnecessary to manually link
+ against ``libc++experimental.a`` -- just use ``-fexperimental-library`` and the
+ compiler will do what's needed to make experimental features work. However, be
+ aware that experimental features are not stable!
+
- The implementation of the function ``std::to_chars`` for integral types using
base 10 has moved from the dylib to the header. This means the function no
longer has a minimum deployment target.
diff --git a/docs/Status/Cxx20.rst b/docs/Status/Cxx20.rst
index 742d91a..43d29c5 100644
--- a/docs/Status/Cxx20.rst
+++ b/docs/Status/Cxx20.rst
@@ -42,7 +42,7 @@
.. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class] and |sect|\ [mem.poly.allocator.class].
.. [#note-P0645] P0645: The paper is implemented but still marked as an incomplete feature
- (the feature-test macro is not set and the libary is only available when built with ``-D_LIBCPP_ENABLE_EXPERIMENTAL``).
+ (the feature-test macro is not set and the libary is only available when built with ``-fexperimental-library``).
Not yet implemented LWG-issues will cause API and ABI breakage.
.. [#note-P0966] P0966: It was previously erroneously marked as complete in version 8.0. See `bug 45368 <https://llvm.org/PR45368>`__.
.. [#note-P0619] P0619: Only sections D.8, D.9, D.10 and D.13 are implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone.
diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst
index 47cbe2d..aa58120 100644
--- a/docs/UsingLibcxx.rst
+++ b/docs/UsingLibcxx.rst
@@ -41,12 +41,10 @@
are either Technical Specifications (TSes) or official features that were voted to
the Standard but whose implementation is not complete or stable yet in libc++. Those
are disabled by default because they are neither API nor ABI stable. However, the
-``_LIBCPP_ENABLE_EXPERIMENTAL`` macro can be defined to turn those features on. Note
-that you will also need to link to the appropriate ``libc++experimental.a`` static
-archive.
+``-fexperimental-library`` compiler flag can be defined to turn those features on.
.. warning::
- Experimental libraries are Experimental.
+ Experimental libraries are experimental.
* The contents of the ``<experimental/...>`` headers and the associated static
library will not remain compatible between versions.
* No guarantees of API or ABI stability are provided.
@@ -54,6 +52,12 @@
the experimental feature is removed two releases after the non-experimental
version has shipped. The full policy is explained :ref:`here <experimental features>`.
+.. note::
+ On compilers that do not support the ``-fexperimental-library`` flag, users can
+ define the ``_LIBCPP_ENABLE_EXPERIMENTAL`` macro and manually link against the
+ appropriate static library (usually shipped as ``libc++experimental.a``) to get
+ access to experimental library features.
+
Using libc++ when it is not the system default
==============================================