Commit Graph

8884 Commits

Author SHA1 Message Date
Nikolas Klauser 1e77b396ff [libc++] Add ranges::in_fun_result
Add `ranges::in_fun_result`

Reviewed By: Quuxplusone, #libc, var-const

Spies: CaseyCarter, var-const, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D116974
2022-02-11 17:10:29 +01:00
Konstantin Varlamov aff115420d [libc++][ranges][NFC] Fix a typo in links on the Ranges status page. 2022-02-10 20:55:27 -08:00
Konstantin Varlamov 2151b3d093 [libc++][ranges][NFC] Update the status of predefined iterators.
`{back,front}_insert_iterator` and `ostream{,buf}_iterator` effectively
fully implement the One Ranges Proposal already, so mark them as done:
- the change to `difference_type` was made by D103273;
- default constructors and the associated default member initializers
  were removed by wg21.link/P2325 (implemented by D102468).

Also fix a stale template signature in the `<iterator>` synopsis.
2022-02-10 18:49:52 -08:00
Nikolas Klauser 8df7ff48e1 [libc++] Add LWG-issues from february 2022 plenary meeting
Reviewed By: ldionne, Quuxplusone, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119443
2022-02-10 23:21:28 +01:00
Martin Storsjö 8cffea061a [libcxx] Silence -Wformat-nonliteral warnings in the Windows support code
This brings the mingw build back to zero build warnings as it was
at some earlier time.

Differential Revision: https://reviews.llvm.org/D119134
2022-02-10 22:44:51 +02:00
Nikolas Klauser dcffa7d3e1 [libc++] Prepare string.modifiers tests for constexpr
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119329
2022-02-10 21:43:18 +01:00
Louis Dionne 4ae83bb2b1 Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS
We are moving away from building the runtimes with LLVM_ENABLE_PROJECTS,
however the documentation was largely outdated. This commit updates all
the documentation I could find to use LLVM_ENABLE_RUNTIMES instead of
LLVM_ENABLE_PROJECTS for building runtimes.

Note that in the near future, libcxx, libcxxabi and libunwind will stop
supporting being built with LLVM_ENABLE_PROJECTS altogether. I don't know
what the plans are for other runtimes like libc, openmp and compiler-rt,
so I didn't make any changes to the documentation that would imply
something for those projects.

Once this lands, I will also cherry-pick this on the release/14.x branch
to make sure that LLVM's documentation is up-to-date and reflects what
we intend to support in the future.

Differential Revision: https://reviews.llvm.org/D119351
2022-02-10 15:05:23 -05:00
Nikolas Klauser fb9646ed78 [libc++][P2321R2] Add vector<bool>::reference::operator=(bool) const
Add vector<bool>::reference::operator(bool) const

Reviewed By: Quuxplusone, ldionne, #libc

Spies: BRevzin, libcxx-commits

Differential Revision: https://reviews.llvm.org/D117736
2022-02-10 20:27:46 +01:00
Jordan Rupprecht d6b1448809 [libc++] Remove usage of `_LIBCPP_DEBUG` in `__comp_ref_type` and replace with `_LIBCPP_DEBUG_LEVEL`
In libc++, checking specific `_LIBCPP_DEBUG_LEVEL` levels is used everywhere except in `comp_ref_type.h`. `_LIBCPP_DEBUG` is meant as a user-facing option, and internally libc++ should be checking the value of `_LIBCPP_DEBUG_LEVEL`.

The definition of `std::__debug_less` doesn't need to be hidden behind the macro, we can unconditionally expose it. It will be unused by `__comp_ref_type` unless debug mode is enabled.

This was suggested in D118940.

Reviewed By: #libc, philnik, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D118950
2022-02-10 09:03:07 -08:00
Jordan Rupprecht 99e5c5256f [libc++] Fix std::__debug_less in c++17.
b07b5bd727 adds a use of `__comp_ref_type.h` to `std::min`. When libc++ is built with `-D_LIBCPP_DEBUG=0`, this enables `std::__debug_less`, which is only marked constexpr after c++17.

`std::min` itself is marked as being `constexpr` as of c++14, so by extension, `std::__debug_less` should also be marked `constexpr` for the same versions so that `std::min` can use it. This change lowers the guard from `> 17` to `> 11`.

Reproducer in godbolt: https://godbolt.org/z/ans3TGsj8

```

constexpr int x() { return std::min<int>({1, 2, 3, 4}); }

static_assert(x() == 1);
```

Reviewed By: #libc, philnik, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D118940
2022-02-10 08:52:17 -08:00
Mark de Wever fedbd264e3 [libc++][nfc] Add TEST_HAS_NO_LOCALIZATION.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119352
2022-02-10 17:44:37 +01:00
Nikolas Klauser c515b652a0 [libc++] Prepare string.{contains, ends_with, iterators, require, starts_with} tests for constexpr
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119304
2022-02-10 16:56:05 +01:00
Nikolas Klauser 9d90531904 [libc++][ranges] Implement std::ranges::swap_ranges()
Implement `std::ranges::swap_ranges()`

Reviewed By: Quuxplusone, #libc, ldionne

Spies: ldionne, mgorny, jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116303
2022-02-10 16:01:45 +01:00
Nikolas Klauser c77de9490e [libc++][NFC] Reformat and modernize compressed_pair.h
Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119335
2022-02-10 13:41:14 +01:00
Martin Storsjö 3dce6b329c [libcxx] [test] Fix the aligned storage test to work on Windows
Don't test alignment over 8 KB, which isn't supported on that
platform.

Differential Revision: https://reviews.llvm.org/D119348
2022-02-10 10:59:52 +02:00
Konstantin Varlamov 8f1d8785df [libc++][ranges] Implement `permutable`.
Differential Revision: https://reviews.llvm.org/D119222
2022-02-09 20:34:20 -08:00
Casey Carter 009791e0db [libcxx][test] optional's comparisons with optional are not portably constrained
so use them as concept test cases only with libc++.

Differential Revision: https://reviews.llvm.org/D116884
2022-02-09 14:00:24 -08:00
Mark de Wever ece0f70664 [libc++] Enables put_long_double test for glibc.
Glibc adds a +-sign for NaN-values when showpos fmtflags are set.

[tab:ios.fmtflags]
showpos generates a + sign in non-negative generated numeric output

Since NaNs aren't negative this behaviour seems correct. Enable the test
for glibc and add ifdefs to make sure the existing tests still pass.

This was noticed while working on D118971.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119260
2022-02-09 17:13:13 +01:00
Mark de Wever 11e4001ba2 [libc++][format][nfc] Header cleanup.
Remove the unneeded macro protection, forward declarations, and
includes.

Reviewed By: #libc, Quuxplusone, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D118925
2022-02-09 17:12:04 +01:00
Mark de Wever d9d2ebbfcb [libc++][nfc] Use TEST_HAS_NO_WIDE_CHARACTERS.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119263
2022-02-09 17:10:12 +01:00
Louis Dionne f13dff68d1 [libc++] Try to fix the quoting of -isystem on Windows bots 2022-02-09 10:08:12 -05:00
Louis Dionne 6f17768e11 [runtimes] Remove support for standalone builds
Standalone build have been deprecated for some time now, so this
commit removes support for those builds entirely from libc++, libc++abi
and libunwind.

This, along with the removal of other legacy ways to build, will allow
for major build system simplifications.

Differential Revision: https://reviews.llvm.org/D119255
2022-02-09 08:55:31 -05:00
Louis Dionne eceb40183c [libc++] Avoid -Wmacro-redefined in libc++ headers in the legacy test config 2022-02-09 08:38:06 -05:00
Nikolas Klauser a5b4479d3c [libc++] Add papers from February 2022 plenary meeting
Reviewed By: ldionne, Quuxplusone, #libc

