aboutsummaryrefslogtreecommitdiff
path: root/libcxx/modules/std
AgeCommit message (Collapse)AuthorFilesLines
2025-08-18[libc++] Implement P3168R2: Give optional range support (#149441)William Tran-Viet1-1/+10
Resolves #105430 - Implement all required pieces of P3168R2 - Leverage existing `wrap_iter` and `bounded_iter` classes to implement the `optional` regular and hardened iterator type, respectively - Update documentation to match
2025-07-20[libc++][ranges] implement `std::ranges::zip_transform_view` (#79605)Hui1-2/+2
Fixes #104977 Fixes #105035 --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com> Co-authored-by: A. Jiang <de34@live.cn>
2025-07-06[libc++] P2655R3 common_reference_t of reference_wrapper Should Be a ↵Hui1-0/+4
Reference Type (#141408) Fixes #105260 This patch applies the change as a DR to C++20. The rationale is that the paper is more like a bug fix. It does not introduce new features, it simply changes an existing behaviour (as a bug fix). MSVC STL DRed this paper to C++20 as well.
2025-06-21[libc++] Implement `views::join_with` (#65536)Jakub Mazurkiewicz1-2/+5
* Implement "P2441R2 `views::join_with`" (https://wg21.link/P2441R2), closes #105185 * Implement LWG4074 (https://wg21.link/LWG4074), closes #105346 * Complete implementation of "P2711R1 Making multi-param constructors of views explicit" (https://wg21.link/P2711R1), closes #105252 * Complete implementation of "P2770R0 Stashing stashing iterators for proper flattening" (https://wg21.link/P2770R0), closes #105250
2025-04-14[libc++] Implement P2897R7 aligned_accessor: An mdspan accessor expressing ↵Damien L-G2-0/+8
pointer over-alignment (#122603) Closes #118372
2025-04-06[libc++] Implement `std::flat_multiset` (#128363)Hui1-3/+1
fixes https://github.com/llvm/llvm-project/issues/105193
2025-04-05[libc++] Implement ranges::iota (#68494)James E T Smith2-3/+9
# Overview As a disclaimer, this is my first PR to LLVM and while I've tried to ensure I've followed the LLVM and libc++ contributing guidelines, there's probably a good chance I missed something. If I have, just let me know and I'll try to correct it as soon as I can. This PR implements `std::ranges::iota` and `std::ranges::out_value_result` outlined in [P2440r1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2440r1.html). As outlined in the paper above, I've: - Implemented `out_value_result` and added to `<algorithm>` - Added `out_value_result`, `iota_result`, and two overloads of `iota` to `std::ranges` in `<numeric>` - Updated the version macro `__cpp_lib_ranges_iota` in `<version>` I've also added tests for `ranges::iota` and `ranges::out_value_result`. Lastly, I added those structs to the appropriate module files. Partially implements #105184 EDIT: Forgot to mention in the original post, thanks to @hawkinsw for taking a look at a preliminary version of this PR! # TODOs - [x] Updating the range [status doc](https://github.com/jamesETsmith/llvm-project/blob/main/libcxx/docs/Status/RangesMajorFeatures.csv) - [x] Ensure all comments from https://reviews.llvm.org/D121436 are addressed here - [X] EDIT (I'll do this in a separate PR). ~~I'm open to implementing the rest of P2440r1 (`ranges::shift_left` and `ranges::shift_right`) if that's ok, I just wanted to get feedback on `ranges::iota` first~~ - [x] I've been having trouble building the modules locally and want to make sure that's working properly Closes: #134060
2025-03-23[libc++] implement std::flat_set (#125241)Hui1-1/+3
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-03-08[libc++][type_traits] Implements "A type trait to detect reference binding ↵Hristo Hristov1-4/+16
to temporary" (#128649) Implements partially: [P2255R2: A type trait to detect reference binding to temporary](https://wg21.link/P2255R2) Issue: https://github.com/llvm/llvm-project/issues/105180 https://eel.is/c++draft/meta.type.synop https://eel.is/c++draft/meta.unary.prop Implented type traits: - [x] `reference_constructs_from_temporary` - [x] `reference_converts_from_temporary` Closes #129049 Minor drive-by tweak to `std::is_implicit_lifetime` tests. --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
2025-02-21[libc++][chrono] implements GPS clock. (#125921)Mark de Wever1-2/+0
Completes: - LWG3359 <chrono> leap second support should allow for negative leap seconds - P1361R2 Integration of chrono with text formatting Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones Fixes: #100432 Fixes: #100014
2025-02-06[libc++][chrono] implements TAI clock. (#125550)Mark de Wever1-1/+1
Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones - P1361 Integration of chrono with text formatting - LWG3359 <chrono> leap second support should allow for negative leap seconds
2025-01-25[libc++] implement `std::flat_multimap` (#113835)Hui1-3/+1
fixes https://github.com/llvm/llvm-project/issues/105190 --------- Co-authored-by: Hui Xie <huixie@Mac.broadband> Co-authored-by: Hui Xie <huixie@Huis-MacBook-Pro.local>
2025-01-24[libc++][chrono] implements UTC clock. (#90393)Mark de Wever1-2/+9
While implementing this feature and its associated LWG issues it turns out - LWG3316 Correctly define epoch for utc_clock / utc_timepoint only added non-normative wording to the standard. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones - P1361 Integration of chrono with text formatting - LWG3359 <chrono> leap second support should allow for negative leap seconds
2025-01-24[libc++] Switch experimental library macros to 0/1 macros (#124030)Nikolas Klauser2-5/+5
This is a continuation of what's been started in #89178. As a drive-by, this also changes the PSTL macro to say `EXPERIMENTAL` instead of `INCOMPLETE`.
2024-11-06[libc++] Refactor the configuration macros to being always defined (#112094)Nikolas Klauser39-122/+118
This is a follow-up to #89178. This updates the `<__config_site>` macros.
2024-10-26[libc++] Implement P0429R9 `std::flat_map` (#98643)Hui1-5/+7
Around half of the tests are based on the tests Arthur O'Dwyer's original implementation of std::flat_map, with modifications and removals. partially implement #105190
2024-10-12[libc++][RFC] Always define internal feature test macros (#89178)Nikolas Klauser6-8/+8
Currently, the library-internal feature test macros are only defined if the feature is not available, and always have the prefix `_LIBCPP_HAS_NO_`. This patch changes that, so that they are always defined and have the prefix `_LIBCPP_HAS_` instead. This changes the canonical use of these macros to `#if _LIBCPP_HAS_FEATURE`, which means that using an undefined macro (e.g. due to a missing include) is diagnosed now. While this is rather unlikely currently, a similar change in `<__configuration/availability.h>` caught a few bugs. This also improves readability, since it removes the double-negation of `#ifndef _LIBCPP_HAS_NO_FEATURE`. The current patch only touches the macros defined in `<__config>`. If people are happy with this approach, I'll make a follow-up PR to also change the macros defined in `<__config_site>`.
2024-10-09[libc++][type_traits] P2674R1: A trait for implicit lifetime types (#106870)Hristo Hristov1-2/+6
Implements P2674R1: https://wg21.link/P2674R1 - https://eel.is/c++draft/type.traits - https://eel.is/c++draft/meta.type.synop - https://eel.is/c++draft/meta.unary.prop - https://eel.is/c++draft/support.limits - https://eel.is/c++draft/version.syn Implementation details: - Uses compiler intrinsic `__builtin_is_implicit_lifetime`: - https://github.com/llvm/llvm-project/pull/101807 - Tests based on: - https://github.com/llvm/llvm-project/blob/d213981c80626698a07b11ce872acba098a863d4/clang/test/SemaCXX/type-traits.cpp#L1989 References: - Implicit-lifetime - Implicit-lifetime types [basic.types.general]/9: https://eel.is/c++draft/basic.types.general - Implicit-lifetime class [class.prop]/9: https://eel.is/c++draft/class.prop - P0593R6 Implicit creation of objects for low-level object manipulation: https://wg21.link/P0593R6 - P1010R1 Container support for implicit lifetime types: https://wg21.link/P1010R1 - P0593R6 Implicit creation of objects for low-level object manipulation: https://wg21.link/P0593R6 Closes: #105259 --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
2024-09-12[libc++] Make std::jthread supported in non-experimental mode (#107900)Louis Dionne2-5/+1
We waited before supporting std::jthread fully because we wanted to investigate other implementation strategies (in particular one involving std::mutex). Since then, we did some benchmarking and decided that we wouldn't be moving forward with std::mutex. Hence, there is no real reason to punt on making std::jthread & friends non-experimental.
2024-09-03[libc++] Add missing `std::is_virtual_base_of` to `type_traits.inc` (#107009)Hristo Hristov1-0/+6
std::is_virtual_base_of was implemented in https://github.com/llvm/llvm-project/pull/105847
2024-08-30[libc++][NFC] Run clang-format on libcxx/includeLouis Dionne1-1/+1
This re-formats a few headers that had become out-of-sync with respect to formatting since we ran clang-format on the whole codebase. There's surprisingly few instances of it.
2024-08-27[libc++] Deprecate and remove std::uncaught_exception (#101830)A. Jiang1-0/+2
Works towards P0619R4/#99985. - std::uncaught_exception was not previously deprecated. This patch deprecates it since C++17 as per N4259. std::uncaught_exceptions is used instead as libc++ unconditionally provides this function. - _LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION restores std::uncaught_exception. - As a drive-by, this patch updates the C++20 status page to explain that D.11 is already done, since it was done in 578d09c1b195d859ca7e62840ff6bb83421a77b5.
2024-08-10[libc++] re-enable clang-tidy in the CI and fix any issues (#102658)Nikolas Klauser2-2/+9
It looks like we've accidentally disabled clang-tidy in the CI. This re-enables it and fixes the issues accumulated while it was disabled.
2024-07-30[libc++][format] Implements P3107R5 in <format>. (#86713)Mark de Wever1-0/+2
This adds the new std::enable_nonlocking_formatter_optimization trait in <format>. This trait will be used in std::print to implement the performance benefits. Implements parts of - P3107R5 - Permit an efficient implementation of ``std::print``
2024-07-20[libc++][math] Mathematical Special Functions: Hermite Polynomial (#89982)PaulXiCao1-0/+2
Implementing the Hermite polynomials which are part of C++17's mathematical special functions. The goal is to get early feedback which will make implementing the other functions easier. Integration of functions in chunks (e.g. `std::hermite` at first, then `std::laguerre`, etc.) might make sense as well (also see note on boost.math below). I started out from this abandoned merge request: https://reviews.llvm.org/D58876 . The C++23 standard defines them in-terms of `/* floating-point type */` arguments. I have not looked into that. Note, there is still an ongoing discussion on discourse whether importing boost.math is an option.
2024-07-19[libc++][ranges] P1223R5: `find_last` (#99312)nicole mazzuca1-2/+3
Implements [P1223R5][] completely. Includes an implementation of `find_last`, `find_last_if`, and `find_last_if_not`. [P1223R5]: https://wg21.link/p1223r5
2024-07-19[libc++][memory] P1132R8: `out_ptr` - a scalable output pointer abstraction ↵Hristo Hristov1-4/+6
(#73618) Differential Revision: https://reviews.llvm.org/D150525 Implements: - https://wg21.link/P1132R8 - `out_ptr` - a scalable output pointer abstraction - https://eel.is/c++draft/smartptr.adapt - 20.3.4 Smart pointer adaptors - https://wg21.link/LWG3734 - Inconsistency in `inout_ptr` and `out_ptr` for empty case - https://wg21.link/LWG3897- `inout_ptr` will not update raw pointer to 0 --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
2024-07-16[libc++][chrono] Adds year_month_day_last&::operator<=>. (#98169)Mark de Wever1-1/+0
41f7bb9975bcaffae0267fa87b63c90b83ffd551 claimed it implemented this change but the code was not adjusted. The other spaceship operators in the calendar code have been validated too. Implements parts of - P1614R2 The Mothership has Landed
2024-07-10[libc++][TZDB] Implements zoned_seconds typedef. (#95141)Mark de Wever1-2/+0
Implements parts of: - P0355 Extending to chrono Calendars and Time Zones
2024-07-09[libc++][TZDB] Adds basics of zoned_time class. (#94999)Mark de Wever1-1/+1
This implements the class, its non-templated constructors and its getters to verify the construction. Completes - LWG3224 zoned_time constructor from TimeZonePtr does not specify initialization of tp_ Implements parts of: - P0355 Extending chrono to Calendars and Time Zones
2024-06-10[libc++][TZDB] Implements zoned_traits. (#91059)Mark de Wever1-2/+1
Implements parts of: - P0355 Extending chrono to Calendars and Time Zones
2024-06-10[libc++][TZDB] Implements time_zone::to_sys. (#90901)Mark de Wever1-3/+0
This implements the overload with the choose argument and adds this enum. Implements parts of: - P0355 Extending chrono to Calendars and Time Zones
2024-06-10[libc++][TZDB] Implements time_zone::to_sys. (#90394)Mark de Wever1-4/+3
This implements the throwing overload and the exception classes throw by this overload. Implements parts of: - P0355 Extending chrono to Calendars and Time Zones
2024-06-07[libc++] Undeprecate shared_ptr atomic access APIs (#92920)Nico Weber1-6/+0
This patch reverts 9b832b72 (#87111): - [libc++] Deprecated `shared_ptr` Atomic Access APIs as per P0718R2 - [libc++] Implemented P2869R3: Remove Deprecated `shared_ptr` Atomic Access APIs from C++26 As explained in [1], the suggested replacement in P2869R3 is `__cpp_lib_atomic_shared_ptr`, which libc++ does not yet implement. Let's not deprecate the old way of doing things before the new way of doing things exists. [1]: https://github.com/llvm/llvm-project/pull/87111#issuecomment-2112740039
2024-05-21[libc++] Implement C++20 atomic_ref (#76647)Damien L-G1-1/+1
Implement the std::atomic_ref class template by reusing atomic_base_impl. Based on the work from https://reviews.llvm.org/D72240
2024-05-08[libc++][CI] Reenables clang-tidy. (#90077)Mark de Wever2-9/+16
The patch does several things: - fixes module exports - disables clang-tidy with Clang-17 due to known issues - disabled clang-tidy on older libstdc++ versions since it lacks C++20 features used - fixes the CMake dependency The issue why clang-tidy was not used in the CI was the last issue; the plugin was not a dependency of the tests. Without a plugin the tests disable clang-tidy. This was noticed while investigating https://github.com/llvm/llvm-project/issues/89898
2024-05-03[libc++][modules] Uses _LIBCPP_USING_IF_EXISTS. (#90409)Mark de Wever17-564/+564
This attribute is used in the headers. Not using this in the modules has led to several issues. Add them to the modules to avoid these errors in other placed.
2024-04-26[libc++][ranges] Exports operator|. (#90071)Mark de Wever1-0/+11
This was omitted in c1086532d4d5 and not detected by the CI since clang-tidy is not running. This fixes the exports. Fixes: https://github.com/llvm/llvm-project/issues/89898
2024-04-23[libc++][ranges] export `std::ranges::range_adaptor_closure` (#89793)Xiaoyang Liu1-1/+3
This patch exports the `std::ranges::range_adaptor_closure` class template implemented in #89148 from the C++ Modules file.
2024-04-18[libc++][TZDB] Adds local_info formatter. (#86256)Mark de Wever1-0/+1
This adds the local_info type and its formatting options. The usage of the local_info object will be done in separate patches. Implements parts of: - P0355 Extending to Calendars and Time Zones - P1361 Integration of chrono with text formatting
2024-04-14[libc++] Deprecated `shared_ptr` Atomic Access APIs as per P0718R2 & ↵Hristo Hristov1-0/+6
Implemented P2869R3: Remove Deprecated `shared_ptr` Atomic Access APIs from C++26 (#87111) Implements https://wg21.link/P2869R4 Implements deprecations as per https://wg21.link/P0718R2
2024-04-10[libc++][chrono] Adds the sys_info class. (#85619)Mark de Wever1-0/+2
Adds the sys_info class and time_zone::get_info(). The code still has a few quirks and has not been optimized for performance yet. The returned sys_info is compared against the output of the zdump tool in the test giving confidence the implementation is correct. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones Implements: - LWGXXXX The sys_info range should be affected by save
2024-04-09[libc++] Implement `bind_back` (#81055)Jakub Mazurkiewicz1-1/+3
Implement `std::bind_back` function from P2387R3 "Pipe support for user-defined range adaptors".
2024-04-05[libc++] P2872R3: Remove ``wstring_convert`` From C++26 (#87100)Hristo Hristov1-0/+5
Implements: https://wg21.link/P2872R3
2024-04-04[libc++][chrono] Completes the tzdb class. (#82157)Mark de Wever1-2/+2
It adds the missing member functions of the tzdb class and adds the free functions that use these member functions. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones
2024-04-04[libc++] P2867R1: Remove Deprecated `strstream`s From C++26 (#87107)Hristo Hristov1-0/+2
Implements: https://wg21.link/P2867R2 --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
2024-04-03[libc++][chrono] Loads leap-seconds.list in tzdb. (#82113)Mark de Wever1-15/+13
This implements the loading of the leap-seconds.list file and store its contents in the tzdb struct. This adds the required `leap_seconds` member. The class leap_seconds is fully implemented including its non-member functions. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones - P1614 The Mothership has Landed Implements: - P1981 Rename leap to leap_second - LWG3359 <chrono> leap second support should allow for negative leap seconds - LWG3383 §[time.zone.leap.nonmembers] sys_seconds should be replaced with seconds
2024-03-04[libc++] Do not forward-declare syncstream outside experimental (#82511)Louis Dionne1-2/+6
We only define the classes in `<syncstream>` when experimental library features are enabled, but we would forward-declare them in `<iosfwd>` even when they are disabled. This led to confusing error messages about being unable to instantiate an undefined template.
2024-02-27[libc++] protect absent atomic types with ifdef (#82351)Dominik Wójt1-0/+2
Otherwise modules.std-module.sh.cpp test fails with following error: error: no member named 'atomic_signed_lock_free' in namespace 'std' when the types are not available.
2024-02-19[libc++][complex] P2819R2: Add `tuple` protocol to `complex` (#79744)Hristo Hristov1-0/+7
Implements: P2819R2 <https://wg21.link/P2819R2> - https://eel.is/c++draft/utilities#concept:tuple-like - https://eel.is/c++draft/complex.syn - https://eel.is/c++draft/complex.tuple --------- Co-authored-by: Zingam <zingam@outlook.com>