Commit Graph

8601 Commits

Author SHA1 Message Date
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