13974 Commits

Author SHA1 Message Date
Hristo Hristov
792fce7cc3
[libc++][ranges][NFC] Format a couple of tests as a prerequisite (#190514)
to https://llvm.org/PR190513 to avoid friction.
2026-04-05 15:20:58 +03:00
Hristo Hristov
5613f77293
[libc++][ranges] Updated ranges::to [[nodiscard]] tests (#173574)
- Updated and moved `ranges::to` `[[nodiscard]]` tests to the new
conventinional location.
- Removed libcxx/test/libcxx/diagnostics/ranges.nodiscard.verify.cpp,
which is now obsolete in favor of more specific test files.

# References:

- https://wg21.link/range.utility.conv
- https://wg21.link/range.utility.conv.to
- https://wg21.link/range.utility.conv.adaptors

Towards #172124
2026-04-02 13:46:06 +03:00
Michael Kruse
afb80bddf1
[Runtimes] Introduce variables containing resource dir paths (#177953)
Introduce common infrastructure for runtimes that determines compiler
resource path locations. These variables introduced are:

 * RUNTIMES_OUTPUT_RESOURCE_DIR
 * RUNTIMES_INSTALL_RESOURCE_PATH
 
That contain the location for the compiler resource path (typically
`lib/clang/<version>`) in the build tree and the install tree (the
latter relative to CMAKE_INSTALL_PREFIX).

Additionally, define

 * RUNTIMES_OUTPUT_RESOURCE_LIB_DIR
 * RUNTIMES_INSTALL_RESOURCE_LIB_PATH

as for the location of clang/flang version-locked libraries (typically
`lib${LLVM_LIBDIR_SUFFIX}/<targer-triple>`, but also depends on `APPLE`
and `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR`). This code is moved from
flang-rt and initially becomes its only user.

Refactored out of #171610 as requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2687382481).

Extracted `get_runtimes_target_libdir_common` from compiler-rt as
requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2689565634).
 
Added TODO comments to all runtimes as requested
[here](https://github.com/llvm/llvm-project/pull/171610#issuecomment-3789598635).
2026-04-02 10:32:14 +00:00
Hristo Hristov
acc609bc29
[libc++][NFC] Removed an EOL stray white space in Release Notes (#189654) 2026-03-31 17:02:49 +03:00
Himadhith
5b2363a102
[libc++][AIX] Fix force_thread_creation_failure by using RLIMIT_THREADS (#188787)
This patch fixes the test `force_thread_creation_failure.cpp` on AIX by
using platform specific `RLIMIT_THREADS` which helps in restricting the
thread creation as `RLIMIT_NPROC` on AIX restricts processes and not
threads.

---------

Co-authored-by: himadhith <himadhith.v@ibm.com>
2026-03-31 12:34:58 +05:30
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
Louis Dionne
16651d240e
[libc++] Bump libc++ runners to include python-venv (#189008) 2026-03-30 08:47:26 -04:00
Joseph Huber
15940b130a [libcxx] Update GPU cache files to use the proper loader
Summary:
These were renamed and the aliases removed, fix running the tests.
2026-03-28 08:47:55 -05:00
Louis Dionne
ede566118f
[libc++] Use --merge append when submitting to LNT (#189030)
This ensures that we can easily gather additional runs of the same
commit to reduce noise.
2026-03-27 11:49:08 -04:00
Louis Dionne
e56161ef98
[libc++] Allow passing individual commits to LNT runners (#189020)
This is useful for generating specific data points.
2026-03-27 11:14:55 -04:00
Louis Dionne
a691a452b5
[libc++] Bump base image version in Docker compose (#188848)
This adds python-venv to the Docker image.
2026-03-27 10:23:57 -04:00
Louis Dionne
e849c68657
[libc++] Install venv in the CI Docker image (#188825)
To support #165769
2026-03-26 17:16:02 -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
Ross Burton
88cbac0495
[libc++] Unify python shebangs (#187258)
As per PEP-0394[1], there is no real concensus over what binary names
Python has, specifically 'python' could be Python 3, Python 2, or not
exist.

However, everyone has a python3 interpreter and the scripts are all
written for Python 3. Unify the shebangs so that the ~50% of shebangs
that use python now use python3.

[1] https://peps.python.org/pep-0394/
2026-03-19 15:16:08 -04:00
Hristo Hristov
c9f6ad8d42
[libc++][docs][NFC] Update Open XL supported version to 17.1.4 (#176112)
Open XL 17.1.4 based on LLVM21 was released:
https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.4?topic=whats-new

Co-authored-by: Hristo Hristov <zingam@outlook.com>
2026-03-19 17:56:26 +02:00
Louis Dionne
e1aef9e227
[libc++] Fix missing availability check for visionOS in apple_availability.h (#187015)
Without this, we were assuming that __ulock was unavailable on visionOS
and falling back to the manual implementation, when in reality we can
always rely on the existence of ulock.

Fixes #186467
2026-03-19 11:14:12 -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
3e09538a42
[libc++] Expand test coverage for converting comparators in associative containers (#187133)
This is in preparation for fixing #187105.
2026-03-18 14:22:22 -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
fec11e3e5f
[libc++] Add scripts defining two LNT runners for libc++ (#187050) 2026-03-17 12:15:56 -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
Louis Dionne
0eefb2682b
[libc++] Build the library with C++26 (#181021)
All supported compilers support C++26. This allows simplifying some of
the upcoming <text_encoding> implementation.
2026-03-17 09:05:51 -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
Jake Egan
3fea2f6165
[libc++][test] Use loop with compare_exchange_weak calls (#185953)
On AIX, this test sometimes fails with error `Assertion failed: y ==
true`. The test assumes `compare_exchange_weak` should succeed on a
single call, however according to the standard:

> A weak compare-and-exchange operation may fail spuriously. That is,
even when the contents of memory referred to by expected and ptr are
equal, it may return false and store back to expected the same memory
contents that were originally there.
This spurious failure enables implementation of compare-and-exchange on
a broader class of machines, e.g., load-locked store-conditional
machines. A consequence of spurious failure is that nearly all uses of
weak compare-and-exchange will be in a loop.

[atomics.ref.ops]/27
2026-03-14 22:34:48 -04:00
Sharjeel Khan
5f479438dd
[libc++][Android] Update Compiler for Android CI (#186531)
Upgrade Android compiler from r563880 to r584948b because libc++ does
not support LLVM 20 anymore
2026-03-14 14:48:08 -07:00
Nikolas Klauser
7ba7d76c86
[libc++] Make the associative container query benchmarks more representative (#183036)
Currently the query benchmarks are training the branch predictor
incredibly well, which isn't representative of the real world. This
change causes the branch misses to go from <1% to ~50% with the current
implementation of `__tree::__find_end`.

This patch also removes the `non-existent` benchmarks, since it'd be
non-trivial to write a representative benchmark for that case, and the
benchmark would be relatively low value. We're already searching to leaf
nodes ~50% of the time (since half the nodes are leaves) with the
current benchmark. So we'd only additionally cover a relatively trivial
failure branch that is only taken once per function call. The loop is
already covered through benchmarking with keys existing in the
container.
2026-03-13 09:48:07 -04: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
c1d26c3c25
[libc++] Fix iostream size ABI break (#185839)
In #124103 we changed the size of various iostream objects, which turns
out to be ABI breaking when compiling non-PIE code.

This ABI break is safe to fix, since for any programs allocating more
memory for the iostream objects, the remaining bytes are simply unused
now.

Fixes #185724
2026-03-12 10:18:25 +01:00
Louis Dionne
b90f606c58
[libc++] Rename container benchmarks for consistency and precision (#181178) 2026-03-11 13:49:09 -04:00
Nikolas Klauser
18b70cebc9
[libc++] Switch to the new docker image in the CI (#185843)
This also simplifies the workflow file a bit and removes a redundant
`generic-cxx26` configuration in stage 3.
2026-03-11 17:09:44 +01:00
Nikolas Klauser
71608f4ce3
[libc++] Update the libcxx-next-runners image (#185871) 2026-03-11 13:53:24 +01:00
Louis Dionne
c7aaaeaef4
[libc++] Rename a few benchmarks to allow identifying what's being benchmarked from the name (#185747) 2026-03-11 08:15:02 -04:00
Nikolas Klauser
1930089f25
[libc++] Update the docker base image version (#185863) 2026-03-11 12:52:03 +01:00
Nikolas Klauser
e9437d01e4
[libc++] Install build-essential in the CI docker container (#185853)
We don't install a compiler via `apt` anymore, so we need to explicitly
install the utilities required to build stuff.
2026-03-11 11:35:57 +01:00
Louis Dionne
b22c6b41af
[libc++][NFC] Merge libc++ specific test directories for std::string (#185717)
String tests do not belong under `containers/`.
2026-03-11 09:17:20 +01:00
Nikolas Klauser
e1fcdc455f
[libc++] Update the libcxx-next-runners to use the new docker image (#185603) 2026-03-10 14:20:20 +01:00
Nikolas Klauser
15bcae5e3b
[libc++] Drop the unrepresentative search_n benchmark (#184783)
This benchmark isn't very good at benchmarking `search_n`, since a good
`search_n` implementation can go through it in ~10 perfectly predictable
steps. We can drop it to avoid spending unnecessary resources. This also
fixes that the two benchmark sets have identical names.

Fixes #183832
2026-03-10 10:40:12 +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