Page MenuHomePhabricator

[libcxx][iterator] adds `std::ranges::next`
ClosedPublic

Authored by cjdb on May 15 2021, 6:03 PM.

Details

Summary

Implements part of P0896 'The One Ranges Proposal'.
Implements [range.iter.op.next].

Depends on D101922.

Diff Detail

Unit TestsFailed

TimeTest
1,830 mslibcxx CI GCC/C++20 > libc++.std/concepts/concepts_callable/concept_invocable::invocable.compile.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/g++ /home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp -v -include /home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/include/c++/v1 -I/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++20 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-aligned-allocation-unavailable -Wno-atomic-alignment -Wno-sized-deallocation -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -fsyntax-only
1,760 mslibcxx CI GCC/C++20 > libc++.std/concepts/concepts_callable/concept_regularinvocable::regular_invocable.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/g++ /home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.pass.cpp -v -include /home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/include/c++/v1 -I/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++20 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-aligned-allocation-unavailable -Wno-atomic-alignment -Wno-sized-deallocation -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -L/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/./lib -L/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/./lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic -o /home/libcxx-builder/.buildkite-agent/builds/214d516637e4-1/llvm-project/libcxx-ci/build/generic-gcc/projects/libcxx/test/std/concepts/concepts.callable/concept.

Event Timeline

cjdb created this revision.May 15 2021, 6:03 PM
cjdb requested review of this revision.May 15 2021, 6:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2021, 6:03 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne requested changes to this revision.May 25 2021, 12:54 PM

You need to mark it [[nodiscard]] as an extension in the synopsis in <iterator>.

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/next.pass.cpp
13 ↗(On Diff #345658)

Normally, we have one test file per overload. I know this slipped through for most ranges reviews so far, but it would be good to do it.

67 ↗(On Diff #345658)

Drop [[nodiscard]] from the tests please!

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/next.verify.cpp
1 ↗(On Diff #345658)

The nodiscard part should be in libcxx/test/libcxx since it's an extension.

This revision now requires changes to proceed.May 25 2021, 12:54 PM
cjdb updated this revision to Diff 347842.May 25 2021, 9:46 PM
cjdb marked 3 inline comments as done.

Applies @ldionne's feedback:

  • removes [[nodiscard]] from ranges::next (per offline discussion: things not explicitly marked [[nodiscard]] in the wording to be on hold till after P2351R0 and P2377R0 are discussed in Library Evolution)
  • removes [[nodiscard]] from tests
  • splits single next.pass.cpp into four files, one for each overload
ldionne accepted this revision.May 26 2021, 4:05 PM
This revision is now accepted and ready to land.May 26 2021, 4:05 PM
cjdb updated this revision to Diff 348141.May 26 2021, 6:34 PM

rebases to see if CI started working properly

This revision was automatically updated to reflect the committed changes.