3866 Commits

Author SHA1 Message Date
Louis Dionne
580d26ae46
[libc++] Remove the CI job testing Clang 15 (#66406)
Since LLVM 17 has been branched and is on the verge of being released,
we can drop the CI job that tests against Clang 15. I think the number
of cherry-picks to `release/17.x` will be a lot smaller now, so keeping
a Clang 15 job around for that purpose seems unnecessary.

As a fly-by, this patch also removes some Clang 15 workarounds and test
suite annotations as we usually do. It also removes some slightly older
gcc test suite annotations that were missed.
2023-09-25 17:55:59 -04:00
Louis Dionne
029c9c3176
[libc++] Refactor tests for std::pointer_traits (#66645)
After landing the implementation of LWG3545, I realized that the tests
for std::pointer_traits had become a bit disorganized. This patch is a
NFC that refactors the tests:
- Move compile-only tests to `.compile.pass.cpp` tests
- Re-create the clear distinction between tests for the std::pointer_traits base tempate and for the T* specialization.
- De-duplicate test coverage -- we had a bunch of things that were tested in duplication.
2023-09-25 11:15:33 -04:00
Louis Dionne
21f8bc25ad
[libc++] Make sure we forward stdin through executors (#67064)
This allows running tests like the ones for std::cin even on SSH
executors. This was originally reported as
https://github.com/llvm/llvm-project/pull/66842#issuecomment-1728701639.
2023-09-25 09:50:07 -04:00
Louis Dionne
5f2da9c80d
[runtimes] Bump the supported AppleClang version to AppleClang 15 (#67065)
AppleClang 15 was released on September 18th and is now stable. Per our
policy, we're bumping the supported AppleClang compiler to the latest
release. This allows cleaning up the test suite, but most importantly
unblocking various other patches that are blocked on bumping the
compiler requirements.
2023-09-25 09:46:01 -04:00
Zhangyin
81a3828dbd [libcxx] <experimental/simd> excluded long double for 32-bits x86 temporarily
Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D159514
2023-09-25 10:27:56 +08:00
James Y Knight
b0e19cfb62
[libcxx] Don't deallocate non-pointer data in string assignment. (#67200)
Previously, assignment to a std::basic_string type with a _custom_
allocator could under certain conditions attempt to interpret part of
the target string's "short" string-content as if it was a "long" data
pointer, and attempt to deallocate a garbage value.

This is a serious bug, but code in which it might happen is rare. It
required:

1. the basic_string must be using a custom allocator type which sets the
propagate_on_container_copy_assignment trait to true (thus, it does not
affect the default allocator, nor most custom allocators).
2. the allocator for the target string must compare not equal to the
allocator for the source string (many allocators always compare equal).
3. the source of the copy must currently contain a "long" string, and
the assignment-target must currently contain a "short" string.

Finally, the issue would've typically been innocuous when the bytes
misinterpreted as a pointer were all zero, as deallocating a nullptr is
typically a no-op. This is why existing test cases did not exhibit an
issue: they were all zero-length strings, which do not have data in the
bytes interpreted as a pointer.
2023-09-24 09:12:57 -04:00
Louis Dionne
0065d75099 [runtimes][NFC] Remove old Lit annotations for gcc-12 and clang-14
We don't support these compilers anymore so these Lit annotations were
never used.
2023-09-21 17:13:31 -04:00
Louis Dionne
24161bcc44 [libc++] Move a few XFAILs to UNSUPPORTED for consistency
The wide stream tests should be marked as `UNSUPPORTED: no-wide-characters`,
not XFAIL.
2023-09-21 07:42:23 -04:00
Louis Dionne
354c99bb5f [libc++] Temporarily disable std::cin tests on Windows -> Linux cross compiler
To get the bot back to green as we figure out how to handle piping data
into a test running behind a SSH executor.
2023-09-21 07:39:58 -04:00
Igor Zhukov
910b76a002 [libc++] Implement LWG-3655: The INVOKE operation and union types
https://cplusplus.github.io/LWG/issue3655

Differential Revision: https://reviews.llvm.org/D144645
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-09-21 05:23:41 -04:00
Louis Dionne
8bbcc6d548
[libc++] Add test coverage for unordered containers comparison (#66692)
This patch is a melting pot of changes picked up from
https://llvm.org/D61878. It adds a few tests checking corner cases of
unordered containers comparison and adds benchmarks for a few
unordered_set operations.
2023-09-21 05:11:49 -04:00
Louis Dionne
257eb74524
[libc++] Simplify how the global stream tests are written (#66842)
Instead of relying on Bash, use the builtin Lit commands whenever
possible. The motivation is to stop running %t.exe behind Bash, which
breaks on macOS 13.5 with SIP enabled because DYLD_LIBRARY_PATH isn't
forwarded to the underlying process when running through a protected
process.

For more details, see [1].

[1]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html
2023-09-20 09:33:16 -04:00
Zijun Zhao
0218ea4aaa [libc++] Implement ranges::ends_with
Reviewed By: #libc, var-const

Differential Revision: https://reviews.llvm.org/D150831
2023-09-18 11:56:10 -07:00
Hui
054f9c55c6
[libc++] Fix std::pair's pair-like constructor's incorrect assumption (#66585)
The helper function `__pair_like_explicit_wknd` is only SFINAE-ed with
`tuple_size<remove_cvref_t<_PairLike>>::value == 2`, but its function
body assumes `std::get` being valid.

Fixes #65620
2023-09-18 14:01:19 -04:00
zhijian
c24a422aa3 [libc++][CI][AIX] modify the equivalence classes of regex_match for locale "cs_CZ.ISO8859-2"
Reviewers: David Tenty, Mark de Wever
Differential Revision: https://reviews.llvm.org/D126407
2023-09-18 11:03:06 -04:00
Daniel Cheng
078651b6de
[libc++] Implement LWG3545: std::pointer_traits should be SFINAE-friendly. (#65177)
See https://wg21.link/LWG3545 for background and details.

Differential Revision: https://reviews.llvm.org/D158922
2023-09-18 08:46:59 -04:00
Hui
4a1fe09b18 [libc++] Fix potentially flaky test joinable.pass.cpp
This is a follow up of
https://reviews.llvm.org/D151559

Where one test point is potentially falky due to a race condition.
2023-09-16 23:07:46 +01:00
Hui
695138ca84 [libc++] implement std::jthread 2023-09-16 19:54:19 +01:00
Louis Dionne
4d08eccd63
[libc++] Implement P2538R1 "ADL-proof std::projected" (#65411)
Notice that because Holder<Incomplete> is _possible_ to complete, but
_unsafe_ to complete, that means that Holder<Incomplete>* is basically
not an iterator and it's not even safe to ask if
input_iterator<Holder<Incomplete>*> because that _will_ necessarily
complete the type. So it's totally expected that we still cannot safely
ask e.g.


static_assert(std::indirect_unary_predicate<bool(&)(Holder<Incomplete>&),
Holder<Incomplete>*>);

or even

static_assert(!std::indirect_unary_predicate<int, Holder<Incomplete>*>);

This was originally uploaded as https://reviews.llvm.org/D119029 and I
picked it up here as part of the Github PR transition.

Co-authored-by: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
2023-09-15 10:09:38 -04:00
Louis Dionne
85f27d126d
[libc++] Make sure LWG2070 is implemented as a DR (#65998)
When we implemented C++20's P0674R1, we didn't enable the part of
P0674R1 that was resolving LWG2070 as a DR. This patch fixes that and
makes sure that we consistently go through the allocator when
constructing and destroying the underlying object in
std::allocate_shared.

Fixes #54365.
2023-09-14 15:12:06 -04:00
Konstantin Varlamov
b85e1862c1 [libc++][hardening] Add back the safe mode.
The safe mode is in-between the hardened and the debug modes, extending
the checks contained in the hardened mode with certain checks that are
relatively cheap and prevent common sources of errors but aren't
security-critical. Thus, the safe mode trades off some performance for
a wider set of checks, but unlike the debug mode, it can still be used
in production.

Differential Revision: https://reviews.llvm.org/D158823
2023-09-12 12:01:51 -07:00
Konstantin Boyarinov
2e106d5520 [libc++][test][NFC] Rewrite map count test and add test case for "final" compare
Was part of D118114. Unify test cases for `std::map::count` method and
add test case for the comparator that marked `final`

Differential Revision: https://reviews.llvm.org/D118232
2023-09-12 13:52:58 -04:00
Igor Zhukov
70248920fc [libc++][test] Add '-Wdeprecated-copy', '-Wdeprecated-copy-dtor' warnings to the test suite
This is a follow up to https://reviews.llvm.org/D144694.
Fixes https://github.com/llvm/llvm-project/issues/60977.

Differential Revision: https://reviews.llvm.org/D144775
2023-09-12 08:53:38 -04:00
Zhangyin
ed29f275bf [libcxx] <experimental/simd> Add broadcast constructor of class simd/simd_mask
Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D156225
2023-09-12 11:41:49 +08:00
Zhangyin
e7a45c6d76 [libcxx] <experimental/simd> Added internal storage type, constructors, subscript operators of class simd/simd_mask and related tests
[libcxx] <experimental/simd> Added internal storage type for class simd/simd_mask
[libcxx] <experimental/simd> Added all constructors of class simd/simd_mask and related tests
[libcxx] <experimental/simd> Added basic simd reference implementation, subscript operators of class simd/simd_mask and related tests

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144364
2023-09-12 11:41:46 +08:00
Zhangyin
a284d0cc9c [libcxx] <experimental/simd> Added aliagned flag types, traits is_simd_flag_type[_v], memory_alignment[_v] and related tests
Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D153319
2023-09-12 11:41:44 +08:00
Zhangyin
ce5652c78a [libcxx] <experimental/simd> Added simd width functions, simd_size traits and related tests
Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144363
2023-09-12 11:41:42 +08:00
Zhangyin
0e30dd44ad [libcxx] <experimental/simd> Add ABI tags, class template simd/simd_mask implementations. Add related simd traits and tests.
[libcxx] <experimental/simd> Add ABI tags, class template simd/simd_mask implementations.
[libcxx] <experimental/simd> Add traits is_abi_tag[_v], is_simd[_v] and is_simd_mask[_v].
[libcxx] <experimental/simd> Add related tests.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144362
2023-09-12 11:41:40 +08:00
Zhangyin
3e14076c76 [libcxx] <experimental/simd> Removed original implementations and tests
Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144698
2023-09-12 11:41:38 +08:00
Louis Dionne
1d7cec6adc [libc++] Fix broken test in C++03 mode 2023-09-11 21:13:35 -04:00
Konstantin Varlamov
881718857f [libc++][ranges] Fix a split_view test accidentally using lazy_split 2023-09-11 16:17:34 -07:00
Louis Dionne
3e24a77a86 [libc++] Use the default initializer for char_type in std::num_get::do_get
This is to fix an error that occurs when the char type is a class type.
Thanks to Yichen Yan for the patch.

Differential Revision: https://reviews.llvm.org/D100005
2023-09-11 14:16:47 -04:00
Louis Dionne
ee2a7bcebf [libc++] Add regression tests for issue #46841 2023-09-11 14:13:30 -04:00
Jake Egan
8a79af676d [libc++][AIX] Remove hardcode fail from format test
The test is hardcoded to fail after passing `test_ill_formed_utf16()`. It passes on 32-bit AIX if we remove this.

Reviewed By: Mordante, #libc, ldionne

Differential Revision: https://reviews.llvm.org/D150273
2023-09-08 13:40:07 -04:00
Alexander Richardson
bf1bcb68fc [libc++] Use intptr_t instead of ptrdiff_t for messages_base::catalog
On GLibc, FreeBSD and macOS systems nl_catd is a pointer type, and
round-tripping this in a variable of ptrdiff_t is not portable.
In fact such a round-trip yields a non-dereferenceable pointer on
CHERI-enabled architectures such as Arm Morello. There pointers (and
therefore intptr_t) are twice the size of ptrdiff_t, which means casting
to ptrdiff_t strips the high (metadata) bits (as well as a hidden pointer
validity bit).

Since catalog is now guaranteed to be the same size or larger than nl_catd,
we can store all return values safely and the shifting workaround from
commit 0c68ed006d4f38c3cdcab6a565aa3e208015895f should not be needed
anymore (this is also not portable to CHERI systems on since shifting a
valid pointer right will create a massively out-of-bounds pointer that
may not be representable).

This can be fixed by using intptr_t which should be the same type as
ptrdiff_t on all currently supported architectures.

See also: https://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2028

Differential Revision: https://reviews.llvm.org/D134420

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-09-08 09:15:57 -04:00
Mark de Wever
88359213ee [libc++][chrono] TZDB CI fixes.
Fixes a conflict with adding the no experimental module build.

Disables some tests that need further investigation, this should fix the
CI runners.

These issues were reported on Discord and in D154282.
2023-09-07 20:31:18 +02:00
Arthur O'Dwyer
3df1a64eba [libc++] Add a test for std::ssize's SFINAE
Inspired by https://reviews.llvm.org/D120684#inline-1157644 and
subsequent LWG discussion. See http://wg21.link/LWG3207 for
additional context.

Differential Revision: https://reviews.llvm.org/D121154

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-09-06 19:40:50 -04:00
Zoe Carver
bd095b5c4d [libc++] Add tests for P0809 (Comparing Unordered Containers)
Differential Revision: https://reviews.llvm.org/D61771

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-09-06 19:37:17 -04:00
Mark de Wever
f78f93bc9f [libc++][chrono] Adds tzdb_list implementation.
This is the first step to implement time zone support in libc++. This
adds the complete tzdb_list class and a minimal tzdb class. The tzdb
class only contains the version, which is used by reload_tzdb.

Next to these classes it contains documentation and build system support
needed for time zone support. The code depends on the IANA Time Zone
Database, which should be available on the platform used or provided by
the libc++ vendors.

The code is labeled as experimental since there will be ABI breaks
during development; the tzdb class needs to have the standard headers.

Implements parts of:
- P0355 Extending <chrono> to Calendars and Time Zones

Addresses:
- LWG3319 Properly reference specification of IANA time zone database

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D154282
2023-09-06 20:48:07 +02:00
Mark de Wever
3401b308f8 [libc++] Renames modules-build.
This is a followup of D157625. Using the name clang-modules-build makes
it clear this is regarding the clang modules and not the C++23 std or
std.compat module.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D158927
2023-09-06 17:11:13 +02:00
yronglin
9f67143be0 [libc++] Implement LWG3938 (Cannot use std::expected monadic ops with move-only error_type)
Implement LWG3938 (Cannot use std::expected monadic ops with move-only error_type)
https://wg21.link/LWG3938

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D154116
2023-09-06 22:38:29 +08:00
Jakub Mazurkiewicz
065dc485bd [libc++][ranges] Implement P2443R1: views::chunk_by
This patch implements https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2443r1.html (`views::chunk_by`).

Reviewed By: #libc, var-const

Differential Revision: https://reviews.llvm.org/D144767
2023-09-05 16:19:49 -07:00
Louis Dionne
6b46c7688f [libc++][NFC] Remove an outdated UNSUPPORTED annotation
This is likely a rebase artifact. libcpp-has-no-concepts is not a
Lit feature we ever define anymore.
2023-09-05 16:00:44 -04:00
Chris Bowler
fbdf684fae [libc++] Avoid destructor call for error_category singletons
When a handle to an error_category singleton object is used during the
termination phase of a program, the destruction of the error_category
object may have occurred prior to execution of the current destructor
or function registered with atexit, because the singleton object may
have been constructed after the corresponding initialization or call
to atexit. For example, the updated tests from this patch will fail if
using a libc++ built using a compiler that updates the vtable of the
object on destruction.

This patch attempts to avoid the issue by causing the destructor to not
be called in the style of ResourceInitHelper in src/experimental/memory_resource.cpp.
This approach might not work if object lifetime is strictly enforced.

Differential Revision: https://reviews.llvm.org/D65667

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-09-05 13:44:10 -04:00
Konstantin Varlamov
a168135487 [libc++] Fix Lit config in string.io.
This file was accidentally formatted by D140612, resulting in incorrect
syntax.
2023-09-01 14:37:15 -07:00
Brendan Emery
a40bada91a [libc++] Apply clang formatting to all string unit tests
This applies clang-format to the std::string unit tests in preparation
for landing https://reviews.llvm.org/D140550.

Differential Revision: https://reviews.llvm.org/D140612
2023-09-01 13:35:18 -04:00
Ruslan Arutyunyan
be4adb5c2b [libcxx][test] Add tests for hash_function() and key_eq() in unordered containers
Add tests for `hasher hash_function() const` and `key_equal key_eq() const`
observers in unordered containers.

Differential Revision: https://reviews.llvm.org/D119703
2023-09-01 08:50:56 -04:00
Louis Dionne
b397921fc7 [runtimes] Fix some duplicate word typos
Those fixes were taken from https://reviews.llvm.org/D137338.
2023-08-31 11:55:10 -04:00
Mark de Wever
8930d04d55 [libc++][format] Fixes out of bounds access.
Fixes https://llvm.org/PR65011

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D158940
2023-08-30 17:40:58 +02:00
Aaron Ballman
a02f9a7756 Revert "[clang] Enable sized deallocation by default in C++14 onwards"
This reverts commit 2916b125f686115deab2ba573dcaff3847566ab9.

Reverting due to failures on:
https://lab.llvm.org/buildbot/#/builders/216/builds/26407
https://lab.llvm.org/staging/#/builders/247/builds/5659
http://45.33.8.238/win/83485/step_7.txt
2023-08-29 09:36:59 -04:00