10117 Commits

Author SHA1 Message Date
Hristo Hristov
2ff646f554 [libc++][spaceship] Implement operator<=> for deque
Based on https://reviews.llvm.org/D132312
Dependes on https://reviews.llvm.org/D132312

Reviewed By: #libc, Mordante, philnik

Spies: philnik, Mordante, yaxunl, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144821
2023-03-03 13:36:01 +01:00
David Spickett
cbace67345 Revert "[libcxx] Temporarily skip Arm configs"
This reverts commit 8a023fed2f848031769eae804e55eed719cdd12d.

The machine is back online.
2023-03-03 10:59:52 +00:00
David Spickett
8a023fed2f [libcxx] Temporarily skip Arm configs
The machine hosting these agents will be down
for maintenance today.

We (Linaro) will remove this once the agents are back online.
2023-03-03 09:22:17 +00:00
Konstantin Varlamov
87cf39aa34 [libc++] Temporarily not use compiler intrinsics for some type traits in Objective-C++ mode.
Currently, there are bugs in Clang's intrinsics for type traits when
handling Objective-C++ `id` (e.g. in `add_pointer`). As a temporary
workaround, don't use these intrinsics in the Objective-C++ mode.

Differential Revision: https://reviews.llvm.org/D145186
2023-03-02 17:35:12 -08:00
Ed Maste
5295fe4e98 [libc++][chrono] XFAIL hh_mm_ss formatter test on FreeBSD
This test did not exist when I added the previous set of XFAILs (and the
libc++ FreeBSD CI runner is not yet active).

Reviewed by: Mordante

Differential Revision: https://reviews.llvm.org/D145120
2023-03-02 15:30:16 -05:00
Louis Dionne
33cf401222 [libc++][NFC] Reformat aligned_storage specialization macro 2023-03-02 13:05:15 -05:00
Louis Dionne
2765fe8a61 [libc++][NFC] Fix typo in documentation 2023-03-02 12:42:15 -05:00
Louis Dionne
25bd6fa5a0 [libc++] Reintroduce workaround for stdint re-export on Darwin
This had been removed as part of 3a0f88c4c2c4. It turns out that this
did break some code, but we never noticed because it requires including
<stdint.h> (and nothing else), and then using one of the types from
that header. It also requires running with modules enabled in a Standard
no later than C++17.

After the test refactorings in D145116, this bug would be caught
by running a CI job on macOS with modules enabled in C++17 mode
(but surprisingly not with more recent standards). This patch doesn't
add such a job because it is deemed a corner case.

Differential Revision: https://reviews.llvm.org/D145117
2023-03-02 12:38:36 -05:00
Louis Dionne
9dfb142ce0 [libc++] Use ASSERT_SAME_TYPE instead of <type_traits> in depr tests
Whenever, possible, use ASSERT_SAME_TYPE instead of static_assert along
with std::is_same in the depr header tests. This prevents dragging in
multiple headers unrelated to the header being tested, which can (and
has) hidden issues.

Also, add a couple of tests to ensure that basic declarations in
<stddef.h> and <stdint.h> are available when including just those
headers, since the rest of the tests for those types require pulling
in additional dependencies.

Differential Revision: https://reviews.llvm.org/D145116
2023-03-02 12:37:03 -05:00
Shivam kunwar
9266edfcfd [libcxx][NFC] Added a note about the P2520R0
Differential Revision: https://reviews.llvm.org/D145087
2023-03-02 07:58:23 +05:30
Ed Maste
0fe1012f8e [libc++] [FreeBSD] correct 64-bit test
Using __SIZEOF_LONG__ == 8 rather than __LP64__ is needed so we use umtx
on CHERI.  I accidentally landed an older diff.

Fixes: 17ecbb3ea6ff0ae716dd524c0e2bf75a4815c95b
2023-03-01 21:21:31 -05:00
Konstantin Belousov
17ecbb3ea6 [libc++] [FreeBSD] only use _umtx_op(2) on 64bit arches
Only 64bit architectures can be supported this way, because libcxx
defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit
arches do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation.

