xref: /aosp_15_r20/external/libcxx/docs/index.rst (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker.. _index:
2*58b9f456SAndroid Build Coastguard Worker
3*58b9f456SAndroid Build Coastguard Worker=============================
4*58b9f456SAndroid Build Coastguard Worker"libc++" C++ Standard Library
5*58b9f456SAndroid Build Coastguard Worker=============================
6*58b9f456SAndroid Build Coastguard Worker
7*58b9f456SAndroid Build Coastguard WorkerOverview
8*58b9f456SAndroid Build Coastguard Worker========
9*58b9f456SAndroid Build Coastguard Worker
10*58b9f456SAndroid Build Coastguard Workerlibc++ is a new implementation of the C++ standard library, targeting C++11 and
11*58b9f456SAndroid Build Coastguard Workerabove.
12*58b9f456SAndroid Build Coastguard Worker
13*58b9f456SAndroid Build Coastguard Worker* Features and Goals
14*58b9f456SAndroid Build Coastguard Worker
15*58b9f456SAndroid Build Coastguard Worker  * Correctness as defined by the C++11 standard.
16*58b9f456SAndroid Build Coastguard Worker  * Fast execution.
17*58b9f456SAndroid Build Coastguard Worker  * Minimal memory use.
18*58b9f456SAndroid Build Coastguard Worker  * Fast compile times.
19*58b9f456SAndroid Build Coastguard Worker  * ABI compatibility with gcc's libstdc++ for some low-level features
20*58b9f456SAndroid Build Coastguard Worker    such as exception objects, rtti and memory allocation.
21*58b9f456SAndroid Build Coastguard Worker  * Extensive unit tests.
22*58b9f456SAndroid Build Coastguard Worker
23*58b9f456SAndroid Build Coastguard Worker* Design and Implementation:
24*58b9f456SAndroid Build Coastguard Worker
25*58b9f456SAndroid Build Coastguard Worker  * Extensive unit tests
26*58b9f456SAndroid Build Coastguard Worker  * Internal linker model can be dumped/read to textual format
27*58b9f456SAndroid Build Coastguard Worker  * Additional linking features can be plugged in as "passes"
28*58b9f456SAndroid Build Coastguard Worker  * OS specific and CPU specific code factored out
29*58b9f456SAndroid Build Coastguard Worker
30*58b9f456SAndroid Build Coastguard Worker
31*58b9f456SAndroid Build Coastguard WorkerGetting Started with libc++
32*58b9f456SAndroid Build Coastguard Worker---------------------------
33*58b9f456SAndroid Build Coastguard Worker
34*58b9f456SAndroid Build Coastguard Worker.. toctree::
35*58b9f456SAndroid Build Coastguard Worker   :maxdepth: 2
36*58b9f456SAndroid Build Coastguard Worker
37*58b9f456SAndroid Build Coastguard Worker   ReleaseNotes
38*58b9f456SAndroid Build Coastguard Worker   UsingLibcxx
39*58b9f456SAndroid Build Coastguard Worker   BuildingLibcxx
40*58b9f456SAndroid Build Coastguard Worker   TestingLibcxx
41*58b9f456SAndroid Build Coastguard Worker
42*58b9f456SAndroid Build Coastguard Worker
43*58b9f456SAndroid Build Coastguard WorkerCurrent Status
44*58b9f456SAndroid Build Coastguard Worker--------------
45*58b9f456SAndroid Build Coastguard Worker
46*58b9f456SAndroid Build Coastguard WorkerAfter its initial introduction, many people have asked "why start a new
47*58b9f456SAndroid Build Coastguard Workerlibrary instead of contributing to an existing library?" (like Apache's
48*58b9f456SAndroid Build Coastguard Workerlibstdcxx, GNU's libstdc++, STLport, etc).  There are many contributing
49*58b9f456SAndroid Build Coastguard Workerreasons, but some of the major ones are:
50*58b9f456SAndroid Build Coastguard Worker
51*58b9f456SAndroid Build Coastguard Worker* From years of experience (including having implemented the standard
52*58b9f456SAndroid Build Coastguard Worker  library before), we've learned many things about implementing
53*58b9f456SAndroid Build Coastguard Worker  the standard containers which require ABI breakage and fundamental changes
54*58b9f456SAndroid Build Coastguard Worker  to how they are implemented.  For example, it is generally accepted that
55*58b9f456SAndroid Build Coastguard Worker  building std::string using the "short string optimization" instead of
56*58b9f456SAndroid Build Coastguard Worker  using Copy On Write (COW) is a superior approach for multicore
57*58b9f456SAndroid Build Coastguard Worker  machines (particularly in C++11, which has rvalue references).  Breaking
58*58b9f456SAndroid Build Coastguard Worker  ABI compatibility with old versions of the library was
59*58b9f456SAndroid Build Coastguard Worker  determined to be critical to achieving the performance goals of
60*58b9f456SAndroid Build Coastguard Worker  libc++.
61*58b9f456SAndroid Build Coastguard Worker
62*58b9f456SAndroid Build Coastguard Worker* Mainline libstdc++ has switched to GPL3, a license which the developers
63*58b9f456SAndroid Build Coastguard Worker  of libc++ cannot use.  libstdc++ 4.2 (the last GPL2 version) could be
64*58b9f456SAndroid Build Coastguard Worker  independently extended to support C++11, but this would be a fork of the
65*58b9f456SAndroid Build Coastguard Worker  codebase (which is often seen as worse for a project than starting a new
66*58b9f456SAndroid Build Coastguard Worker  independent one).  Another problem with libstdc++ is that it is tightly
67*58b9f456SAndroid Build Coastguard Worker  integrated with G++ development, tending to be tied fairly closely to the
68*58b9f456SAndroid Build Coastguard Worker  matching version of G++.
69*58b9f456SAndroid Build Coastguard Worker
70*58b9f456SAndroid Build Coastguard Worker* STLport and the Apache libstdcxx library are two other popular
71*58b9f456SAndroid Build Coastguard Worker  candidates, but both lack C++11 support.  Our experience (and the
72*58b9f456SAndroid Build Coastguard Worker  experience of libstdc++ developers) is that adding support for C++11 (in
73*58b9f456SAndroid Build Coastguard Worker  particular rvalue references and move-only types) requires changes to
74*58b9f456SAndroid Build Coastguard Worker  almost every class and function, essentially amounting to a rewrite.
75*58b9f456SAndroid Build Coastguard Worker  Faced with a rewrite, we decided to start from scratch and evaluate every
76*58b9f456SAndroid Build Coastguard Worker  design decision from first principles based on experience.
77*58b9f456SAndroid Build Coastguard Worker  Further, both projects are apparently abandoned: STLport 5.2.1 was
78*58b9f456SAndroid Build Coastguard Worker  released in Oct'08, and STDCXX 4.2.1 in May'08.
79*58b9f456SAndroid Build Coastguard Worker
80*58b9f456SAndroid Build Coastguard WorkerPlatform and Compiler Support
81*58b9f456SAndroid Build Coastguard Worker-----------------------------
82*58b9f456SAndroid Build Coastguard Worker
83*58b9f456SAndroid Build Coastguard Workerlibc++ is known to work on the following platforms, using gcc and
84*58b9f456SAndroid Build Coastguard Workerclang.
85*58b9f456SAndroid Build Coastguard WorkerNote that functionality provided by ``<atomic>`` is only functional with clang
86*58b9f456SAndroid Build Coastguard Workerand GCC.
87*58b9f456SAndroid Build Coastguard Worker
88*58b9f456SAndroid Build Coastguard Worker============ ==================== ============ ========================
89*58b9f456SAndroid Build Coastguard WorkerOS           Arch                 Compilers    ABI Library
90*58b9f456SAndroid Build Coastguard Worker============ ==================== ============ ========================
91*58b9f456SAndroid Build Coastguard WorkerMac OS X     i386, x86_64         Clang, GCC   libc++abi
92*58b9f456SAndroid Build Coastguard WorkerFreeBSD 10+  i386, x86_64, ARM    Clang, GCC   libcxxrt, libc++abi
93*58b9f456SAndroid Build Coastguard WorkerLinux        i386, x86_64         Clang, GCC   libc++abi
94*58b9f456SAndroid Build Coastguard Worker============ ==================== ============ ========================
95*58b9f456SAndroid Build Coastguard Worker
96*58b9f456SAndroid Build Coastguard WorkerThe following minimum compiler versions are strongly recommended.
97*58b9f456SAndroid Build Coastguard Worker
98*58b9f456SAndroid Build Coastguard Worker* Clang 3.5 and above
99*58b9f456SAndroid Build Coastguard Worker* GCC 4.7 and above.
100*58b9f456SAndroid Build Coastguard Worker
101*58b9f456SAndroid Build Coastguard WorkerAnything older *may* work.
102*58b9f456SAndroid Build Coastguard Worker
103*58b9f456SAndroid Build Coastguard WorkerC++ Dialect Support
104*58b9f456SAndroid Build Coastguard Worker---------------------
105*58b9f456SAndroid Build Coastguard Worker
106*58b9f456SAndroid Build Coastguard Worker* C++11 - Complete
107*58b9f456SAndroid Build Coastguard Worker* `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
108*58b9f456SAndroid Build Coastguard Worker* `C++17 - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
109*58b9f456SAndroid Build Coastguard Worker* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
110*58b9f456SAndroid Build Coastguard Worker
111*58b9f456SAndroid Build Coastguard WorkerNotes and Known Issues
112*58b9f456SAndroid Build Coastguard Worker----------------------
113*58b9f456SAndroid Build Coastguard Worker
114*58b9f456SAndroid Build Coastguard WorkerThis list contains known issues with libc++
115*58b9f456SAndroid Build Coastguard Worker
116*58b9f456SAndroid Build Coastguard Worker* Building libc++ with ``-fno-rtti`` is not supported. However
117*58b9f456SAndroid Build Coastguard Worker  linking against it with ``-fno-rtti`` is supported.
118*58b9f456SAndroid Build Coastguard Worker* On OS X v10.8 and older the CMake option ``-DLIBCXX_LIBCPPABI_VERSION=""``
119*58b9f456SAndroid Build Coastguard Worker  must be used during configuration.
120*58b9f456SAndroid Build Coastguard Worker
121*58b9f456SAndroid Build Coastguard Worker
122*58b9f456SAndroid Build Coastguard WorkerA full list of currently open libc++ bugs can be `found here`__.
123*58b9f456SAndroid Build Coastguard Worker
124*58b9f456SAndroid Build Coastguard Worker.. __:  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
125*58b9f456SAndroid Build Coastguard Worker
126*58b9f456SAndroid Build Coastguard WorkerDesign Documents
127*58b9f456SAndroid Build Coastguard Worker----------------
128*58b9f456SAndroid Build Coastguard Worker
129*58b9f456SAndroid Build Coastguard Worker.. toctree::
130*58b9f456SAndroid Build Coastguard Worker   :maxdepth: 1
131*58b9f456SAndroid Build Coastguard Worker
132*58b9f456SAndroid Build Coastguard Worker   DesignDocs/AvailabilityMarkup
133*58b9f456SAndroid Build Coastguard Worker   DesignDocs/DebugMode
134*58b9f456SAndroid Build Coastguard Worker   DesignDocs/CapturingConfigInfo
135*58b9f456SAndroid Build Coastguard Worker   DesignDocs/ABIVersioning
136*58b9f456SAndroid Build Coastguard Worker   DesignDocs/VisibilityMacros
137*58b9f456SAndroid Build Coastguard Worker   DesignDocs/ThreadingSupportAPI
138*58b9f456SAndroid Build Coastguard Worker   DesignDocs/FileTimeType
139*58b9f456SAndroid Build Coastguard Worker
140*58b9f456SAndroid Build Coastguard Worker* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
141*58b9f456SAndroid Build Coastguard Worker* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
142*58b9f456SAndroid Build Coastguard Worker* `Notes by Marshall Clow`__
143*58b9f456SAndroid Build Coastguard Worker
144*58b9f456SAndroid Build Coastguard Worker.. __: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
145*58b9f456SAndroid Build Coastguard Worker
146*58b9f456SAndroid Build Coastguard WorkerBuild Bots and Test Coverage
147*58b9f456SAndroid Build Coastguard Worker----------------------------
148*58b9f456SAndroid Build Coastguard Worker
149*58b9f456SAndroid Build Coastguard Worker* `LLVM Buildbot Builders <http://lab.llvm.org:8011/console>`_
150*58b9f456SAndroid Build Coastguard Worker* `Apple Jenkins Builders <http://lab.llvm.org:8080/green/view/Libcxx/>`_
151*58b9f456SAndroid Build Coastguard Worker* `Windows Appveyor Builders <https://ci.appveyor.com/project/llvm-mirror/libcxx>`_
152*58b9f456SAndroid Build Coastguard Worker* `Code Coverage Results <http://efcs.ca/libcxx-coverage>`_
153*58b9f456SAndroid Build Coastguard Worker
154*58b9f456SAndroid Build Coastguard WorkerGetting Involved
155*58b9f456SAndroid Build Coastguard Worker================
156*58b9f456SAndroid Build Coastguard Worker
157*58b9f456SAndroid Build Coastguard WorkerFirst please review our `Developer's Policy <http://llvm.org/docs/DeveloperPolicy.html>`__
158*58b9f456SAndroid Build Coastguard Workerand `Getting started with LLVM <http://llvm.org/docs/GettingStarted.html>`__.
159*58b9f456SAndroid Build Coastguard Worker
160*58b9f456SAndroid Build Coastguard Worker**Bug Reports**
161*58b9f456SAndroid Build Coastguard Worker
162*58b9f456SAndroid Build Coastguard WorkerIf you think you've found a bug in libc++, please report it using
163*58b9f456SAndroid Build Coastguard Workerthe `LLVM Bugzilla`_. If you're not sure, you
164*58b9f456SAndroid Build Coastguard Workercan post a message to the `libcxx-dev mailing list`_ or on IRC.
165*58b9f456SAndroid Build Coastguard Worker
166*58b9f456SAndroid Build Coastguard Worker**Patches**
167*58b9f456SAndroid Build Coastguard Worker
168*58b9f456SAndroid Build Coastguard WorkerIf you want to contribute a patch to libc++, the best place for that is
169*58b9f456SAndroid Build Coastguard Worker`Phabricator <http://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber.
170*58b9f456SAndroid Build Coastguard WorkerAlso make sure you are subscribed to the `libcxx-commits mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-commits>`_.
171*58b9f456SAndroid Build Coastguard Worker
172*58b9f456SAndroid Build Coastguard Worker**Discussion and Questions**
173*58b9f456SAndroid Build Coastguard Worker
174*58b9f456SAndroid Build Coastguard WorkerSend discussions and questions to the
175*58b9f456SAndroid Build Coastguard Worker`libcxx-dev mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-dev>`_.
176*58b9f456SAndroid Build Coastguard Worker
177*58b9f456SAndroid Build Coastguard Worker
178*58b9f456SAndroid Build Coastguard Worker
179*58b9f456SAndroid Build Coastguard WorkerQuick Links
180*58b9f456SAndroid Build Coastguard Worker===========
181*58b9f456SAndroid Build Coastguard Worker* `LLVM Homepage <http://llvm.org/>`_
182*58b9f456SAndroid Build Coastguard Worker* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
183*58b9f456SAndroid Build Coastguard Worker* `LLVM Bugzilla <https://bugs.llvm.org/>`_
184*58b9f456SAndroid Build Coastguard Worker* `libcxx-commits Mailing List`_
185*58b9f456SAndroid Build Coastguard Worker* `libcxx-dev Mailing List`_
186*58b9f456SAndroid Build Coastguard Worker* `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_
187*58b9f456SAndroid Build Coastguard Worker* `Browse libc++ -- ViewVC <http://llvm.org/viewvc/llvm-project/libcxx/trunk/>`_
188