blob: b13e42f1dd2eb693f2197a6bdb549c0c0a775b4d [file] [log] [blame]
Eric Fiselierd720d1f2015-08-22 19:40:49 +00001.. _index:
2
3=============================
4"libc++" C++ Standard Library
5=============================
6
7Overview
8========
9
Mehdi Amini032f15a2017-01-25 17:00:30 +000010libc++ is a new implementation of the C++ standard library, targeting C++11 and
11above.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000012
13* Features and Goals
14
15 * Correctness as defined by the C++11 standard.
16 * Fast execution.
17 * Minimal memory use.
18 * Fast compile times.
19 * ABI compatibility with gcc's libstdc++ for some low-level features
20 such as exception objects, rtti and memory allocation.
21 * Extensive unit tests.
22
23* Design and Implementation:
24
25 * Extensive unit tests
26 * Internal linker model can be dumped/read to textual format
27 * Additional linking features can be plugged in as "passes"
28 * OS specific and CPU specific code factored out
29
30
31Getting Started with libc++
Louis Dionnef5cd4c72021-07-06 15:47:29 -040032===========================
Eric Fiselierd720d1f2015-08-22 19:40:49 +000033
34.. toctree::
Louis Dionne4b1b70d2021-07-06 10:39:01 -040035 :maxdepth: 1
Eric Fiselierd720d1f2015-08-22 19:40:49 +000036
Louis Dionne743b1c02018-09-06 15:05:43 +000037 ReleaseNotes
Eric Fiselierd720d1f2015-08-22 19:40:49 +000038 UsingLibcxx
39 BuildingLibcxx
40 TestingLibcxx
Marek Kurdejd5bc4d92020-12-02 08:52:35 +010041 Contributing
Louis Dionnee96350d2021-07-06 09:46:29 -040042 Status/Cxx14
43 Status/Cxx17
44 Status/Cxx20
45 Status/Cxx2b
46 Status/Ranges
47 Status/Format
Eric Fiselierd720d1f2015-08-22 19:40:49 +000048
Eric Fiseliera28db902015-09-05 05:29:23 +000049
Eric Fiselier4e860492019-01-16 01:37:43 +000050.. toctree::
51 :hidden:
52
Louis Dionnef34ac042020-11-19 14:22:28 -050053 AddingNewCIJobs
Eric Fiselier4e860492019-01-16 01:37:43 +000054 FeatureTestMacroTable
55
Louis Dionnef34ac042020-11-19 14:22:28 -050056
Eric Fiselierd720d1f2015-08-22 19:40:49 +000057Current Status
Louis Dionnef5cd4c72021-07-06 15:47:29 -040058==============
Eric Fiselierd720d1f2015-08-22 19:40:49 +000059
60After its initial introduction, many people have asked "why start a new
61library instead of contributing to an existing library?" (like Apache's
62libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
63reasons, but some of the major ones are:
64
Eric Fiselier98596ba2015-09-05 06:50:03 +000065* From years of experience (including having implemented the standard
66 library before), we've learned many things about implementing
67 the standard containers which require ABI breakage and fundamental changes
68 to how they are implemented. For example, it is generally accepted that
69 building std::string using the "short string optimization" instead of
70 using Copy On Write (COW) is a superior approach for multicore
71 machines (particularly in C++11, which has rvalue references). Breaking
72 ABI compatibility with old versions of the library was
73 determined to be critical to achieving the performance goals of
74 libc++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000075
Eric Fiselier98596ba2015-09-05 06:50:03 +000076* Mainline libstdc++ has switched to GPL3, a license which the developers
77 of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
78 independently extended to support C++11, but this would be a fork of the
79 codebase (which is often seen as worse for a project than starting a new
80 independent one). Another problem with libstdc++ is that it is tightly
81 integrated with G++ development, tending to be tied fairly closely to the
82 matching version of G++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000083
Eric Fiselier98596ba2015-09-05 06:50:03 +000084* STLport and the Apache libstdcxx library are two other popular
85 candidates, but both lack C++11 support. Our experience (and the
86 experience of libstdc++ developers) is that adding support for C++11 (in
87 particular rvalue references and move-only types) requires changes to
88 almost every class and function, essentially amounting to a rewrite.
89 Faced with a rewrite, we decided to start from scratch and evaluate every
90 design decision from first principles based on experience.
91 Further, both projects are apparently abandoned: STLport 5.2.1 was
92 released in Oct'08, and STDCXX 4.2.1 in May'08.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000093
Louis Dionnef5cd4c72021-07-06 15:47:29 -040094
Eric Fiselierd720d1f2015-08-22 19:40:49 +000095Platform and Compiler Support
Louis Dionnef5cd4c72021-07-06 15:47:29 -040096=============================
Eric Fiselierd720d1f2015-08-22 19:40:49 +000097
Louis Dionnef5cd4c72021-07-06 15:47:29 -040098Libc++ aims to support common compilers that implement the C++11 Standard. In order to strike a
99good balance between stability for users and maintenance cost, testing coverage and development
100velocity, libc++ drops support for older compilers as newer ones are released.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000101
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400102============ =============== ========================== =====================
103Compiler Versions Restrictions Support policy
104============ =============== ========================== =====================
105Clang 11, 12 latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_
106AppleClang 12 latest stable release per `Xcode's release page <https://developer.apple.com/documentation/xcode-release-notes>`_
107GCC 11 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
108============ =============== ========================== =====================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000109
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400110Libc++ also supports common platforms and architectures:
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000111
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400112=============== ========================= ============================
113Target platform Target architecture Notes
114=============== ========================= ============================
115macOS 10.9+ i386, x86_64, arm64 Building the shared library itself requires targetting macOS 10.11+
116FreeBSD 10+ i386, x86_64, arm
117Linux i386, x86_64, arm, arm64
118Windows x86_64
119=============== ========================= ============================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000120
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400121Generally speaking, libc++ should work on any platform that provides a fairly complete
122C Standard Library. It is also possible to turn off parts of the library for use on
123systems that provide incomplete support.
Louis Dionne678dc852020-02-12 17:01:19 +0100124
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400125However, libc++ aims to provide a high-quality implementation of the C++ Standard
126Library, especially when it comes to correctness. As such, we aim to have test coverage
127for all the platforms and compilers that we claim to support. If a platform or compiler
Martin Storsjöe9747ef2021-07-13 14:24:51 +0300128is not listed here, it is not officially supported. It may happen to work, and
129in practice the library is known to work on some platforms not listed here, but
130we don't make any guarantees. If you would like your compiler and/or platform
Louis Dionne49696152021-08-17 10:52:12 -0400131to be formally supported and listed here, please work with the libc++ team to set
132up testing for your configuration.
Louis Dionne678dc852020-02-12 17:01:19 +0100133
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000134
135C++ Dialect Support
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400136===================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000137
138* C++11 - Complete
Louis Dionnee96350d2021-07-06 09:46:29 -0400139* :ref:`C++14 - Complete <cxx14-status>`
140* :ref:`C++17 - In Progress <cxx17-status>`
141* :ref:`C++20 - In Progress <cxx20-status>`
Mark de Wever8b38f962021-01-22 19:03:14 +0100142* :ref:`C++2b - In Progress <cxx2b-status>`
Eric Fiselier4e860492019-01-16 01:37:43 +0000143* :ref:`C++ Feature Test Macro Status <feature-status>`
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000144
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400145
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000146Notes and Known Issues
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400147======================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000148
149This list contains known issues with libc++
150
151* Building libc++ with ``-fno-rtti`` is not supported. However
152 linking against it with ``-fno-rtti`` is supported.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000153
154
Eric Fiseliera72fd802015-09-06 23:22:02 +0000155A full list of currently open libc++ bugs can be `found here`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000156
Eric Fiselier5d604012017-02-17 08:37:03 +0000157.. __: https://bugs.llvm.org/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000158
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400159
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000160Design Documents
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400161================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000162
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000163.. toctree::
164 :maxdepth: 1
165
Eric Fiselier1a1c74b2015-10-14 00:22:05 +0000166 DesignDocs/ABIVersioning
Louis Dionne0df08db2021-06-08 11:15:27 -0400167 DesignDocs/AtomicDesign
168 DesignDocs/CapturingConfigInfo
169 DesignDocs/DebugMode
Louis Dionne37677132019-06-11 14:48:40 +0000170 DesignDocs/ExperimentalFeatures
Eric Fiselierf9954532019-06-11 22:53:49 +0000171 DesignDocs/ExtendedCXX03Support
Louis Dionne0df08db2021-06-08 11:15:27 -0400172 DesignDocs/FeatureTestMacros
173 DesignDocs/FileTimeType
zoecarver08de8162021-02-05 11:24:38 -0800174 DesignDocs/NoexceptPolicy
Louis Dionne0df08db2021-06-08 11:15:27 -0400175 DesignDocs/ThreadingSupportAPI
176 DesignDocs/UniquePtrTrivialAbi
177 DesignDocs/VisibilityMacros
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000178
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400179
Eric Fiselier44451cb2015-10-15 03:27:02 +0000180Build Bots and Test Coverage
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400181============================
Eric Fiselier98596ba2015-09-05 06:50:03 +0000182
Louis Dionnef34ac042020-11-19 14:22:28 -0500183* `Buildkite CI pipeline <https://buildkite.com/llvm-project/libcxx-ci>`_
184* `LLVM Buildbot Builders <http://lab.llvm.org:8011>`_
185* :ref:`Adding New CI Jobs <AddingNewCIJobs>`
Eric Fiselier98596ba2015-09-05 06:50:03 +0000186
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400187
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000188Getting Involved
189================
190
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100191First please review our `Developer's Policy <https://llvm.org/docs/DeveloperPolicy.html>`__
192and `Getting started with LLVM <https://llvm.org/docs/GettingStarted.html>`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000193
194**Bug Reports**
195
196If you think you've found a bug in libc++, please report it using
Eric Fiselier98596ba2015-09-05 06:50:03 +0000197the `LLVM Bugzilla`_. If you're not sure, you
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000198can post a message to the `libcxx-dev mailing list`_ or on IRC.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000199
200**Patches**
201
202If you want to contribute a patch to libc++, the best place for that is
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100203`Phabricator <https://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber.
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000204Also make sure you are subscribed to the `libcxx-commits mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-commits>`_.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000205
206**Discussion and Questions**
207
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000208Send discussions and questions to the
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000209`libcxx-dev mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-dev>`_.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000210
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000211
Eric Fiselier98596ba2015-09-05 06:50:03 +0000212Quick Links
213===========
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100214* `LLVM Homepage <https://llvm.org/>`_
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000215* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
Eric Fiselier5d604012017-02-17 08:37:03 +0000216* `LLVM Bugzilla <https://bugs.llvm.org/>`_
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000217* `libcxx-commits Mailing List`_
218* `libcxx-dev Mailing List`_
xgupta482d5872021-02-01 12:54:21 +0530219* `Browse libc++ Sources <https://github.com/llvm/llvm-project/tree/main/libcxx/>`_