blob: b953e9048732156b1cbf39a625e675786beb5234 [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
Louis Dionnee96350d2021-07-06 09:46:29 -040046 Status/Format
Kent Ross3b4b6c92021-08-19 23:10:47 +000047 Status/Ranges
48 Status/Spaceship
Nikolas Klauser6e9d2692022-01-06 23:12:55 +010049 Status/Zip
Eric Fiselierd720d1f2015-08-22 19:40:49 +000050
Eric Fiseliera28db902015-09-05 05:29:23 +000051
Eric Fiselier4e860492019-01-16 01:37:43 +000052.. toctree::
53 :hidden:
54
Louis Dionnef34ac042020-11-19 14:22:28 -050055 AddingNewCIJobs
Eric Fiselier4e860492019-01-16 01:37:43 +000056 FeatureTestMacroTable
57
Louis Dionnef34ac042020-11-19 14:22:28 -050058
Eric Fiselierd720d1f2015-08-22 19:40:49 +000059Current Status
Louis Dionnef5cd4c72021-07-06 15:47:29 -040060==============
Eric Fiselierd720d1f2015-08-22 19:40:49 +000061
62After its initial introduction, many people have asked "why start a new
63library instead of contributing to an existing library?" (like Apache's
64libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
65reasons, but some of the major ones are:
66
Eric Fiselier98596ba2015-09-05 06:50:03 +000067* From years of experience (including having implemented the standard
68 library before), we've learned many things about implementing
69 the standard containers which require ABI breakage and fundamental changes
70 to how they are implemented. For example, it is generally accepted that
71 building std::string using the "short string optimization" instead of
72 using Copy On Write (COW) is a superior approach for multicore
73 machines (particularly in C++11, which has rvalue references). Breaking
74 ABI compatibility with old versions of the library was
75 determined to be critical to achieving the performance goals of
76 libc++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000077
Eric Fiselier98596ba2015-09-05 06:50:03 +000078* Mainline libstdc++ has switched to GPL3, a license which the developers
79 of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
80 independently extended to support C++11, but this would be a fork of the
81 codebase (which is often seen as worse for a project than starting a new
82 independent one). Another problem with libstdc++ is that it is tightly
83 integrated with G++ development, tending to be tied fairly closely to the
84 matching version of G++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000085
Eric Fiselier98596ba2015-09-05 06:50:03 +000086* STLport and the Apache libstdcxx library are two other popular
87 candidates, but both lack C++11 support. Our experience (and the
88 experience of libstdc++ developers) is that adding support for C++11 (in
89 particular rvalue references and move-only types) requires changes to
90 almost every class and function, essentially amounting to a rewrite.
91 Faced with a rewrite, we decided to start from scratch and evaluate every
92 design decision from first principles based on experience.
93 Further, both projects are apparently abandoned: STLport 5.2.1 was
94 released in Oct'08, and STDCXX 4.2.1 in May'08.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000095
Louis Dionnef5cd4c72021-07-06 15:47:29 -040096
Eric Fiselierd720d1f2015-08-22 19:40:49 +000097Platform and Compiler Support
Louis Dionnef5cd4c72021-07-06 15:47:29 -040098=============================
Eric Fiselierd720d1f2015-08-22 19:40:49 +000099
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400100Libc++ aims to support common compilers that implement the C++11 Standard. In order to strike a
101good balance between stability for users and maintenance cost, testing coverage and development
102velocity, libc++ drops support for older compilers as newer ones are released.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000103
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400104============ =============== ========================== =====================
105Compiler Versions Restrictions Support policy
106============ =============== ========================== =====================
Louis Dionne0e4742c2022-02-02 13:08:52 -0500107Clang 13, 14 latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_
108AppleClang 13 latest stable release per `Xcode's release page <https://developer.apple.com/documentation/xcode-release-notes>`_
David Tenty77235932021-10-19 14:09:46 -0400109Open XL 17.1 (AIX) latest stable release per `Open XL's documentation page <https://www.ibm.com/docs/en/openxl-c-and-cpp-aix>`_
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400110GCC 11 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
111============ =============== ========================== =====================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000112
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400113Libc++ also supports common platforms and architectures:
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000114
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400115=============== ========================= ============================
116Target platform Target architecture Notes
117=============== ========================= ============================
118macOS 10.9+ i386, x86_64, arm64 Building the shared library itself requires targetting macOS 10.11+
119FreeBSD 10+ i386, x86_64, arm
120Linux i386, x86_64, arm, arm64
Martin Storsjöf154e6a2022-05-04 11:05:44 +0300121Windows i386, x86_64 Both MSVC and MinGW style environments
David Tenty77235932021-10-19 14:09:46 -0400122AIX powerpc, powerpc64
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400123=============== ========================= ============================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000124
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400125Generally speaking, libc++ should work on any platform that provides a fairly complete
126C Standard Library. It is also possible to turn off parts of the library for use on
127systems that provide incomplete support.
Louis Dionne678dc852020-02-12 17:01:19 +0100128
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400129However, libc++ aims to provide a high-quality implementation of the C++ Standard
130Library, especially when it comes to correctness. As such, we aim to have test coverage
131for all the platforms and compilers that we claim to support. If a platform or compiler
Martin Storsjöe9747ef2021-07-13 14:24:51 +0300132is not listed here, it is not officially supported. It may happen to work, and
133in practice the library is known to work on some platforms not listed here, but
134we don't make any guarantees. If you would like your compiler and/or platform
Louis Dionne49696152021-08-17 10:52:12 -0400135to be formally supported and listed here, please work with the libc++ team to set
136up testing for your configuration.
Louis Dionne678dc852020-02-12 17:01:19 +0100137
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000138
139C++ Dialect Support
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400140===================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000141
142* C++11 - Complete
Louis Dionnee96350d2021-07-06 09:46:29 -0400143* :ref:`C++14 - Complete <cxx14-status>`
144* :ref:`C++17 - In Progress <cxx17-status>`
145* :ref:`C++20 - In Progress <cxx20-status>`
Mark de Wever8b38f962021-01-22 19:03:14 +0100146* :ref:`C++2b - In Progress <cxx2b-status>`
Eric Fiselier4e860492019-01-16 01:37:43 +0000147* :ref:`C++ Feature Test Macro Status <feature-status>`
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000148
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400149
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000150Notes and Known Issues
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400151======================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000152
153This list contains known issues with libc++
154
155* Building libc++ with ``-fno-rtti`` is not supported. However
156 linking against it with ``-fno-rtti`` is supported.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000157
158
Eric Fiseliera72fd802015-09-06 23:22:02 +0000159A full list of currently open libc++ bugs can be `found here`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000160
Louis Dionne85d2e982022-01-10 08:33:14 -0500161.. __: https://github.com/llvm/llvm-project/labels/libc%2B%2B
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000162
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400163
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000164Design Documents
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400165================
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000166
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000167.. toctree::
168 :maxdepth: 1
169
Eric Fiselier1a1c74b2015-10-14 00:22:05 +0000170 DesignDocs/ABIVersioning
Louis Dionne0df08db2021-06-08 11:15:27 -0400171 DesignDocs/AtomicDesign
172 DesignDocs/CapturingConfigInfo
173 DesignDocs/DebugMode
Louis Dionne37677132019-06-11 14:48:40 +0000174 DesignDocs/ExperimentalFeatures
Eric Fiselierf9954532019-06-11 22:53:49 +0000175 DesignDocs/ExtendedCXX03Support
Louis Dionne0df08db2021-06-08 11:15:27 -0400176 DesignDocs/FeatureTestMacros
177 DesignDocs/FileTimeType
zoecarver08de8162021-02-05 11:24:38 -0800178 DesignDocs/NoexceptPolicy
Louis Dionne0df08db2021-06-08 11:15:27 -0400179 DesignDocs/ThreadingSupportAPI
180 DesignDocs/UniquePtrTrivialAbi
Danila Kutenina9cbea12021-11-16 15:48:59 -0500181 DesignDocs/UnspecifiedBehaviorRandomization
Louis Dionne0df08db2021-06-08 11:15:27 -0400182 DesignDocs/VisibilityMacros
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000183
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400184
Eric Fiselier44451cb2015-10-15 03:27:02 +0000185Build Bots and Test Coverage
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400186============================
Eric Fiselier98596ba2015-09-05 06:50:03 +0000187
Louis Dionnef34ac042020-11-19 14:22:28 -0500188* `Buildkite CI pipeline <https://buildkite.com/llvm-project/libcxx-ci>`_
189* `LLVM Buildbot Builders <http://lab.llvm.org:8011>`_
190* :ref:`Adding New CI Jobs <AddingNewCIJobs>`
Eric Fiselier98596ba2015-09-05 06:50:03 +0000191
Louis Dionnef5cd4c72021-07-06 15:47:29 -0400192
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000193Getting Involved
194================
195
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100196First please review our `Developer's Policy <https://llvm.org/docs/DeveloperPolicy.html>`__
197and `Getting started with LLVM <https://llvm.org/docs/GettingStarted.html>`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000198
199**Bug Reports**
200
201If you think you've found a bug in libc++, please report it using
Louis Dionnebce8fe32022-01-09 14:40:10 -0500202the `LLVM bug tracker`_. If you're not sure, you
Danny Möschf9d8a732022-03-23 10:10:20 -0400203can ask for support on the `libcxx forum`_ or on IRC.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000204
205**Patches**
206
207If you want to contribute a patch to libc++, the best place for that is
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100208`Phabricator <https://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber.
Danny Möschf9d8a732022-03-23 10:10:20 -0400209Also make sure you are subscribed to the `libcxx-commits mailing list`_.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000210
211**Discussion and Questions**
212
Danny Möschf9d8a732022-03-23 10:10:20 -0400213Send discussions and questions to the `libcxx forum`_.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000214
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000215
Eric Fiselier98596ba2015-09-05 06:50:03 +0000216Quick Links
217===========
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100218* `LLVM Homepage <https://llvm.org/>`_
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000219* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
Danny Möschf9d8a732022-03-23 10:10:20 -0400220* `LLVM Bug Tracker <https://github.com/llvm/llvm-project/labels/libc++/>`_
221* `libcxx-commits Mailing List <http://lists.llvm.org/mailman/listinfo/libcxx-commits>`_
222* `libcxx Forum <https://discourse.llvm.org/c/runtimes/libcxx/>`_
xgupta482d5872021-02-01 12:54:21 +0530223* `Browse libc++ Sources <https://github.com/llvm/llvm-project/tree/main/libcxx/>`_