6792 Commits

Author SHA1 Message Date
A. Jiang
2e02135cec
[libc++] Remove non-conforming __bit_reference::operator& (#188714)
The overloaded `operator&` caused non-conforming behavior when
- using `operator==` to compare "addresses" of proxy reference objects,
and
- relying on the exact type of `&ref`.

No deprecation warning is added, becaue it should be portable to write
`&ref` where `ref` is a proxy reference variable, and this patch just
corrects the behavior.

`__bit_const_reference::operator&` is kept, because when one defines
`_LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL` to make the
libc++ implementation strategy conforming, the `operator&` will never be
exposed to users.
2026-03-31 13:45:20 +08:00
Louis Dionne
8a0c070309
[libc++] Revert recent changes to __hash_table and ext/hash_map (#189427)
This reverts commits 30084d74765c and 5b8c17580482. The second commit
was landed without proper review: not by fault of the submitter, but
because I mistakenly thought this was modifying something else entirely
that is unsupported. The first commit must also be reverted because it
is a breaking change without the second commit.

This corresponds to PRs #183223 and #188660, see those for more details.
2026-03-31 00:12:01 -04:00
Peter Collingbourne
5b8c175804
[libc++] Add another const_cast to support hash_map copy assignment
There was one more const_cast needed after #183223 without which
copy assignment of hash_map was broken. Add it, together with a copy
assignment test.

Reviewers: ldionne

Pull Request: https://github.com/llvm/llvm-project/pull/188660
2026-03-26 12:12:01 -07:00
Louis Dionne
15213edadf
[libc++] Fix negate and bit_xor in C++03 frozen headers (#187573)
An unintended change in #134045 gave them a default template argument,
which is supposed to be from C++14 onwards.

I considered adding a test for this but it is really awkward to test
that we don't support passing no template argument in C++03 mode and
that provides little value, so I decided against it.
2026-03-26 14:47:15 -04:00
Michael Levine
e80b46efc5
[libc++] Remove the dead code in stdatomic.h in frozen C++03 mode (#188346)
Fixes #187384

Assisted-by: Claude Code

Signed-off-by: mlevine55 <mlevine55@bloomberg.net>
2026-03-26 14:43:10 -04:00
Michael Levine
46c79a0c1f
[libc++] Use internal std::__is_sufficiently_aligned to check requirement in atomic ref constructors (#188530)
This PR introduces a `std::__is_sufficiently_aligned` helper function that
can be used for the `atomic_ref` C++20 constructors while the public
C++26 `std::is_sufficiently_aligned` delegates to the new helper
function.

Fixes #179803

Assisted-by: Claude Code

Signed-off-by: mlevine55 <mlevine55@bloomberg.net>
2026-03-26 14:38:24 -04:00
Christopher Di Bella
8c2c816cf7
Reapply "[libcxx] adds __split_buffer::__swap_layouts" (#185120) (#187763)
This reverts commit 01a97050f01b6b833d3d1f22997b5009293b43a3.
2026-03-26 17:09:34 +00:00
Peter Collingbourne
f3274a496c
Prepare libcxx and libcxxabi for pointer field protection.
Pointer field protection has the following characteristics:

- Pointer fields in RTTI types are unsigned. Signing these fields
  is unnecessary because PFP is a mechanism for protecting the heap,
  and the RTTI objects typically live in global variables. Therefore,
  mark the fields with the no_field_protection to inhibit PFP for these
  fields.

- libcxx's interim trivial relocatability implementation, which memcpy's
  some non-trivially-copyable objects according to the value of a trait,
  conflicts with PFP in tagged mode (in which the address of the pointer
  is used as part of the pointer encoding) by causing such copies to
  result in a crash in some cases where the object being copied includes
  a pointer field. These copies are undefined behavior. Therefore, make
  libcxx's trivially relocatable predicate simply return the value of
  the trivially copyable trait when PFP in tagged mode is enabled, which
  results in standards compliant behavior that is accommodated by PFP.

Reviewers: philnik777, fmayer, ldionne

Pull Request: https://github.com/llvm/llvm-project/pull/151651
2026-03-25 15:51:35 -07:00
Alexey Samsonov
0eb8f018a1
[libc++] Add CMake plumbing for _LIBCPP_HAS_THREAD_API_C11 mode. (#188414)
Introduce CMake option `LIBCXX_HAS_C11_THREAD_API` that explicitly
instructs libc++ to use C11 threads. Make sure
`_LIBCPP_HAS_THREAD_API_C11` is defined properly in the
`<__config_site>` and interacts correctly with platform-based
auto-selection of thread API when it's not explicitly set.
2026-03-25 10:51:31 -07:00
Nikhil Kotikalapudi
feae3bc202
[libc++] Remove non-standard member type iterator_type from __wrap_iter (#186871)
Resolves #186801 
Removed the non-standard member type `iterator_type` from `__wrap_iter`.
This member exposed the underlying iterator type, and its removal
prevents users from relying on the implementation detail.
2026-03-25 11:04:14 +08:00
Peter Collingbourne
30084d7476
[libc++] Fix type confusion in hash_{,multi}map
The type `__gnu_cxx::hash_{,multi}map` creates objects of type
`std::pair<Key, Value>` and returns pointers to them of type
`std::pair<const Key, Value>`. If either `Key` or `Value` are
non-standard-layout, this is UB, and is furthermore considered by
pointer field protection to be a type confusion, which leads to a
program crash. Fix it by using the correct type for the pair's storage
and using const_cast to form a pointer to the key in the one place where
that is needed.

Reviewers: ldionne

Reviewed By: ldionne

Pull Request: https://github.com/llvm/llvm-project/pull/183223
2026-03-24 15:44:54 -07:00
A. Jiang
26ee552ef5
[libc++] Fix includes in <string> for no-wchar_t modes (#187650)
Since befaa35212dbaac39cd76a8dc748e4df7c90a0d9, the CI stably failed for
the generic-no-wide-characters build, because in no-`wchar_t` modes, the
header for `__remove_cv_t` wasn't properly included.

This PR adds the missing include of `<__type_traits/remove_cv.h>`.

As drive-by, `<__cstddef/size_t.h>` and
`<__type_traits/is_constant_evaluated.h>`, which are included by
`<cwchar>`, are also made included by `<string>` to avoid potential
regression as we're using `size_t` and
`__libcpp_is_constant_evaluated()` in `<string>`.
2026-03-22 20:29:25 +08:00
Zibi Sarbinowski
fa49ad564b
[libc++] Fix random_shuffle signature in C++03 mode with frozen headers (#186443)
The frozen C++03 headers got an invalid simplification in #134045 that
changed the signature of random_shuffle to use a forwarding reference
instead of a lvalue reference. This patch fixes it and adds a test.

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2026-03-20 11:22:42 -04:00
A. Jiang
486bd96099
[libc++][NFC] Remove redundant guard for __cpp_lib_destroying_delete (#187473)
In `<version>` and test files, `__cpp_lib_destroying_delete` is already
properly guarded with standard modes, so it's redundant to say standard
revision in `test_suite_guard`/`libcxx_guard`.
2026-03-19 15:17:00 -04:00
Nikolas Klauser
befaa35212
[libc++] Fix passing through object to comparisons in __tree (#186341)
Fixes #180659
2026-03-18 14:23:01 -04:00
Louis Dionne
fc569dafd7
[libc++] Refactor __is_transparent_v to make it clear what it depends on (#186419)
__is_transparent_v used to accept an additional _Key template argument
whose sole purpose was to make the instantiation as a whole dependent.
It turns out that creates confusion around whether that trait takes into
account the key type (it does not). Instead, we can use our traditional
approach for making template params artificially dependent, which allows
removing the confusing parameter.

For disclaimer, I authored this patch with Claude code just to see if I
could get it to do the right thing. It works, but you have to steer it
right.

Fixes #186417
2026-03-18 10:53:47 -04:00
Louis Dionne
3ae428ff3a
[libc++][NFC] Rename the template parameter of __make_transparent (#186435)
Renaming from _Tp to _ArgumentType makes it clearer that we're passing
the argument type intended for the comparator, which allows checking
whether *that specific use* of the comparator would be transparent.

Fixes #186396
2026-03-17 10:15:37 -04:00
Nikolas Klauser
c2e739f3bb
[libc++] Avoid including <cmath> in <format> (#186332)
This reduces the time to parse `<format>` a bit.
2026-03-16 11:27:21 +01:00
Dimitrij Mijoski
1616fbaccf
[libc++] Fix checks for terminal and flushes in std::print() (#70321)
The check whether a stream is associated with a terminal or not and the
flushing of the stream in `std::print()` is needed only on Windows.
Additionally, the correct flush should be used. When `std::print` is
called with a C stream, `std::fflush()` should be used. When it is
called with C++ `ostream`, `ostream::flush()` should be called.

Because POSIX does not have a separate Unicode API for terminal output,
checking for terminal (`isatty`) and flushing is not needed at all.
Moreover, `isatty` has noticeable performance cost.

See also https://wg21.link/LWG4044.

Fixes #70142
2026-03-12 10:58:36 +01:00
Nikolas Klauser
1729480d24
[libc++] Reduce the amount of formatter code included in <vector> (#178683)
`formatter::parse` and `formatter::format` only have to accept
`basic_format_parse_context` and `basic_format_context` respectively,
which are only guaranteed to be provided via `<format>`. This allows us
to only declare the functions for `formatter<bool>` in `<vector>` and
define them if `<format>` is included. This reduces the amount of time
it takes to parse `<vector>` by ~15% on my system.
2026-03-10 09:34:15 +01:00
A. Jiang
fe04edc5a0
[libc++] Fix strict aliasing violation for deque::const_iterator (#136067)
When the allocators use fancy pointers, the internal map of `deque`
stores `FancyPtr<T>` objects, and the previous strategy accessed these
objects via `const FancyPtr<const T>` lvalues, which usually caused core
language undefined behavior. Now `const_iterator` stores `FancyPtr<const
FancyPtr<T>>` instead of `FancyPtr<const FancyPtr<const T>>`, and ABI
break can happen when such two types have incompatible layouts.

This is necessary for reducing undefined behavior and `constexpr`
support for `deque` in C++26, and I currently don't want to provide any
way to opt-out of that behavior.

For `iterator`, the current strategy makes it store
`FancyPtr<FancyPtr<T>>`. But it would make more sense to also store
`FancyPtr<const FancyPtr<T>>` because we never modify the map via
`iterator`.

For some pathological combinations of allocators and fancy pointers, the
rebinding trick doesn't work. These cases are rejected by
`static_assert`.

The existing test coverage seems to be sufficient.
2026-03-10 16:00:38 +08:00
William Tran-Viet
54b671e054
[libc++][NFC] Simplify most of optional.observe (#185252)
- Hoist `operator*()`, `operator->()`, `value()` into their respective
`optional_storage_base` to reduce the amount of concepts flying around.
- `value_or()` has been deliberately left out since that seems to
produce extra (superfluous) error messages during invalid template
instantiation.
2026-03-10 13:48:32 +08:00
William Tran-Viet
a2231642b3
[libc++][NFC] Simplify optional::iterator (#183230)
- Rename `__optional_iterator` into `__optional_iterator_base` and make
it part of the `__optional_{meow}_base` inheritance chain. This allows
us to get rid of a sketchy-looking downcast and shorten some code.
2026-03-08 09:58:06 +08:00
Nikolas Klauser
861b9cacdc
[libc++] Fix std::variant comparators not working on recursive instantiations (#182238)
We currently have an instantiation cycle in `variant`'s comparison
operators. This patch fixes that by replacing a `decltype(auto)` with an
explicit return type, removing the requirement to instantiate the
function in order to know the return type.

Fixes #182232
2026-03-07 10:13:34 +01:00
Nikolas Klauser
e830ee8006
[libc++] Don't double-wrap iterators when bounded iterators are used (#182264)
There is no reason to double-wrap iterators, since we can already
achieve anything we want within `__bounded_iter`itself.

This is technically ABI breaking, but people using bounded iterators
shouldn't require ABI stability currently.

Fixes #178521
2026-03-07 09:12:25 +01:00
Christopher Di Bella
01a97050f0
Revert "[libcxx] adds __split_buffer::__swap_layouts" (#185120)
Reverts llvm/llvm-project#180102
2026-03-06 22:31:42 +00:00
Christopher Di Bella
65f39a16ab
[libcxx] Add __split_buffer::__swap_layouts (#180102)
This commit simplifies the cumbersome process of swapping the respective
layout members for `__split_buffer` and `vector`.
2026-03-06 21:57:03 +00:00
William Fynn
832517f28d
[libc++] Add alias template for __strip_signature::type (#181955)
Simplifying the internal implementation by providing a more concise
way to access the underlying type within the __strip_signature class.
2026-03-06 17:49:39 +00:00
Vitaly Buka
fb7d25556a
[libc++][string] Replace ASAN volatile wrapper with memory barrier (#184693)
The previous `_LIBCPP_ASAN_VOLATILE_WRAPPER` approach was used to
prevent
speculative loads of string data before the short/long state was
determined. This patch replaces that mechanism with a more explicit
`__annotate_memory_barrier()` using an empty volatile assembly block.

This PR is inspired by #183457 and by downstream false positive on
`__get_long_size`. It fails same way as `__get_long_pointer` before we
have
`_LIBCPP_ASAN_VOLATILE_WRAPPER`. Barrier approach avoids
expanding `_LIBCPP_ASAN_VOLATILE_WRAPPER` for size_t, and to
in general looks more readable.

I failed to create reasonable reproducer for test, I suspect it requires
precise set of compiler flags, and libc++ site_config which will be hard
to maintain in test.
2026-03-05 21:09:53 -08:00
William Tran-Viet
65d378d82d
[libc++] Remove __wrap_iter::base() (#179389)
Resolves #126442

- Converts all the relevant functions that used `.base()` into friends
- Fixed usage in `<regex>`

---------

Co-authored-by: A. Jiang <de34@live.cn>
2026-03-05 20:06:46 +08:00
Nikolas Klauser
8fcb60aa47
[libc++][NFC] Introduce __data() to std::string to replace std::__to_address(__get_pointer()) (#178212)
`std::__to_address(__get_pointer())` is an extremely common pattern
inside `string` and is basically equivalent to `data()`, except that
`data()` only returns a non-const pointer since C++17. This patch
introduces `__data()` to back-port returning a non-const pointer.
2026-03-04 10:19:34 +01:00
Nikolas Klauser
0a9b5d5218
[libc++] Forward find* algorithms to find_if (#179938)
This propagates any optimizations to the whole family of `find`
functions.
2026-02-27 14:48:58 -08:00
Nikolas Klauser
d6fcf47a89
[libc++] Fix vector::append_range growing before the capacity is reached (#183264)
Currently `vector::append_range` grows even when appending a number of
elements that is exactly equal to its spare capacity, which is
guaranteed by the standard to _not_ happen.

Fixes #183256
2026-02-27 11:12:17 +01:00
Louis Dionne
5de92856bd
[libc++] Introduce a escape hatch for the changed behavior of map and set search operations (#183190)
In #155245, we implemented an optimization to std::map and std::set
search operations. That optimization took advantage of something that is
guaranteed by the Standard, namely that the comparator provided to the
associative container is a valid strict weak ordering.

Sadly, some code in the wild did not satisfy this requirement, such as
Boost.ICL: boostorg/icl#51

Since this can have extremely tricky runtime consequences, this patch
introduces a temporary escape hatch for the LLVM 22 release that allows
reverting to the previous behavior. It also explicitly calls out the
change in the release notes, adds some regression tests and adds debug
mode support for catching some of these invalid predicates.

Fixes #183189
2026-02-26 10:22:59 -05:00
Nikolas Klauser
b101f01382
[libc++] Optimize using std::copy with an ostreambuf_iterator (#181815)
```
Benchmark                                                  old             new    Difference    % Difference
----------------------------------------------  --------------  --------------  ------------  --------------
std::copy(CharT*,_CharT*,_ostreambuf_iterator)         8115.45          329.54      -7785.91         -95.94%
```
2026-02-26 12:01:07 +01:00
Louis Dionne
09d7b890e0
[libc++] Add a thread-safe version of std::lgamma in the dylib (#153631)
Libc++ currently redeclares ::lgamma_r on platforms that provide it.
This causes issues when building with modules, and redeclaring functions
provided by another library (here the C library) is bad hygiene.

Instead, use an asm declaration to call the right function without
having to redeclare it.
2026-02-25 13:46:51 -05:00
Nikolas Klauser
12d8360727
[libc++] Add segmented iterator optimization to std::equal (#179242)
```
Benchmark                                                 97fa3e593693    a820f8f10736    Difference    % Difference
------------------------------------------------------  --------------  --------------  ------------  --------------
std::equal(deque<int>)_(it,_it,_it)/1024                        510.92           82.64       -428.27         -83.82%
std::equal(deque<int>)_(it,_it,_it)/1048576                  518795.61        87141.29    -431654.32         -83.20%
std::equal(deque<int>)_(it,_it,_it)/50                           29.24            6.77        -22.46         -76.84%
std::equal(deque<int>)_(it,_it,_it)/8                             4.20            3.71         -0.49         -11.61%
std::equal(deque<int>)_(it,_it,_it)/8192                       3972.84          643.83      -3329.01         -83.79%
std::equal(deque<int>)_(it,_it,_it,_it)/1024                    417.45           81.52       -335.93         -80.47%
std::equal(deque<int>)_(it,_it,_it,_it)/1048576              539228.26        87480.92    -451747.34         -83.78%
std::equal(deque<int>)_(it,_it,_it,_it)/50                       22.25            7.25        -15.00         -67.41%
std::equal(deque<int>)_(it,_it,_it,_it)/8                         4.75            4.44         -0.31          -6.45%
std::equal(deque<int>)_(it,_it,_it,_it)/8192                   3259.01          641.31      -2617.70         -80.32%
std::equal(deque<int>)_(it,_it,_it,_it,_pred)/1024              532.68          327.58       -205.10         -38.50%
std::equal(deque<int>)_(it,_it,_it,_it,_pred)/1048576        600755.28       402988.04    -197767.24         -32.92%
std::equal(deque<int>)_(it,_it,_it,_it,_pred)/50                 27.26           25.29         -1.97          -7.22%
std::equal(deque<int>)_(it,_it,_it,_it,_pred)/8                   5.20            5.58          0.38           7.31%
std::equal(deque<int>)_(it,_it,_it,_it,_pred)/8192             4204.16         2847.30      -1356.86         -32.27%
std::equal(deque<int>)_(it,_it,_it,_pred)/1024                  531.32          329.03       -202.30         -38.07%
std::equal(deque<int>)_(it,_it,_it,_pred)/1048576            598948.55       403822.65    -195125.90         -32.58%
std::equal(deque<int>)_(it,_it,_it,_pred)/50                     26.28           16.18        -10.10         -38.43%
std::equal(deque<int>)_(it,_it,_it,_pred)/8                       4.44            3.70         -0.74         -16.67%
std::equal(deque<int>)_(it,_it,_it,_pred)/8192                 4184.03         2902.98      -1281.05         -30.62%
std::equal(list<int>)_(it,_it,_it)/1024                        1168.78         1168.51         -0.27          -0.02%
std::equal(list<int>)_(it,_it,_it)/1048576                  1283003.12      1281885.44      -1117.69          -0.09%
std::equal(list<int>)_(it,_it,_it)/50                            60.19           44.38        -15.81         -26.27%
std::equal(list<int>)_(it,_it,_it)/8                              3.07            3.07          0.00           0.15%
std::equal(list<int>)_(it,_it,_it)/8192                       10367.41        11075.24        707.83           6.83%
std::equal(list<int>)_(it,_it,_it,_it)/1024                     728.32          734.18          5.86           0.80%
std::equal(list<int>)_(it,_it,_it,_it)/1048576               951276.58       953928.39       2651.81           0.28%
std::equal(list<int>)_(it,_it,_it,_it)/50                        31.86           32.32          0.46           1.44%
std::equal(list<int>)_(it,_it,_it,_it)/8                          3.11            3.10         -0.01          -0.34%
std::equal(list<int>)_(it,_it,_it,_it)/8192                   14940.68        16058.91       1118.22           7.48%
std::equal(list<int>)_(it,_it,_it,_it,_pred)/1024               803.49          813.53         10.05           1.25%
std::equal(list<int>)_(it,_it,_it,_it,_pred)/1048576        1012708.15      1026207.55      13499.40           1.33%
std::equal(list<int>)_(it,_it,_it,_it,_pred)/50                  38.68           39.24          0.56           1.46%
std::equal(list<int>)_(it,_it,_it,_it,_pred)/8                    4.07            4.07         -0.00          -0.08%
std::equal(list<int>)_(it,_it,_it,_it,_pred)/8192             16632.08        18073.63       1441.55           8.67%
std::equal(list<int>)_(it,_it,_it,_pred)/1024                  1162.99         1162.48         -0.51          -0.04%
std::equal(list<int>)_(it,_it,_it,_pred)/1048576            1291522.30      1303819.01      12296.72           0.95%
std::equal(list<int>)_(it,_it,_it,_pred)/50                      45.73           46.32          0.59           1.29%
std::equal(list<int>)_(it,_it,_it,_pred)/8                        4.35            4.40          0.04           1.03%
std::equal(list<int>)_(it,_it,_it,_pred)/8192                 15035.93        14598.06       -437.87          -2.91%
std::equal(vector<bool>)_(aligned)/1024                           0.22            0.22          0.00           0.04%
std::equal(vector<bool>)_(aligned)/1048576                        0.22            0.22          0.00           0.12%
std::equal(vector<bool>)_(aligned)/50                             0.22            0.22          0.00           0.02%
std::equal(vector<bool>)_(aligned)/8                              0.22            0.22          0.00           0.03%
std::equal(vector<bool>)_(aligned)/8192                           0.22            0.22          0.00           0.05%
std::equal(vector<bool>)_(unaligned)/1024                         6.34            6.39          0.04           0.70%
std::equal(vector<bool>)_(unaligned)/1048576                   6809.31         6833.52         24.21           0.36%
std::equal(vector<bool>)_(unaligned)/50                           1.11            0.92         -0.19         -17.55%
std::equal(vector<bool>)_(unaligned)/8                            1.11            1.05         -0.06          -5.29%
std::equal(vector<bool>)_(unaligned)/8192                        59.27           59.92          0.65           1.10%
std::equal(vector<int>)_(it,_it,_it)/1024                        80.39           80.59          0.20           0.25%
std::equal(vector<int>)_(it,_it,_it)/1048576                  72546.36        73803.43       1257.07           1.73%
std::equal(vector<int>)_(it,_it,_it)/50                           3.92            4.43          0.51          12.92%
std::equal(vector<int>)_(it,_it,_it)/8                            1.46            1.47          0.01           0.75%
std::equal(vector<int>)_(it,_it,_it)/8192                       553.63          559.59          5.95           1.07%
std::equal(vector<int>)_(it,_it,_it,_it)/1024                    78.69           78.37         -0.32          -0.40%
std::equal(vector<int>)_(it,_it,_it,_it)/1048576              72238.51        73582.13       1343.62           1.86%
std::equal(vector<int>)_(it,_it,_it,_it)/50                       4.18            4.62          0.44          10.52%
std::equal(vector<int>)_(it,_it,_it,_it)/8                        1.68            1.66         -0.01          -0.87%
std::equal(vector<int>)_(it,_it,_it,_it)/8192                   549.35          555.24          5.89           1.07%
std::equal(vector<int>)_(it,_it,_it,_it,_pred)/1024             361.08          363.32          2.24           0.62%
std::equal(vector<int>)_(it,_it,_it,_it,_pred)/1048576       391367.63       394209.88       2842.25           0.73%
std::equal(vector<int>)_(it,_it,_it,_it,_pred)/50                15.24           15.83          0.59           3.87%
std::equal(vector<int>)_(it,_it,_it,_it,_pred)/8                  3.18            3.19          0.01           0.40%
std::equal(vector<int>)_(it,_it,_it,_it,_pred)/8192            2992.57         3026.90         34.32           1.15%
std::equal(vector<int>)_(it,_it,_it,_pred)/1024                 362.45          365.46          3.01           0.83%
std::equal(vector<int>)_(it,_it,_it,_pred)/1048576           399898.16       402718.88       2820.72           0.71%
std::equal(vector<int>)_(it,_it,_it,_pred)/50                    14.79           14.79         -0.01          -0.04%
std::equal(vector<int>)_(it,_it,_it,_pred)/8                      2.45            2.52          0.06           2.64%
std::equal(vector<int>)_(it,_it,_it,_pred)/8192                3062.16         3088.11         25.95           0.85%
Geomean                                                         253.49          200.79        -52.70         -20.79%
```
2026-02-24 10:23:15 +01:00
William Tran-Viet
33025a267d
[libc++] Make __wrap_iter comparison operators hidden friends (#179590)
Prelude to #179389
2026-02-24 09:18:15 +01:00
Matt Stephanson
a28755537b
[libc++] Fix gps_time formatting and related tests (#181560)
- The Standard wording in https://eel.is/c++draft/time.format#13 is similar
  to TAI formatting in that it's equivalent to formatting a `sys_time`
  with a fixed offset. Leap seconds should not be considered.

- Tests need to be adjusted by adding the number of leap seconds between
  the GPS epoch and the tested date, which is 15s for 2010 and 18s for
  2019.

- The TAI and GPS tests using `meow_time<cr::duration<long, ...>>`
  should use `long long` because the offset swill overflow a 32-bit
  signed integer.
2026-02-23 09:20:39 -05:00
Connector Switch
e37c985ba0
[libc++] Fix typo in atomic.h comment (#182719) 2026-02-23 09:43:04 +08:00
Nikolas Klauser
e65218149d
[libc++] Avoid including <format> code in <optional> (#179466)
This patch moves `format_kind` to `<__fwd/format.h>` and moves the
mandate of `basic_format_context` into the class body. This reduces the
time it takes to parse `<optional>` by ~14%.
2026-02-19 11:09:10 +01:00
Nikolas Klauser
5b9b25b9f8
[libc++][NFC] Use std::has_single_bit instead of std::popcount(v) == 1 (#181787)
We have a function that specifically checks if a single bit is set. Use
that instad of a `popcount`.
2026-02-19 09:29:43 +01:00
Christopher Di Bella
be28e55d2d
[libc++] Memoise size() in vector::__assign_with_size (#180288)
This is an optimisation from the size-based vector project that's
applicable to all vector implementations.
2026-02-16 22:39:11 +00:00
Fady Farag
2bee460f01
[libc++] Prevent ADL on _Block_copy/_Block_release (#179614)
Suppress ADL on Blocks runtime calls in std::function.
2026-02-16 15:23:40 +01:00
Nikolas Klauser
3519aaecef Reapply "[libc++] Add test_iterators.h to the modulemap (#181351)"
Another test committed recently was missing an include.

This reverts commit ab88d9af5371ef62a636fc780c88cf6d3487c584.
2026-02-16 08:09:55 +01:00
Aiden Grossman
ab88d9af53 Revert "[libc++] Add test_iterators.h to the modulemap (#181351)"
This reverts commit 04ef765b65040e1df4cafaf3dacc26fa5d48e519.

This was causing buildbot failures for premerge:
1. https://lab.llvm.org/staging/#/builders/192/builds/20135
2026-02-16 02:28:39 +00:00
Nikolas Klauser
04ef765b65
[libc++] Add test_iterators.h to the modulemap (#181351)
and fix all the missing includes found by it.
2026-02-15 22:05:55 +01:00
Hui
d7a24d30f6
[libc++] Implement ranges::shift_right (#177847)
Implement the `ranges::shift_right` algorithm from
[P2440R1](https://wg21.link/P2440R1).

Fixes #134062
Fixes #105184
2026-02-14 17:34:44 +00:00
h-vetinari
d4854177dd
[libc++] Increase the minimum deployment target on macOS to 11.0 (#176094)
#166172 moved the effective minimum deployment target on macOS to 10.15
(because `aligned_alloc` is not defined before that in the C stdlib),
and indeed, it was mentioned in that PR that libc++ only supports macOS
11 and later.

This PR rectifies the documentation and the code to reflect the actually
supported deployment targets on macOS. See [1] for additional discussion
about this.

[1]: https://discourse.llvm.org/t/minimum-macos-deployment-target-increases-to-11-0-in-v22-1-visibility-discussion-on-update-policy
2026-02-13 17:03:41 -05:00
Nikolas Klauser
d7d4e4ace5
[libc++][NFC] Don't use copy_n to copy a single integer in __sign_combinator (#181119)
We can just assign the integer directly.
2026-02-13 10:51:57 +01:00