blob: d866d82b8a98e0fc9a3f018f6633325556e35971 [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++
32---------------------------
33
34.. toctree::
35 :maxdepth: 2
36
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
Marek Kurdej906116e2020-11-26 09:03:50 +010042 Cxx1yStatus
43 Cxx1zStatus
44 Cxx2aStatus
Marek Kurdej176140d2020-12-03 09:17:14 +010045 Cxx2bStatus
Zoe Carvera720e2c2021-04-13 17:56:55 -070046 RangesStatus
Eric Fiselierd720d1f2015-08-22 19:40:49 +000047
Eric Fiseliera28db902015-09-05 05:29:23 +000048
Eric Fiselier4e860492019-01-16 01:37:43 +000049.. toctree::
50 :hidden:
51
Louis Dionnef34ac042020-11-19 14:22:28 -050052 AddingNewCIJobs
Eric Fiselier4e860492019-01-16 01:37:43 +000053 FeatureTestMacroTable
54
Louis Dionnef34ac042020-11-19 14:22:28 -050055
Eric Fiselierd720d1f2015-08-22 19:40:49 +000056Current Status
57--------------
58
59After its initial introduction, many people have asked "why start a new
60library instead of contributing to an existing library?" (like Apache's
61libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
62reasons, but some of the major ones are:
63
Eric Fiselier98596ba2015-09-05 06:50:03 +000064* From years of experience (including having implemented the standard
65 library before), we've learned many things about implementing
66 the standard containers which require ABI breakage and fundamental changes
67 to how they are implemented. For example, it is generally accepted that
68 building std::string using the "short string optimization" instead of
69 using Copy On Write (COW) is a superior approach for multicore
70 machines (particularly in C++11, which has rvalue references). Breaking
71 ABI compatibility with old versions of the library was
72 determined to be critical to achieving the performance goals of
73 libc++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000074
Eric Fiselier98596ba2015-09-05 06:50:03 +000075* Mainline libstdc++ has switched to GPL3, a license which the developers
76 of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
77 independently extended to support C++11, but this would be a fork of the
78 codebase (which is often seen as worse for a project than starting a new
79 independent one). Another problem with libstdc++ is that it is tightly
80 integrated with G++ development, tending to be tied fairly closely to the
81 matching version of G++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000082
Eric Fiselier98596ba2015-09-05 06:50:03 +000083* STLport and the Apache libstdcxx library are two other popular
84 candidates, but both lack C++11 support. Our experience (and the
85 experience of libstdc++ developers) is that adding support for C++11 (in
86 particular rvalue references and move-only types) requires changes to
87 almost every class and function, essentially amounting to a rewrite.
88 Faced with a rewrite, we decided to start from scratch and evaluate every
89 design decision from first principles based on experience.
90 Further, both projects are apparently abandoned: STLport 5.2.1 was
91 released in Oct'08, and STDCXX 4.2.1 in May'08.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000092
93Platform and Compiler Support
94-----------------------------
95
Louis Dionne678dc852020-02-12 17:01:19 +010096For using the libc++ headers
97############################
98The libc++ headers are known to work on the following platforms, using GCC and
99Clang. Note that functionality provided by ``<atomic>`` is only functional with
100Clang and GCC.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000101
Louis Dionne678dc852020-02-12 17:01:19 +0100102============ ==================== ============
103OS Arch Compilers
104============ ==================== ============
105macOS 10.9+ i386, x86_64 Clang, GCC
106FreeBSD 10+ i386, x86_64, ARM Clang, GCC
107Linux i386, x86_64 Clang, GCC
108============ ==================== ============
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000109
Louis Dionne678dc852020-02-12 17:01:19 +0100110The following minimum compiler versions are required:
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000111
Louis Dionne60481d62020-03-23 11:37:40 -0400112* Clang 4.0 and above
Eric Fiselier75c05562019-06-13 00:37:25 +0000113* GCC 5.0 and above.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000114
Louis Dionne678dc852020-02-12 17:01:19 +0100115The C++03 dialect is only supported with Clang.
116
117For building the libc++ library
118###############################
119Building the libc++ library (static or shared) requires some features from
120the operating system. As such, it has its own set of (slightly different)
121system requirements.
122
123============ ==================== ============ ========================
124OS Arch Compilers ABI Library
125============ ==================== ============ ========================
126macOS 10.12+ i386, x86_64 Clang, GCC libc++abi
127FreeBSD 10+ i386, x86_64, ARM Clang, GCC libcxxrt, libc++abi
128Linux i386, x86_64 Clang, GCC libc++abi
129============ ==================== ============ ========================
130
131The following minimum compiler versions are required:
132
133* Clang 4.0 and above
134* GCC 5.0 and above.
135
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000136
137C++ Dialect Support
138---------------------
139
140* C++11 - Complete
Marek Kurdej906116e2020-11-26 09:03:50 +0100141* :ref:`C++14 - Complete <cxx1y-status>`
142* :ref:`C++17 - In Progress <cxx1z-status>`
143* :ref:`C++20 - In Progress <cxx2a-status>`
Mark de Wever8b38f962021-01-22 19:03:14 +0100144* :ref:`C++2b - In Progress <cxx2b-status>`
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000145* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
Eric Fiselier4e860492019-01-16 01:37:43 +0000146* :ref:`C++ Feature Test Macro Status <feature-status>`
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000147
148Notes and Known Issues
149----------------------
150
151This list contains known issues with libc++
152
153* Building libc++ with ``-fno-rtti`` is not supported. However
154 linking against it with ``-fno-rtti`` is supported.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000155
156
Eric Fiseliera72fd802015-09-06 23:22:02 +0000157A full list of currently open libc++ bugs can be `found here`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000158
Eric Fiselier5d604012017-02-17 08:37:03 +0000159.. __: 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 +0000160
161Design Documents
162----------------
163
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000164.. toctree::
165 :maxdepth: 1
166
Eric Fiselierfb825432016-12-28 04:58:52 +0000167 DesignDocs/DebugMode
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000168 DesignDocs/CapturingConfigInfo
Eric Fiselier1a1c74b2015-10-14 00:22:05 +0000169 DesignDocs/ABIVersioning
Louis Dionne37677132019-06-11 14:48:40 +0000170 DesignDocs/ExperimentalFeatures
Eric Fiselier1b57fa82016-09-15 22:27:07 +0000171 DesignDocs/VisibilityMacros
Eric Fiselier2ba7b052017-01-06 20:05:40 +0000172 DesignDocs/ThreadingSupportAPI
Eric Fiselierf2b55582018-07-25 02:53:53 +0000173 DesignDocs/FileTimeType
Eric Fiselier4e860492019-01-16 01:37:43 +0000174 DesignDocs/FeatureTestMacros
Eric Fiselierf9954532019-06-11 22:53:49 +0000175 DesignDocs/ExtendedCXX03Support
Vy Nguyene369bd92020-07-13 12:34:37 -0400176 DesignDocs/UniquePtrTrivialAbi
zoecarver08de8162021-02-05 11:24:38 -0800177 DesignDocs/NoexceptPolicy
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000178
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000179* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
180* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000181* `Notes by Marshall Clow`__
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000182
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000183.. __: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000184
Eric Fiselier44451cb2015-10-15 03:27:02 +0000185Build Bots and Test Coverage
186----------------------------
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
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000192Getting Involved
193================
194
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100195First please review our `Developer's Policy <https://llvm.org/docs/DeveloperPolicy.html>`__
196and `Getting started with LLVM <https://llvm.org/docs/GettingStarted.html>`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000197
198**Bug Reports**
199
200If you think you've found a bug in libc++, please report it using
Eric Fiselier98596ba2015-09-05 06:50:03 +0000201the `LLVM Bugzilla`_. If you're not sure, you
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000202can post a message to the `libcxx-dev mailing list`_ or on IRC.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000203
204**Patches**
205
206If you want to contribute a patch to libc++, the best place for that is
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100207`Phabricator <https://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber.
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000208Also 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 +0000209
210**Discussion and Questions**
211
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000212Send discussions and questions to the
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000213`libcxx-dev mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-dev>`_.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000214
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000215
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000216
Eric Fiselier98596ba2015-09-05 06:50:03 +0000217Quick Links
218===========
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100219* `LLVM Homepage <https://llvm.org/>`_
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000220* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
Eric Fiselier5d604012017-02-17 08:37:03 +0000221* `LLVM Bugzilla <https://bugs.llvm.org/>`_
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000222* `libcxx-commits Mailing List`_
223* `libcxx-dev Mailing List`_
xgupta482d5872021-02-01 12:54:21 +0530224* `Browse libc++ Sources <https://github.com/llvm/llvm-project/tree/main/libcxx/>`_