Fixes: 83387dbc18e7998f87aa4a2d35320bcb2ed5c392

Reviewed by: arichardson, ldionne, emaste, Mordante
Differential Revision: https://reviews.llvm.org/D142422
2023-03-01 15:51:24 -05:00
Louis Dionne
62e3f298de [libc++] Use generic-cxx20 instead of apple-cxx20 on Apple CI
apple-cxx20 is equivalent to generic-cxx20, so we don't need it anymore.
It had been introduced when clang-tidy was enabled explicitly from
run-buildbot, but that's not needed anymore since clang-tidy is
enabled from the buildkite pipeline definition.
2023-03-01 15:26:18 -05:00
Louis Dionne
15cef42696 [libc++][NFC] Remove trailing whitespace on line and clang-format
This broke the CI after 813e1da974 was checked in.
2023-03-01 15:21:05 -05:00
Louis Dionne
dafeb97a28 [libc++] Refactor the std/depr C headers tests
Move multiple tests to .compile.pass.cpp when they were not running
anything and reindent a bit more consistently.
2023-03-01 14:55:05 -05:00
Louis Dionne
911e0d038d [libc++][NFC] Move test to .compile.pass.cpp since it doesn't run anything 2023-03-01 13:21:20 -05:00
Shivam kunwar
813e1da974 [libc++] implement move_iterator<T*> should be a random access iterator \n Differntial Revision- https://reviews.llvm.org/D135248 2023-03-01 23:47:00 +05:30
Arthur O'Dwyer
f56dfb78aa [libc++] Fix modules issues on OS X
First, fix a collision with the Point type from MacTypes.h, which was
reported on Slack, 2022-07-31: https://cpplang.slack.com/archives/C2X659D1B/p1659284691275889

