Reapply "[libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`"
authorvarconst <varconsteq@gmail.com>
Sat, 14 Jan 2023 00:56:58 +0000 (16:56 -0800)
committerKonstantin Varlamov <varconst@apple.com>
Sat, 14 Jan 2023 00:57:13 +0000 (16:57 -0800)
commit5629d492df388bf6b5532a2a5c1ef5fd27d65ab0
tree2e37d85bd1d60fbe0d783ae1730be4f3d5cf3ac9
parent7c3ea2db37dce5e7b06dc9c8a3e0731d34b4e8bd
Reapply "[libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`"

This reverts commit a6e1080b87db8fbe0e1afadd96af5a3c0bd5e279.

Fix the conditions when the `memmove` optimization can be applied and refactor them out into a reusable type trait, fix and significantly expand the tests.

Differential Revision: https://reviews.llvm.org/D139235
39 files changed:
libcxx/include/CMakeLists.txt
libcxx/include/__algorithm/copy.h
libcxx/include/__algorithm/copy_backward.h
libcxx/include/__algorithm/copy_move_common.h [new file with mode: 0644]
libcxx/include/__algorithm/move.h
libcxx/include/__algorithm/move_backward.h
libcxx/include/__algorithm/ranges_copy.h
libcxx/include/__algorithm/ranges_copy_backward.h
libcxx/include/__algorithm/ranges_copy_n.h
libcxx/include/__algorithm/ranges_move.h
libcxx/include/__algorithm/ranges_move_backward.h
libcxx/include/__algorithm/ranges_set_difference.h
libcxx/include/__algorithm/ranges_set_symmetric_difference.h
libcxx/include/__algorithm/ranges_set_union.h
libcxx/include/__algorithm/rotate.h
libcxx/include/__algorithm/set_difference.h
libcxx/include/__algorithm/set_symmetric_difference.h
libcxx/include/__algorithm/set_union.h
libcxx/include/__iterator/reverse_iterator.h
libcxx/include/__type_traits/is_always_bitcastable.h [new file with mode: 0644]
libcxx/include/algorithm
libcxx/include/module.modulemap.in
libcxx/include/valarray
libcxx/test/libcxx/algorithms/alg.modifying.operations/copy.pass.cpp [deleted file]
libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/test/libcxx/transitive_includes/cxx2b.csv
libcxx/test/libcxx/type_traits/is_always_bitcastable.compile.pass.cpp [new file with mode: 0644]
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy_backward.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/ranges.move.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/ranges.move_backward.pass.cpp
libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp
libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp
libcxx/test/std/time/time.syn/formatter.duration.pass.cpp
libcxx/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
libcxx/test/std/utilities/format/format.functions/P2418.pass.cpp
libcxx/test/std/utilities/format/format.tuple/format.functions.vformat.pass.cpp