Commit Graph

8601 Commits

Author SHA1 Message Date
Arthur O'Dwyer 0e03c62b4c [libc++] [bench] Stop using uniform_int_distribution<char> in benchmarks.
Reviewed as part of D114920.
2022-01-17 14:31:33 -05:00
Arthur O'Dwyer 01193cae1c [libc++] [doc] Fix a Sphinx error in ReleaseNotes.rst (I hope) 2022-01-17 14:29:59 -05:00
Nikolas Klauser 311207bbea [libc++][P2321R2] Add specializations of basic_common_reference and common_type for tuple
Add specializations of `basic_common_reference` and `common_type` for `tuple`

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116538
2022-01-17 19:49:57 +01:00
Nikolas Klauser d7630b37ce [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <vector>
Use `_LIBCPP_DEBUG_ASSERT` in `<vector>`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117402
2022-01-17 19:28:16 +01:00
Arthur O'Dwyer d96a5042d6 [libc++] [test] Improve the tests for std::assignable_from.
Fixes #50060.

Differential Revision: https://reviews.llvm.org/D117434
2022-01-17 12:11:49 -05:00
Arthur O'Dwyer 9fe67486cc [libc++] [test] Improve the test for `uniform_int_distribution<T>`.
Extracted from https://reviews.llvm.org/D114920
2022-01-17 10:31:10 -05:00
Arthur O'Dwyer 0359b85c61 [libc++] [ABI BREAK] Conform lognormal_distribution::param_type.
Fixes #52906.

Differential Revision: https://reviews.llvm.org/D116344
2022-01-17 10:22:41 -05:00
Arthur O'Dwyer e93f98f09c [libc++] [test] Check for another kind of modulemap typo in lint_modulemap.sh.py.
Verify that the name of the private submodule matches the name of the detail header.

Differential Revision: https://reviews.llvm.org/D117438
2022-01-17 10:20:34 -05:00
John Ericson da77db58d7 Revert "[cmake] Use `GNUInstallDirs` to support custom installation dirs."
https://lab.llvm.org/buildbot/#/builders/46/builds/21146 Still have
this odd error, not sure how to reproduce, so I will just try breaking
up my patch.

This reverts commit 4a678f8072.
2022-01-16 05:48:30 +00:00
John Ericson 4a678f8072 [cmake] Use `GNUInstallDirs` to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D99484
2022-01-16 05:33:07 +00:00
Nikolas Klauser d3e49a41b1 [libc++] Add _LIBCPP_HIDE_FROM_ABI to in_in_result
Add `_LIBCPP_HIDE_FROM_ABI` to `in_in_result` conversion operators

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117399
2022-01-15 20:30:08 +01:00
Arthur O'Dwyer cba72e4ce2 [libc++] Normalize some whitespace in preparation for D116570. NFC. 2022-01-15 12:20:33 -05:00
Mark de Wever 3ba96cb2c9 [libc++] Adds tests for LWG-3373.
The code in libc++ already satisfy the requirements of LWG-3373. Since
the issue was written to specifically allow the types to be used in
structured bindings, tests have been added to validate the new
requirement.

Implements
LWG-3373 {to,from}_chars_result and format_to_n_result need the "we really mean what we say" wording

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117337
2022-01-15 13:46:53 +01:00
John Ericson 6e52bfe09d Revert "[cmake] Use `GNUInstallDirs` to support custom installation dirs."
Sorry for the disruption, I will try again later.

This reverts commit efeb501970.
2022-01-15 07:35:02 +00:00
John Ericson efeb501970 [cmake] Use `GNUInstallDirs` to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D99484
2022-01-15 01:08:35 +00:00
Arthur O'Dwyer 6cc305764f [libc++] [test] Add a test for proper _Uglification of template parameter names.
Merge nasty_macros.h into the new test.

Differential Revision: https://reviews.llvm.org/D116957
2022-01-14 15:50:37 -05:00
Arthur O'Dwyer 0ab54c28f8 [libc++] Further small cleanups of move_iterator.h. NFC.
Differential Revision: https://reviews.llvm.org/D117324
2022-01-14 15:41:45 -05:00
Arthur O'Dwyer c09692a644 [libc++] s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/g in move_iterator.h. NFC. 2022-01-14 15:41:02 -05:00
Arthur O'Dwyer 9542c9c599 [libc++] Rename __i to __current_ in move_iterator. NFC. 2022-01-14 15:40:57 -05:00
Louis Dionne cd97aaee5f [libc++] Add missing `<cstddef>` include in span test 2022-01-14 15:07:17 -05:00
Casey Carter ecd64c4e15 [libcxx][test] Properly qualify uses of std::size_t
To silence modular build error https://reviews.llvm.org/harbormaster/unit/view/1854595/
2022-01-14 11:41:27 -08:00
Nikolas Klauser bdd5b94837 [libc++][NFC] Remove clang-diagnostic-c++98-compat-extra-semi warnings in experimental/simd
Force semicolons or remove them in `experimental/simd`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D117157
2022-01-14 19:38:33 +01:00
Hui Xie 597b90ebac [libc++] Fix __simple_view concept in std::ranges
Differential Revision: https://reviews.llvm.org/D116808
2022-01-14 12:55:34 -05:00
Arthur O'Dwyer fa244345e1 [libc++] [test] ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS is not supported on AIX.
I believe all four of these failures are directly due to the pattern where
allocations in the dylib are unobserved by the client program. If AIX32 and AIX64
don't support that, we should just disable the ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS
macro on AIX, and then we don't need to XFAIL these tests.

This also means I won't need to XFAIL a dozen other tests in D89057,
which rely heavily on ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS and
also currently fail on AIX.
See https://buildkite.com/llvm-project/libcxx-ci/builds/7669

Differential Revision: https://reviews.llvm.org/D116866
2022-01-14 12:48:04 -05:00
Arthur O'Dwyer 2a11fbb827 [libc++] [NFC] Remove a hard tab from __config. 2022-01-14 12:18:44 -05:00
Muiez Ahmed a1da73961d [SystemZ][z/OS] ASCII/EBCDIC support with no coexistence
The aim of this patch is to break up the larger patch (https://reviews.llvm.org/D111323) to be more upstream friendly. In particular, this patch adds the char encoding sensitive changes but does not use inline namespaces as before. The use of namespaces to build both versions of the library, and localization of error messages will follow in a subsequent patch.

Differential Revision: https://reviews.llvm.org/D114813
2022-01-14 11:37:09 -05:00
Arthur O'Dwyer a8f1a715f0 [libc++] _Uglify some template parameter names. NFCI. 2022-01-14 10:32:04 -05:00
Louis Dionne 5726e55981 [libc++] Modularize <chrono>
I didn't split the calendar bits more than this because there was little
benefit to doing it, and I know our calendar support is incomplete.
Whoever picks up the missing calendar bits can organize these headers
at their leisure.

Differential Revision: https://reviews.llvm.org/D116965
2022-01-14 09:55:29 -05:00
Konstantin Varlamov b6d87773fe [libc++] LWG3171: implement operator<< for filesystem::directory_entry.
Differential Revision: https://reviews.llvm.org/D116642
2022-01-13 20:44:18 -08:00
Nikolas Klauser d3729bb384 [libc++][ranges] Add ranges::in_in_result
Add `std::ranges::in_in_result`

Reviewed By: Quuxplusone, Mordante, #libc

Spies: ldionne, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D116278
2022-01-14 02:56:33 +01:00
Casey Carter cb71d77cc8 [libcxx][test] Add missing includes and suppress warnings
... from testing with MSVC's STL. Mostly truncation warnings and variables that are only used in `LIBCPP_ASSERT`.

Differential Revision: https://reviews.llvm.org/D116878
2022-01-13 17:34:04 -08:00
Louis Dionne 3d40508169 [libc++][NFC] Fix placement of some XFAILs 2022-01-13 15:28:41 -05:00
Louis Dionne e7b07a6538 [libc++][NFC] Add missing 'return 0' in main() functions 2022-01-13 14:32:41 -05:00
Louis Dionne b476039e8b [libc++] Refactor the tests for ranges::{advance,next,prev}
This makes all the tests consistent and improves code coverage. This also
uncovers a bug with negative indices in advance() (which also impacts
prev()) -- I'll fix that in a subsequent patch.

I chose to only count operations in the tests for ranges::advance because
doing so in prev() and next() too was reaching diminishing returns, and
didn't meaningfully improve our test coverage.
2022-01-13 13:57:55 -05:00
Louis Dionne c0671e2c9b [libc++] Move assignable_sentinel to a common header where it can be reused 2022-01-13 12:59:16 -05:00
Arthur O'Dwyer 67151d029b [libc++] [ranges] Implement P2415R2 owning_view.
"What is a view?"
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2415r2.html
https://github.com/cplusplus/draft/pull/5010/files

This was a late-breaking (Oct 2021) change to C++20.
The only thing missing from this patch is that we're supposed
to bump the feature-test macro from
    #define __cpp_lib_ranges 202106L
to
    #define __cpp_lib_ranges 202110L
but we can't do that because we don't implement all of 202106 Ranges yet.

Differential Revision: https://reviews.llvm.org/D116894
2022-01-13 12:29:41 -05:00
Louis Dionne c7aa8b2962 [libc++][NFC] Remove duplication of distance_apriori_sentinel 2022-01-13 12:23:33 -05:00
Arthur O'Dwyer 42185ad870 [libc++] Add tests verifying alphabetical order for several things.
These things are header #includes, CMakeLists.txt, and module.modulemap.

Differential Revision: https://reviews.llvm.org/D116958
2022-01-13 09:58:56 -05:00
Arthur O'Dwyer 483f7f5536 [libc++] [ranges] Implement ranges::cdata.
Differential Revision: https://reviews.llvm.org/D117044
2022-01-12 22:07:13 -05:00
Konstantin Varlamov b9bc3c107c [libc++][ranges] Implement `construct_at` and `destroy{,_at}`.
Differential Revision: https://reviews.llvm.org/D116078
2022-01-12 16:01:04 -08:00
Arthur O'Dwyer 9be193bc58 [libc++] [ranges] Finish ADL-proofing ranges::data.
This should have been part of D116239.
2022-01-12 18:16:22 -05:00
Arthur O'Dwyer 4163f61f29 [libc++] [ranges] Fix a missing auto(x) cast in ranges::data.
Also remove some bogus `std::forward`s. My impression is that these
forwards were actually harmless, because `ranges::begin(FWD(t))` is
always identical to `ranges::begin(t)` (except when it's ill-formed,
and that can't happen in this case). However, they're also superfluous
and don't reflect the wording in the standard, so let's eliminate them.

Differential Revision: https://reviews.llvm.org/D117043
2022-01-12 18:16:15 -05:00
Konstantin Varlamov 57092f87b2 Revert "[libc++] Temporarily disable the in_out_result test on Fuchsia."
This reverts commit 9e634b35ff.
2022-01-12 13:10:30 -08:00
Arthur O'Dwyer a70fe03961 [libc++] [ranges] SFINAE away ranges::cbegin(const T&&) for non-borrowed T.
Fixes #52952.

Differential Revision: https://reviews.llvm.org/D116991
2022-01-12 13:25:41 -05:00
Louis Dionne d202c76441 [libc++] Start using `arc4random()` to implement `std::random_device` on Apple
On Apple platforms, arc4random is faster than /dev/urandom, and it is
the recommended user-space RNG according to Apple's own OS folks.

This commit adds an ABI switch to guard ABI-break-protections in
std::random_device, and starts using arc4random instead of /dev/urandom
to implement std::random_device on Apple platforms.

Note that previously, `std::random_device` would allow passing a custom
token to its constructor, and that token would be interpreted as the name
of a file to read entropy from. This was implementation-defined and
undocumented. After this change, Apple platforms will be using arc4random()
instead, and any custom token passed to the constructor will be ignored.
This behavioral change will also impact other platforms that use the
arc4random() implementation, such as OpenBSD. This should be fine since
that is effectively a relaxation of the constructor's requirements.

rdar://86638350

Differential Revision: https://reviews.llvm.org/D116045
2022-01-12 11:24:23 -05:00
Konstantin Varlamov fe958b140a [libc++] Quick fix to remove a narrowing conversion from the in_out_result test.
This needs a proper solution in a follow-up. The issue is that the
Standard defines conversions between `in_out_result` classes with
different template types as just `return {in, out};`. Because the
expression uses list initialization, it will fail to compile if the
conversion happens to be narrowing -- which is probably unintended.

Surprisingly, this error wasn't caught by the CI.

Differential Revision: https://reviews.llvm.org/D117089
2022-01-12 01:49:46 -08:00
Joe Loser 0d1365e380
[libc++][test] Move iter_swap into iterator.cust.swap. NFC.
Move `iter_swap.pass.cpp` into a new subdirectory: `iterator.cust.swap`
for symmetry with the neighboring subdirectory `iterator.cust.move`.

Differential Revision: https://reviews.llvm.org/D116992
2022-01-11 19:56:35 -05:00
Konstantin Varlamov 9e634b35ff [libc++] Temporarily disable the in_out_result test on Fuchsia. 2022-01-11 15:05:43 -08:00
Nikolas Klauser fcfc0e7ad3 [libc++] Introduce __fits_in_sso()
Introduce `__fits_in_sso()` to put the constexpr tests into a central place.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116487
2022-01-11 23:20:15 +01:00
Nikolas Klauser d5b5fc06b8 [libc++] Add Status page for P2321R2 (Zip)
Add a status page for P2321R2

Reviewed By: ldionne, Mordante, #libc

Spies: jloser, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D116691
2022-01-11 23:13:31 +01:00
Nikolas Klauser e3cf70502c [libc++] Introduce __debug_db_insert_c()
There are a lot of
```
#if _LIBCPP_DEBUG_LEVEL == 2
    __get_db()->__insert_c(this);
#endif
```

This patch introduces `__debug_db_insert_c()` to put the `#if` in one central place.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116947
2022-01-11 23:11:26 +01:00
John Ericson 0a8d15ad55 [libc++][libc++abi][libunwind] Dedup install path var definitions
In D116873 I did this for libunwind prior to defining a new install path
variable. But I think the change is good on its own, and libc++{,abi}
could also use it.

libc++ needed the base header var defined above the conditional part to
use it for the prefi+ed headers in the non-target-specific case. For
consistency, I therefore put the unconditional ones above for all 3
libs, which is why I touched the libunwind code (seeing that it had the
core change already)

Reviewed By: phosek, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D116988
2022-01-11 18:24:50 +00:00
Louis Dionne 7c7d59a35d [libc++] Use TEST_HAS_NO_UNICODE instead of _LIBCPP_HAS_NO_UNICODE in the test suite
Differential Revision: https://reviews.llvm.org/D116973
2022-01-11 10:34:59 -05:00
Konstantin Varlamov 8d23b7420c [libc++][ranges] Implement `uninitialized_copy{,_n}` and `uninitialized_move{,_n}`.
Also implement `in_out_result` which is a prerequisite.

Differential Revision: https://reviews.llvm.org/D116023
2022-01-10 22:49:50 -08:00
Casey Carter 1d3964d2ad [libcxx][test] Make LIBCPP_STATIC_ASSERT usable at namespace scope
... even when `!defined(_LIBCPP_VERSION)`. (Note that the previous definition for this case - `((void)0);` - is ill-formed at namespace scope.) Ditto for `LIBCPP_ASSERT`, `LIBCPP_ASSERT_NOEXCEPT`, `LIBCPP_ASSERT_NOT_NOEXCEPT`, and `LIBCPP_ONLY`.

Differential Revision: https://reviews.llvm.org/D116880
2022-01-10 16:35:31 -08:00
Nikolas Klauser 2154dbaa59 [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <list>
Use `_LIBCPP_DEBUG_ASSERT` in `<list>`

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116938
2022-01-10 23:19:16 +01:00
Casey Carter a765eea153 [libcxx][test] Auto-detect _LIBCPP_HAS_NO_UNICODE for MSVC STL
... by examining `_MSVC_EXECUTION_CHARACTER_SET` in the force-include header.

Differential Revision: https://reviews.llvm.org/D116883
2022-01-10 13:56:22 -08:00
Louis Dionne 84654f2733 [libc++] Refactor the tests for std::random_device
That will make it easier to change the behavior of the arc4random()
based implementation. Note that in particular, the eval.pass.cpp test
used to work with non "/dev/random" based implementations because we'd
throw an exception upon constructing the random_device. This patch makes
the intent of the test clearer.
2022-01-10 16:34:16 -05:00
Arthur O'Dwyer 4d81a46f7f [libc++] Alphabetize header #includes. NFCI.
The NFC part of D116809. We still want to enforce this in CI,
but the mechanism for that is still to-be-determined.

Differential Revision: https://reviews.llvm.org/D116809
2022-01-10 16:30:38 -05:00
Roland McGrath ce167c6fb2 [libcxx] Use Fuchsia-native monotonic clock for std::chrono::steady_clock
Use the zx_clock_get_monotonic system call directly rather than
going through the POSIX clock_gettime function.  The libc function
is a trivial wrapper around the system call, and is not a standard C
function.  Avoiding it reduces the Fuchsia libc ABI surface that
libc++ depends on.

Reviewed By: phosek, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D116606
2022-01-10 13:14:50 -08:00
Arthur O'Dwyer c9f83a8af9 [libc++] Alphabetize CMakeLists.txt and module.modulemap. NFC.
The NFC part of D116958. We still want to enforce this in CI,
but the mechanism for that is still to-be-determined.
2022-01-10 15:38:40 -05:00
Arthur O'Dwyer 07a0b0ee94 [libc++] Properly handle specializations of std::is_placeholder.
Before this patch, the user needed to specialize both of
`is_placeholder<MyType>` and `is_placeholder<const MyType>`.
After this patch, only the former is needed (although the
latter is harmless if provided).

The new tests don't actually fail unless return type deduction
is used, which is a C++14 feature. Specializing `is_placeholder`
is still allowed in C++11, though.

Fixes #51095.

Differential Revision: https://reviews.llvm.org/D116388
2022-01-10 12:38:59 -05:00
Arthur O'Dwyer 4b5d59ffd0 [libc++] libcxx/utils: s/preambule/preamble/g. NFC. 2022-01-10 11:38:25 -05:00
Louis Dionne 7893bb7408 [libc++] Refactor the test for join_view's default constructor
In particular, this removes the need for adding a ad-hoc `operator==`
to forward_iterator.

Differential Revision: https://reviews.llvm.org/D116614
2022-01-10 09:02:45 -05:00
Louis Dionne c01260a781 [libc++] Add missing `return 0` to main() functions in the tests 2022-01-10 08:38:18 -05:00
Louis Dionne e6d7b2f0de [libc++] Fix link to bug tracker 2022-01-10 08:33:28 -05:00
Louis Dionne 49b9b9dc9c [libc++] Fix the documentation and re-enable documentation CI
The documentation CI job is very cheap, so we can afford to keep it
around even with reduced capacity. This commit fixes the documentation
(which had an invalid reference in it) and re-enables that CI step.

Differential Revision: https://reviews.llvm.org/D116897
2022-01-10 08:05:58 -05:00
Casey Carter 4cd768ed5e [libcxx][test] `_VSTD` doesn't belong in test code 2022-01-08 21:33:52 -08:00
Arthur O'Dwyer 8a21e0c10c [libc++] [test] Remove `UNSUPPORTED: stdlib=msvc` from lock.pass.cpp.
Casey Carter says, "We run std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
on every CI and it works fine with MSVC STL. I'm guessing this annotation predates
Billy's rewrite of std::lock in 2017-ish."

Differential Revision: https://reviews.llvm.org/D116712
2022-01-08 16:03:30 -05:00
Arthur O'Dwyer 6ce732cbad [libc++] [ranges] Add namespace __cpo to ranges::{advance,next,prev}.
The reason for those nested namespaces is explained in D115315:

> AIUI, this keeps the CPO's own type from ADL'ing into the `std::ranges`
> namespace; e.g. `foobar(std::ranges::uninitialized_default_construct)`
> should not consider `std::ranges::foobar` a candidate, even if
> `std::ranges::foobar` is not a CPO itself. Also, of course, consistency
> (Chesterton's Fence, the economist's hundred-dollar bill): if it were
> safe to omit the namespace, we'd certainly want to do it everywhere,
> not just here.

This makes these three niebloids more consistent with the other Ranges
niebloids we've already implemented, such as the `ranges::begin` group
and the `ranges::uninitialized_default_construct` group.

FWIW, we still have three different indentation-and-comment styles
among these three groups.

Differential Revision: https://reviews.llvm.org/D116569
2022-01-08 12:47:54 -05:00
Ben Wagner fb1582f6c5 [libc++] Disable coverage with sanitize-coverage=0
When building libcxx, libcxxabi, and libunwind the build environment may
specify any number of sanitizers. For some build feature tests these
sanitizers must be disabled to prevent spurious linking errors. With
-fsanitize= this is straight forward with -fno-sanitize=all. With
-fsanitize-coverage= there is no -fno-sanitize-coverage=all, but there
is the equivalent undocumented but tested -fsanitize-coverage=0.

The current build rules fail to disable 'trace-pc-guard'. By disabling
all sanitize-coverage flags, including 'trace-pc-guard', possible
spurious linker errors are prevented. In particular, this allows libcxx,
libcxxabi, and libunwind to be built with HonggFuzz.

CMAKE_REQUIRED_FLAGS is extra compile flags when running CMake build
configuration steps (like check_cxx_compiler_flag). It does not affect
the compile flags for the actual build of the project (unless of course
these flags change whether or not a given source compiles and links or
not). So libcxx, libcxxabi, and libunwind will still be built with any
specified sanitize-coverage as before. The build configuration steps
(which are mostly checking to see if certain compiler flags are
available) will not try to compile and link "int main() { return 0;}"
(or other specified source) with sanitize-coverage (which can fail to
link at this stage in building, since the final compile flags required
are yet to be determined).

The change to LIBFUZZER_CFLAGS was done to keep it consistent with the
obvious intention of disabling all sanitize-coverage. This appears to
be intentional, preventing the fuzzer driver itself from showing up in
any coverage calculations.

Reviewed By: #libunwind, #libc, #libc_abi, ldionne, phosek

Differential Revision: https://reviews.llvm.org/D116050
2022-01-07 17:53:21 -08:00
Arthur O'Dwyer 004ebe22f8 [libc++] Add missing templated version of `std::lerp`.
Fixes #50806.

Differential Revision: https://reviews.llvm.org/D116295
2022-01-07 09:55:33 -05:00
Nikolas Klauser bec50db2ed [libc++] Implement P1072R10 (std::basic_string::resize_and_overwrite)
Reviewed By: Quuxplusone, #libc, Mordante

Spies: mzeren-vmw, ckennelly, arichardson, ldionne, Mordante, libcxx-commits, Quuxplusone

Differential Revision: https://reviews.llvm.org/D113013
2022-01-07 00:09:16 +01:00
Nikolas Klauser 16232611ec [libc++][NFC] Remove using declarations in common_reference.compile.pass.cpp
Remove using declarations in common_reference.compile.pass.cpp

Reviewed By: Quuxplusone, Mordante, #libc, jloser

Spies: jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116744
2022-01-06 21:39:17 +01:00
Arthur O'Dwyer 9e35e61aa4 [libc++] [ranges] Simplify our idiom for testing niebloid-ness.
In the test files, replace the old-style tests with a simple static_assert,
matching the current style as depicted in e.g.
`ranges_uninitialized_default_construct.pass.cpp`.

Preserve `is_function_like` (but renamed to `is_niebloid`) at
ldionne's request. The removal of this test helper will happen
in D116570 if at all.

Differential Revision: https://reviews.llvm.org/D116384
2022-01-06 14:20:44 -05:00
Nikolas Klauser f3aed36981 [libc++] Implement P1425R4 (Iterator pair constructors for std::stack and std::queue)
Implement P1425R4

Reviewed By: Quuxplusone, #libc, Mordante

Spies: Mordante, jloser, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D115977
2022-01-06 18:55:11 +01:00
Nikolas Klauser 3ef363ecec [libc++] Re-enable `GCC11 / C++11`, `Clang 12` and `ASAN` CI-runs 2022-01-06 18:52:44 +01:00
Arthur O'Dwyer 570ed38b6e [libc++] [test] XFAIL "span.cons/initializer_list.pass.cpp" for apple-clang-12.
This should have been done in 6a6a80e88e, but buildkite was down so I
hadn't noticed. This brings this test file into line with several others
in this directory.
2022-01-06 12:15:28 -05:00
Nikolas Klauser f2277e60f4 [libc++][NFC] Reformat <__filesystem/operations.h>
Reformat `<__filesystem/operations.h>`

Reviewed By: Quuxplusone, #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116234
2022-01-06 16:15:41 +01:00
Fanbo Meng 43c5e61b55 [SystemZ][z/OS][libcxx]:Fix fopen64 undeclared error in 32 bit mode
z/OS doesn't support fopen64() functions. Modify the preprocessor directive for z/OS to use fopen() instead.

Reviewed By: #libc, abhina.sreeskantharajan, muiez, ldionne

Differential Revision: https://reviews.llvm.org/D111226
2022-01-06 08:57:56 -05:00
Chuanqi Xu bbce75e352 Update Bug report URL to Github Issues
Although we moved to Github Issues. The bug report message refers to
Bugzilla still. This patch tries to update these URLs.

Reviewed By: MaskRay, Quuxplusone, jhenderson, libunwind, libc++

Differential Revision: https://reviews.llvm.org/D116351
2022-01-06 17:33:25 +08:00
Nico Weber 085f078307 Revert "Revert D109159 "[amdgpu] Enable selection of `s_cselect_b64`.""
This reverts commit 859ebca744.
The change contained many unrelated changes and e.g. restored
unit test failes for the old lld port.
2022-01-05 13:10:25 -05:00
David Salinas 859ebca744 Revert D109159 "[amdgpu] Enable selection of `s_cselect_b64`."
This reverts commit 640beb38e7.

That commit caused performance degradtion in Quicksilver test QS:sGPU and a functional test failure in (rocPRIM rocprim.device_segmented_radix_sort).
Reverting until we have a better solution to s_cselect_b64 codegen cleanup

Change-Id: Ibf8e397df94001f248fba609f072088a46abae08

Reviewed By: kzhuravl

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

Change-Id: Id169459ce4dfffa857d5645a0af50b0063ce1105
2022-01-05 17:57:32 +00:00
Mark de Wever de731efd4c [libc++][format] Improve an exception message.
The fix in D116381 makes an existing exception message wrong. This
improves the message and fixes the associated unit tests.

Note other message can be also be improved, but that will be done later.
Changing these messages may cause merge conflicts with other patches
that are under review or WIP.

Depends on D116381

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D116495
2022-01-05 17:43:11 +01:00
Mark de Wever f2b40ba400 [libc++][format] Fix precision parser conformance.
@CaseyCarter reported that the tests for the std-format-spec rejects leading
zeroes for precision, which the Standard does not require. The Standard allows
them. Only for precision, not for the width or an arg-id.

Fixes the precision parser and adds some test for the arg-id since they
were missing.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D116381
2022-01-05 17:41:36 +01:00
Nikolas Klauser 93746b940a [libc++] Use _LIBCPP_DEBUG_ASSERT in __iterator/wrap_iter.h
Use `_LIBCPP_DEBUG_ASSERT` in `__iterator/wrap_iter.h`

Reviewed By: #libc, Quuxplusone, Mordante, ldionne

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116347
2022-01-05 09:15:42 +01:00
Nikolas Klauser cf54cb2e03 [libc++][NFC] Remove duplicate header includes from <algorithm> and reorder them
Remove duplicate header includes from `<algorithm>` and reorder the includes

Reviewed By: Quuxplusone, ldionne, Mordante, #libc, jloser

Spies: jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116507
2022-01-05 09:06:53 +01:00
Nikolas Klauser 1e1e97a326 [libc++][test] Allow multiple tries in some thread tests 2022-01-04 23:47:43 +01:00
Nikolas Klauser 6d722801d1 [libc++][ranges] Add indirectly_comparable concept
Add `indirectly_comparable` concept

Reviewed By: Quuxplusone, Mordante, #libc

Spies: mgorny, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116268
2022-01-04 23:40:57 +01:00
Arthur O'Dwyer 855d7bedb7 [libc++] [P0887] Add newest feature-test macros; mark `type_identity` as implemented.
`__cpp_lib_type_identity` was implemented way back in cf49ccd0 (Clang 8),
probably before the feature-test macro had been settled on.

`__cpp_lib_string_resize_and_overwrite` will be added by D113013 so I didn't add it here.

Fixes #46605.

Differential Revision: https://reviews.llvm.org/D116433
2022-01-04 17:23:37 -05:00
Arthur O'Dwyer 8507383631 [libc++] [ranges] ADL-proof the [range.access] CPOs.
For example, `std::ranges::range<Holder<Incomplete>*>` should be
well-formed false, not a hard error at compile time.

Differential Revision: https://reviews.llvm.org/D116239
2022-01-04 17:15:42 -05:00
Arthur O'Dwyer 1716c36d84 [libc++] [test] More test coverage for ranges::{data,size}.
Reviewed as part of D116239.
2022-01-04 17:15:26 -05:00
Arthur O'Dwyer 502e5df0e0 [libc++] Implement `ranges::{cbegin,cend}` per the spec.
The big change here is that they now work as intended for rvalues,
e.g. `ranges::cbegin(std::string_view("hello"))`.
Also, add tests verifying their return types.

Differential Revision: https://reviews.llvm.org/D116199
2022-01-04 16:18:41 -05:00
Arthur O'Dwyer e80ef6bd27 [libc++] Fix whitespace in __partial_sort. NFC. 2022-01-04 16:15:02 -05:00
Arthur O'Dwyer f6fb7bf636 [libc++] Add an early return for __partial_sort of an empty range.
If `__first == __middle`, then `partial_sort` is a no-op; don't
bother to iterate all the way from `__middle` to `__end`.

Fixes #49431.

Differential Revision: https://reviews.llvm.org/D116296
2022-01-04 16:14:05 -05:00
Louis Dionne 4a47ac7d51 [libc++] Remove incorrect default constructor in cpp17_input_iterator
AFAICT, Cpp17InputIterators are not required to be default constructible,
since that requirement is added in Cpp17ForwardIterator. Hence, our
archetype for Cpp17InputIterator should not be default constructible.
Removing that constructor has a ripple effect on a couple of tests that
were making incorrect assumptions. Notably:

- Some tests were using cpp17_input_iterator as a sentinel for itself.
  That is not valid, because a cpp17_input_iterator is not semiregular
  anymore after the change (and hence it doesn't satisfy sentinel_for).

- Some tests were using a stride-counted cpp17_input_iterator as the
  sentinel for a range. This doesn't work anymore because of the problem
  above, so these tests were changed not to check stride counts for
  input iterators.

- Some tests were default constructing cpp17_input_iterator when a simple
  alternative was available -- those have been changed to use that alternative.

Differential Revision: https://reviews.llvm.org/D115806
2022-01-04 14:33:51 -05:00
Arthur O'Dwyer 6a6a80e88e [libc++] [test] Add tests for std::span construction from initializer lists.
Differential Revision: https://reviews.llvm.org/D116481
2022-01-04 14:25:32 -05:00
Arthur O'Dwyer 5a3c276365 [libc++] [test] Remove IFNDR uses of std::invocable.
libstdc++'s implementation diagnoses these with hard errors.

Fixes #50059.

Differential Revision: https://reviews.llvm.org/D116293
2022-01-04 14:12:54 -05:00
Mark de Wever bd6e6846e7 [libc++] Add the version header to all headers.
Some headers which require the version header depend on other headers to
provide it. Include the version header in all top-level headers to make
sure a header cleanup can't remove the version header.

Note this doesn't add the version header to the c headers.

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D116172
2022-01-04 19:50:59 +01:00
Roland McGrath 3064dd8ccf [libcxx] Use Fuchsia-native CPRNG for std::random_device
Use the zx_cprng_draw system call directly rather than going
through the libc getentropy function.  The libc function is a
trivial wrapper around the system call, and is not a standard C
function.  Avoiding it reduces the Fuchsia libc ABI surface that
libc++ depends on.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D116498
2022-01-04 10:24:18 -08:00
Louis Dionne e24ddb6027 [libc++] Use std::addressof in std::function::target
This guards against hostile overloads of operator&. Thanks to Peter Dimov
for the report in https://github.com/boostorg/lambda/issues/24.

Differential Revision: https://reviews.llvm.org/D116380
2022-01-04 12:31:45 -05:00
Nikolas Klauser 875dd75e5a [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <__hash_table>
Use `_LIBCPP_DEBUG_ASSERT` in `<__hash_table>`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116486
2022-01-04 16:00:37 +01:00
Louis Dionne c31cf74c3c [libc++] Add `return 0` to some main() functions
This unbreaks the tests when running in freestanding mode.
2022-01-04 09:18:08 -05:00
Nikolas Klauser c9dbf0f2a1 [libc++] Fix __wrap_iter copy-assignment in constexpr contexts
Fixes https://github.com/llvm/llvm-project/issues/52902

In debug mode during constant evaluation the iterator was never assigend. There seem to be no other instances of this bug.

Reviewed By: Quuxplusone, Mordante, #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116346
2022-01-04 11:05:53 +01:00
Louis Dionne 4aba7e901e [libc++][CI] Don't install libc6-dev-i386 in the Docker image
We don't cross-compile to 32 bits in the CI anymore.
2022-01-03 16:10:59 -05:00
Louis Dionne 4f7f7284c2 [libc++][NFC] Fix comment for running Docker container 2022-01-03 16:10:59 -05:00
John Ericson 949bbd0a68 [CMake] Use `LLVM_COMMON_CMAKE_UTILS` in runtimes just for clarity
In D116472 we created conditionally defined variables for the tools to
unbreak the legacy build where they are in `llvm/tools`.

The runtimes are not tools, so that flexibility doesn't matter. Still,
it might be nice to define (unconditionally) and use the variable for
the runtimes simply to make the code a bit clearer and document what is
going on.

Also, consistently put project dirs at the beginning, not end of `CMAKE_MODULE_PATH`. This ensures they will properly shadow similarly named stuff that happens to be later on the path.

Reviewed By: mstorsjo, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D116477
2022-01-03 20:55:44 +00:00
Louis Dionne 89f4a18f37 [libc++][CI] Temporarily disable several Linux jobs
There is an ongoing CI outage with our Linux nodes, so I temporarily
set up a couple of nodes. These nodes will be much slower than the
usual ones and there's only a few of them, so I am temporarily disabling
most of our CI to keep things working.
2022-01-03 12:28:20 -05:00
Arthur O'Dwyer eda5bbfb9d [libc++] [test] Remove an erroneously copy-paste in the hypot() tests. NFC.
Line 1140 is a duplicate of line 1119; it tests the two-argument version
of std::hypot, whereas all the lines in this section are supposed to be
testing the C++17 three-argument version. Remove the erroneous duplicated line.

Split out of D116295.
2022-01-02 12:49:55 -05:00
Louis Dionne ee8e81b40e [libc++][NFC] Fix incorrect synopsis in transform_view test 2021-12-30 15:43:27 -05:00
Arthur O'Dwyer 928852f156 [libc++] [NFC] Remove an unused parameter from `__sift_down`.
Differential Revision: https://reviews.llvm.org/D116382
2021-12-29 16:25:33 -05:00
Joe Loser 7f410251e8
[libcxx][test] Remove redundant semiregular checks for CPOs
Some individual test files verify the CPO under test satisfies
`semiregular` concept.  This is redundant since it is already part of the test
in verifying whether the entity is indeed a CPO in
`libcxx/test/std/library/description/conventions/customization.point.object/cpo.compile.pass.cpp`.

Differential Revision: https://reviews.llvm.org/D116173
2021-12-28 22:09:12 -05:00
Chuanqi Xu 6441536c27 [libcxx] [Coroutines] Support noop_coroutine for GCC
We didn't support noop_coroutine for GCC in previous conforming patch.
So that GCC couldn't use noop_coroutine() defined in <coroutine>. And
after this patch, GCC should be able to compile the whole <coroutine>
header.

Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D116144
2021-12-27 13:53:21 +08:00
Kazu Hirata 7006d34ce7 Ensure newlines at the end of files (NFC) 2021-12-26 08:51:06 -08:00
Arthur O'Dwyer 3042091168 [libc++] [ranges] Whitespace and namespace-style adjustments. NFC.
Largely split out of D116199 to keep that PR smaller.
2021-12-23 14:56:23 -05:00
Arthur O'Dwyer 4191a93ea4 [libc++] [test] Eliminate `== true` and `== false`. NFC.
As suggested in D115312.
2021-12-23 14:56:23 -05:00
Arthur O'Dwyer a2a9a5c7d3 [libc++] [ranges] Fix bugs in ranges::empty().
It was missing the cast to `bool` in `bool(__t.empty())`.
It was wrongly using `std::forward` in some places.

Differential Revision: https://reviews.llvm.org/D115312
2021-12-23 14:56:23 -05:00
Arthur O'Dwyer 6842f52a0b [libc++] [test] Flatten the directory structure a bit. NFC.
Differential Revision: https://reviews.llvm.org/D116198
2021-12-23 14:56:23 -05:00
Mark de Wever e8b24ee115 [libc++][format][NFC] Remove some unneeded headers.
Reviewed By: #libc, Quuxplusone, Mordante

Differential Revision: https://reviews.llvm.org/D116175
2021-12-23 17:38:21 +01:00
Mark de Wever dfb20d4d19 [libc++][format] Improve ABI stability.
During the review of D115991 @vitaut pointed out the enum shouldn't
depend on whether or not _LIBCPP_HAS_NO_INT128 is defined. The current
implementation lets the enum's ABI depend on this configuration option
without a good cause.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D116120
2021-12-23 17:37:12 +01:00
Nikolas Klauser 23f1cd9e63 [libc++] Remove unused headers from <filesystem>
Remove unused headers from `<filesystem>`

Reviewed By: Quuxplusone, #libc, Mordante

Spies: Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116146
2021-12-23 13:32:49 +01:00
Nikolas Klauser 1d50cf98b5 [libc++] IWYU in <filesystem> tests
Add headers in `<filesystem>` tests that were transitively included
through `<filesystem>`

Reviewed as part of D116146
2021-12-23 12:03:36 +01:00
Nikolas Klauser fcc0964ed4 Revert "[libc++] Remove unused headers from <filesystem>"
This reverts commit 352945dd36.
2021-12-23 11:55:38 +01:00
Nikolas Klauser 352945dd36 [libc++] Remove unused headers from <filesystem>
Remove unused headers from `<filesystem>`

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116146
2021-12-23 02:07:47 +01:00
Arthur O'Dwyer caf940bac6 [libc++] Remove "clang-format off/on" comments. NFC.
These headers have stabilized; we don't expect anyone to be
blindly clang-formatting them anymore.
Leave the comments in `__format/*.h` for Mark to remove at his leisure.
2021-12-22 17:56:03 -05:00
Arthur O'Dwyer cb8a0b0797 [libc++] [ranges] Introduce _LIBCPP_AUTO_CAST(x) for auto(x).
Clang is gaining `auto(x)` support in D113393; sadly there
seems to be no feature-test macro for it. Zhihao is opening
a core issue for that macro.

Use `_LIBCPP_AUTO_CAST` where C++20 specifies we should use `auto(x)`;
stop using `__decay_copy(x)` in those places.
In fact, remove `__decay_copy` entirely. As of C++20, it's purely
a paper specification tool signifying "Return just `x`, but it was
perfect-forwarded, so we understand you're going to have to call
its move-constructor sometimes." I believe there's no reason we'd
ever need to do its operation explicitly in code.

This heisenbugs away a test failure on MinGW; see D112214.

Differential Revision: https://reviews.llvm.org/D115686
2021-12-22 12:29:42 -05:00
Arthur O'Dwyer 8ad364ad21 [libc++] [ranges] Remove the static_assert from ranges::begin and ranges::end.
As discussed with ldionne. The problem with this static_assert
is that it makes ranges::begin a pitfall for anyone ever to use
inside a constraint or decltype. Many Ranges things, such as ranges::size,
are specified as "Does X if X is well-formed, or else Y if Y is well-formed,
or else `ranges::end(t) - ranges::begin(t)` if that is well-formed, or else..."
And if there's a static_assert hidden inside `ranges::begin(t)`, then you get
a hard error as soon as you ask the question -- even if the answer would have
been "no, that's not well-formed"!

Constraining on `requires { t + 0; }` or `requires { t + N; }` is verboten
because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103700 . For ranges::begin,
we can just decay to a pointer even in the incomplete-type case. For ranges::end,
we can safely constrain on `sizeof(*t)`. Yes, this means that an array of incomplete
type has a `ranges::begin` but no `ranges::end`... just like an unbounded array of
complete type. This is a valid manifestation of IFNDR.

All of the new libcxx/test/std/ cases are mandatory behavior, as far as I'm aware.
Tests for the IFNDR cases in ranges::begin and ranges::end remain in `libcxx/test/libcxx/`.
The similar tests for ranges::empty and ranges::data were simply wrong, AFAIK.

Differential Revision: https://reviews.llvm.org/D115838
2021-12-22 10:33:17 -05:00
Martin Storsjö 7176799a7e [libc++] Add from-scratch testing configs for Windows
The paths to the compiler and to the python executable may need to
be quoted (if they're installed into e.g. C:\Program Files).

All testing commands that are executed expect a gcc compatible command
line interface, while clang-cl uses different command line options.
In the original testing config, if the chosen compiler was clang-cl, it
was replaced with clang++ by looking for such an executable in the path.

For the new from-scratch test configs, I instead chose to add
"--driver-mode=g++" to flags - invoking "clang-cl --driver-mode=g++"
has the same effect as invoking "clang++", without needing to run any
heuristics for picking a different compiler executable.

Differential Revision: https://reviews.llvm.org/D111202
2021-12-22 15:16:58 +02:00
Martin Storsjö fd64544fbe [libcxx] [test] Remove a leftover unused function in config.py. NFC.
While there's little value in polishing the old config system,
I ran into this function and was confused for a while, while grepping
around and trying to wrap my head around things.

Differential Revision: https://reviews.llvm.org/D116131
2021-12-22 15:16:14 +02:00
Martin Storsjö 516882a8f2 [libcxx] [test] Prepare the ctime.timespec test for mingw CI env upgrades
The test is currently marked XFAIL for mingw environments, but latest
mingw-w64 got support for timespec_get:
e62a0a987c

The CI environment will probably be upgraded to a state where this
test is passing only after 14.x is branched in the llvm-project monorepo.

If we'd just go from having an XFAIL to no marking at all (when CI is
passing), we'd have to update both main and 14.x branches in sync
exactly when the CI runners are updated to a newer version.

Instead, mark the test as temporarily unsupported (so it doesn't
cause failed builds when the CI environment is updated); after the
CI environments are upgraded to such a state, we can remove the
UNSUPPORTED marking to start requiring it to pass on the main branch,
without needing to synchronize that change to anything else.

Differential Revision: https://reviews.llvm.org/D116132
2021-12-22 15:14:55 +02:00
Nikolas Klauser 7056250f51 [libc++][NFC] Granularize <filesystem>
Granularize the `<filesystem>` header

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D115578
2021-12-22 02:31:17 +01:00
Arthur O'Dwyer 1fe897dffd [libc++] [test] Simplify some ranges tests.
Eliminate a bogus operator== overload.
Also, check more intermediate steps in the logic we're checking here.
Some of this simplification is possible only now that we've implemented
more of <ranges>.

Differential Revision: https://reviews.llvm.org/D116002
2021-12-21 20:16:35 -05:00
Martin Storsjö d67b25e7f6 [libcxx] [test] Extend test for bash for executor-has-no-bash
If %{exec} sets "--env PATH=single-dir", the directory containing
bash and related shell utils is omitted from the path, which means
that most shell scripts would fail.

(Setting PATH is needed for DLL builds on Windows; PATH fills the same
role as e.g. LD_LIBRARY_PATH on Linux.)

This condition is missed in the current test, because the executor
run.py first resolves the executable to run using the original path,
then invokes that executable with an environment with a restricted
path. Thus the executor is able to run bash, but that bash is then
unable to run further shell commands (other than bash builtins).

Extend the test from "bash --version" to "bash -c 'bash --version'".
This correctly identifies the executor-has-no-bash condition in the
current Windows CI configs, allowing removing 6 cases of
LIBCXX-WINDOWS-FIXME.

Another longterm fix would be to extend run.py with an option like
"--env-prepend PATH=dir", to allow keeping the current path while
adding a directory to it.

Differential Revision: https://reviews.llvm.org/D116117
2021-12-22 00:43:29 +02:00
Martin Storsjö f68e89044a [libcxx] Add LIBCXX_EXTRA_SITE_DEFINES for adding extra defines in __config_site
This is similar to the existing setting LIBCXX_ABI_DEFINES, with
the difference that this also allows setting other defines than
ones that start with "_LIBCPP_ABI_", and allows setting defines
to a specific value.

This allows avoiding using LIBCXX_TEST_COMPILER_FLAGS in two
CI configurations.

Differential Revision: https://reviews.llvm.org/D116109
2021-12-22 00:43:29 +02:00
Martin Storsjö c1a14a5c3e [libcxx] Use LIBCXX_EXECUTOR in new test configs
This allows cross-testing (by setting LIBCXX_EXECUTOR to point
to ssh.py) without making an entirely new test config file.

Implicitly, this also fixes quoting of the python executable name
(which is quoted in test/CMakeLists.txt).

Differential Revision: https://reviews.llvm.org/D115398
2021-12-22 00:43:28 +02:00
Louis Dionne beff71520b [libc++] Partially revert 346ef5e587
This moves the macro definitions back to __config, but keeps the
improved documentation. 346ef5e587 had broken the MinGW build.
2021-12-21 23:58:17 +02:00
Louis Dionne 346ef5e587 [libc++][NFC] Improve documentation of the various random_device implementations
Also, move the setting of the macro closer to its point of use, which
also has the benefit of uncluttering `__config`.
2021-12-21 15:32:09 -05:00
Louis Dionne e03ce65190 [libc++][NFC] Reformatting in random_device.h and random.cpp 2021-12-21 13:32:56 -05:00
Martin Storsjö 008849d7a5 [libcxx] [test] Don't rerun supportsVerify for each individual test
We can't just memoize _supportsVerify in place in format.py, as it
previously was executed in each of the individual processes.

Instead use hasCompileFlag() and add a feature flag for it instead,
which can be used both by tests (that already have such a flag,
locally for one set of tests) and for the testing framework itself.

By using hasCompileFlag(), this also implicitly fixes two other issues:
Previously, _supportsVerify called subprocess.call() directly, which can
interpret command line quoting differently than lit.TestRunner.

(In particular, TestRunner handles arguments quoted by a single quote,
while launching Windows processes with subprocess.call() only supports
double quotes. This allows using shlex.quote(), which uses single quotes,
everywhere - as all commands now go through TestRunner. This should make
41d7909368 redundant.)

Secondly, the old _supportsVerify method didn't include %{flags) or
%{compile_flags}.

Differential Revision: https://reviews.llvm.org/D116010
2021-12-21 19:40:30 +02:00
Louis Dionne d5b3cb0711 [libc++][NFC] Fix links to https://llvm.org/PR20183 in the tests 2021-12-21 10:34:08 -05:00
Joe Loser 8dbc7745e5
[libcxx][test] Verify customization point object properties
Add test for various customization point object properties as defined by
the Standard. Test various CPOs from `<ranges>`, `<iterator>`,
`<concepts>`, etc.

The test is mostly from https://reviews.llvm.org/D107036 and split up
into this.

Differential Revision: https://reviews.llvm.org/D115588
2021-12-21 10:12:19 -05:00
Arthur O'Dwyer 9233675466 [libc++] Rename __s1/__s2 to __dest/__source in __copy_constexpr. NFC.
This consistently completes the renaming started in D115986.
2021-12-21 08:36:44 -05:00
Nikolas Klauser edb4698008 [libc++] Allow __move_constexpr to work with unrelated pointers
Allow `__move_constexpr` to work with unrelated pointers and `_LIBCPP_ASSERT` that `__copy_constexpr`, `__move_constexpr` and `__assign_constexpr` are only run during constant evaluation

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D115986
2021-12-21 14:03:39 +01:00
Raul Tambre 4e730aeb73 [libcxx] Add deprecation notices to macros deprecated in P0883R2
When P0883R2 was initially implemented in D103769 #pragma clang deprecated didn't exist yet.
We also forgot to cleanup usages in libc++ itself.

This takes care of both.

Differential Revision: https://reviews.llvm.org/D115995
2021-12-20 20:30:00 +02:00
Louis Dionne d4a69ef841 [libc++][NFC] Bump Dockerfile to get latest nightly Clang 2021-12-20 11:25:08 -05:00
Louis Dionne 37e6bd8bc8 [libc++] Add a helper class to write code with the strong exception guarantee
__transaction is a helper class that allows rolling back code in case an
exception is thrown. The main goal is to reduce the clutter when code
needs to be guarded with `#if _LIBCPP_NO_EXCEPTIONS`.

Differential Revision: https://reviews.llvm.org/D115730
2021-12-20 11:17:29 -05:00
Konstantin Varlamov 754ea6fd4d [libc++][ranges] Implement `uninitialized_value_construct{,_n}` and `uninitialized_fill{,_n}`.
Also:
- refactor out `__voidify`;
- use the `destroy` algorithm internally;
- refactor out helper classes used in tests for `uninitialized_*`
  algorithms.

Differential Revision: https://reviews.llvm.org/D115626
2021-12-20 00:24:27 -08:00
Martin Storsjö 2ec75a0869 [lit] Flush stderr manually on Windows after printing messages
When run in a git bash terminal, sys.stderr isn't flushed implicitly
after printing each line. Manually flush it after each printout,
to avoid getting broken/misordered output.

A similar fix had been done in the old libcxx test config, committed
as part of 7e3ee09ad2 / D28725; this
generalizes the fix, making it available in the new libcxx test
configs too, and for any other test that uses lit_config.note().

Differential Revision: https://reviews.llvm.org/D115761
2021-12-18 21:41:40 +02:00
Konstantin Boyarinov ff94bd1bc9 [libcxx][test][NFC] noexcept tests for std::array
Minor change - add tests that std::array methods (data, (c/r)begin,
(c/r)end) are noexcept

Reviewed By: ldionne, rarutyun, #libc

Differential Revision: https://reviews.llvm.org/D115717
2021-12-18 16:06:56 +03:00
Louis Dionne 2722ac65f6 [libc++] Add a bunch of missing inline and _LIBCPP_HIDE_FROM_ABI in __threading_support
The inline keyword is required on those functions because they are defined
in the headers, so we need them to be inline to avoid ODR violations.
While we're at it, slap _LIBCPP_HIDE_FROM_ABI on them because they are
implementation details and we don't want them to be part of our ABI under
any circumstances.

Differential Revision: https://reviews.llvm.org/D115906
2021-12-17 12:02:32 -05:00