Second, rename the meta:: namespace to types::. OSX's "/usr/include/ncurses.h"
defines a `meta` function, and is (for some reason) included in
"<SDK>/usr/include/module.modulemap", so that identifier is off-limits
for us to use in anything that compiles with -fmodules:

    libcxx/test/support/type_algorithms.h:16:11: error: redefinition of 'meta' as different kind of symbol
    namespace meta {
               ^
    <SDK>/usr/include/ncurses.h:603:28: note: previous definition is here
    extern NCURSES_EXPORT(int) meta (WINDOW *,bool);                        /* implemented */
                                ^

Finally, add a CI configuration for modules on OS X to make sure it
does not regress.

Differential Revision: https://reviews.llvm.org/D144915
2023-03-01 10:33:40 -05:00
Vladimir Vereschaka
c1c29eb9f7 Fix failed libcxx test build on the Windows to Linux cross builders. NFC.
Disable `modules_include.sh.cpp` test on Windows build hosts,
it cannot be executed there anymore.

Differential Revision: https://reviews.llvm.org/D144640
2023-02-28 17:42:07 -08:00
Nikolas Klauser
4668dd8c4a [libc++] Run clang-tidy in all configurations that are run in the Docker container
Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D143333
2023-02-28 19:14:58 +01:00
Mark de Wever
853059a150 [libc++] Addresses LWG3782.
3782. Should <math.h> declare ::lerp?

Libc++ doesn't declare ::lerp, adds tests to validate the requirement.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D142817
2023-02-28 18:31:17 +01:00
Arthur O'Dwyer
ce32e05733 [libc++] Refactor allocator_mismatch.compile.fail.cpp -> .verify.cpp
compile.fail.cpp tests are an anti-feature since they are too easy to
break when evolving code. This patch moves various allocator_mismatch
tests to .verify.cpp and normalizes the error messages from various
containers.

Differential Revision: https://reviews.llvm.org/D144913
2023-02-28 12:22:49 -05:00
Adrian Vogelsgesang
b5a84ae09a [libc++][spaceship] Implement operator<=> for list
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D132312
2023-02-28 06:11:31 -08:00
Arthur O'Dwyer
049a3fe10f [libc++] Fix "size_t" constants that should be "bool" or "int", and add tests
`is_placeholder`, despite having an "is_" name, actually returns an int:
1 for `_1`, 2 for `_2`, 3 for `_3`, and so on. But it should still be int,
not size_t.
2023-02-27 16:53:04 -05:00
Nikolas Klauser
2aeda9aaaf [libc++][NFC] Format __split_buffer and move constructors that are marked inline into the class body
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D142433
2023-02-27 19:46:03 +01:00
Nikolas Klauser
411c799a1d [libc++] Simplify the modules_include.sh.cpp script a bit
Reviewed By: #libc, ldionne

Spies: vvereschaka, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144825
2023-02-27 19:43:37 +01:00
Mark de Wever
de6827b530 [libc++] Improves clang-format settings.
Add a new test based .clang-format file which inherits from the generic
one. This moves some test specific formatting rules to the test
directory.

The main benefit is that headers are sorted, which makes it more likely
to catch these errors before creating a review instead of spotting the
error in the CI clang-tidy step.

Reviewed By: ldionne, philnik, #libc

Differential Revision: https://reviews.llvm.org/D144755
2023-02-27 19:24:06 +01:00
Mark de Wever
f41f392520 [libc++] Fixes operator& hijacking atomic types.
This uses std::addressof everywherein atomic. This is not strictly
needed for the integral and floating point specializations. They should
not be used by user defined types. But it's easier to fix everything.

Note these changes are made using a WIP clang-tidy plugin.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D144786
2023-02-27 19:23:13 +01:00
Igor Zhukov
a8ead9194c [libc++][ranges] Implement LWG-3860 range_common_reference_t is missing 2023-02-27 20:49:12 +07:00
Mark de Wever
664f345cd5 [libc++] Improves clang-tidy configuration.
The current clang-tidy settings work in the CI but not on all systems
outside the CI.
- The range 16...17 doesn't work when only clang-17 is installed.
- Running CMake a second time will fail.

This addresses these issues.

Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D144785
2023-02-26 12:19:50 +01:00
Nikolas Klauser
3d4b7a6fa8 [libc++] Add FTM for views::as_rvalue
`views::as_rvalue` was implemented in D137637, but we forgot to set the feature test macro.
Fixes #60986.

Reviewed By: Mordante, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D144781
2023-02-25 18:26:57 +01:00
Igor Zhukov
9d53c8684f [libc++] Implement LWG-3204: sub_match::swap only swaps the base class
Reviewed By: Mordante, JMazurkiewicz, #libc

Differential Revision: https://reviews.llvm.org/D144629
2023-02-25 21:43:37 +07:00
Casey Carter
7d5275e0c0 [libc++][test] Silence MSVC deprecation warnings
... for implicitly-generated copy constructors and copy assignment operators.

Differential Revision: https://reviews.llvm.org/D144694
2023-02-24 21:13:29 -08:00
Mark de Wever
ffe9ebbfe1 [libc++][test] Use the Japanese test.
This was discovered in D144667.

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D144737
2023-02-24 20:53:52 +01:00
Nikolas Klauser
6e93bf5f66 [libc++] Remove <experimental/{algorithm,functional}>
The contents of these files have been implemented for at least two releases, so let's remove them according to our policy (https://libcxx.llvm.org/DesignDocs/ExperimentalFeatures.html#id4).

Reviewed By: Mordante, #libc

Spies: arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144475
2023-02-24 14:18:12 +01:00
Nikolas Klauser
bb588519c5 [libc++] Run modules_include.sh.cpp compiles in parallel
It's not pretty, but it makes the test run a lot faster.

Reviewed By: #libc, philnik

Spies: DavidSpickett, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144640
2023-02-23 22:24:25 +01:00
Advenam Tacet
a9356a515b [ASan][libcxx] Annotating std::vector with all allocators
This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection
capabilities by adding annotations, similar to those existing
in std::vector, to std::string and std::deque collections.
These changes allow ASan to detect cases when the instrumented
program accesses memory which is internally allocated by
the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).

