Page MenuHomePhabricator
Feed Advanced Search

Jul 22 2022

huixie90 added a comment to D130330: [libc++][NFC] Add checks for lifetime issues in classic algorithms..

I think this is good. But I'd like to clarify the idea behind it. IIUC, the idea is that

  • there is a global object pool of ptrs
  • the class's destructor removes this from the global pool
  • every operation assert this is inside the pool

But if the object destructor has been run, it is UB to call its member function. and since it is UB , those assert in theory is not guaranteed to run

Yes, it's true that this relies on undefined behavior. However, I think it's the pragmatic thing to do:

  • I can't think of a way to do this that avoids UB, because checking an object after its destructor has run is really the crux of the problem. constexpr checks are great in that regard but unfortunately won't give us full coverage as I mentioned in another comment. So it looks like our alternatives are either having checks that rely on UB or no checks at all (for some cases, like most of std::sort which is the motivating example);
  • I have manually confirmed that it works (in the sense that it does find actual lifetime issues). It would have found both the original bug that triggered the assertion in Chromium and the fact that the first patch with the fix still contained a dangling temporary;
  • I have deliberately written the lifetime checks so that they never dereference this (that's one of the reasons the cache is a static variable). In practice, I presume that member function calls translate to regular function calls with this as the first parameter (simplifying a little). Neither the function code nor the _value_ of the this pointer have a reason to become invalid after the destructor has run. Now, it's possible that some compiler optimization simply prevents the member function from being called since that is supposed to be impossible (for a valid program). I'm very skeptical this could happen in practice, and even if it does, it seems like the worst that could happen is that these tests would miss a lifetime bug. While that would be unfortunate, it's not significantly worse than the status quo which is no checks at all.

Of course, I'd be happy to rewrite this if there's a way to achieve the same or similar coverage without relying on undefined behavior. Unfortunately, I can't think of one -- if you have any ideas, I'm happy to discuss.

Jul 22 2022, 3:20 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130321: [libc++][ranges] Implement `ranges::shuffle`..
Jul 22 2022, 11:09 AM · Restricted Project, Restricted Project
huixie90 added a comment to D130321: [libc++][ranges] Implement `ranges::shuffle`..

LGTM

Jul 22 2022, 11:03 AM · Restricted Project, Restricted Project
huixie90 added a comment to D130330: [libc++][NFC] Add checks for lifetime issues in classic algorithms..

I think this is good. But I'd like to clarify the idea behind it. IIUC, the idea is that

  • there is a global object pool of ptrs
  • the class's destructor removes this from the global pool
  • every operation assert this is inside the pool
Jul 22 2022, 5:03 AM · Restricted Project, Restricted Project
huixie90 committed rGc559964d85e8: [libc++][ranges] implement `std::ranges::includes` (authored by huixie90).
[libc++][ranges] implement `std::ranges::includes`
Jul 22 2022, 2:31 AM · Restricted Project, Restricted Project
huixie90 closed D130116: [libc++][ranges] implement `std::ranges::includes`.
Jul 22 2022, 2:31 AM · Restricted Project, Restricted Project
huixie90 committed rG0f6364b8a100: [libc++][ranges] implement `std::ranges::equal_range` (authored by huixie90).
[libc++][ranges] implement `std::ranges::equal_range`
Jul 22 2022, 2:28 AM · Restricted Project, Restricted Project
huixie90 closed D129796: [libc++][ranges] implement `std::ranges::equal_range`.
Jul 22 2022, 2:27 AM · Restricted Project, Restricted Project

Jul 21 2022

huixie90 updated the diff for D130116: [libc++][ranges] implement `std::ranges::includes`.

rebase

Jul 21 2022, 3:32 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

rebase

Jul 21 2022, 3:29 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D128864: [libc++] Fix algorithms which use reverse_iterator.
Jul 21 2022, 3:25 PM · Restricted Project, Restricted Project

Jul 20 2022

huixie90 added a reviewer for D130212: [libc++][ranges] attempt to fix proxy iterator issues that cause Chromium to crash: eaeltsin.
Jul 20 2022, 4:21 PM · Restricted Project, Restricted Project
huixie90 requested review of D130212: [libc++][ranges] attempt to fix proxy iterator issues that cause Chromium to crash.
Jul 20 2022, 4:12 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D130116: [libc++][ranges] implement `std::ranges::includes`.

address review issues

Jul 20 2022, 3:05 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

fix merge conflicts

Jul 20 2022, 2:48 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

add static_assert

Jul 20 2022, 2:38 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130197: [libc++] Fix `_IterOps::__iter_move` to support proxy iterators..
Jul 20 2022, 2:04 PM · Restricted Project, Restricted Project
huixie90 accepted D130070: [libc++][ranges] Implement `std::ranges::partition_{point,copy}`..

LGTM with nits

Jul 20 2022, 1:50 AM · Restricted Project, Restricted Project

Jul 19 2022

huixie90 updated the diff for D130124: [libc++][ranges] fix `std::search_n` incorrect `static_assert`.

address comments

Jul 19 2022, 3:00 PM · Restricted Project, Restricted Project
huixie90 added a comment to D130124: [libc++][ranges] fix `std::search_n` incorrect `static_assert`.

Should we add a similar test in std::search and others that have a similar pattern?

Jul 19 2022, 2:45 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130124: [libc++][ranges] fix `std::search_n` incorrect `static_assert`.
Jul 19 2022, 2:30 PM · Restricted Project, Restricted Project
huixie90 requested review of D130124: [libc++][ranges] fix `std::search_n` incorrect `static_assert`.
Jul 19 2022, 2:00 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130070: [libc++][ranges] Implement `std::ranges::partition_{point,copy}`..
Jul 19 2022, 1:18 PM · Restricted Project, Restricted Project
huixie90 requested review of D130116: [libc++][ranges] implement `std::ranges::includes`.
Jul 19 2022, 1:02 PM · Restricted Project, Restricted Project
huixie90 accepted D129741: [libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`..
Jul 19 2022, 10:18 AM · Restricted Project, Restricted Project
huixie90 accepted D130057: [libc++][ranges][NFC] Test that range algorithms support iterators requiring `iter_move`..
Jul 19 2022, 3:09 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D124079: [libc++] Implement ranges::find_end, ranges::search{, _n}.
Jul 19 2022, 1:33 AM · Restricted Project, Restricted Project

Jul 18 2022

huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

rebase

Jul 18 2022, 2:04 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D129794: [libc++] Fix reverse_iterator::iterator_concept.
Jul 18 2022, 1:47 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

update one more caller

Jul 18 2022, 2:31 AM · Restricted Project, Restricted Project
huixie90 accepted D129624: [libc++][ranges] Implement `ranges::{,stable_}partition`..

The algorithm LGTM. Regarding testing, I still prefer to have extra tests to verify iter_move and/or iter_swap is correctly used

Jul 18 2022, 2:19 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D129741: [libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`..
Jul 18 2022, 1:43 AM · Restricted Project, Restricted Project
huixie90 accepted D129968: [libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI.
Jul 18 2022, 1:35 AM · Restricted Project, Restricted Project
huixie90 accepted D129976: [libc++] Add clang-tidy for the tests.

thanks for the update

Jul 18 2022, 1:21 AM · Restricted Project, Restricted Project

Jul 17 2022

huixie90 added inline comments to D129796: [libc++][ranges] implement `std::ranges::equal_range`.
Jul 17 2022, 1:56 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

address feedback

Jul 17 2022, 1:56 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D129823: [libc++][ranges] Make range algorithms support proxy iterators.
Jul 17 2022, 1:59 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

try again

Jul 17 2022, 1:36 AM · Restricted Project, Restricted Project

Jul 16 2022

huixie90 accepted D129823: [libc++][ranges] Make range algorithms support proxy iterators.

LGTM with green ci
we could follow up with more testing for iter_move

Jul 16 2022, 2:42 PM · Restricted Project, Restricted Project

Jul 15 2022

huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

try again to fix CI

Jul 15 2022, 12:01 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D129859: [libc++][ranges] Implement `ranges::{prev, next}_permutation`.
Jul 15 2022, 10:36 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

try again to fix CI

Jul 15 2022, 8:47 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129796: [libc++][ranges] implement `std::ranges::equal_range`.

fix CI

Jul 15 2022, 7:45 AM · Restricted Project, Restricted Project
huixie90 published D129796: [libc++][ranges] implement `std::ranges::equal_range` for review.
Jul 15 2022, 6:56 AM · Restricted Project, Restricted Project
huixie90 accepted D129806: [libc++][ranges] Implement `ranges::replace_copy{,_if}`..
Jul 15 2022, 6:35 AM · Restricted Project, Restricted Project
huixie90 requested changes to D129823: [libc++][ranges] Make range algorithms support proxy iterators.
Jul 15 2022, 2:59 AM · Restricted Project, Restricted Project

Jul 14 2022

huixie90 committed rG3151b95dad40: [libc++][ranges] implement `std::ranges::set_union` (authored by huixie90).
[libc++][ranges] implement `std::ranges::set_union`
Jul 14 2022, 1:06 PM · Restricted Project, Restricted Project
huixie90 closed D129657: [libc++][ranges] implement `std::ranges::set_union`.
Jul 14 2022, 1:06 PM · Restricted Project, Restricted Project
huixie90 accepted D129794: [libc++] Fix reverse_iterator::iterator_concept.

LGTM with nits

Jul 14 2022, 1:01 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D128864: [libc++] Fix algorithms which use reverse_iterator.
Jul 14 2022, 8:12 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D129741: [libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`..
Jul 14 2022, 2:30 AM · Restricted Project, Restricted Project

Jul 13 2022

huixie90 added inline comments to D128864: [libc++] Fix algorithms which use reverse_iterator.
Jul 13 2022, 11:31 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129657: [libc++][ranges] implement `std::ranges::set_union`.

address review feedback

Jul 13 2022, 1:36 PM · Restricted Project, Restricted Project
huixie90 committed rGa5c0638dec83: [libc++][ranges] implement `std::ranges::set_symmetric_difference` (authored by huixie90).
[libc++][ranges] implement `std::ranges::set_symmetric_difference`
Jul 13 2022, 1:25 PM · Restricted Project, Restricted Project
huixie90 closed D129520: [libc++][ranges] implement `std::ranges::set_symmetric_difference`.
Jul 13 2022, 1:25 PM · Restricted Project, Restricted Project
huixie90 published D129657: [libc++][ranges] implement `std::ranges::set_union` for review.
Jul 13 2022, 9:24 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129520: [libc++][ranges] implement `std::ranges::set_symmetric_difference`.

rename variables

Jul 13 2022, 4:07 AM · Restricted Project, Restricted Project
huixie90 accepted D128744: [libc++][ranges] Implement `ranges::partial_sort`..
Jul 13 2022, 1:36 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D129520: [libc++][ranges] implement `std::ranges::set_symmetric_difference`.
Jul 13 2022, 12:31 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129520: [libc++][ranges] implement `std::ranges::set_symmetric_difference`.

addressed review feedback

Jul 13 2022, 12:30 AM · Restricted Project, Restricted Project
huixie90 added a comment to D129414: [libc++][ranges][NFC] Consolidate some repetitive range algorithm tests:.

It seems that the "ranges_robust_against_copying_xxx" tests are in "test/libcxx/algorithms" and these "ranges_robust_against_" tests are in "test/std/algorithms".
Is there a reason for using different directories?

Jul 13 2022, 12:14 AM · Restricted Project, Restricted Project

Jul 12 2022

huixie90 accepted D129390: [lib++][ranges][NFC] Refactor `iterator_operations.h` to use tags..
Jul 12 2022, 4:58 AM · Restricted Project, Restricted Project
huixie90 published D129520: [libc++][ranges] implement `std::ranges::set_symmetric_difference` for review.
Jul 12 2022, 3:21 AM · Restricted Project, Restricted Project
huixie90 accepted D129549: [libc++][ranges][NFC] Implement the repetitive parts of the remaining range algorithms:.

LGTM. please confirm if ranges_set_union test is in the right directory

Jul 12 2022, 2:28 AM · Restricted Project, Restricted Project
huixie90 added a comment to D129549: [libc++][ranges][NFC] Implement the repetitive parts of the remaining range algorithms:.

Thanks for doing this. It is really useful.
Could you please remove the set_symmetric_difference bit as I have something in progress here
https://reviews.llvm.org/D129520

Jul 12 2022, 2:14 AM · Restricted Project, Restricted Project

Jul 11 2022

huixie90 added reviewers for D129503: [libc++] Rename variables to use the snake case instead of camel case: philnik, gulfem, var-const, ldionne.
Jul 11 2022, 10:31 AM · Restricted Project, Restricted Project
huixie90 requested review of D129503: [libc++] Rename variables to use the snake case instead of camel case.
Jul 11 2022, 10:29 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D129390: [lib++][ranges][NFC] Refactor `iterator_operations.h` to use tags..
Jul 11 2022, 8:26 AM · Restricted Project, Restricted Project

Jul 10 2022

huixie90 accepted D124079: [libc++] Implement ranges::find_end, ranges::search{, _n}.
Jul 10 2022, 11:27 PM · Restricted Project, Restricted Project
huixie90 committed rG96b674f23cd6: [libc++][ranges] implement `std::ranges::set_intersection` (authored by huixie90).
[libc++][ranges] implement `std::ranges::set_intersection`
Jul 10 2022, 11:02 PM · Restricted Project, Restricted Project
huixie90 closed D129233: [libc++][ranges] implement `std::ranges::set_intersection`.
Jul 10 2022, 11:02 PM · Restricted Project, Restricted Project

Jul 9 2022

huixie90 added inline comments to D128744: [libc++][ranges] Implement `ranges::partial_sort`..
Jul 9 2022, 7:51 PM · Restricted Project, Restricted Project
huixie90 requested changes to D128744: [libc++][ranges] Implement `ranges::partial_sort`..
Jul 9 2022, 2:12 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129233: [libc++][ranges] implement `std::ranges::set_intersection`.

fix CI

Jul 9 2022, 1:18 PM · Restricted Project, Restricted Project

Jul 8 2022

huixie90 updated the diff for D129233: [libc++][ranges] implement `std::ranges::set_intersection`.

address feedback

Jul 8 2022, 1:23 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129233: [libc++][ranges] implement `std::ranges::set_intersection`.

rebase

Jul 8 2022, 7:11 AM · Restricted Project, Restricted Project
huixie90 committed rG1cdec6c96e85: [libcxx][ranges] implement `std::ranges::set_difference` (authored by huixie90).
[libcxx][ranges] implement `std::ranges::set_difference`
Jul 8 2022, 5:30 AM · Restricted Project, Restricted Project
huixie90 closed D128983: [libcxx][ranges] implement `std::ranges::set_difference`.
Jul 8 2022, 5:30 AM · Restricted Project, Restricted Project
huixie90 updated the summary of D129233: [libc++][ranges] implement `std::ranges::set_intersection`.
Jul 8 2022, 3:00 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D129233: [libc++][ranges] implement `std::ranges::set_intersection`.
Jul 8 2022, 2:59 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129233: [libc++][ranges] implement `std::ranges::set_intersection`.

addressing feedback

Jul 8 2022, 2:59 AM · Restricted Project, Restricted Project

Jul 7 2022

huixie90 added inline comments to D128744: [libc++][ranges] Implement `ranges::partial_sort`..
Jul 7 2022, 11:41 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D128864: [libc++] Fix algorithms which use reverse_iterator.
Jul 7 2022, 6:17 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D129233: [libc++][ranges] implement `std::ranges::set_intersection`.
Jul 7 2022, 5:56 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D128864: [libc++] Fix algorithms which use reverse_iterator.
Jul 7 2022, 5:46 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D128983: [libcxx][ranges] implement `std::ranges::set_difference`.
Jul 7 2022, 5:09 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D128983: [libcxx][ranges] implement `std::ranges::set_difference`.

address feedback

Jul 7 2022, 5:09 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D128864: [libc++] Fix algorithms which use reverse_iterator.
Jul 7 2022, 5:01 PM · Restricted Project, Restricted Project
huixie90 committed rGa81cc1fc0712: [libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move`… (authored by huixie90).
[libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move`…
Jul 7 2022, 4:15 PM · Restricted Project, Restricted Project
huixie90 closed D129099: [libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move` and `iter_swap`.
Jul 7 2022, 4:15 PM · Restricted Project, Restricted Project
huixie90 added a comment to D127211: [libc++] Implement ranges::{reverse, rotate}_copy.

LGTM

Jul 7 2022, 3:59 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D128611: [libc++] Implement `std::ranges::merge`.
Jul 7 2022, 3:25 PM · Restricted Project, Restricted Project

Jul 6 2022

huixie90 published D129233: [libc++][ranges] implement `std::ranges::set_intersection` for review.
Jul 6 2022, 3:25 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D129099: [libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move` and `iter_swap`.

improve comments

Jul 6 2022, 3:17 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D124079: [libc++] Implement ranges::find_end, ranges::search{, _n}.
Jul 6 2022, 1:41 PM · Restricted Project, Restricted Project
huixie90 accepted D128149: [libc++][ranges] Implement `ranges::nth_element`..
Jul 6 2022, 10:01 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129099: [libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move` and `iter_swap`.

CI failure on mac clang

Jul 6 2022, 4:38 AM · Restricted Project, Restricted Project
huixie90 accepted D128115: [libc++][ranges] Implement modifying heap algorithms:.
Jul 6 2022, 2:48 AM · Restricted Project, Restricted Project
huixie90 accepted D128744: [libc++][ranges] Implement `ranges::partial_sort`..
Jul 6 2022, 2:41 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D129099: [libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move` and `iter_swap`.

address review feedback

Jul 6 2022, 1:31 AM · Restricted Project, Restricted Project