aboutsummaryrefslogtreecommitdiff
path: root/libcxx
AgeCommit message (Collapse)AuthorFilesLines
2022-10-11[libc++][NFC] Change _VSTD to std as a prereq for D122780Louis Dionne1-17/+17
2022-10-11Reenable gdb pretty printers, and update them.Sterling Augustine2-13/+36
Libcxx gdb pretty printers were disabled due to an old version of gdb in the release testing. This reenables them, and fixes various bit rot issues from not running them.
2022-10-11[runtimes] Add the ability to customize the output name of libc++, libc++abi ↵Louis Dionne2-3/+3
and libunwind We already had the ability to do that for libc++.dylib, so this only adds consistency for all the runtime libraries. This should allow working around difficulties on AIX as described in https://llvm.org/D134221. Differential Revision: https://reviews.llvm.org/D135669
2022-10-11[NFC][libc++][format] Improves tests.Mark de Wever15-3693/+3718
This is mainly to improve the readability of the tests. As a side effects the tests run faster too, Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D135288
2022-10-11[libc++] static_assert that rebinding the allocator works as expectedNikolas Klauser14-59/+90
Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D133638
2022-10-11[libc++] Add the C++17 <memory_resource> header (mono-patch)Arthur O'Dwyer131-341/+7447
This patch is the rebase and squash of three earlier patches. It supersedes all three of them. - D47111: experimental monotonic_buffer_resource. - D47358: experimental pool resources. - D47360: Copy std::experimental::pmr to std::pmr. The significant difference between this patch and the-sum-of-those-three is that this patch does not add `std::experimental::pmr::monotonic_buffer_resource` and so on. This patch simply adds the C++17 standard facilities, and leaves the `std::experimental` namespace entirely alone. Differential Revision: https://reviews.llvm.org/D89057
2022-10-09[libc++][ranges]implement `std::views::take_while`Hui Xie22-4/+1443
Differential Revision: https://reviews.llvm.org/D134952
2022-10-08[libc++] Make charconv require C++17 or later.Mark de Wever13-36/+26
Implementing the paper P2291R3 Add Constexpr Modifiers to Functions to_chars and from_chars for Integral Types in <charconv> Header Gives issues in language versions prior to C++17. As suggested in D131855 disable the code prior to C++17. This removes libc++'s extension. Reviewed By: ldionne, #libc_vendors, #libc, philnik Differential Revision: https://reviews.llvm.org/D133216
2022-10-06implement `std::views::istream`Hui Xie22-5/+885
implement `std::ranges::basic_istream_view` and `std::views::istream`. Although the view itself is constexpr, the constructor argument is a base class std::istream where its ctor/dtor are not constexpr. So no tests are performed in constexpr Differential Revision: https://reviews.llvm.org/D133317
2022-10-06[libc++] Implement P0591R4 (Utility functions to implement uses-allocator ↵Nikolas Klauser25-22/+948
construction) Reviewed By: ldionne, #libc, huixie90 Spies: huixie90, libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D131898
2022-10-06[libc++] Fix wrong implementation of CityHashoToToT2-1/+37
As PR56606 stated, the current implementation of CityHash in libc++ would drop some bits unintentionally. Cast the 32bit int to the 64bit int to avoid this happened. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D134124
2022-10-05[libc++][format] Implements formattable concept.Mark de Wever8-405/+24
This concept is introduced in P2286, but was implemented in libc++ before. This implementation was used in the library internally. This implementation lacked the resolution of LWG3636. The original formatter had a non-const member function that wasn't trivial to make a const member. The recent parser improvements made this member a const member in preparation of LWG3636. Note LWG3636 isn't voted in. Its status is Ready. P2286's concept has been written as-if LWG3636 is accepted and refers to that LWG issue. Updates some tests make format a const member function and removes a tests that's mainly a duplicate of the formattable concept test. Implements - LWG3636 formatter<T>::format should be const-qualified Implements parts of - P2286R8 Formatting Ranges Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D134110
2022-10-05[libc++][chrono] Implements formatter month.Mark de Wever10-4/+416
Partially implements: - P1361 Integration of chrono with text formatting Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D134138
2022-10-05[libc++] Get rid of _LIBCPP_HAS_OPEN_WITH_WCHAR in the test suiteLouis Dionne9-48/+68
Differential Revision: https://reviews.llvm.org/D135163
2022-10-05[libc++][chrono] Implements formatter year.Mark de Wever12-5/+517
Partially implements: - P1361 Integration of chrono with text formatting Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D133663
2022-10-04[libc++][format] Updates to Unicode 15.Mark de Wever5-54/+109
This adds support for the new code points in the Extended Grapheme Cluster algorithm. The algorithm itself has remained unchanged. The width estimation still follows the rules of the Standard. @cor3ntin filed LWG3780 format's width estimation is too approximate and not forward compatible to improve the estimate. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D134106
2022-10-04[llvm] Remove libcxx, libcxxabi and libunwind from supported ↵Louis Dionne3-34/+2
LLVM_ENABLE_PROJECTS This is a breaking change. If you were passing one of those three runtimes in LLVM_ENABLE_PROJECTS, you need to start passing them in LLVM_ENABLE_RUNTIMES instead. The runtimes in LLVM_ENABLE_RUNTIMES will start being built using the "bootstrapping build" instead, which means that they will be built using the just-built Clang. This is usually what you wanted anyway. If you were using LLVM_ENABLE_PROJECTS=all with the explicit goal of building these three runtimes, you can now use LLVM_ENABLE_RUNTIMES=all and these runtimes will be built using the bootstrapping build. NOTE: This is a re-application of 887b8bd733ea which had been reverted in 6b03a4fea0b4 because it broke the Sphinx documentation publishers. The Sphinx documentation publishers have now been moved to using the runtimes build, so this should not be an issue anymore. Differential Revision: https://reviews.llvm.org/D132480
2022-10-03[SystemZ][z/OS] Add ASCII and 32-bit variants for libc++.Zibi Sarbinowski8-4/+186
This patch enables libc++ build as shared library in all combinations of ASCII/EBCDIC and 32-bit/64-bit variants. In particular it introduces: # ASCII version of libc++ named as libc++_a.so # Script to rename DLL name inside the generated side deck # Various names for dataset members where DLL libraries and their side decks will reside # Add the following options: - LIBCXX_SHARED_OUTPUT_NAME - LIBCXX_ADDITIONAL_COMPILE_FLAGS - LIBCXX_ADDITIONAL_LIBRARIES - LIBCXXABI_ADDITIONAL_COMPILE_FLAGS - LIBCXXABI_ADDITIONAL_LIBRARIES **Background and rational of this patch** The linker on z/OS creates a list of exported symbols in a file called side deck. The list contains the symbol name as well as the name of the DLL which implements the symbol. The name of the DLL depends on what is specified in the -o command line option. If it points to a USS file, than the DLL name in the side deck will be the USS file name. If it points to a member of a dataset then the DLL name in the side deck is the member name. If CMake could deal with z/OS datasets we could use -o that points to a dataset member name, but this does not seem to work so we have to produce a USS file as the DLL and then copy the content of the produced side deck to a dataset as well as rename the USS file name in the side deck to a dataset member name that corresponds to that DLL. Reviewed By: muiez, SeanP, ldionne, #libc, #libc_abi Differential Revision: https://reviews.llvm.org/D118503
2022-10-03[libc++] Simplify transitive includes test and fix a bugLouis Dionne7-222/+234
This patch incorporates the "sanitize" step of the transitive includes test into the CSV generator itself. In doing so, it removes complexity in the test but also fixes a bug where we would filter out <__mutex> from the output, leading to an incorrect list of includes for the <shared_mutex> header. Differential Revision: https://reviews.llvm.org/D134830
2022-10-03[libc++] Suppress -Wctad-maybe-unsupported on types w/o deduction guidesLouis Dionne73-73/+765
There are a handful of standard library types that are intended to support CTAD but don't need any explicit deduction guides to do so. This patch adds a dummy deduction guide to those types to suppress -Wctad-maybe-unsupported (which gets emitted in user code). This is a re-application of the original patch by Eric Fiselier in fcd549a7d828 which had been reverted due to reasons lost at this point. I also added the macro to a few more types. Reviving this patch was prompted by the discussion on https://llvm.org/D133425. Differential Revision: https://reviews.llvm.org/D133535
2022-10-03[libc++] Avoid relying on non-portable behaviour in std::alignAlex Richardson1-1/+1
Round-tripping pointers via size_t is not portable, the C/C++ standards only require this to be valid when using (u)intptr_t. Originally committed to the CHERI fork of LLVM as https://github.com/CTSRD-CHERI/llvm-project/commit/dd01245185ab9e71b70b418bee8f11ea0199e1a3, but I forgot to upstream the change. I rediscovered this issue due to a compiler warning when building libc++ on a Arm Morello system. Reviewed By: #libc, ldionne, philnik Differential Revision: https://reviews.llvm.org/D134363
2022-10-03[libc++] Remove a part of reverted D131898 or D130695Vitaly Buka1-0/+1
2022-10-03Revert "[libc++] Updates generated transitve includes."Vitaly Buka6-114/+16
Looks like a part of reverted D131898. This reverts commit cfd5b8f11195f5c23ae6d4aa2df2d95cae9b976e.
2022-10-02Revert "[libc++] Implement P0591R4 (Utility functions to implement ↵Vitaly Buka24-947/+22
uses-allocator construction)" Breaks ubsan tests https://lab.llvm.org/buildbot/#/builders/85/builds/11131 This reverts commit 099384dcea49f5f4b0dc7e615c9845bf9baad4bc.
2022-10-02Revert "[libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`"Vitaly Buka30-758/+459
Breaks msan, asan https://lab.llvm.org/buildbot/#/builders/5/builds/27904 This reverts commit 005916de58f73aa5c4264c084ba7b0e21040d88f.
2022-10-02[libc++] Updates generated transitve includes.Mark de Wever6-16/+114
This should fix the CI.
2022-10-01[libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`Konstantin Varlamov31-460/+758
Instead of using `reverse_iterator`, share the optimization between the 4 algorithms. The key observation here that `memmove` applies to both `copy` and `move` identically, and to their `_backward` versions very similarly. All algorithms now follow the same pattern along the lines of: ``` if constexpr (can_memmove<InIter, OutIter>) { memmove(first, last, out); } else { naive_implementation(first, last, out); } ``` A follow-up will delete `unconstrained_reverse_iterator`. This patch removes duplication and divergence between `std::copy`, `std::move` and `std::move_backward`. It also improves testing: - the test for whether the optimization is used only applied to `std::copy` and, more importantly, was essentially a no-op because it would still pass if the optimization was not used; - there were no tests to make sure the optimization is not used when the effect would be visible. Differential Revision: https://reviews.llvm.org/D130695
2022-10-01[libc++] Enable libc++-specific tests for constexpr stringNikolas Klauser6-44/+62
Reviewed By: ldionne, Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D128578
2022-10-01[libc++][NFC] Prefer type aliases over structsNikolas Klauser60-214/+135
Reviewed By: ldionne, #libc Spies: sstefan1, libcxx-commits, jeroen.dobbelaere Differential Revision: https://reviews.llvm.org/D134901
2022-10-01[libc++] Implement P0591R4 (Utility functions to implement uses-allocator ↵Nikolas Klauser24-22/+947
construction) Reviewed By: ldionne, #libc, huixie90 Spies: huixie90, libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D131898
2022-09-30[libc++] Fix ADL for `make_error_{code,condition}`Jonathan Wakely6-5/+190
Implement LWG 3629, by making lookup for make_error_code and make_error_condition only consider names found by ADL. This is achieved by adding a block scope using-declaration for a function that will be found by unqualified lookup, preventing unqualified lookup from continuing to enclosing scopes (the class scope, then enclosing namespaces). The function named by the using declaration is not viable, so overload resolution must select a candidate found by ADL. This fixes https://github.com/llvm/llvm-project/issues/57614 Differential Revision: https://reviews.llvm.org/D134943
2022-09-30[runtimes] Remove all traces of the legacy testing configuration systemLouis Dionne11-1408/+5
Now that all jobs have moved over to the new style of Lit configuration, we can remove all traces of the legacy testing configuration system. This includes: - Cache settings that are not honored or useful anymore - Several CMake options that were only useful in the context of the legacy Lit configuration system - A bunch of Python support code that is not used anymore - The legacy lit.cfg.in files themselves Differential Revision: https://reviews.llvm.org/D134650
2022-09-30[libc++] Remove unique usage of the en_US locale in a testLouis Dionne2-5/+6
Differential Revision: https://reviews.llvm.org/D134914
2022-09-29[libc++] Include skipped headers in the --trace-includes outputLouis Dionne10-129/+2056
By default, Clang does not include headers that are skipped due to the include guard optimization in the --trace-includes output, which breaks the use case that we were trying to use it for. However, Clang does support the -fshow-skipped-includes flag, which does exactly what we need and will result in an accurate include graph. As a fly-by fix, make sure that our includes don't differ between -fexceptions and -fno-exceptions. Differential Revision: https://reviews.llvm.org/D134829
2022-09-29[NFC][libc++][test] Enables variant test.Mark de Wever1-9/+5
Noticed this while working on D133326. Let's see whehter all compilers now support this feature. Reviewed By: #libc, philnik, ldionne Differential Revision: https://reviews.llvm.org/D134818
2022-09-29[libc++] Add missing return 0;'s to main() functions in testsLouis Dionne4-0/+4
2022-09-28[libc++] Remove MSVC tests checked into the libc++ test suiteLouis Dionne5-265/+120
We should strive to have our own tests, except when there is overwhelming value in using another standard library's existing tests. The reason is that it ensures that implementations don't all start relying on the same interpretation of the Standard. The unique_ptr tests did not add any test coverage AFAICT, and the forward_like tests were moved to the style used everywhere in the libc++ test suite. Note that I got to this because this actually broke a downstream configuration where we use -ffreestanding. The signature of main() was not consistent with the signature we (need to) use everywhere in the test suite. Differential Revision: https://reviews.llvm.org/D134767
2022-09-28[libc++] implement "pair" section of P2321R2 `zip`Hui Xie27-174/+962
Differential Revision: https://reviews.llvm.org/D131495
2022-09-27[libc++][NFC] Fix some standard-mandated includes commentsNikolas Klauser19-2/+44
Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D134447
2022-09-27[libcxx] Make stdatomic.h work when included from a C source fileGergely Nagy3-12/+13
If a C source file includes the libc++ stdatomic.h, compilation will break because (a) the C++ standard check will fail (which is expected), and (b) `_LIBCPP_COMPILER_CLANG_BASED` won't be defined because the logic defining it in `__config` is guarded by a `__cplusplus` check, so we'll end up with a blank header. Move the detection logic outside of the `__cplusplus` check to make the second check pass even in a C context when you're using Clang. Note that `_LIBCPP_STD_VER` is not defined when in C mode, hence stdatomic.h needs to check if in C++ mode before using that macro to avoid a warning. In an ideal world, a C source file wouldn't be including the libc++ header directory in its search path, so we'd never have this issue. Unfortunately, certain build environments make this hard to guarantee, and in this case it's easy to tweak this header to make it work in a C context, so I'm hoping this is acceptable. Fixes https://github.com/llvm/llvm-project/issues/57710. Differential Revision: https://reviews.llvm.org/D134591
2022-09-27[libcxx] Support LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY + ↵Nikita Popov1-18/+10
LIBCXX_ENABLE_ABI_LINKER_SCRIPT Currently if both LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY (only applies to static library) and LIBCXX_ENABLE_ABI_LINKER_SCRIPT (only applies to shared library) are enabled, the former will be silently ignored. The shared library will use a linker script, while the static library fails to link libc++abi.a entirely. This is caused by what appears to be an implementation bug: The LIBCXX_STATICALLY_LINK_ABI_IN_*_LIBRARY options are declared as dependent options of LIBCXX_ENABLE_STATIC_ABI_LIBRARY, rather than simply using it as the default value. Of course, the combination of LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY and LIBCXX_ENABLE_ABI_LINKER_SCRIPT still results in a cmake error, because these would be conflicting requests for the shared library. Differential Revision: https://reviews.llvm.org/D134644
2022-09-26[libc++] Use XXYYZZ instead of XXYZZ for _LIBCPP_VERSIONLouis Dionne2-3/+9
As discussed on Discord. Differential Revision: https://reviews.llvm.org/D134209
2022-09-26[libc++] Add release note about unary_function and binary_function being ↵Louis Dionne1-0/+3
removed in >= C++17
2022-09-25fix errors on passing input iterator to `std::views::take`Hui Xie2-0/+14
In the implementation of `std::views::take`, it uses `subrange<Iter>` as part of the return type. But in case of input iterator, `subrange<Iter>` can be ill-formed Differential Revision: https://reviews.llvm.org/D133220
2022-09-25[libc++] Rewrites graph_header_deps.py.Mark de Wever9-235/+34
The new version is a lot simpler and has less option which were not used. This uses the CSV files as generated by D133127 as input data. The current Python script has more features but uses a simple "grep" making the output less accurate: - Conditionally included header are always included. This is an issue since part of our includes are unneeded transitive includes. Based on the language version they may be omitted. The script however always includes them. - Includes in comments are processed as-if they are includes. This is an issue when comments explain how certain data is generated; of course there are digraphs which the script omits. This implementation uses Clang's --trace-includes to generate the includes per header. This means the input of the generation script always has the real list of includes. Libc++ is moving from large monolithic Standard headers to more fine grained headers. For example, algorithm includes every header in `__algorithm`. Adding all these detail headers in the graph makes the output unusable. Instead it only shows the Standard headers. The transitive includes of the detail headers are parsed and "attributed" to the Standard header including them. This gives an accurate include graph without the unneeded clutter. Note that this graph is still big. This changes fixes the cyclic dependency issue with the previous version of the tool so the markers and its documentation is removed. Since the input has no cycles the CI test is removed. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D134188
2022-09-25[libc++][test] Improves transitive includes.Mark de Wever723-15820/+3782
This test generates the include graph of the Standard headers of libc++ in a CSV file. This was originally used to generate graphviz dot files. During review it was noticed these files have all information needed to replace the current transitive includes. Therefore the output, with the same information as the .dot file is stored in a .csv file. This removes all the existing transitive include files. The .cvs can be converted by a .dot file by the script in D134188. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D133127
2022-09-21Revert "[llvm] Remove libcxx, libcxxabi and libunwind from supported ↵Louis Dionne3-2/+32
LLVM_ENABLE_PROJECTS" This reverts commit 887b8bd733ea36aaa5d9b0a2b45df16c6f6bb6a4 while we work on resolving issues brought up in https://reviews.llvm.org/D132480.
2022-09-21[libc++] Use Clang-16 for c++17.Mark de Wever1-5/+2
Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D132788
2022-09-20[libc++] Applies P0602R4 retro-actively.Mark de Wever9-118/+29
While testing a test failure of C++17 with Clang ToT it was noticed the paper P0602R4 variant and optional should propagate copy/move triviality was not applied as a DR in libc++. This was discovered while investigating the issue "caused by" D131479. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D133326
2022-09-20[NFC][libc++][format] Uses ranges algorithm.Mark de Wever2-8/+4
Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D134060