The motivation for the research and those changes was a bug,
found by Trail of Bits, in a real code where an out-of-bounds read
could happen as two strings were compared via a std::equals function
that took iter1_begin, iter1_end, iter2_begin iterators
(with a custom comparison function).
When object iter1 was longer than iter2, read out-of-bounds on iter2
could happen. Container sanitization would detect it.

In revision D132522, support for non-aligned memory buffers (sharing
first/last granule with other objects) was added, therefore the
check for standard allocator is not necessary anymore.
This patch removes the check in std::vector annotation member
function (__annotate_contiguous_container) to support
different allocators.

Additionally, this revision fixes unpoisoning in std::vector.
It guarantees that __alloc_traits::deallocate may access returned memory.
Originally suggested in D144155 revision.

If you have any questions, please email:
 - advenam.tacet@trailofbits.com
 - disconnect3d@trailofbits.com

Reviewed By: #libc, #sanitizers, philnik, vitalybuka

Spies: hans, EricWF, philnik, #sanitizers, libcxx-commits

Differential Revision: https://reviews.llvm.org/D136765
2023-02-23 20:46:05 +01:00
Petr Hosek
24d144571d Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"
This reverts commit efae3174f09560353fb0f3d528bcbffe060d5438 since
it broke the standalone Flang build.
2023-02-22 17:32:07 +00:00
Mark de Wever
306b24c0bd [libc++][format] Removes transitive type_traits.
Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144498
2023-02-22 17:18:13 +01:00
Nikolas Klauser
7ced7e84c0 [libc++][NFC] Replace typedef with using declarations in <__atomic/*>
Reviewed By: Mordante, #libc

Spies: arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144259
2023-02-22 14:49:39 +01:00
Petr Hosek
efae3174f0 [CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
These have the same purposes but two different implementations.
llvm_check_compiler_linker_flag uses CMAKE_REQUIRED_FLAGS which affects
flags used both for compilation and linking which is problematic because
some flags may be link-only and trigger unused argument warning when set
during compilation. llvm_check_linker_flag does not have this issue so
we chose it as the prevailaing implementation.

Differential Revision: https://reviews.llvm.org/D143052
2023-02-22 04:24:49 +00:00
Nikolas Klauser
141471a0cb [runtimes] Remove unused functions from Handle{Libcxx,Libunwind}Flags.cmake
Reviewed By: phosek, #libunwind, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144400
2023-02-22 00:38:44 +01:00
Nikolas Klauser
811b5f52ad [libc++][NFC] Simplify __sort{4,5}
Don't return the number of swaps; it's not used anywhere.

Reviewed By: Mordante, #libc, avogelsgesang

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144478
2023-02-21 19:42:23 +01:00
Nikolas Klauser
b4ecfd3c46 [libc++] Forward to std::memcmp for trivially comparable types in equal
Reviewed By: #libc, ldionne

Spies: ldionne, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D139554
2023-02-21 17:11:21 +01:00
Nikolas Klauser
e8cb3559ee [libc++] Move constexpr <cstring> functions into their own headers and remove unused <cstring> includes
Reviewed By: ldionne, Mordante, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143329
2023-02-21 16:56:29 +01:00
Nikolas Klauser
d0e95fec65 [runtimes] Remove add_target_flags* functions and use add_flags* instead
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144398
2023-02-21 13:16:44 +01:00
Nikolas Klauser
0af67d167d [runtimes] Move common functions from Handle{Libcxx,Libcxxabi,Libunwind}Flags.cmake to runtimes/cmake/Modules/HandleFlags.cmake
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144395
2023-02-21 13:15:25 +01:00
Mark de Wever
cf83e79a4b [libc++][format] Disables test on GCC-12.
These tests fail in D144331, for the same reason other format tests fail
in GCC. This is a resource issue.
2023-02-19 16:44:56 +01:00
Mark de Wever
9adf78d6a7 [NFC][libc++][format] Small improvements.
While working on the formatter for the thread::id several minor issues
where spotted. This fixes them.
2023-02-18 18:59:32 +01:00
Mark de Wever
c1877e6465 [NFC][libc++][doc] Fixes formatting. 2023-02-18 18:30:56 +01:00