Spies: arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D119189
2022-02-09 10:21:19 +01:00
Joe Loser d7095e8035
[libc++] Remove outdated synopsis parts in experimental/functional
Remove mentions of `experimental::function`, its operators, etc. They are no
longer in `experimental/functional`.

Differential Revision: https://reviews.llvm.org/D119204
2022-02-08 19:06:35 -05:00
Casey Carter 0dcb370d43 [libcxx][test] Disable bad unique_ptr<T[]> to shared_ptr<U[]> conversion test cases
for non-libc++. I've reported allowance of these conversions as a bug at https://llvm.org/PR53368.

Differential Revision: https://reviews.llvm.org/D117996
2022-02-08 14:56:47 -08:00
Casey Carter c93a531cae [libcxx][test] tests for strengthened `noexcept` are non-portable
Differential Revision: https://reviews.llvm.org/D117966
2022-02-08 14:54:13 -08:00
Nikolas Klauser e85018b7dd [libc++] Prepare string.{access, capacity, cons} tests for constexpr
Reviewed By: ldionne, #libc

Spies: libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D119123
2022-02-08 23:39:44 +01:00
Louis Dionne 817d897b57 [libc++] Remove _LIBCPP_ABI_UNSTABLE
Previously, _LIBCPP_ABI_UNSTABLE would be used interchangeably with
_LIBCPP_ABI_VERSION >= 2. This was confusing and creating unnecessary
complexity.

This patch removes _LIBCPP_ABI_UNSTABLE -- instead, the LIBCXX_ABI_UNSTABLE
CMake option will result in the LIBCXX_ABI_VERSION being set to '2', the
current unstable ABI. As a result, in the code, we only have _LIBCPP_ABI_VERSION
to check in order to query the current ABI version.

As a fly-by, this also defines the ABI namespace during CMake configuration
to reduce complexity in __config. I believe it was previously done this
way because we used to try to use __config_site as seldom as possible.
Now that we always ship a __config_site, it doesn't really matter and
I think being explicit about how the library is configured in the __config_site
is actually a feature.

Differential Revision: https://reviews.llvm.org/D119173
2022-02-08 15:18:09 -05:00
Louis Dionne 506cf6dc04 [libc++] Fix modules and benchmarks CI builds when incomplete features are disabled
Differential Revision: https://reviews.llvm.org/D119036
2022-02-08 15:15:07 -05:00
Mark de Wever 5dc1da3e30 [libc++][nfc] Use TEST_SAFE_STATIC.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D118874
2022-02-08 17:39:21 +01:00
Mark de Wever a0071b9353 [libc++] Removes cpp17_output_iterator's default constructor.
This has been suggested in D117950.

Reviewed By: ldionne, #libc, philnik

