summaryrefslogtreecommitdiff
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Implement P2505R5(Monadic operations for std::expected).yronglin2023-05-1829-35/+3113
| | | | | | | | Implement P2505R5(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r5.html) Reviewed By: #libc, philnik, ldionne Differential Revision: https://reviews.llvm.org/D140911
* Revert "[libc++] Implement P2505R5(Monadic operations for std::expected)."yronglin2023-05-1829-3113/+35
| | | | | | | | | | This reverts commit ebc111b08bddca55d5f7e560a20bdb2c913d80cb. Sorry, I forgot to append Phabricator reversion when land D140911, I try to revert this change and reland. Reviewed By: #libc, ldionne, EricWF Differential Revision: https://reviews.llvm.org/D150793
* [libc++][NFC] Rename the 'noexceptions' CI config to 'no-exceptions' for ↵Louis Dionne2023-05-175-11/+11
| | | | | | consistency Differential Revision: https://reviews.llvm.org/D150672
* [libcxx] Fix crash in std::stringstream with payload >= INT_MAXAzat Khuzhin2023-05-172-1/+42
| | | | | | | | | | | | | | | | stringstream does works for payload > INT_MAX, however stringstream::gcount() can break the internal field (__nout_) and this breaks the stringstream itself, and so the program will crash. Fix this, by using __pbump(streamsize) over pbump(int) Note, libstdc++ does not have this bug. Reviewed By: #libc, ldionne, Mordante Spies: arichardson, Mordante, philnik, ldionne, libcxx-commits, mikhail.ramalho Differential Revision: https://reviews.llvm.org/D146294
* [libc++] Improve ranges::starts_withzijunzhao2023-05-171-24/+20
| | | | Fix some nits in ranges::starts_with
* [libc++] Implement P2505R5(Monadic operations for std::expected).yronglin2023-05-1729-35/+3113
| | | | Signed-off-by: yronglin <yronglin777@gmail.com>
* Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Nico Weber2023-05-171-1/+1
| | | | | | | | | | | | | | This reverts commit 65429b9af6a2c99d340ab2dcddd41dab201f399c. Broke several projects, see https://reviews.llvm.org/D144509#4347562 onwards. Also reverts follow-up commit "[OpenMP] Compile assembly files as ASM, not C" This reverts commit 4072c8aee4c89c4457f4f30d01dc9bb4dfa52559. Also reverts fix attempt "[cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump" This reverts commit 7d47dac5f828efd1d378ba44a97559114f00fb64.
* [libc++][ranges] Implement the changes to `deque` from P1206 (`ranges::to`):varconst2023-05-177-14/+429
| | | | | | | | | - add the `from_range_t` constructors and the related deduction guides; - add the `insert_range`/`assign_range`/etc. member functions. (Note: this patch is split from https://reviews.llvm.org/D142335) Differential Revision: https://reviews.llvm.org/D149827
* [libc++] Utilities for implementing stop_tokenHui2023-05-1710-0/+659
| | | | | | | | | This change contains three util classes that were out from D145183 to make incremental progress - automic_unique_lock - intrusive_list - intrusive_shared_ptr Differential Revision: https://reviews.llvm.org/D150205
* [libcxx] Add mdspan/extentsChristian Trott2023-05-1644-285/+2218
| | | | | | | | | | | | | | | | This patch adds std::extents. extents is one of the core classes used by std::mdspan. It describes a multi-dimensional index space with a mix of compile time and runtime sizes. Furthermore, it is templated on the index type used to describe the multi-dimensional index space. The class is designed to be highly optimizable in performance critical code sections, and is fully useable in constant expressions contexts. Testing of this class tends to be somewhat combinatorical, due to the large number of possible corner cases involved in situations where we have both runtime and compile time extents. To add to this, the class is designed to be interoperable (in particular constructible) from arguments which only need to be convertible to the index_type, but are otherwise arbitrary user types. For a larger discussion on the design of this class refer to: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html Co-authored-by: Damien L-G <dalg24@gmail.com> Reviewed By: ldionne, #libc Spies: libcxx-commits, H-G-Hristov, tschuett, philnik, arichardson, Mordante, crtrott Differential Revision: https://reviews.llvm.org/D148067
* [libc++] Add C++20 stringstream::view()Piotr Fusik2023-05-167-1/+287
| | | | | | | | Reviewed By: #libc, philnik, Mordante Spies: Mordante, philnik, libcxx-commits Differential Revision: https://reviews.llvm.org/D148641
* [libc++][format] Removes format sources.Mark de Wever2023-05-164-34/+5
| | | | | | | | | | | | | | | | | | | | | The source file is used to anchor the destructor of format_error. When format is moved from experimental to stable this code would move to the dylib. One issue with code in the dylib is that it can't be used in constexpr context. There is a proposal to make format work during constant evaluation P2758 Emitting messages at compile time This paper has initially been received favourable by EWG. Therefore move the code to the header. This also avoids possible availability issues on Mac back deployment targets. Note it is expected that format will no longer be experimental with the next LLVM release. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D150073
* [libcxx] [test] Improve error reporting around invoked commandsMartin Storsjö2023-05-161-4/+4
| | | | | | | This was requested in the review of D145807, but I had missed to apply it before landing the patch. Differential Revision: https://reviews.llvm.org/D150444
* [libc++][PSTL] Implement std::copy{,_n}Nikolas Klauser2023-05-157-44/+265
| | | | | | | | Reviewed By: ldionne, #libc Spies: jloser, libcxx-commits Differential Revision: https://reviews.llvm.org/D149706
* [libc++] Revert moving the pre-release checklistLouis Dionne2023-05-151-13/+12
| | | | | I had not seen https://reviews.llvm.org/D150585 which supersedes this, and I want to avoid merge conflicts for D150585.
* [libc++][NFC] Reformat testLouis Dionne2023-05-151-134/+142
| | | | | I didn't notice in the review that clang-format made a poor job at formatting the test so I went back and did it manually.
* [libc++][NFC] Use angle brackets to include ranges_mismatch.hLouis Dionne2023-05-151-1/+1
|
* [libc++] Removes _LIBCPP_ABI_OLD_LOGNORMAL_DISTRIBUTIONMark de Wever2023-05-152-138/+2
| | | | | | | | This was planned for LLVM 15 but was never done. Reviewed By: #libc, philnik Differential Revision: https://reviews.llvm.org/D150580
* [libc++] Implement ranges::starts_withzijunzhao2023-05-1510-5/+374
|
* Revert "[libc++][PSTL] Implement std::copy{,_n}"Nikolas Klauser2023-05-157-265/+44
| | | | | | This reverts commit b049fc0481bc387f57fd61da7239f85ef91096c1. The wrong patch was landed.
* [libc++][docs] Move the pre-release check-listLouis Dionne2023-05-151-12/+13
| | | | | It was confusing to some contributors because it appeared in a prominent place on the Contibuting page.
* [libc++][PSTL] Implement std::copy{,_n}Nikolas Klauser2023-05-157-44/+265
| | | | | | | | Reviewed By: ldionne, #libc Spies: jloser, libcxx-commits Differential Revision: https://reviews.llvm.org/D149706
* [libc++][PSTL] Implement std::transformNikolas Klauser2023-05-1513-44/+388
| | | | | | | | Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D149615
* Revert "[libc++][PSTL] Implement std::transform"Nikolas Klauser2023-05-158-290/+44
| | | | | | This reverts commit cbd9e5454741ebe6b39521fe1a8ed4eed5c2c801. The wrong patch was landed.
* [libc++][PSTL] Implement std::transformNikolas Klauser2023-05-158-44/+290
| | | | | | | | Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D149615
* [libc++] Moves unwrap_reference to type_traits.Mark de Wever2023-05-149-12/+14
| | | | | | | | This was discovered while working on modules. Reviewed By: #libc, philnik Differential Revision: https://reviews.llvm.org/D149351
* [libc++][PSTL] Make the PSTL submodules only have one headerIan Anderson2023-05-132-2/+17
| | | | | | | | Module map generation for the private detail headers is easier done if each private header is by itself in a submodule. Move the __algorithm/pstl_backends into their own submodules. Reviewed By: philnik, #libc Differential Revision: https://reviews.llvm.org/D150503
* [libc++][NFC] Use _LIBCPP_STD_VER instead of ↵Nikolas Klauser2023-05-132-3/+3
| | | | | | | | | | __cpp_lib_atomic_is_always_lock_free Reviewed By: #libc, ldionne, Mordante Spies: Mordante, libcxx-commits Differential Revision: https://reviews.llvm.org/D150421
* Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever2023-05-131-1/+1
| | | | | | The owner of the last two failing buildbots updated CMake. This reverts commit e8e8707b4aa6e4cc04c0cffb2de01d2de71165fc.
* [NFC][libc++][format] Tests formatter requirements.Mark de Wever2023-05-134-4/+229
| | | | | | | | Like done D149543 this validates the other formatter specializations. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D150041
* [libc++][PSTL] Move the already implemented functions to the new dispatching ↵Nikolas Klauser2023-05-1217-289/+427
| | | | | | | | | | scheme Reviewed By: ldionne, #libc Spies: arichardson, pcwang-thead, libcxx-commits, miyuki Differential Revision: https://reviews.llvm.org/D150277
* [libc++][ranges] Fix `iota_view`'s constructor's incorrect constraintHui2023-05-122-1/+7
| | | | | | One of the overload of the constructors should check Bound is not unreachable_sentinel_t, instead of the Start Differential Revision: https://reviews.llvm.org/D150206
* [NFC][libc++][format] Uses uniform member signatures.Mark de Wever2023-05-1215-168/+179
| | | | | | | | | | | The newer formatters for (tuple, vector<bool>::reference) specify the formatter's parse and format member function. This signature is slightly different from the signature for existing formatters. Adapt the existing formatters to the new style. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D150034
* [clang][ci] Improves buildkite artifacts.Mark de Wever2023-05-121-8/+8
| | | | | | | | | | | | | | | | | The financial cost of the network I/O for the Clang install artifacts is quite significant. afd3478f37c8 improved this by creating tarballs. This commit improves the tarball by using xz compression instead of gzip. This option is the slowest, but gives the smallest size. size time time (compression) (decompression) gzip 51 M 7 s 1.2 s bz2 44 M 17 s 5.8 s xz 33 M 76 s 3.1 s Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D150062
* [libc++][PSTL] Add more specialized backend customization pointsLouis Dionne2023-05-1120-37/+348
| | | | | | | | | | This allows backends to customize arbitrary parallel algorithms, which was requested pretty often. Reviewed By: #libc, ldionne Spies: arichardson, miyuki, crtrott, dalg24, __simt__, philnik, libcxx-commits Differential Revision: https://reviews.llvm.org/D149686
* [libc++] Adjust tests using ext/* headers that undefine __DEPRECATEDJohn Brawn2023-05-1120-257/+7
| | | | | | | | | | | | | | Several tests undefined __DEPRECATED to avoid warnings as they're testing the deprecated ext/hash_map. A better way to do this is to use -Wno-deprecated so it isn't defined in the first place. This prevents these tests from failing when we give a warning when undefining the __DEPRECATED macro, as D144654 will do. For the generated tests however just remove the testing of these header files, so we don't disable the warning when testing the other header files. Differential Revision: https://reviews.llvm.org/D145691
* [libc++][PSTL] Add missing includes to PSTL headersIan Anderson2023-05-108-2/+22
| | | | | | | | | | | Several PSTL headers included by <algorithm> are missing includes for things they use. Switch some quoted includes to angle includes. (Issues found from running `check-cxx` with https://reviews.llvm.org/D144322) Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D150085
* [libc++] Consistently enable __CORRECT_ISO_CPP_WCHAR_H_PROTO in mbstate.Jordan Rupprecht2023-05-104-0/+60
| | | | | | | | | | | | In libc++'s `wchar.h`, before we forward to the system `wchar.h`, we set `__CORRECT_ISO_CPP_WCHAR_H_PROTO` to ensure it defines the correct signature (e.g. `extern "C++" const wchar_t *wmemchr` and not `extern wchar_t *wmemchr`). After D148542, there are cases where we include the system `wchar.h` from within `__mbstate_t.h` without setting that, and so we get a function type mismatch if we transitively include `wchar.h` through multiple headers in a modules-enabled build. Consistently setting it here resolves those build errors. Alternative 1: we could put this in `__config` instead. I chose to put it here for a more limited scope. Alternative 2: we could patch `wchar.h` itself to work correctly and remove references `__CORRECT_ISO_CPP_WCHAR_H_PROTO` from libc++ entirely. It does already set it, but with an additional condition that it is being built by GCC >= 4.4. Clang does pretend to be GCC via `__GNUC__` etc. which can be controlled via `-fgnuc-version` command line flags, but that might have other consequences. Reviewed By: ldionne, #libc, MaskRay Differential Revision: https://reviews.llvm.org/D150015
* [libc++][NFC] Remove duplicate declaration of __iter_value_typeLouis Dionne2023-05-101-3/+0
| | | | The exact same declaration exists a few lines above.
* [libc++][NFC] Fix slightly incorrect instructions for testing with NinjaLouis Dionne2023-05-101-1/+1
|
* [libcxx] Fix pstl __init_ identifier after 9c4717aAaron Siddhartha Mondal2023-05-101-4/+4
| | | | | | Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D150201
* [libc++][PSTL] Move the remaining configuration into __configNikolas Klauser2023-05-1024-85/+61
| | | | | | | | Reviewed By: ldionne, #libc Spies: sstefan1, jplehr, arichardson, libcxx-commits, miyuki Differential Revision: https://reviews.llvm.org/D150217
* [libc++] Add assertions for potential OOB reads in std::sortLouis Dionne2023-05-095-26/+3687
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduced an optimization to std::sort in 4eddbf9f10a6. However, that optimization led to issues where users that were passing invalid comparators to std::sort could start seeing OOB reads. This led to the revert of the std::sort optimization from the LLVM 16 release (see https://llvm.org/D146421). This patch introduces _LIBCPP_ASSERTs to the places in the algorithm where we make an assumption that the comparator will be consistent and hence avoid a bounds check based on that. If the comparator happens not to be consistent with itself, these are the places where we would incorrectly go out of bounds. This allows users that enable libc++ assertions to catch such misuse at the cost of basically a bounds check. For users that do not enable libc++ assertions (which is 99.9% of users since assertions are off by default), this is basically a no-op, and in fact the assertion will turn into a __builtin_assume, making it explicit to the compiler that it can rely on the fact that we're not going out of bounds. I think this patch strikes the right balance. Folks that want absolute performance will get what they want, since it is a precondition for the comparator to be consistent, so the bounds checks are technically not mandatory. Folks who want more safety *already* need to be enabling libc++ assertions to catch other types of bugs (like operator[] OOB), so this solution should also work for them. I do think we have a lot of work towards popularizing the use of libc++ assertions and integrating it better so that users don't have to know about the obscure _LIBCPP_ENABLE_ASSERTIONS macro to enable them, but that's a separate concern. rdar://106897934 Differential Revision: https://reviews.llvm.org/D147089
* [libc++] Provide an assignment operator from pair<U, V> in C++03Louis Dionne2023-05-093-9/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an extension to std::pair in C++03 mode where we provide an assignment operator from a pair<U, V>. Previously, any code trying to trigger such an assignment operator would have tried using the `operator=(pair const&)` copy assignment operator, which would then have tried creating a `pair const&` by using the unconstrained pair<U, V> constructor. After this patch, pair will instead go through operator= directly if its member types are assignable. If they are not assignable, the extension operator= is disabled with SFINAE and the pair(pair<U, V>) constructor will be used. Since that constructor is unconstrained, that will either work or give a hard error. This should be pretty transparent to users, but this is technically a behavior change in C++03. Indeed, if a type has both a valid cross-type assignment operator *and* a valid cross-type constructor, the library will now prefer the cross-type assignment instead of going through the cross-type constructor and then using the copy-constructor. Since this is the mandated behavior in C++11, however, one could argue that any user broken by that needs to change their code. The motivation for this change is to allow simplifying the definition of std::map's value_type, which requires handling assignment to a pair of references properly. This patch will allow removing complexity from https://llvm.org/D121485 instead of adding complexity in that patch. Differential Revision: https://reviews.llvm.org/D150119
* [libc++][ranges] Implement the changes to vector from P1206 (`ranges::to`):varconst2023-05-0825-196/+2347
| | | | | | | | - add the `from_range_t` constructors and the related deduction guides; - add the `insert_range`/`assign_range`/etc. member functions. (Note: this patch is split from https://reviews.llvm.org/D142335) Differential Revision: https://reviews.llvm.org/D149826
* [AIX] Adjust support of format function testsJake Egan2023-05-082-5/+3
| | | | | | | | escaped_output.unicode.pass.cpp is failing only on 32-bit AIX. The rest are passing. Reviewed by: #libc, Mordante Differential Revision: https://reviews.llvm.org/D149078
* [libc++][AIX] Remove LIBCXX-AIX-FIXME feature from testJake Egan2023-05-081-2/+0
| | | | | | | | This test was originally unsupported for `LIBCXX-AIX-FIXME` feature because we lacked `-fvisibility=hidden` support. AIX now has visibility support and the test passes in debug mode. Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D149255
* [libc++][spaceship] Implement `operator<=>` for `array`Hristo Hristov2023-05-089-148/+273
| | | | | | | | Implements part of P1614R2 "The Mothership has Landed" Reviewed By: Mordante, #libc, philnik Differential Revision: https://reviews.llvm.org/D132265
* [libc++] Fix mistake in documentation of libcxx-lit scriptLouis Dionne2023-05-081-1/+1
|
* [libc++] Use the __is_trivially_equality_comparable builtinNikolas Klauser2023-05-0711-197/+346
| | | | | | | | Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D148553