Details
- Reviewers
ldionne - Group Reviewers
Restricted Project - Commits
- rGd2a46e6480f3: [libc++][PSTL] Implement std::move
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libcxx/include/__algorithm/pstl_move.h | ||
---|---|---|
33 | ||
44 | This needs to be updated for exception safety, including tests. | |
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/pstl.copy.pass.cpp | ||
11 ↗ | (On Diff #546908) | You have two tests that still use // REQUIRES: with-pstl, which means they are always disabled. Please fix in a separate patch. |
libcxx/include/__algorithm/pstl_move.h | ||
---|---|---|
2 | __pstl_move is missing from the documentation in pstl_backend.h |
libcxx/include/__algorithm/pstl_move.h | ||
---|---|---|
23 | Missing <optional> include. | |
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/pstl.exception_handling.pass.cpp | ||
2 | You need to add a test that __move is noexcept, we said we would add such tests in the PSTL / exception safety patch. | |
23–27 | This is never used. | |
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/pstl.move.pass.cpp | ||
83–86 | This is never used. |
Address comments
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/pstl.exception_handling.pass.cpp | ||
---|---|---|
2 | I thought we didn't need the test after all, since noexcept isn't necessary on the backend anymore and the death tests caught missing noexcepts quite well (and a std tests seems generally preferable to libc++-specific ones). |
LGTM w/ comments applied.
libcxx/include/__algorithm/pstl_move.h | ||
---|---|---|
55 | Right now, we perform a move-construction + an assignment for every element (https://godbolt.org/z/vTs9ofrrT). This can be fixed with -> decltype(auto) on the lambda (https://godbolt.org/z/WKeMdEc3W) Let's fix this and add a test. This is an important property of std::move! | |
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/pstl.exception_handling.pass.cpp | ||
2 | I think you're right, I just got confused with all the recent discussions we had about exception safety in PSTL. | |
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/pstl.move.pass.cpp | ||
2 | Can you add tests with move-only types? This should definitely work since it's std::move. Can you also take a look at the serial std::move tests to make sure we test it there? We should, but just to be certain. |
__pstl_move is missing from the documentation in pstl_backend.h