blob: 75d5b8226b4c85a446fc7958d3606e9a18b311a4 [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
41
Eric Fiseliera28db902015-09-05 05:29:23 +000042
Eric Fiselier4e860492019-01-16 01:37:43 +000043.. toctree::
44 :hidden:
45
46 FeatureTestMacroTable
47
Eric Fiselierd720d1f2015-08-22 19:40:49 +000048Current Status
49--------------
50
51After its initial introduction, many people have asked "why start a new
52library instead of contributing to an existing library?" (like Apache's
53libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
54reasons, but some of the major ones are:
55
Eric Fiselier98596ba2015-09-05 06:50:03 +000056* From years of experience (including having implemented the standard
57 library before), we've learned many things about implementing
58 the standard containers which require ABI breakage and fundamental changes
59 to how they are implemented. For example, it is generally accepted that
60 building std::string using the "short string optimization" instead of
61 using Copy On Write (COW) is a superior approach for multicore
62 machines (particularly in C++11, which has rvalue references). Breaking
63 ABI compatibility with old versions of the library was
64 determined to be critical to achieving the performance goals of
65 libc++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000066
Eric Fiselier98596ba2015-09-05 06:50:03 +000067* Mainline libstdc++ has switched to GPL3, a license which the developers
68 of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
69 independently extended to support C++11, but this would be a fork of the
70 codebase (which is often seen as worse for a project than starting a new
71 independent one). Another problem with libstdc++ is that it is tightly
72 integrated with G++ development, tending to be tied fairly closely to the
73 matching version of G++.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000074
Eric Fiselier98596ba2015-09-05 06:50:03 +000075* STLport and the Apache libstdcxx library are two other popular
76 candidates, but both lack C++11 support. Our experience (and the
77 experience of libstdc++ developers) is that adding support for C++11 (in
78 particular rvalue references and move-only types) requires changes to
79 almost every class and function, essentially amounting to a rewrite.
80 Faced with a rewrite, we decided to start from scratch and evaluate every
81 design decision from first principles based on experience.
82 Further, both projects are apparently abandoned: STLport 5.2.1 was
83 released in Oct'08, and STDCXX 4.2.1 in May'08.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000084
85Platform and Compiler Support
86-----------------------------
87
Louis Dionne678dc852020-02-12 17:01:19 +010088For using the libc++ headers
89############################
90The libc++ headers are known to work on the following platforms, using GCC and
91Clang. Note that functionality provided by ``<atomic>`` is only functional with
92Clang and GCC.
Eric Fiselierd720d1f2015-08-22 19:40:49 +000093
Louis Dionne678dc852020-02-12 17:01:19 +010094============ ==================== ============
95OS Arch Compilers
96============ ==================== ============
97macOS 10.9+ i386, x86_64 Clang, GCC
98FreeBSD 10+ i386, x86_64, ARM Clang, GCC
99Linux i386, x86_64 Clang, GCC
100============ ==================== ============
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000101
Louis Dionne678dc852020-02-12 17:01:19 +0100102The following minimum compiler versions are required:
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000103
Louis Dionne60481d62020-03-23 11:37:40 -0400104* Clang 4.0 and above
Eric Fiselier75c05562019-06-13 00:37:25 +0000105* GCC 5.0 and above.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000106
Louis Dionne678dc852020-02-12 17:01:19 +0100107The C++03 dialect is only supported with Clang.
108
109For building the libc++ library
110###############################
111Building the libc++ library (static or shared) requires some features from
112the operating system. As such, it has its own set of (slightly different)
113system requirements.
114
115============ ==================== ============ ========================
116OS Arch Compilers ABI Library
117============ ==================== ============ ========================
118macOS 10.12+ i386, x86_64 Clang, GCC libc++abi
119FreeBSD 10+ i386, x86_64, ARM Clang, GCC libcxxrt, libc++abi
120Linux i386, x86_64 Clang, GCC libc++abi
121============ ==================== ============ ========================
122
123The following minimum compiler versions are required:
124
125* Clang 4.0 and above
126* GCC 5.0 and above.
127
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000128
129C++ Dialect Support
130---------------------
131
132* C++11 - Complete
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000133* `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
Sylvestre Ledru7e245372018-09-20 07:57:31 +0000134* `C++17 - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000135* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
Eric Fiselier4e860492019-01-16 01:37:43 +0000136* :ref:`C++ Feature Test Macro Status <feature-status>`
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000137
138Notes and Known Issues
139----------------------
140
141This list contains known issues with libc++
142
143* Building libc++ with ``-fno-rtti`` is not supported. However
144 linking against it with ``-fno-rtti`` is supported.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000145
146
Eric Fiseliera72fd802015-09-06 23:22:02 +0000147A full list of currently open libc++ bugs can be `found here`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000148
Eric Fiselier5d604012017-02-17 08:37:03 +0000149.. __: 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 +0000150
151Design Documents
152----------------
153
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000154.. toctree::
155 :maxdepth: 1
156
Mehdi Amini228053d2017-05-04 17:08:54 +0000157 DesignDocs/AvailabilityMarkup
Eric Fiselierfb825432016-12-28 04:58:52 +0000158 DesignDocs/DebugMode
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000159 DesignDocs/CapturingConfigInfo
Eric Fiselier1a1c74b2015-10-14 00:22:05 +0000160 DesignDocs/ABIVersioning
Louis Dionne37677132019-06-11 14:48:40 +0000161 DesignDocs/ExperimentalFeatures
Eric Fiselier1b57fa82016-09-15 22:27:07 +0000162 DesignDocs/VisibilityMacros
Eric Fiselier2ba7b052017-01-06 20:05:40 +0000163 DesignDocs/ThreadingSupportAPI
Eric Fiselierf2b55582018-07-25 02:53:53 +0000164 DesignDocs/FileTimeType
Eric Fiselier4e860492019-01-16 01:37:43 +0000165 DesignDocs/FeatureTestMacros
Eric Fiselierf9954532019-06-11 22:53:49 +0000166 DesignDocs/ExtendedCXX03Support
Vy Nguyene369bd92020-07-13 12:34:37 -0400167 DesignDocs/UniquePtrTrivialAbi
Eric Fiselier5cf9a822015-10-13 22:12:02 +0000168
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000169* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
170* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000171* `Notes by Marshall Clow`__
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000172
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000173.. __: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000174
Eric Fiselier44451cb2015-10-15 03:27:02 +0000175Build Bots and Test Coverage
176----------------------------
Eric Fiselier98596ba2015-09-05 06:50:03 +0000177
178* `LLVM Buildbot Builders <http://lab.llvm.org:8011/console>`_
179* `Apple Jenkins Builders <http://lab.llvm.org:8080/green/view/Libcxx/>`_
Eric Fiselierf1e02022017-05-04 07:40:23 +0000180* `Windows Appveyor Builders <https://ci.appveyor.com/project/llvm-mirror/libcxx>`_
Eric Fiselier44451cb2015-10-15 03:27:02 +0000181* `Code Coverage Results <http://efcs.ca/libcxx-coverage>`_
Eric Fiselier98596ba2015-09-05 06:50:03 +0000182
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000183Getting Involved
184================
185
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100186First please review our `Developer's Policy <https://llvm.org/docs/DeveloperPolicy.html>`__
187and `Getting started with LLVM <https://llvm.org/docs/GettingStarted.html>`__.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000188
189**Bug Reports**
190
191If you think you've found a bug in libc++, please report it using
Eric Fiselier98596ba2015-09-05 06:50:03 +0000192the `LLVM Bugzilla`_. If you're not sure, you
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000193can post a message to the `libcxx-dev mailing list`_ or on IRC.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000194
195**Patches**
196
197If you want to contribute a patch to libc++, the best place for that is
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100198`Phabricator <https://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber.
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000199Also 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 +0000200
201**Discussion and Questions**
202
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000203Send discussions and questions to the
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000204`libcxx-dev mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-dev>`_.
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000205
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000206
Eric Fiselierd720d1f2015-08-22 19:40:49 +0000207
Eric Fiselier98596ba2015-09-05 06:50:03 +0000208Quick Links
209===========
Sylvestre Ledrub09c9382020-03-22 22:42:03 +0100210* `LLVM Homepage <https://llvm.org/>`_
Eric Fiselier4f9062a2015-09-06 23:09:54 +0000211* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
Eric Fiselier5d604012017-02-17 08:37:03 +0000212* `LLVM Bugzilla <https://bugs.llvm.org/>`_
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000213* `libcxx-commits Mailing List`_
214* `libcxx-dev Mailing List`_
James Y Knightf18eebf2019-01-29 16:37:27 +0000215* `Browse libc++ Sources <https://github.com/llvm/llvm-project/tree/master/libcxx/>`_