[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI.All supported compilers that support C++20 now support concepts. So, remove`_LIB_LIBCPP_HAS_NO_CONCEPTS` in favor of `_LIBC
[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI.All supported compilers that support C++20 now support concepts. So, remove`_LIB_LIBCPP_HAS_NO_CONCEPTS` in favor of `_LIBCPP_STD_VER > 17`. Similarly inthe tests, remove `// UNSUPPORTED: libcpp-no-concepts`.Differential Revision: https://reviews.llvm.org/D121528
show more ...
[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.The logic here is that we are disabling *only* things in `std::ranges::`.Everything in `std::` is permitted, including `de
[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.The logic here is that we are disabling *only* things in `std::ranges::`.Everything in `std::` is permitted, including `default_sentinel`, `contiguous_iterator`,`common_iterator`, `projected`, `swappable`, and so on. Then, we includeanything from `std::ranges::` that is required in order to make those thingswork: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`,`ranges::iter_move`, and so on. But then that's all. Everything else (includingnotably all of the "views" and the `std::views` namespace itself) is stilllocked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.Differential Revision: https://reviews.llvm.org/D118736
[libc++][NFC] Use cpp17_output_iterator in tests.The renames the output_iterator to cpp17_output_iterator. Theseiterators are still used in C++20 so it's not possible to change thecurrent type to
[libc++][NFC] Use cpp17_output_iterator in tests.The renames the output_iterator to cpp17_output_iterator. Theseiterators are still used in C++20 so it's not possible to change thecurrent type to the new C++20 requirements. This is done in a similarfashion as the cpp17_input_iterator.Reviewed By: #libc, Quuxplusone, ldionneDifferential Revision: https://reviews.llvm.org/D117950
[libc++] [test] Fix a couple of copy-paste comments. NFC.
[libc++] Fix bug in ranges::advanceIn `ranges::advance(iter, n, bound)`, we'd incorrectly handle the casewhere bound < iter and n is 0: int a[10]; int *p = a+5; int *bound = a+3;
[libc++] Fix bug in ranges::advanceIn `ranges::advance(iter, n, bound)`, we'd incorrectly handle the casewhere 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 patchThis was caused by an incorrect handling of 0 inside __magnitude_geq.Differential Revision: https://reviews.llvm.org/D117240
[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 Revisio
[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
[libc++] Refactor stride_counting_iteratorInstead of storing the wrapped iterator inside the stride_counting_iterator,store its base so we can have e.g. a stride_counting_iterator of aninput_iter
[libc++] Refactor stride_counting_iteratorInstead of storing the wrapped iterator inside the stride_counting_iterator,store its base so we can have e.g. a stride_counting_iterator of aninput_iterator (which was previously impossible because input_iteratorsare not copyable). Also a few other simplifications in stride_counting_iterator.As a fly-by fix, remove the member base() functions, which are superconfusing.Differential Revision: https://reviews.llvm.org/D116613
[libc++] Refactor the tests for ranges::{advance,next,prev}This makes all the tests consistent and improves code coverage. This alsouncovers a bug with negative indices in advance() (which also im
[libc++] Refactor the tests for ranges::{advance,next,prev}This makes all the tests consistent and improves code coverage. This alsouncovers a bug with negative indices in advance() (which also impactsprev()) -- I'll fix that in a subsequent patch.I chose to only count operations in the tests for ranges::advance becausedoing so in prev() and next() too was reaching diminishing returns, anddidn't meaningfully improve our test coverage.
[libc++][NFC] Remove duplication of distance_apriori_sentinel
[libc++] [ranges] Simplify our idiom for testing niebloid-ness.In the test files, replace the old-style tests with a simple static_assert,matching the current style as depicted in e.g.`ranges_uni
[libc++] [ranges] Simplify our idiom for testing niebloid-ness.In the test files, replace the old-style tests with a simple static_assert,matching the current style as depicted in e.g.`ranges_uninitialized_default_construct.pass.cpp`.Preserve `is_function_like` (but renamed to `is_niebloid`) atldionne's request. The removal of this test helper will happenin D116570 if at all.Differential Revision: https://reviews.llvm.org/D116384
[libc++] Remove incorrect default constructor in cpp17_input_iteratorAFAICT, Cpp17InputIterators are not required to be default constructible,since that requirement is added in Cpp17ForwardIterato
[libc++] Remove incorrect default constructor in cpp17_input_iteratorAFAICT, Cpp17InputIterators are not required to be default constructible,since that requirement is added in Cpp17ForwardIterator. Hence, ourarchetype for Cpp17InputIterator should not be default constructible.Removing that constructor has a ripple effect on a couple of tests thatwere making incorrect assumptions. Notably:- Some tests were using cpp17_input_iterator as a sentinel for itself. That is not valid, because a cpp17_input_iterator is not semiregular anymore after the change (and hence it doesn't satisfy sentinel_for).- Some tests were using a stride-counted cpp17_input_iterator as the sentinel for a range. This doesn't work anymore because of the problem above, so these tests were changed not to check stride counts for input iterators.- Some tests were default constructing cpp17_input_iterator when a simple alternative was available -- those have been changed to use that alternative.Differential Revision: https://reviews.llvm.org/D115806
[libc++][ranges] Implement ranges::uninitialized_default_construct{,_n}.Defined in [`specialized.algorithms`](wg21.link/specialized.algorithms).Also:- refactor the existing non-range implementat
[libc++][ranges] Implement ranges::uninitialized_default_construct{,_n}.Defined in [`specialized.algorithms`](wg21.link/specialized.algorithms).Also:- refactor the existing non-range implementation so that most of it can be shared between the range-based and non-range-based algorithms;- remove an existing test for the non-range version of `uninitialized_default_construct{,_n}` that likely triggered undefined behavior (it read the values of built-ins after default-initializing them, essentially reading uninitialized memory).Reviewed By: #libc, Quuxplusone, ldionneDifferential Revision: https://reviews.llvm.org/D115315
[libc++] Remove Lit annotations for unsupported GCC versions from the test suiteSince we officially don't support several older compilers now, we candrop a lot of the markup in the test suite. Thi
[libc++] Remove Lit annotations for unsupported GCC versions from the test suiteSince we officially don't support several older compilers now, we candrop a lot of the markup in the test suite. This helps keep the testsuite simple and makes sure that UNSUPPORTED annotations don't rot.This is the first patch of a series that will remove annotations forcompilers that are now unsupported.Differential Revision: https://reviews.llvm.org/D107787
[libc++] Fix signed overflow inside ranges::advance.See LWG reflector thread of 2021-07-23 titled'Question on ranges::advance and "past-the-sentinel iterators"'.Test case heavily based on one gra
[libc++] Fix signed overflow inside ranges::advance.See LWG reflector thread of 2021-07-23 titled'Question on ranges::advance and "past-the-sentinel iterators"'.Test case heavily based on one graciously provided by Casey Carter.Differential Revision: https://reviews.llvm.org/D106735
[libcxx][nfc] Global `constexpr friend` -> `friend constexpr`.
[libcxx][modularisation] properly modularises advance, next, and prev`__function_like` wasn't being exported, so certain properties of the`ranges` functions weren't being propagated in modules lan
[libcxx][modularisation] properly modularises advance, next, and prev`__function_like` wasn't being exported, so certain properties of the`ranges` functions weren't being propagated in modules land.Differential Revision: https://reviews.llvm.org/D105078
[libc++] Add XFAIL for Clang ToT with modulesThis is what I should have done instead of 6afd6e96ce20.
Revert "Revert "[libcxx][module-map] creates submodules for private headers""This reverts commit d9633f229c36f292dab0e5f510ac635cfaf3a798 as aworkaround was discovered.Differential Revision: htt
Revert "Revert "[libcxx][module-map] creates submodules for private headers""This reverts commit d9633f229c36f292dab0e5f510ac635cfaf3a798 as aworkaround was discovered.Differential Revision: https://reviews.llvm.org/D104170
[libc++] NFC: More refactoring in the prev/next/advance tests per review comments
[libc++] Refactor the tests for std::prev, next and advanceThis started as an attempt to fix a GCC 11 warning of misplaced parentheses.I then noticed that trying to fix the parentheses warning act
[libc++] Refactor the tests for std::prev, next and advanceThis started as an attempt to fix a GCC 11 warning of misplaced parentheses.I then noticed that trying to fix the parentheses warning actually triggerederrors in the tests, showing that we were incorrectly assuming that theimplementation of ranges::advance was using operator+= or operator-=.This commit fixes that issue and makes the tests easier to follow bylocalizing the assertions it makes.Differential Revision: https://reviews.llvm.org/D103272
[libcxx][iterator] adds `std::ranges::advance`Implements part of P0896 'The One Ranges Proposal'.Implements [range.iter.op.advance].Differential Revision: https://reviews.llvm.org/D101922