blob: 5c404517a1747571c32bb3c0ecd1b312e9a2719c [file] [log] [blame]
Eric Fiselierb17bb062015-08-22 19:40:49 +00001.. _index:
2
3=============================
4"libc++" C++ Standard Library
5=============================
6
7Overview
8========
9
10libc++ is a new implementation of the C++ standard library, targeting C++11.
11
12* Features and Goals
13
14 * Correctness as defined by the C++11 standard.
15 * Fast execution.
16 * Minimal memory use.
17 * Fast compile times.
18 * ABI compatibility with gcc's libstdc++ for some low-level features
19 such as exception objects, rtti and memory allocation.
20 * Extensive unit tests.
21
22* Design and Implementation:
23
24 * Extensive unit tests
25 * Internal linker model can be dumped/read to textual format
26 * Additional linking features can be plugged in as "passes"
27 * OS specific and CPU specific code factored out
28
29
30Getting Started with libc++
31---------------------------
32
33.. toctree::
34 :maxdepth: 2
35
36 UsingLibcxx
37 BuildingLibcxx
38 TestingLibcxx
39
Eric Fiselier11027f62015-09-05 05:29:23 +000040
Eric Fiselierb17bb062015-08-22 19:40:49 +000041Current Status
42--------------
43
44After its initial introduction, many people have asked "why start a new
45library instead of contributing to an existing library?" (like Apache's
46libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
47reasons, but some of the major ones are:
48
49From years of experience (including having implemented the standard
50library before), we've learned many things about implementing
51the standard containers which require ABI breakage and fundamental changes
52to how they are implemented. For example, it is generally accepted that
53building std::string using the "short string optimization" instead of
54using Copy On Write (COW) is a superior approach for multicore
55machines (particularly in C++11, which has rvalue references). Breaking
56ABI compatibility with old versions of the library was
57determined to be critical to achieving the performance goals of
58libc++.
59
60Mainline libstdc++ has switched to GPL3, a license which the developers
61of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
62independently extended to support C++11, but this would be a fork of the
63codebase (which is often seen as worse for a project than starting a new
64independent one). Another problem with libstdc++ is that it is tightly
65integrated with G++ development, tending to be tied fairly closely to the
66matching version of G++.
67
68STLport and the Apache libstdcxx library are two other popular
69candidates, but both lack C++11 support. Our experience (and the
70experience of libstdc++ developers) is that adding support for C++11 (in
71particular rvalue references and move-only types) requires changes to
72almost every class and function, essentially amounting to a rewrite.
73Faced with a rewrite, we decided to start from scratch and evaluate every
74design decision from first principles based on experience.
75
76Further, both projects are apparently abandoned: STLport 5.2.1 was
77released in Oct'08, and STDCXX 4.2.1 in May'08.
78
79Platform and Compiler Support
80-----------------------------
81
82libc++ is known to work on the following platforms, using gcc-4.2 and
83clang (lack of C++11 language support disables some functionality).
84Note that functionality provided by ``<atomic>`` is only functional with clang
85and GCC.
86
87============ ==================== ============ ========================
88OS Arch Compilers ABI Library
89============ ==================== ============ ========================
90Mac OS X i386, x86_64 Clang, GCC libc++abi
91FreeBSD 10+ i386, x86_64, ARM Clang, GCC libcxxrt, libc++abi
92Linux i386, x86_64 Clang, GCC libc++abi
93============ ==================== ============ ========================
94
95The following minimum compiler versions are strongly recommended.
96
97* Clang 3.5 and above
98* GCC 4.7 and above.
99
100Anything older *may* work.
101
102C++ Dialect Support
103---------------------
104
105* C++11 - Complete
106* `C++14 - Complete <cxx14 status_>`__
107* `C++1z - In Progress <cxx1z status_>`__
108* `Post C++14 Technical Specifications - In Progress <ts status_>`__
109
110.. _cxx14 status: http://libcxx.llvm.org/cxx1y_status.html
111.. _cxx1z status: http://libcxx.llvm.org/cxx1z_status.html
112.. _ts status: http://libcxx.llvm.org/ts1z_status.html
113
114
115Notes and Known Issues
116----------------------
117
118This list contains known issues with libc++
119
120* Building libc++ with ``-fno-rtti`` is not supported. However
121 linking against it with ``-fno-rtti`` is supported.
122* On OS X v10.8 and older the CMake option ``-DLIBCXX_LIBCPPABI_VERSION=""``
123 must be used during configuration.
124
125
126A full list of currently open libc++ bugs can be `found here <libcxx bug list_>`__.
127
128.. _libcxx bug list: https://llvm.org/bugs/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
129
130Design Documents
131----------------
132
133* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
134* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
135* `Status of debug mode <http://libcxx.llvm.org/debug_mode.html>`_
136* `Notes by Marshall Clow <clow notes_>`__
137
138.. _clow notes: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
139
140Getting Involved
141================
142
143First please review our `Developer's Policy <http://llvm.org/docs/DeveloperPolicy.html>`__.
144
145**Bug Reports**
146
147If you think you've found a bug in libc++, please report it using
148the _`LLVM Bugzilla`. If you're not sure, you
149can post a message to the `cfe-dev`_. mailing list or on IRC.
150Please include "libc++" in your subject.
151
152**Patches**
153
154If you want to contribute a patch to libc++, the best place for that is
155`Phabricator <phab doc_>`__. Please include [libcxx] in the subject and
156add `cfe-commits` as a subscriber.
157
158**Discussion and Questions**
159
160Send discussions and questions to the `clang mailing list <cfe-dev_>`__.
161Please include [libcxx] in the subject.
162
163.. _phab doc: http://llvm.org/docs/Phabricator.html
164.. _cfe-dev: http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
165
Eric Fiselierb17bb062015-08-22 19:40:49 +0000166Links
167=====
168
169* `Getting started with LLVM <http://llvm.org/docs/GettingStarted.html>`_
170* `libc++abi Homepage <libc++abi_>`__
171
172.. _`libc++abi`: http://libcxxabi.llvm.org/