[all-commits] [llvm/llvm-project] 3456b2: [libc++] Refactor __debug_three_way_comp
Louis Dionne via All-commits
all-commits at lists.llvm.org
Tue Jun 13 14:25:25 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3456b2f60a08a6ab750d58817463a6701a416e3b
https://github.com/llvm/llvm-project/commit/3456b2f60a08a6ab750d58817463a6701a416e3b
Author: Louis Dionne <ldionne.2 at gmail.com>
Date: 2023-06-13 (Tue, 13 Jun 2023)
Changed paths:
M libcxx/include/__algorithm/three_way_comp_ref_type.h
M libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way.pass.cpp
M libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp
Log Message:
-----------
[libc++] Refactor __debug_three_way_comp
This makes __debug_three_way_comp consistent with __debug_less and
in particular gets rid of a potential use-after-move caused by the
use of std::forward. In the previous version of the code, we would
call `__do_compare_assert` after forwarding the arguments into the
comparator, which could end up using the arguments after they've been
moved from.
This also simplifies how we call `__do_compare_assert` by using
`if constexpr` and adds a missing test for proxy iterators in
lexicographical_compare_three_way, which could have found this
issue.
Differential Revision: https://reviews.llvm.org/D152753
More information about the All-commits
mailing list