Page MenuHomePhabricator

[libc++] Implement ranges::is_permutation
Needs RevisionPublic

Authored by philnik on Jun 7 2022, 2:36 AM.

Details

Reviewers
ldionne
Mordante
var-const
Group Reviewers
Restricted Project

Diff Detail

Unit TestsFailed

TimeTest
4,740 mslibcxx CI C++03 > llvm-libc++-shared-cfg-in.libcxx::clang_tidy.sh.cpp
Script: -- : 'RUN: at line 12'; clang-tidy /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/libcxx/clang_tidy.sh.cpp --warnings-as-errors=* -header-filter=.* -- -Wno-unknown-warning-option -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++03 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings
2,660 mslibcxx CI C++03 > llvm-libc++-shared-cfg-in.libcxx::double_include.sh.cpp
Script: -- : 'RUN: at line 11'; /usr/bin/c++ -c /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/libcxx/double_include.sh.cpp -o /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/test/libcxx/Output/double_include.sh.cpp.dir/t.tmp.first.o --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++03 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings
2,560 mslibcxx CI C++03 > llvm-libc++-shared-cfg-in.libcxx::min_max_macros.compile.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/libcxx/min_max_macros.compile.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++03 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fsyntax-only
3,360 mslibcxx CI C++03 > llvm-libc++-shared-cfg-in.libcxx::modules_include.sh.cpp
Script: -- : 'RUN: at line 50'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/libcxx/modules_include.sh.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++03 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules -fcxx-modules -fsyntax-only -DTEST_0
2,620 mslibcxx CI C++03 > llvm-libc++-shared-cfg-in.libcxx::nasty_macros.compile.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/libcxx/nasty_macros.compile.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3443b29a72e7-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++03 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fsyntax-only
View Full Test Results (529 Failed)

Event Timeline

philnik created this revision.Jun 7 2022, 2:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2022, 2:36 AM
Herald added a subscriber: mgorny. · View Herald Transcript
philnik requested review of this revision.Jun 7 2022, 2:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2022, 2:36 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
var-const requested changes to this revision.Thu, Jun 9, 6:58 PM
var-const added inline comments.
libcxx/docs/Status/RangesAlgorithms.csv
36

Missing link.

libcxx/include/__algorithm/is_permutation.h
99

Question: using __invoke slightly changes the behavior of the non-ranges version of the algorithm as well, right?

172

Optional: can you use using like other similar places that were refactored in this patch?

libcxx/include/__algorithm/ranges_is_permutation.h
26

Please add the language version/no incomplete ranges guard.

44

Nit: please move the iterators (and add the include).

54

Can we do the same optimization in the iterator version (by checking sized_sentinel_for)?

59

Should this go to the else branch of the if constexpr?

libcxx/include/algorithm
1121

Missing synopsis.

libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/ranges.is_permutation.pass.cpp
8

Missing synopsis.

87

Please also check with a single-element range.

95

Nit: there's an unnecessary blank line.

109

Please also add test cases that use a non-default projection or a non-default predicate.

190

Should be ranges of different sizes or similar. Also, is there a reason that these test cases aren't part of the test function?

This revision now requires changes to proceed.Thu, Jun 9, 6:58 PM
philnik marked 4 inline comments as done.Tue, Jun 21, 6:30 AM
philnik added inline comments.
libcxx/include/__algorithm/is_permutation.h
99

Any changes to the behaviour should be negated by the __is_callable check.