7029 Commits

Author SHA1 Message Date
Mark de Wever
6de15379f4
[NFC][libc++][test] Minor updates to generated header version test. (#134543)
Adjusting the existing script to match the new output makes it easy to
review the new script works correctly.

This adjusts the tests to match the changes in the new tests, Notably
- removes the synopsis uses 2 spaces indent in `# if`

It does not implement the conditional include part. This would be quite
some effort and these diffs are easy to review manually.

Note there are no tests for the changes; the existing script will be
phased out when the next generators are complete.
2025-04-12 14:20:01 +02:00
Mark de Wever
df579ce4b6
[libc++] Adds is_implemented function for new ftm generator. (#134538)
At the moment the ftm macro for __cpp_lib_to_chars will have the
following values:

standard_ftms: {
    "c++17": "201611L",
    "c++20": "201611L",
    "c++23": "201611L",
    "c++26": "201611L",
}

implemented_ftms: {
    "c++17": None,
}

This is an issue with the test whether the FTM is implemented it does:
  self.implemented_ftms[ftm][std] == self.standard_ftms[ftm][std]
This will fail in C++20 since implemented_ftms[ftm] does not have the
key c++20. This adds a new helper function and removes the None entries
when a FTM is not implemented.

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-04-11 20:27:29 +02:00
Mark de Wever
88e15b7815
[libc++] A quick-fix for the Apple CI. (#135202)
The Apple runners automatically pick up newer XCode versions breaking
the CI. This disables the test to get the CI green which allows us to
investigate the issue properly later on.
2025-04-11 17:05:30 +02:00
Nikolas Klauser
8fc2538f33
Reapply "[libc++] Optimize num_put integral functions" (#131613) (#133572)
This reverts commit d1156fcb56891fb1a426c3e8331a51d47f98a1b8.

This patch fixes the reported incorrect formatting changes and adds
tests for them. The performance should be unaffected, since there are no
significant changes required to fix the bugs.

Specifically, a `>` was changed to a `>=` to also add a `+` in the zero
case, and we're checking for zero now before printing the octal and
hexadecimal prefixes.

Closes #131710
2025-04-11 15:35:58 +02:00
Peter Collingbourne
a4e6a771a6
libcxx: In gdb test detect execute_mi with feature check instead of version check.
The existing version check can lead to test failures on some distribution
packages of gdb where not all components of the version number are
integers, such as Fedora where gdb.VERSION can be something like
"15.2-4.fc41". Fix it by replacing the version check with a feature check.

Reviewers: philnik777

Reviewed By: philnik777

Pull Request: https://github.com/llvm/llvm-project/pull/132291
2025-04-10 10:38:08 -07:00
A. Jiang
ab95005a05
[libc++] P3247R2: Deprecate is_trivial(_v) (#130573)
Requirements on character-like types are updated unconditionally,
because `basic_string` does requires the default-constructibility. It
might be possible to make `basic_string_view` support classes with
non-public trivial default constructor, but this doesn't seem sensible.

libcxxabi's `ItaniumDemangle.h` is also updated to avoid deprecated
features.
2025-04-09 07:40:01 +08:00
Mark de Wever
658f848fed
[NFC][libc++][test] Refactor new ftm generator tests. (#134490)
This uses the python unit test framework instead of just asserts. This
improves the diagnostics when a test fails.
2025-04-08 19:38:26 +02:00
Matheus Izvekov
d057811655
[clang] fix diagnostic printing of expressions ignoring LangOpts (#134693)
Currently when printing a template argument of expression type, the
expression is converted immediately into a string to be sent to the
diagnostic engine, unsing a fake LangOpts.

This makes the expression printing look incorrect for the current
language, besides being inneficient, as we don't actually need to print
the expression if the diagnostic would be ignored.

This fixes a nastiness with the TemplateArgument constructor for
expressions being implicit, and all current users just passing an
expression to a diagnostic were implicitly going through the template
argument path.

The expressions are also being printed unquoted. This will be fixed in a
subsequent patch, as the test churn is much larger.
2025-04-07 23:19:32 -03:00
Damien L-G
9965f3d337
[libc++] Improve diagnostic when violating std::atomic trivially copyable mandates (#131754)
When attempting to instantiate `std::atomic` with a non trivially
copyable type, one gets errors from instantiating internals before the
actual static assertion that check the template parameter type
requirements.

The `verify` test for it had a `// ADDITIONAL_COMPILE_FLAGS: -Xclang
-verify-ignore-unexpected=error` directive to work around this issue.
The changes I propose enable us to drop that directive.
As I understand it, the `verify` test was misplaced so I moved it to
`test/{std -> libcxx}/atomics`.

(I ran into this while working on #121414 in which we would add another
static assertion in `__check_atomic_mandates`)
2025-04-07 15:25:45 -04:00
Mark de Wever
a406fb8f5a
[libc++] Clang-tidy operator& hijacker. (#128366)
Guards against introducing new places where operator& depends on a
template type.
2025-04-07 18:19:58 +02:00
Hui
7013b51548
[libc++] Implement std::flat_multiset (#128363)
fixes https://github.com/llvm/llvm-project/issues/105193
2025-04-06 10:50:55 +01:00
Louis Dionne
b4f7a2ab57
[libc++] Bump OS version for macOS backdeployment CI jobs (#131883)
In 0547e573c555, I introduced backdeployment testing on macOS using
Github-provided builders. This was done by basically building libc++ on
a slightly older macOS (like macOS 13) and then running against the
system library on that machine. However, that created a dependency that
libc++ must keep working on macOS 13, which doesn't support the
latest-released Xcode.

This patch solves that problem by moving the deployment testing to a
newer version of macOS which supports the latest-released version of
Xcode.

Sadly, that also reduces the backdeployment coverage we have since we're
not actually testing on older OSes, but is necessary to satisfy the
documented libc++ support policy. In the future, we could improve the
situation by providing a Lit configuration that allows compiling (but
not running) all the tests, building the tests on a supported macOS, and
then shipping those tests on an older backdeployment target in order to
run them against the system library. Since that requires significant
engineering, this isn't done at this time.
2025-04-05 20:53:18 +02:00
James E T Smith
475cbf0ad6
[libc++] Implement ranges::iota (#68494)
# 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-04-05 13:46:11 +02:00
Louis Dionne
4090910a69
[libc++] Guard additional headers with _LIBCPP_HAS_LOCALIZATION (#131921)
There were some remaining headers that were not guarded with
_LIBCPP_HAS_LOCALIZATION, leading to errors when trying to use modules
on platforms that don't support localization (since all the headers get
pulled in when building the 'std' module). This patch brings these
headers in line with what we do for every other header that depends on
localization.

This patch also requires including <picolibc.h> from
<__configuration/platform.h> in order to define _NEWLIB_VERSION. In the
long term, we should use a better approach for doing that, such as
defining a macro in the __config_site header.
2025-04-04 11:48:46 -04:00
Hristo Hristov
b93376f899
[libc++][type_traits] reference_{constructs|converts}_from_temporary with -Winvalid-specialization tests (#133946)
Addresses comment:
https://github.com/llvm/llvm-project/pull/128649/files#r2022341035

---------

Co-authored-by: Hristo Hristov <zingam@outlook.com>
2025-04-03 23:18:04 +03:00
Peng Liu
e6c2fdc90f
[libc++] Fix ambiguous call to std::max in vector<bool> (#119801)
Closes #121713.
2025-04-02 11:14:14 -04:00
Matheus Izvekov
dc17429ae6
[clang] improved preservation of template keyword (#133610) 2025-04-01 17:15:18 -03:00
Hui
e16541e1a6
[libc++] fix flat_set's transparent insert (#133402)
Unlike `flat_map` and `flat_multimap`, The two function template
overloads `flat_set::insert`'s wording strongly suggest we should use
the transparent comparator
https://eel.is/c++draft/flat.set#modifiers-1

Both the code and the tests were not using the transparent comparator,
which needs to be fixed
2025-03-29 16:29:31 +00:00
Nikolas Klauser
457970d25d [libc++][NFC] Format std::num_put tests 2025-03-28 23:03:42 +01:00
A. Jiang
3c0300d1fe
[libc++][ranges] Adjust inheritance detection for enable_view (#132582)
Per [range.view]/6, a `view_interface` isn't a base class of itself, so
`enable_view` should report `false`. Also, current implementation
strategy handles `const` but not `volatile`, IIUC cv-qualifiers should
be consistent handled.

In `enable_view.compile.pass.cpp`, coverage for (`const`) `volatile`
types are added.

Drive-by: Remove one unnessary `test_macro.h` inclusion in a test.

Fixes #132577.
2025-03-26 20:56:52 -04:00
Mark de Wever
f9aa7a20d9
[libc++] Verify std::forward_like's mandates clause. (#127318)
The existing using _ForwardLike declaration already fails with a
subsitution failure. The LWG issue was filed to clarify what should
happen for non-referencable types.

Added test to verify libc++ is already enforcing the new Mandates.

Implements:
- LWG3757 What's the effect of std::forward_like<void>(x)

Closes: #105026
2025-03-26 20:53:30 -04:00
Martin Storsjö
51bceb46f8
[libcxx] [test] Fix restoring LLVM_DIR and Clang_DIR (#132838)
In 664f345cd53d1f624d94f9889a1c9fff803e3391, a fix was introduced,
attempting to restore LLVM_DIR and Clang_DIR after doing
find_package(Clang).

However, 6775285e7695f2d45cf455f5d31b2c9fa9362d3d added a return if the
clangTidy target wasn't found. If this is hit, we don't restore LLVM_DIR
and Clang_DIR, which causes strange effects if CMake is rerun a second
time.

Move the code for restoring LLVM_DIR and Clang_DIR to directly after the
find_package calls, to make sure they are restored, regardless of the
find_package outcome.
2025-03-26 22:13:28 +02:00
Peng Xie
3fbd0ec7e3
[libc++] Update the status for LWG3120 (#116772)
The current implementation already have an __initial_descriptor which
saves the initial state. When release() is called, we will reset the
__initial_descriptor.__cur_ pointer.

This patch also updates the status of LWG3120.

Closes #104274

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-03-25 20:24:56 -04:00
A. Jiang
af267993a7
[libc++] Re-implement LWG2770 again * 2 (#132598)
1013fe3c0cfd7582e94ef2d4bfd79da7ea1a1289 used to implement LWG2770, but
cb0d4df97490ec2d2b1cdf7574d26b1bc4063599 made LWG2770 unimplemented
again because of CWG2386.

This patch re-implements LWG2770, while keeping the libc++-specific
implementation strategy (which is controversial as noted in LWG4040).

Drive-by:
- Make the test coverage for the controversial part noted in LWG4040
libc++-only.
- Add the previously missed entry for LWG2770 to the documentation.
2025-03-26 07:38:02 +08:00
Louis Dionne
b0668d859b
[libc++] Make sure that __desugars_to isn't tripped up by reference_wrapper, const and ref qualifiers (#132092)
Previously, const and ref qualification on an operation would cause
__desugars_to to report false, which would lead to unnecessary
pessimizations. The same holds for reference_wrapper.

In practice, const and ref qualifications on the operation itself are
not relevant to determining whether an operation desugars to something
else or not, so can be ignored.

We are not stripping volatile qualifiers from operations in this patch
because we feel that this requires additional discussion.

Fixes #129312
2025-03-25 14:29:06 -04:00
Amr Hesham
357306572d
[libcxx] Put std::monostate in <utility> (#128373)
Fixes: #127874
2025-03-25 18:31:57 +01:00
Louis Dionne
aa80388cf9
[libc++] Ensure that we vectorize algorithms on all Clang-based compilers (#132090)
Otherwise, we wouldn't vectorize on compilers like AppleClang when in
reality we know perfectly well how to do it.
2025-03-24 13:22:40 -04:00
Louis Dionne
410754410f
[libc++] Add benchmarks for partitioning algorithms (#127324)
This patch adds benchmarks for std::partition, is_partitioned, etc and
their ranges:: variants.
2025-03-24 12:24:43 -04:00
Nikolas Klauser
ddc62797c4
[libc++] Simplify the implementation of __is_referenceable (#130043)
The `__is_referenceable` builtin has been removed from Clang, since all
its uses have been replaced by builtins themselves. This trait only
exists for GCC compatibility and to word around some issues in the other
traits. The non-builtin implementation has been refactored to use
variable templates instead, making the implementation much simpler.
2025-03-24 07:32:01 +01:00
Nikolas Klauser
66531c998a
[libc++] Remove one of the std::signbit overloads (#130505)
We'e specialized `std::signbit` for signed and unsigned integral types
seperately, even though the optimizer can trivially figure out that
`unsigned_value < 0` always false is. This patch removes the
specialization, since there is really not much of a benefit to it.
2025-03-24 07:30:45 +01:00
A. Jiang
e409464e95
[libc++][test][NFC] Introduce TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED (#132593)
And use it for test cases that became constant-evaluation-suitable due
to P2562R1.

`TEST_STD_AT_LEAST_(20|23)_OR_RUNTIME_EVALUATED` are the precedents.
2025-03-24 10:43:19 +08:00
Nikolas Klauser
fb44f00641
[libc++] Add [[gnu::nodebug]] on type traits (#128502) 2025-03-23 21:01:25 +01:00
Hui
2f1416bbcd
[libc++] implement std::flat_set (#125241)
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-03-23 14:45:21 +00:00
Stephan T. Lavavej
51aab96ebf
[libc++][test] Small fixes for time tests (#132532)
* Fix copy-paste damage in `formatter.tai_time.pass.cpp`.
+ Comparing the `#if` to the `#else` case, it's clear that this
half-copied check should be removed.
* Mark `is_steady` as `[[maybe_unused]]`.
  + It's only used within `LIBCPP_STATIC_ASSERT`.
2025-03-22 06:38:47 -07:00
S. B. Tam
7d742f97b0
[libc++][test] Guard uses of _LIBCPP_HAS_THREADS in FTM tests (#132258) 2025-03-21 11:36:36 +08:00
A. Jiang
6038077dde
[libc++] Bump __cpp_lib_constexpr_algorithms for P2562R1 in C++26 (#132075)
Completes P2562R1.
2025-03-21 07:33:52 +08:00
Louis Dionne
be36f41ff9 [libc++][NFC] Run two tests I'm about to modify a bunch under clang-format 2025-03-20 16:03:31 -04:00
Louis Dionne
382b707e52
[libc++] Add coverage for C++17 and Clang Modules with LSV (#131815)
In recent versions of Clang, using -std=c++20 (and later) implies LSV
when compiling with modules. This change resulted in making our LSV job
redundant with the regular modules job, which uses the latest Standard.
This patch increases the coverage of our CI without increasing its cost
by pinning the LSV job to use C++17, which normally doesn't use LSV. A
related question is whether we should add coverage for non-LSV builds
using Clang modules.
2025-03-20 13:50:59 -04:00
Peng Liu
9dc854ccbd
[libc++] Improve test coverage for copy/move ctors for vector<bool> (#120132)
The current tests for `vector<bool>` fail to adequately cover realistic
scenarios, as they are limited to cases of up to 3 bytes, representing
less than 1/2 of a word size on a 64-bit system. However, most
`vector<bool>` operations rely on code paths triggered only when
handling multiple storage words (8 bytes each). To address this gap,
this PR rewrites the tests for copy and move constructors, as well as
allocator-extended copy and move constructors, ensuring that previously
untested code paths are now thoroughly validated.
2025-03-20 08:37:39 -04:00
Stephan T. Lavavej
bf5cdd6358
[libc++][test] Fix issues found by MSVC's STL (#131787)
* libcxx/test/support/min_allocator.h
+ Fix `tiny_size_allocator::rebind` which mistakenly said `T` instead of
`U`.
*
libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp
  + `std::stable_partition` requires bidirectional iterators.
* libcxx/test/std/containers/sequences/vector.bool/max_size.pass.cpp
+ Fix allocator type given to `std::vector<bool>`. The element types are
required to match, [N5008](https://isocpp.org/files/papers/N5008.pdf)
\[container.alloc.reqmts\]/5: "*Mandates:* `allocator_type::value_type`
is the same as `X::value_type`."
* libcxx/test/std/time/time.clock/time.clock.utc/types.compile.pass.cpp
+ Mark `is_steady` as `[[maybe_unused]]`, as it appears within
`LIBCPP_STATIC_ASSERT` only.
*
libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp
*
libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp
* libcxx/test/std/utilities/utility/utility.swap/swap_array.pass.cpp
+ Fix MSVC warning C4127 "conditional expression is constant".
`TEST_STD_AT_LEAST_23_OR_RUNTIME_EVALUATED` was introduced for this
purpose, so it should be used consistently.
* libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
+ Fix `gcd()` precondition violation for `signed char`. This test case
was causing `-128` to be passed as a `signed char` to `gcd()`, which is
forbidden.
* libcxx/test/std/containers/sequences/array/assert.iterators.pass.cpp
*
libcxx/test/std/containers/sequences/vector/vector.modifiers/assert.push_back.invalidation.pass.cpp
*
libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp
+ Split some REQUIRES and XFAIL lines. This is a "nice to have" for
MSVC's internal test harness, which is extremely simple and looks for
exact comment matches to skip tests. We can recognize the specific lines
"REQUIRES: has-unix-headers" and "XFAIL: msvc", but it's a headache to
maintain if they're chained with other conditions.
* libcxx/test/support/sized_allocator.h
+ Fix x86 truncation warnings. `std::allocator` takes `std::size_t`, so
we need to `static_cast`.
*
libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp
+ Fix x86 truncation warning. `std::min()` is returning
`std::streamoff`, which was being unnecessarily narrowed to
`std::size_t`.
*
libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
+ Fix MSVC warning C4127 "conditional expression is constant" for an
always-true branch. This was very recently introduced by #129008 making
`N` constexpr. As it's a local constant just nine lines above, we don't
need to test whether 100 is greater than 0.
2025-03-20 15:53:25 +08:00
A. Jiang
053a714add
[libc++] Implement part of P2562R1: constexpr ranges::inplace_merge (#131947)
Drive-by changes:
- Consistently mark `std::__inplace_merge::__inplace_merge_impl`
`_LIBCPP_CONSTEXPR_SINCE_CXX26`.
- This function template is only called by other functions that becomes
constexpr since C++26, and it itself calls `std::__inplace_merge` that
is constexpr since C++26.
- Unblock related test coverage in constant evaluation for
`stable_partition`, `ranges::stable_sort`, `std::stable_sort`,
`std::stable_partition`, and `std::inplace_merge`.
2025-03-20 01:59:32 +08:00
Peng Liu
b350bc2c0b
[libc++] Verify forward_list self-merging is a no-op (#129985)
https://wg21.link/LWG3088 requires that `forward_list::merge()` is a no-op when passed
`*this`, which aligns with the behavior of `list::merge`. Although libc++'s implementation
of `forward_list::merge()` already meets this requirement, there were no tests to verify
this behavior. This patch adds the necessary tests to ensure that self-merging remains a
no-op and prevents any future regressions on this.

Closes #104942.
2025-03-19 12:28:11 -04:00
Peng Liu
70480fcff6
[libc++] Validate vector<bool> copy/move-assignment operators in realistic scenarios (#119817)
The existing tests for `vector<bool>` copy- and move-assignment
operators are limited to 3 bits only, which are inadequate to cover
realistic scenarios. Most `vector<bool>` operations have code paths that
are executed only when multiple storage words are involved, with each
storage word typically comprising 64 bits on a 64-bit platform.
Furthermore, the existing tests fail to cover all combinations
`POCCA`/`POCMA`, along with different allocator equality and/or
reallocation scenarios, leaving some critical code paths untested.

This patch enhances the test coverage by introducing new tests covering
up to 5 storage words, ensuring that partial words in the front or tail,
and whole words in the middle are all properly tested. Moreover, these
new tests ensure that the copy- and move-assignment operators are tested
under all combinations of `POCCA`/`POCMA` and various allocator equality
scenarios, both with or without reallocations.
2025-03-19 12:08:20 -04:00
Peng Liu
029cb8aff1
[libc++] Fix copy_backward for vector<bool> with small storage types (#131560)
This patch fixes an issue in libc++ where `std::copy_backward` and
`ranges::copy_backward` incorrectly copy `std::vector<bool>` with small
storage types (e.g., `uint8_t`, `uint16_t`). The problem arises from
flawed bit mask computations involving integral promotions and sign-bit
extension, leading to unintended zeroing of bits. This patch corrects
the bitwise operations to ensure correct bit-level copying.

Fixes #131718.
2025-03-19 11:58:02 -04:00
Peng Liu
a5b3d3a03f
[libc++] Fix {std, ranges}::copy for vector<bool> with small storage types (#131545)
The current implementation of `{std, ranges}::copy` fails to copy
`vector<bool>` correctly when the underlying storage type
(`__storage_type`) is smaller than `int`, such as `unsigned char`,
`unsigned short`, `uint8_t` and `uint16_t`. The root cause is that the
unsigned small storage type undergoes integer promotion to (signed)
`int`, which is then left and right shifted, leading to UB (before
C++20) and sign-bit extension (since C++20) respectively. As a result,
the underlying bit mask evaluations become incorrect, causing erroneous
copying behavior.

This patch resolves the issue by correcting the internal bitwise
operations, ensuring that `{std, ranges}::copy` operates correctly for
`vector<bool>` with any custom (unsigned) storage types.

Fixes #131692.
2025-03-19 11:55:51 -04:00
Peng Liu
c5195ae2d0
[libc++] Fix {std, ranges}::equal for vector<bool> with small storage types (#130394)
The current implementation of `{std, ranges}::equal` fails to correctly
compare `vector<bool>`s when the underlying storage type is smaller than
`int` (e.g., `unsigned char`, `unsigned short`, `uint8_t` and
`uint16_t`). See [demo](https://godbolt.org/z/j4s87s6b3)). The problem
arises due to integral promotions on the intermediate bitwise
operations, leading to incorrect final equality comparison results. This
patch fixes the issue by ensuring that `{std, ranges}::equal` operate
properly for both aligned and unaligned bits.
 
Fixes #126369.
2025-03-19 11:51:21 -04:00
Peng Liu
e53bea5182
[libc++] Fix ambiguous call in {ranges, std}::count (#122529)
This PR fixes an ambiguous call encountered while using the
`std::ranges::count` and `std::count` algorithms with `vector<bool>`
with small `size_type`s.

The ambiguity arises from integral promotions during the internal
bitwise arithmetic of the `count` algorithms for small integral types.
This results in multiple viable candidates:
`__libcpp_popcount(unsigned)`,` __libcpp_popcount(unsigned long)`, and
`__libcpp_popcount(unsigned long long)`, leading to an ambiguous call
error. To resolve this ambiguity, we introduce a dispatcher function,
`__popcount`, which directs calls to the appropriate overloads of
`__libcpp_popcount`. This closes #122528.
2025-03-19 11:36:29 -04:00
Louis Dionne
b3a4bf9d8f
[libc++] Refactor and add benchmarks from [alg.nonmodifying] (#128206) 2025-03-19 00:08:46 -04:00
A. Jiang
854a4f2bbb
[libc++] Implement part of P2562R1: constexpr std::inplace_merge (#129008)
Drive-by:
- Adds `constexpr_random.h` for pseudo-randomizing or shuffling in tests
for constant evaluation.
2025-03-19 07:42:23 +08:00
Mark de Wever
9feac2cbd0 [libc++] Improve deprecated diagnostic guards.
Recent Clang-21 builds improved the deprecated diagnotics. This
uncovered missing guards in libc++ internally.

Note: This patch should be a separate commit and not merged.
For testing purposes they are combined.

Reviewed as part of #130497.
2025-03-18 18:30:48 +01:00