Differential Revision: https://reviews.llvm.org/D118971
2022-02-08 17:38:30 +01:00
Mark de Wever e885b1137b [libc++][format[[nfc] Use string_view in tests.
This change is a preparation for adapting the tests for
  P2216 std::format improvements

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D118717
2022-02-08 17:31:18 +01:00
Louis Dionne 768b50df29 [libc++] Add a Lit configuration for running back-deployment tests
This testing configuration links tests against one libc++ shared library,
but runs them against another libc++ shared library. This makes sure that
we can build applications against the libc++ provided in a recent SDK and
back-deploy them to platforms containing older libc++ dylibs.

It also switches the Apple CI script to using that new configuration
instead of the legacy one.

Differential Revision: https://reviews.llvm.org/D119195
2022-02-08 11:13:58 -05:00
Nikolas Klauser 126663211a [libc++][CI] Put runs into groups
Many CI runs are very similar in nature. Let's put them into groups for a better overview

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson, mstorsjo

Differential Revision: https://reviews.llvm.org/D119059
2022-02-08 01:19:10 +01:00
Joe Loser 66dea85b36
[libc++] Mark some members private in experimental/functional
Some members are public but should be private. Nothing requires they are public
right now, so make them private.

Differential Revision: https://reviews.llvm.org/D119097
2022-02-07 18:06:56 -05:00
Louis Dionne 157bbe6aea [libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode
Back in https://reviews.llvm.org/D109459, we stopped using the C++03
emulation for std::nullptr_t by default, which was an ABI break. We
still left a knob for users to turn it back on if they were broken by
the change, with a note that we would remove that knob after one release.

The time has now come to remove the knob and clean up the std::nullptr_t
emulation.

Differential Revision: https://reviews.llvm.org/D114786
2022-02-07 17:51:05 -05:00
Ruslan Arutyunyan 6a929492a6 [libcxx][test][NFC] Add tests for backward iteration over associative
containers

Add test cases for iteration over the ordered associative container from
end to begin using operator--

Reviewed By: Quuxplusone, rarutyun

Differential Revision: https://reviews.llvm.org/D118114
2022-02-08 01:21:42 +03:00
Nikolas Klauser 9b0d324154 [libc++][CI] Reorder CI runs
This patch makes the uncontrovertial changes to the pipeline.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D119041
2022-02-07 20:53:13 +01:00
Nikolas Klauser 0e7d7fe912 [libc++] Disable -Wattributes in GCC
Currently GCC produces lots of warnings. Most of them are `-Wattributes`, but these warnings are completly ignored by everybody. So let's disable -Wattributes and make the output cleaner.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D119140
2022-02-07 19:58:25 +01:00
Fangrui Song 0a1c94f915 [libc++][docs] Change some words to use reST inline literals
Reviewed By: #libc, ldionne, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119052
2022-02-07 10:00:42 -08:00
Nikolas Klauser 5488021f3e [libc++] Add Unstable ABI CI run
Reviewed By: ldionne, #libc, Mordante

Spies: mgorny, Mordante, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D118725
2022-02-05 15:37:22 +01:00
Nikolas Klauser 24c12bfb33 [libc++] __config cleanup; _LIBCPP_ABI_UNSTABLE should set _LIBCPP_ABI_VERSION
Some `__config` cleanup and `_LIBCPP_ABI_UNSTABLE` should set `_LIBCPP_ABI_VERSION`, since the latest ABI version //is// the unstable ABI.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D118989
2022-02-05 12:00:54 +01:00
Louis Dionne 78205faf54 [libc++][Docker] Don't actually start using a newer compiler in the CI
To ensure a smooth transition without breaking CI, we should use explicitly
versioned Clangs in the CI jobs definition instead, since that's a change
we can actually test in the CI.

So instead of bumping the compiler version from the Docker image, use
the same version as before by default, and we can bump it from the CI
job definition once all the nodes are running the new image.
2022-02-04 17:17:17 -05:00
Arthur O'Dwyer ea2206d70d [libc++] Replace includes of <utility> with specific detail headers
Basically a rebase of D104980; most of that patch had already happened
via gradual drive-by changes, but this finishes it up.
Don't touch the inclusions from `<__functional_base>`, `<__hash_table>`,
or `<__locale>`; those could be removed if we propagated the
inclusions up to the includers of those files, but there are lots
of those includers.

`<algorithm>`, `<functional>`, and `<memory>` already include `<utility>`
at the top level. `<iterator>` did not, so I've added it there.

Differential Revision: https://reviews.llvm.org/D119020
2022-02-04 17:08:32 -05:00
Louis Dionne a27304c50f [libc++] Bump the version of Clang we use in the CI
Differential Revision: https://reviews.llvm.org/D118830
2022-02-04 17:05:38 -05:00
Arthur O'Dwyer cc1d02ba2d [libc++] No longer support ranges::begin(x) when x is an array of incomplete type.
var-const points out that `ranges::begin` is (non-normatively
but explicitly) always supposed to return a `std::input_or_output_iterator`,
and `Incomplete*` is not a `std::input_or_output_iterator` because it
has no `operator++`. Therefore, we should never return `Incomplete*`
from `ranges::begin(x)`, even when `x` is `Incomplete(&)[]`. Instead,
just SFINAE away.

Differential Revision: https://reviews.llvm.org/D118963
2022-02-04 16:11:39 -05:00
Nikolas Klauser 679f8a885b [libc++] Move fpos into its own header
For some reason `<string>` defines `std::fpos`, which should be defined in `<ios>`.

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D118914
2022-02-04 21:53:43 +01:00
Louis Dionne abcbe87311 [libc++] Remove unused code paths for non-existent builtins
It looks like we added some checks to try and use builtin type traits
in https://reviews.llvm.org/D67900, but some of those type traits are
never implemented as builtins, so this is essentially dead code.

Fixes llvm-project#53569

Differential Revision: https://reviews.llvm.org/D118923
2022-02-04 15:51:42 -05:00
Konstantin Varlamov 254ee89c7a [libc++][ranges][NFC] On the Ranges status page, fix some broken links. 2022-02-04 11:58:35 -08:00
Arthur O'Dwyer 44cdca37c0 [libc++] Define `namespace views` in its own detail header.
Discovered in the comments on D118748: we would like this namespace
to exist anytime Ranges exists, regardless of whether concepts syntax
is supported. Also, we'd like to fully granularize the <ranges> header,
which means not putting any loose declarations at the top level.

Differential Revision: https://reviews.llvm.org/D118809
2022-02-04 12:37:47 -05:00
Arthur O'Dwyer fa6b9e4010 [libc++] Normalize all our '#pragma GCC system_header', and regression-test.
Now we'll notice if a header forgets to include this magic phrase.

Differential Revision: https://reviews.llvm.org/D118800
2022-02-04 12:27:19 -05:00
Nikolas Klauser b82da8b555 [libc++] Remove vector base class
Remove the vector base class as suggested by @ldionne

Reviewed By: ldionne, Quuxplusone, #libc

Spies: libcxx-commits, ldionne

Differential Revision: https://reviews.llvm.org/D117108
2022-02-04 13:06:28 +01:00
Mark de Wever 5e97d37b96 [libc++][NFC] Use cpp17_output_iterator in tests.
The renames the output_iterator to cpp17_output_iterator. These
iterators are still used in C++20 so it's not possible to change the
current type to the new C++20 requirements. This is done in a similar
fashion as the cpp17_input_iterator.

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D117950
2022-02-04 08:01:20 +01:00
Tiago Macarios eaadc45156 [libc++] Fix chrono::duration constructor constraint
As per [time.duration.cons]/1, the constructor constraint should be on
const Rep2&. As it is now the code will fail to compile in certain
cases, for example (https://godbolt.org/z/c7fPrcTYM):

     struct S{
          operator int() const&& noexcept = delete;
          operator int() const& noexcept;
     };

     const S &fun();

     auto k = std::chrono::microseconds{fun()};

Differential Revision: https://reviews.llvm.org/D118902
2022-02-03 18:07:12 -05:00
Nikolas Klauser 5173f43cc8 [libc++] Remove the std::string base class
Removing the base class of std::basic_string is not an ABI break, so we can remove any references to it from the header.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D118733
2022-02-03 22:57:23 +01:00
Mark de Wever 959678425d [libc++][nfc] Add TEST_HAS_NO_UNICODE_CHARS.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D118832
2022-02-03 08:02:25 +01:00
Konstantin Varlamov 823fa098aa [libc++][ranges][NFC] Test the specializations of `tuple_{size,element}` for ranges.
Also update the synopsis in `<ranges>` to mention the specializations.

Differential Revision: https://reviews.llvm.org/D118686
2022-02-02 22:58:33 -08:00
Nikolas Klauser 610979b301 [libc++][ranges] Add ranges::in_out_out_result
Add `ranges::in_out_out_result`

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D118634
2022-02-03 02:17:48 +01:00
Konstantin Varlamov 7e9d19016e [libc++][ranges][NFC] Small updates to the Ranges status page:
- note that `split_view` has been renamed to `lazy_split_view`.
- fix formatting.
2022-02-02 13:33:15 -08:00
Konstantin Varlamov e65d3760a3 [libc++][ranges] Implement `indirectly_copyable{,_storable}`.
Also refactor tests for `indirectly_movable{,_storable}`.

Differential Revision: https://reviews.llvm.org/D118432
2022-02-02 13:27:44 -08:00
Konstantin Varlamov a37a05d0dc [libc++][ranges][NFC] In the Ranges status, mark move_sentinel as "in progress" 2022-02-02 13:15:54 -08:00
Konstantin Varlamov 298331f14d [libc++][ranges][NFC] Test new requirements for `basic_string_view` and `span` iterators.
Note that most changes to `strings` and `views.span` from the One Ranges
Proposal are no longer applicable:
- free `begin` and `end` functions taking `basic_string_view` and `span`
  were removed by [P1870](http://wg21.link/p1870);
- `span::const_iterator` was removed by [LWG3320](https://cplusplus.github.io/LWG/lwg-defects.html#3320).

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D118687
2022-02-02 12:54:39 -08:00
Konstantin Varlamov f681d7d558 [libc++][ranges][NFC] Add contiguous_iterator_tag to the <iterator> synopsis
It was previously implemented by commit [45d048c20](https://reviews.llvm.org/rG45d048c20440989df2b4e1be1f9343225e7741ab).

Reviewed By: #libc, Quuxplusone, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D118751
2022-02-02 12:53:15 -08:00
Haowei Wu 1a3137dc84 [libc++] Add UNSUPPORTED for clang-15
This started breaking in the CI because we bumped the Clang version
to 15, which requires adjusting the markup in the test suite.

Differential Revision: https://reviews.llvm.org/D118838
2022-02-02 12:33:04 -08:00
Arthur O'Dwyer 0b5fb7c604 [libc++] [NFC] s/__referenceable/__can_reference/
The Standard name for this exposition-only concept is _can-reference_.

Differential Revision: https://reviews.llvm.org/D118726
2022-02-02 13:40:21 -05:00
Louis Dionne c06b4bc89c [libc++] UNSUPPORT GDB pretty printers with Clang 15 (which is what main is) 2022-02-02 12:44:00 -05:00
Arthur O'Dwyer ab9a571a94 [libc++] [test] Fix a couple of copy-paste comments. NFC. 2022-02-02 12:08:33 -05:00
Arthur O'Dwyer b2a0cc1c65 [libc++] Guard bits of 598983d7 against _LIBCPP_HAS_NO_CONCEPTS. 2022-02-02 11:19:46 -05:00
Arthur O'Dwyer 93e7f35ac3 [libc++] [NFC] Normalize some `#ifndef _LIBCPP_HAS_NO_CONCEPTS`. 2022-02-02 11:02:56 -05:00
Arthur O'Dwyer 38db42d004 [libc++] [NFC] s/_LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)/!defined(_LIBCPP_HAS_NO_CONCEPTS)/
Per Discord discussion, we're normalizing on a simple `!defined(_LIBCPP_HAS_NO_CONCEPTS)`
so that we can do a big search-and-replace for `!defined(_LIBCPP_HAS_NO_CONCEPTS)`
back into `_LIBCPP_STD_VER > 17` when we're ready to abandon support for concept-syntax-less
compilers.

Differential Revision: https://reviews.llvm.org/D118748
2022-02-02 11:02:56 -05:00
Louis Dionne 99ae458231 [libc++] Add CI without experimental features and don't exclude span from the tests
There is no reason for the parts of std::span that don't depend on ranges
to be disabled when ranges aren't provided. Also, to make sure the
"no-experimental-stuff" configuration is tested, add a CI job for it.

Differential Revision: https://reviews.llvm.org/D118740
2022-02-02 10:48:35 -05:00
Nikolas Klauser 598983d7a9 [libc++][P2321R2] Add specializations of basic_common_reference and common_type for pair
Add specializations of basic_common_reference and common_type for pair

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117506
2022-02-02 10:47:04 +01:00
Tom Stellard a2601c9887 Bump the trunk major version to 15 2022-02-01 23:54:52 -08:00
Konstantin Varlamov e1f7edb64b [libc++][ranges][NFC] Fix an inconsistent patch link on the Ranges status page. 2022-02-01 16:50:33 -08:00
Konstantin Varlamov 039e55d618 [libc++][ranges][NFC] In the Ranges status, list the changes to stream.iterators 2022-02-01 14:41:09 -08:00
Konstantin Varlamov d5ce90f414 [libc++][ranges][NFC] In the Ranges status, list the changes to predef.iterators 2022-02-01 14:34:40 -08:00
Nikolas Klauser 453620f55e [libc++] Make _VSTD and alias for std
There is no practical difference between `_VSTD` and `std` so we should just remove `_VSTD`. This is the first step.

Reviewed By: ldionne, #libc

Spies: jeroen.dobbelaere, wmaxey, EricWF, lebedev.ri, __simt__, dim, mgrang, sstefan1, wenlei, smeenai, libcxx-commits, #libc_vendors

Differential Revision: https://reviews.llvm.org/D117811
2022-02-01 22:41:51 +01:00
Mark de Wever d7c4072fdb [libc++] Remove unneeded qualifier.
In D117811 @Quuxplusone pointed out the friend declarations don't need
to be qualified. Removing the qualification should avoid needing to add
a GCC work-around when changing _VSTD to std.

Reviewed By: Quuxplusone, philnik, #libc, ldionne

Differential Revision: https://reviews.llvm.org/D118719
2022-02-01 16:33:03 -05:00
Louis Dionne 4f67a90990 [libc++] Fix TOCTOU issue with std::filesystem::remove_all
https://bugs.chromium.org/p/llvm/issues/detail?id=19
rdar://87912416

Differential Revision: https://reviews.llvm.org/D118134
2022-02-01 15:31:28 -05:00
Louis Dionne c7b255e5a8 [libc++][ci] Re-enable the bootstrapping build
Differential Revision: https://reviews.llvm.org/D118067
2022-02-01 15:29:00 -05:00
Arthur O'Dwyer 6a56d5cc25 [libc++] Fix LWG3589 "The const lvalue reference overload of get for subrange..."
https://cplusplus.github.io/LWG/issue3589

Differential Revision: https://reviews.llvm.org/D117961
2022-02-01 15:14:44 -05:00
Nikolas Klauser 9c52a19e32 [libc++][NFC] Add namespace comments in ranges
With this patch there should be no more namespaces without closing comment

Reviewed By: ldionne, Quuxplusone, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D118668
2022-02-01 18:18:13 +01:00
Konstantin Varlamov 85dae4c11e [libc++][ranges][NFC] Fix formatting on newly-added links on the Ranges status page. 2022-01-31 14:45:21 -08:00
Martin Storsjö eb9645819c [libcxx] [Windows] Pick a unique bit for __regex_word
The old `__regex_word` aliased the mask for `xdigit`, causing stray
test failures.

The diff may look surprising, as if the previous faulty value had
been set specifically for Windows - but this is due to a restructuring
in 411c630bae. Prior to that, there
were OS specific settings for some OSes, and one fallback used for
the rest (which turns out to not work for Windows).

Differential Revision: https://reviews.llvm.org/D118188
2022-01-31 23:13:58 +02:00
Martin Storsjö 1a5388ca67 [libcxx] [Windows] Use the standard vsnprintf instead of _vsnprintf
In ancient Microsoft C runtimes, there might only have been
a nonstandard `_vsnprintf` instead of the standard `vsnprintf`, but
in modern versions (the only ones relevant for libc++), both
are available.

In MinGW configurations built with `__USE_MINGW_ANSI_STDIO=1` (as it
is built in CI), `vsnprintf` provides a more standards compliant
behaviour than what Microsoft's CRT provides, while `_vsnprintf` retains
the Microsoft C runtime specific quirks.

Differential Revision: https://reviews.llvm.org/D118187
2022-01-31 22:29:12 +02:00
Louis Dionne 2e7532c003 [libc++][NFC] Mark a few issues and papers as implemented
Differential Revision: https://reviews.llvm.org/D118638
2022-01-31 14:53:07 -05:00
Konstantin Varlamov 7c89c2ac6f [libc++][ranges][NFC] Add some missing links to the Ranges status page. 2022-01-31 11:23:40 -08:00
Arthur O'Dwyer bf150e8dab [libc++] [ranges] ADL-proof ranges::iter_{swap,move}.
As discovered in D117817, `std::ranges::input_range<Holder<Incomplete>*[10]>`
hard-errored before this patch. That's because `input_range` requires
`iter_rvalue_reference_t`, which requires `iter_move`, which was
not ADL-proofed.

Add ADL-proofing tests to all the range refinements.
`output_range` and `common_range` shouldn't be affected,
and all the others subsume `input_range` anyway, but we might as
well be thorough.

Differential Revision: https://reviews.llvm.org/D118213
2022-01-31 14:14:26 -05:00
Arthur O'Dwyer c965d5448e [libc++] [ranges] Implement std::ranges::distance
This includes an experimental workaround for
LWG3664 "LWG3392 broke std::ranges::distance(a, a+3)",
but the workaround may be incomplete, I'm not sure.
This should be re-audited when LWG3664 is actually adopted,
to see if we need to change anything about our implementation.

See also https://github.com/microsoft/STL/pull/2500

Differential Revision: https://reviews.llvm.org/D117940
2022-01-31 12:23:10 -05:00
Arthur O'Dwyer 23f73ff5f6 [libc++] [NFC] Audit LWG issues for "Nothing To Do" and "Complete".
Each "Nothing To Do" issue only changed nits in the English wording,
not anything to do with the code.
Each "Complete" issue was completed already, as far as I can tell.
I tried to err on the side of caution: I didn't mark a few issues
whose P/Rs were very invasive and would take time to verify, and I
didn't mark a lot of issues involving features we haven't even started
yet.

Differential Revision: https://reviews.llvm.org/D117960
2022-01-31 12:10:22 -05:00
Arthur O'Dwyer 2eb2ff2a02 [libc++] Merge _LIBCPP_HAS_NO_RANGES into _LIBCPP_HAS_NO_CONCEPTS. NFC.
The macro that opts out of `std::ranges::` functionality is called
`_LIBCPP_HAS_NO_INCOMPLETE_RANGES`, and is unrelated to this macro
which is specifically about _compiler_ support for the _syntax_.

The only non-mechanical diff here is in `<__config>`.

Differential Revision: https://reviews.llvm.org/D118507
2022-01-31 12:10:22 -05:00
Nikolas Klauser 5d2b8fa155 [libc++][test] add vector<bool>::reference tests
Add test coverage for `vector<bool>::reference`

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117780
2022-01-31 17:46:12 +01:00
Nikolas Klauser f3514af492 [libc++][ranges] Add ranges::in_in_out_result
Add `ranges::in_in_out_result`

Reviewed By: Quuxplusone, Mordante, #libc

Spies: CaseyCarter, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D117512
2022-01-31 16:33:45 +01:00
Mark de Wever ab0554b2ec [libc++][format][nfc] Move tests.
The formatter specialization tests were placed in the wrong
subdirectory. This moves them to the proper place.
2022-01-30 14:21:13 +01:00
Mark de Wever 7927b69a6b [libc++][doc] Update the release notes.
I had a look at the changes since the last release and updated the
release notes with interesting changes.

It seems this time the release notes were already rather up to date :-)

If there are more interesting changes, please let me know and I'll
update the patch. I'd like to commit these changes latest next weekend
so they land before branching the 14.0 release.

I've added most active libc++ contributors. If I forgot anybody please add them.

Reviewed By: Quuxplusone, ldionne, philnik, #libc

Differential Revision: https://reviews.llvm.org/D117948
2022-01-30 14:16:56 +01:00
Joe Loser 81cc834a48
[libc++][test] Clean up libcxx/test/support/MoveOnly.h
Remove copy and copy assignment rather than have them as private declarations.
They are superfluous given the move and move assignment.

As a drive-by, also specialize `std::hash` without reopening `namespace std`.

Differential Revision: https://reviews.llvm.org/D118502
2022-01-29 18:20:46 -05:00
Arthur O'Dwyer d1c4c75531 [libc++] Fix the last instances of `namespace ranges::inline...`. NFC.
Make these look the same as everywhere else.
2022-01-29 11:10:04 -05:00
Arthur O'Dwyer da23e87319 [libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.
Should fix the Apple build CI, e.g.
https://buildkite.com/llvm-project/libcxx-ci/builds/8227
2022-01-29 10:14:02 -05:00
Konstantin Varlamov 46283589ef [libc++][ranges][NFC] Small cleanup to the Ranges status page.
- add a few missing links to code reviews;
- reorder the views to follow the same order as in the Standard.
2022-01-28 22:40:07 -08:00
John Ericson 7017e6c9cf [cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm
We previously had a few varied definitions of this floating around.

I had tried to make the one installed with LLVM handle all the cases, and then made the others use it, but this ran into issues with `HandleOutOfTreeLLVM` not working for compiler-rt, and also `CMAKE_EXE_LINKER_FLAGS` not working right without `CMP0056` set to the new behavior.

 My compromise solution is this:

 - No not completely deduplicate: the runtime libs will instead use a version that still exists as part of the internal and not installed common shared CMake utilities. This avoids `HandleOutOfTreeLLVM` or a workaround for compiler-rt.

- Continue to use `CMAKE_REQUIRED_FLAGS`, which effects compilation and linking. Maybe this is unnecessary, but it's safer to leave that as a future change. Also means we can avoid `CMP0056` for now, to try out later, which is good incrementality too.

- Call it `llvm_check_compiler_linker_flag` since it, in fact is about both per its implementation (before and after this patch), so there is no name collision.

In the future, we might still enable CMP0056 and make compiler-rt work with HandleOutOfTreeLLVM, which case we delete `llvm_check_compiler_flag` and go back to the old way (as these are, in fact, linking related flags), but that I leave for someone else as future work.

The original issue was reported to me in https://reviews.llvm.org/D116521#3248117 as
D116521 made clang and LLVM use the common cmake utils.

Reviewed By: sebastian-ne, phosek, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D117537
2022-01-29 06:07:24 +00:00
Konstantin Varlamov c38c134b62 [libc++][ranges][NFC] Update and slightly cleanup Ranges status page.
- add missing links to sections of the Standard and to patches;
- update the status on a couple of items.
2022-01-28 20:15:36 -08:00
Martin Storsjö 9a9a372d38 [libcxx] [test] Fix testcases that fail on systems with 16 bit wchar_t
Don't decode a UTF-8 character that is out of range for a 16 bit
`wchar_t`.

Differential Revision: https://reviews.llvm.org/D118191
2022-01-28 11:21:14 +02:00
Martin Storsjö de5d38ef2d [libcxx] Allow using thread safety annotations in MinGW mode
These were omitted in all Windows configurations, but it turns out
that they work just fine in MinGW mode.

This allows converting a couple cases of "XFAIL: LIBCXX-WINDOWS-FIXME"
into "XFAIL: msvc" as the bug is specific to MSVC mode (clang-cl).

Differential Revision: https://reviews.llvm.org/D118192
2022-01-28 11:20:58 +02:00
Arthur O'Dwyer bf20a09790 [libc++] [P1614] Implement the second half of [cmp.alg]: compare_{strong,weak,partial}_fallback.
The tests for these are just copy-pasted from the tests for std::{strong,weak,partial}_order,
and then I added an extra clause in each (test_2()) to test the stuff that's not just the same
as std::*_order.

This also includes the fix for https://wg21.link/LWG3465 (which falls naturally out of the
"you must write it three times" style, but I've added test cases for it also).

There is an action item here to go back and give good diagnostics for SFINAE failures
in these CPOs. I've filed this as https://github.com/llvm/llvm-project/issues/53456 .

Differential Revision: https://reviews.llvm.org/D111514
2022-01-27 17:48:01 -05:00
Brian Cain d5ab243c6f Omit atomic_{,un}signed_lock_free if unsupported
On targets that have limited atomic support, e.g. ones that define
ATOMIC_*_LOCK_FREE to '1' ("sometimes lock free"), we would end up
referencing yet-undefined __libcpp_{,un}signed_lock_free.

This commit adds a guard to prevent these references for such
targets.

Differential Revision: https://reviews.llvm.org/D118391
2022-01-27 14:29:08 -08:00
Louis Dionne 02ae5e9fbf [libc++] Add documentation about the libc++ review group
This explains stuff that most contributors already know, but it's always
good to write down explicitly.

Differential Revision: https://reviews.llvm.org/D118278
2022-01-27 17:06:44 -05:00
Arthur O'Dwyer 9021f3682c [libc++] [ranges] ref_view and empty_view are borrowed ranges. Normalize borrowed_range tests.
Differential Revision: https://reviews.llvm.org/D118164
2022-01-27 14:21:51 -05:00
Arthur O'Dwyer 8c98ce4dfa [libc++] Fix a typo in reverse_iterator::operator=.
We should be checking `is_assignable<It&, ...>`.
`is_assignable<It, ...>` checks for an rvalue left-hand side, which
is basically never assignable-to.
Found while looking into https://cplusplus.github.io/LWG/issue3435 .

Differential Revision: https://reviews.llvm.org/D117660
2022-01-27 14:21:50 -05:00
Mark de Wever 8f972cb0fd [libc++][nfc] Add TEST_HAS_NO_INT128.
Avoid using the libc++ internal `_LIBCPP_HAS_NO_INT128` in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117992
2022-01-27 17:31:27 +01:00
Mark de Wever 5d3ab6a2bb [libc++][nfc] Include test_macros.h in more tests.
This should fix the regressions detected in D117992.

This lands before D117992 to avoid breaking main.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D118056
2022-01-27 17:28:26 +01:00
Louis Dionne 89f03804fa [libc++][NFC] Move some functions from directory_iterator.cpp to filesystem_common.h
This move is going to be needed in order to reuse `posix_readdir` in
another translation unit. This doesn't change any of the code except
for removing an unused function parameter that otherwise triggers a
warning inside our tests.

Differential Revision: https://reviews.llvm.org/D118254
2022-01-27 10:58:27 -05:00
Louis Dionne d27cbfa9d3 [libc++] Fix bug in ranges::advance
In `ranges::advance(iter, n, bound)`, we'd incorrectly handle the case
where bound < iter and n is 0:

    int a[10];
    int *p = a+5;
    int *bound = a+3;
    std::ranges::advance(p, 0, bound);
    assert(p - a == 5); // we'd return 3 before this patch

This was caused by an incorrect handling of 0 inside __magnitude_geq.

Differential Revision: https://reviews.llvm.org/D117240
2022-01-27 10:57:54 -05:00
Louis Dionne 0902eb30ad [libc++] Fix common_iterator for output_iterators
We were missing a constraint in common_iterator's iterator_traits and
we were eagerly instantiating iter_value_t even when invalid.

Thanks to Casey Carter for finding this bug.

Differential Revision: https://reviews.llvm.org/D117449
2022-01-27 10:57:04 -05:00
Martin Storsjö 0d5b35934e [libcxx] [test] Narrow down a MinGW bug workaround in rand.dist.uni.int/eval.pass.cpp
Differential Revision: https://reviews.llvm.org/D118235
2022-01-27 13:19:06 +02:00
Arthur O'Dwyer 7ea4fe7ede [libc++] Fix LWG3390: move_iterator now handles move-only iterators.
This can't really be tested until C++20 move_iterator is completely implemented.

Differential Revision: https://reviews.llvm.org/D117327
2022-01-26 23:50:26 -05:00
Arthur O'Dwyer 4b3e0d2a7e [libc++] Fix LWG3533 "Make `base() const&` consistent..."
Fixed in counted_iterator and transform_view::iterator.
The LWG issue also affected elements_view::iterator, but we haven't
implemented that one yet, and whoever does implement it will get
the fix for free if they just follow the working draft's wording.

Drive-by stop calling `.base()` on test iterators in the test,
and improve the transform_view::iterator/sentinel tests.

Differential Revision: https://reviews.llvm.org/D117329
2022-01-26 19:38:39 -05:00
Arthur O'Dwyer c99a585399 [libc++] Make C++03 reference_wrapper more like C++11.
Remove a bunch of LIBCPP_CXX03_LANG. This is the result of a
rabbithole to re-eliminate the workaround I introduced into
std::cref in D117953. It turns out that Clang's C++03 mode
(the only compiler we care about C++03 for) now supports all
the things we were originally eschewing via LIBCPP_CXX03_LANG;
we can fully support these reference_wrapper features in
C++03 mode, and un-XFAIL the relevant tests.

Drive-by constexprify a few more tests.

Differential Revision: https://reviews.llvm.org/D117974
2022-01-26 19:34:03 -05:00
Arthur O'Dwyer 16031cbf2b [libc++] Fix LWG3557 "static_cast expression in convertible_to has the wrong operand"
https://cplusplus.github.io/LWG/issue3557
I think the code change is unobservable, so we could just close this as
"Nothing To Do" instead; but it seems appropriate to follow the Standard's
wording here as closely as possible.

Differential Revision: https://reviews.llvm.org/D117964
2022-01-26 19:32:46 -05:00
Arthur O'Dwyer ff84c635b7 [libc++] [ranges] Fix LWG3470 "convertible-to-non-slicing seems to reject valid case"
Differential Revision: https://reviews.llvm.org/D117941
2022-01-26 19:30:12 -05:00
Casey Carter b5bada6f85 [libcxx][test] Narrow XFAIL for tests that pass with `msvc && stdlib=msvc`
... but fail with `msvc && stdlib=libc++`.

Differential Review: https://reviews.llvm.org/D118194
2022-01-26 12:17:45 -08:00
Martin Storsjö 810752aaa1 [libcxx] [test] Fix the locale.time.put.byname/put1 testcase on Linux and Windows
The Windows and Glibc abbreviated form of Saturday in French locale
is "sam." with a trailing period included. Account for this in the
test reference.

Differential Revision: https://reviews.llvm.org/D118240
2022-01-26 22:13:39 +02:00
Martin Storsjö a2aea7199a [libcxx] [test] Fix mismatches between _aligned_malloc and free() on Windows
This allows getting rid of one case of LIBCXX-WINDOWS-FIXME. The fixme
comment was inaccurate; aligned allocation functions are provided these
days, but the test kept failing as it was using mismatched allocation
and free functions.

A similar issue was fixed earlier, in
6596778b46. That test was fixed by
overriding the aligned `operator new` too, and returning a dummy fixed
allocation instead. As this test is libcxx specific, it can use the
internal `std::__libcpp_aligned_free()` instead, to match libcxx's
internal aligned `operator new`.

Differential Revision: https://reviews.llvm.org/D118190
2022-01-26 11:52:32 +02:00
Arthur O'Dwyer a13c10588c [libc++] [test] Fix LWG3146 "Excessive unwrapping in std::ref/cref"
Drive-by constexprify the existing tests, too.

Differential Revision: https://reviews.llvm.org/D117953
2022-01-25 19:30:32 -05:00
Louis Dionne 7dc705f86d [libc++][NFC] Fix typo 2022-01-25 15:27:07 -05:00
Mark de Wever ff8a4766ac [libc++][nfc] Update formatting of some tests.
These tests were formatted with older clang-format settings, this
updates them to the current settings.

In order to implement P2216 a lot of changes to these tests are
required. This makes it easier to review those patches.
2022-01-25 20:01:32 +01:00
Casey Carter 93230ac1d2 [libcxx][test] Use bool allocators for vector<bool>::get_allocator test
... to be consistent with other `get_allocator` tests, and to avoid requiring `vector<T, allocator<U>>` to be valid.
2022-01-25 10:29:12 -08:00
Mark de Wever ee522345ae [libc++][doc] Update format implementation status. 2022-01-25 19:23:48 +01:00
Arthur O'Dwyer 8b29b84c99 [libc++] Fix LWG3422 "Issues of seed_seq's constructors"
https://cplusplus.github.io/LWG/issue3422

Also add a static_assert to check the "Mandates:" on the
iterator-pair constructor. Oddly, the `InputIterator` parameter
itself is merely preconditioned, not constrained, to satisfy the
input iterator requirements.

Also drive-by rename `init` to `__init`.

Differential Revision: https://reviews.llvm.org/D117962
2022-01-24 20:14:25 -05:00
Nikolas Klauser 014a673441 [libc++] Remove std::basic_string's base class in ABIv2
Remove `std::basic_string`'s base class in ABI version 2

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116334
2022-01-25 00:21:53 +01:00
Nikolas Klauser 52f37c24c3 [libc++][NFC] remove this-> when calling member functions in <string>
remove `this->` when calling member functions

Reviewed By: Quuxplusone, Mordante, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116324
2022-01-25 00:21:51 +01:00
Casey Carter 997e128e2a [libcxx][test] the domain of == for forward iterators is iterator values from the same range
* Default-initialized `basic_string` iterators are not portably in the domain of `==`.
* Avoid comparing iterators from non-equal string_views which MSVCSTL considers not to be in the domain of equality.
* Don't test invalid range `[in, out + N)`.

Also silence some truncation warnings by testing with a non-narrowing conversion.

Differential Revision: https://reviews.llvm.org/D118049
2022-01-24 13:00:07 -08:00
Louis Dionne 1f6af9c9ce [libc++][CI] Re-enable all CI jobs
This essentially reverts commit 89f4a18f37 now that our CI is back
online at full capacity.

Differential Revision: https://reviews.llvm.org/D116891
2022-01-24 15:47:11 -05:00
Louis Dionne 0407ab4114 [libc++] Make sure basic_string::reserve(n) never shrinks in all Standard modes
Since basic_string::reserve(n) is instantiated in the shared library but also
available to the compiler for inlining, its definition should not depend on
things like the Standard mode in use. Indeed, that flag may not match between
how the shared library is compiled and how users are compiling their own code,
resulting in ODR violations.

However, note that we retain the behavior of basic_string::reserve() to
shrink the string for backwards compatibility reasons. While it would
technically be conforming to not shrink, we believe user expectation is
for it to shrink, and so existing code might have been written based on
that assumption. We prefer to not break such code, even though that makes
basic_string::reserve() and basic_string::reserve(0) not equivalent anymore.

Fixes llvm-project#53170

Differential Revision: https://reviews.llvm.org/D117332
2022-01-24 15:43:13 -05:00
Mark de Wever 4684857abf [libc++][format] Finish P0645 Text Formatting.
This adjust the version macro and sets it as completed. All parts of the paper
have been implemented, except for the parts replaced by later papers and
LWG-issues.

Adjusted the synopsis to match the synopsis in the Standard. Not yet
implemented parts of P2216 and P2418 still use the P0645 wording.

Completes:
- P0645 Text Formatting

Depends on D115991

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D115999
2022-01-24 20:10:14 +01:00
Arthur O'Dwyer eadf7268d5 [libc++] Fix bugs in common_iterator; add test coverage.
Differential Revision: https://reviews.llvm.org/D117400
2022-01-24 13:45:38 -05:00
Mark de Wever ade6d0d8fa [libc++][format] Adds formatter handle.
This implements the handler according to P0645. P2418 changes the wording
in the Standard. That isn't implemented and requires changes in more
places. LWG3631 applies modifications to P2418, but is currently
unresolved.

Implements parts of:
* P0645 Text Formatting

Depends on D115989

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D115991
2022-01-24 18:15:08 +01:00
Mark de Wever 2b8b48c5a0 [libc++][format] Disable default formatter.
[format.formatter.spec]/5 lists the requirements for the default
formatter. The original implementation didn't implement this. This
implements the default formatter according to the Standard.

This adds additional test to validate the default formatter is disabled
and the required standard formatters are enabled.

While adding the tests it seems the formatters needed a constraint for the
character types they were valid for.

Implements parts of:
- P0645 Text Formatting

Depends on D115988

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D115989
2022-01-24 18:14:41 +01:00
Mark de Wever 787ccd345c [libc++][format] Adds formatter pointer.
This implements the last required formatter specialization.

Completes:
- LWG 3251 Are std::format alignment specifiers applied to string arguments?
- LWG 3340 Formatting functions should throw on argument/format string mismatch in §[format.functions]
- LWG 3540 §[format.arg] There should be no const in basic_format_arg(const T* p)

Implements parts of:
- P0645 Text Formatting

Depends on D114001

Reviewed By: ldionne, vitaut, #libc

Differential Revision: https://reviews.llvm.org/D115988
2022-01-24 18:13:02 +01:00
Mark de Wever db2944e34b [libc++][format] Adds formatter floating-point.
This properly implements the formatter for floating-point types.

Completes:
- P1652R1 Printf corner cases in std::format
- LWG 3250 std::format: # (alternate form) for NaN and inf
- LWG 3243 std::format and negative zeroes

Implements parts of:
- P0645 Text Formatting

Reviewed By: #libc, ldionne, vitaut

Differential Revision: https://reviews.llvm.org/D114001
2022-01-24 18:12:24 +01:00
Louis Dionne a2afc8249a [libc++] Fix benchmark failure 2022-01-24 12:05:09 -05:00
Casey Carter cfe17986c9 [libcxx][test] {move,reverse}_iterator cannot be instantiated for a type with no `operator*`
Since their nested reference types are defined in terms of `iter_reference_t<T>`, which examines `decltype(*declval<T>())`.

Differential Revision: https://reviews.llvm.org/D117371
2022-01-24 08:34:39 -08:00
Sean Fertile d193f7be78 [libc++][AIX] Do not assert chmod return value is non-zero.
A number of the filesystem tests create a directory that contains a bad
symlink. On AIX recursively setting permissions on said directory will
return a non-zero value because of the bad symlink, however the
following rm -r still completes successfully. Avoid the assertion on
AIX, and rely on the return value of the remove command to detect
problems.

Differential Revision: https://reviews.llvm.org/D112086
2022-01-24 10:30:05 -05:00
Casey Carter 818cfb10c5 [libcxx][test] Make MSVC `<charconv>` test compile when testing MSVC
<meme>How many layers of irony are you on?</meme>

Differential Revision: https://reviews.llvm.org/D117967
2022-01-23 10:12:53 -08:00
Arthur O'Dwyer 5d78fef6db [libc++] Fix LWG3437 "__cpp_lib_polymorphic_allocator is in the wrong header"
https://cplusplus.github.io/LWG/issue3437

Differential Revision: https://reviews.llvm.org/D117963
2022-01-23 10:30:09 -05:00
Arthur O'Dwyer 938944445a [libc++] Mark LWG3541 as "Complete". NFC.
Differential Revision: https://reviews.llvm.org/D117956
2022-01-23 10:15:17 -05:00
Joe Loser 2513b79030
[libc++] Implement LWG3549: view_interface need not inherit from view_base
Implement LWG3549 by making `view_interface` not inherit from `view_base`. Types
are still views if they have a public and unambiguous derivation from
`view_interface`, so adjust the `enable_view` machinery as such to account for
that.

Differential Revision: https://reviews.llvm.org/D117714
2022-01-22 22:52:46 -05:00
Arthur O'Dwyer 26fffc1b8e [libc++] [test] {cpo,niebloid}.compile.pass.cpp: Also test their constness.
This will detect if someone writes `inline auto cpo =` instead of
`inline constexpr auto cpo =`. I don't know how that'd be possible,
but it's easy to test, so let's test it.
2022-01-22 11:53:00 -05:00
Mark de Wever 26544b98f7 [libc++] Use addressof in unordered_set.
This addresses the usage of `operator&` in `<unordered_set>`.

(Note there are still more headers with the same issue.)

Reviewed By: #libc, philnik, Quuxplusone

Differential Revision: https://reviews.llvm.org/D117917
2022-01-22 11:41:13 +01:00
Joe Loser 4f547ee8b8
[libc++][test] Add const and reference tests for enable_view. NFC.
As discussed in https://reviews.llvm.org/D117714, there is missing test coverage
for the behavior of `enable_view` when given a const or reference qualified
type. Add such tests showing the current behavior.

Differential Revision: https://reviews.llvm.org/D117918
2022-01-21 19:46:45 -05:00
Muiez Ahmed 4f8ea3c84f [SystemZ][z/OS][NFC] Remove extra symbol 2022-01-21 16:18:46 -05:00
Mark de Wever d6e2c95d22 [libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.

(Note there are still more headers with the same issue.)

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D117393
2022-01-21 20:43:45 +01:00
Petr Hosek 10e5c513b5 Revert "[cmake] Duplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm"
This reverts commit 4af11272f5.
2022-01-21 09:53:14 -08:00
Mark de Wever e4a556268e Revert "[libc++] Use addressof in unordered_map."
This reverts commit cab9616938.

This breaks the CI.
2022-01-21 17:59:07 +01:00
Mark de Wever cab9616938 [libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.

(Note there are still more headers with the same issue.)

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D117393
2022-01-21 17:34:29 +01:00
Vy Nguyen 9900acacfb [libcxx][doc][nfc] Fixed typo in doc 2022-01-21 10:17:28 -05:00
John Ericson 4af11272f5 [cmake] Duplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm
We previously had a few varied definitions of this floating around. I made the one installed with LLVM handle all the cases, and then made the others use it.

This issue was reported to me in https://reviews.llvm.org/D116521#3248117 as
D116521 made clang and llvm use the common cmake utils.

Reviewed By: sebastian-ne, phosek, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D117537
2022-01-20 21:18:42 +00:00
Casey Carter b8d38e8b4f [libcxx][test] view_interface need not derive from view_base
... after LWG-3549.

Differential Revision: https://reviews.llvm.org/D117608
2022-01-20 12:17:10 -08:00
Casey Carter 864b5b49fd [libcxx] chrono::month_weekday should not be default constructible
It was not in P0355R7, nor has it ever been so in a working draft.

Drive-by:
* tests should test something: fix loop bounds so initial value is not >= final value
* calender type streaming tests are useless - let's remove them
* don't declare printf, especially if you don't intend to use it

Differential Revision: https://reviews.llvm.org/D117638
2022-01-20 11:47:56 -08:00
Arthur O'Dwyer 63a991d035 [libc++] Eliminate the `__function_like` helper.
As prefigured in the comments on D115315.
This gives us one unified style for all niebloids,
and also simplifies the modulemap.

Differential Revision: https://reviews.llvm.org/D116570
2022-01-20 14:40:16 -05:00
John Ericson df31ff1b29 [cmake] Make include(GNUInstallDirs) always below project(..)
Its defaulting logic must go after `project(..)` to work correctly,  but `project(..)` is often in a standalone condition making this
awkward, since the rest of the condition code may also need GNUInstallDirs.

The good thing is there are the various standalone booleans, which I had missed before. This makes splitting the conditional blocks less awkward.

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

Differential Revision: https://reviews.llvm.org/D117639
2022-01-20 18:59:17 +00:00
Nikolas Klauser 4822447522 [libc++] basic_string::resize_and_overwrite: Adopt LWG3645 (Not voted in yet)
Adopt LWG3645, which fixes the value categories of basic_string::resize_and_overwrite
https://timsong-cpp.github.io/lwg-issues/3645

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116815
2022-01-20 18:41:09 +01:00
Casey Carter 67d483aba2 [libcxx][test] Use TEST_HAS_BUILTIN in test code
... rather than using `__has_builtin` directly. This both (1) allows a compiler that doesn't speak `__has_builtin` to workaround with preprocessor magic, and (2) avoids diagnostics about things that look like function like macros after `#if` but are not.
2022-01-20 01:47:29 -08:00
John Ericson 429a717ea5 [cmake] Move HandleOutOfTreeLLVM to common cmake utils
This is better than libunwind and libcxxabi fishing it out of libcxx's
module directory.

It is done in prepartion for a better version of D117537 which deduplicates
CMake logic instead of just renaming to avoid a name clash.

Reviewed By: phosek, #libunwind, #libc_abi, Ericson2314

Differential Revision: https://reviews.llvm.org/D117617
2022-01-19 22:05:23 +00:00
Casey Carter 3a1b178a0b [libcxx][test] Portably test that `{w,}format_context` is a specialization of `basic_format_context`
Differential Revision: https://reviews.llvm.org/D117606
2022-01-19 11:36:29 -08:00
Alex Richardson 89103bd2f0 [libc++] Fix GDB pretty printers when GDB uses Python 2.7
The gdb_pretty_printer_test.sh fails if GDB was built against Python 2.7
since Python 2 expects iterators to have a next() method rather than
using __next__. To make the pretty printers work with both Python 2 and 3
we can simply set next to __next__ in the iterator classes.

Python 2.7 support was removed in f46f93b478,
so this partially reverts that commit. While Python 2.7 is EOL, it
appears there are still many GDB installations that are linked against
Python 2.7, so we may want to keep this tiny amount of compat code
around for a while longer.

Without this commit the tests fails with errors such as:
```
GDB printed:
   u"std::tuple containingTypeError: iter() returned non-iterator of type '_Children'\n"
Value should match:
   u'std::tuple containing = {[1] = 2, [2] = 3, [3] = 4}'
```

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117470
2022-01-19 10:11:45 +00:00
Casey Carter a94739985b [libcxx][test] test _LIBCPP_VERSION with #ifdef, not #if 2022-01-18 19:37:03 -08:00
Louis Dionne a00f3e2d09 [libc++] Re-enable the _BitInt test for std::atomic on Clang 14
It should now work since the Clang on CI nodes has been updated.

Differential Revision: https://reviews.llvm.org/D115256
2022-01-18 21:32:22 -05:00
Casey Carter f105d98443 [libcxx][test] `unordered_meow` iterators are not portably non-bidi
MSVCSTL's are actually bidirectional.

Differential Revision: https://reviews.llvm.org/D117369
2022-01-18 11:43:21 -08:00
Casey Carter 4e00a1921f [libcxx][test] compiler options are non-portable
... it's easier to suppress warnings internally, where we can detect the compiler.

* Rename `TEST_COMPILER_C1XX` to `TEST_COMPILER_MSVC`
* Rename all `TEST_WORKAROUND_C1XX_<meow>` to `TEST_WORKAROUND_MSVC_<meow>`

Differential Revision: https://reviews.llvm.org/D117422
2022-01-18 11:34:57 -08:00
Nikolas Klauser 275e7d197c [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <unordered_map>
Use `_LIBCPP_DEBUG_ASSERT` in <unordered_map>

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117401
2022-01-18 20:31:02 +01:00
Nikolas Klauser 6322cb4890 [libc++][test] test in_in_result convertible requirements
Currently it is not checked that operator in_in_result<II1, II2>() SFINAEs away properly

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117517
2022-01-18 20:29:51 +01:00
Alex Brachet 1dbe32dd9c [libc++] Use reserved identifier for template parameter
`T` is not a valid identifier for libc++ to use, use `_Tp` instead. Caught from D116957

Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D117582
2022-01-18 19:20:25 +00:00
Mark de Wever 8f4a6187f2 [libc++] Adds a test for std::fill_n.
The function `std::fill` requires a ForwardIterator, but `std::fill_n`
only requires an OutputIterator. Adds a test to validate `std::fill_n`
works with an OutputIterator.

Noticed this while working on LWG3539
format_to must not copy models of output_iterator<const charT&>

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D117395
2022-01-18 19:27:02 +01:00
Arthur O'Dwyer 3049d51e98 [libc++] [test] Use hidden friends consistently in the test iterators.
Differential Revision: https://reviews.llvm.org/D117397
2022-01-18 13:04:40 -05:00
Louis Dionne a9bfb4c4f4 [libc++] Refactor stride_counting_iterator
Instead of storing the wrapped iterator inside the stride_counting_iterator,
store its base so we can have e.g. a stride_counting_iterator of an
input_iterator (which was previously impossible because input_iterators
are not copyable). Also a few other simplifications in stride_counting_iterator.

As a fly-by fix, remove the member base() functions, which are super
confusing.

Differential Revision: https://reviews.llvm.org/D116613
2022-01-18 12:24:05 -05:00
Louis Dionne df51be85e4 [libc++] Split a few utilities out of __threading_support
This change is the basis for a further refactoring where I'm going to
split up the various implementations we have in __threading_support to
make that code easier to understand.

Note that I had to make __convert_to_timespec a template to break
circular dependencies. Concretely, we never seem to use it with anything
other than ::timespec, but I am wary of hardcoding that assumption as
part of this change, since I suspect there's a reason for going through
these hoops in the first place.

Differential Revision: https://reviews.llvm.org/D116944
2022-01-18 12:23:44 -05:00
Louis Dionne 4afa9c1726 [libc++] Persistently cache memoized operations during Lit configuration
When invoking Lit repeatedly, we perform all the configuration checks
over and over again, which takes a lot of time. This patch allows caching
the result of configuration checks persistently across Lit invocations to
speed this up.

In theory, this should still be functionally correct since the cache
key should contain everything that determines the output of the
configuration check. However, in cases where e.g. the compiler has
changed but is at the same path as previously, the Lit configuration
checks will be cached even though technically the cache should have
been invalidated.

Differential Revision: https://reviews.llvm.org/D117361
2022-01-18 10:44:23 -05:00
John Ericson f16a4a034a [libcxx][libcxxabi][libunwind][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.

Differential Revision: https://reviews.llvm.org/D117417
2022-01-18 06:44:57 +00:00
Arthur O'Dwyer 459b4b725f [libc++] [API BREAK] Change `fs::path::iterator::iterator_category` to `input_iterator_tag`.
This essentially reverts e02ed1c255 and puts in a new fix, which makes `path::iterator`
a true C++20 `bidirectional_iterator`, but downgrades it to an `input_iterator` in C++17.

Fixes #37852.

Differential Revision: https://reviews.llvm.org/D116489
2022-01-17 16:33:23 -05:00
Arthur O'Dwyer 5820322cb1 [libc++] [test] UNSUPPORTED my new uniform_int_distribution test on MinGW.
After 9fe67486cc, this test fails on MinGW for some reason.
https://buildkite.com/llvm-project/libcxx-ci/builds/7922#9e267294-441d-4b79-8a19-30fdb5599c1f
All it says in the build output is

    note: command had no output on stdout or stderr
    error: command failed with exit status: 4294967295
2022-01-17 16:32:44 -05:00
Nikolas Klauser c10cbb243c [libc++] Install clang-tidy in docker containers
Install clang-tidy

Reviewed By: ldionne, #libc

Spies: sammccall, mgorny, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D117268
2022-01-17 21:05:42 +01:00
Nikolas Klauser caf5548c7c [libc++] Introduce __debug_db_insert_i()
Introduce `__debug_db_insert_i()`

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117410
2022-01-17 20:31:21 +01:00
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