[all-commits] [llvm/llvm-project] 16bf43: [libc++] Comma-operator-proof a lot of algorithm/c...

Quuxplusone via All-commits all-commits at lists.llvm.org
Wed Sep 8 10:36:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 16bf43398a62604e6a4146deeb1c43dfa1e78e04
      https://github.com/llvm/llvm-project/commit/16bf43398a62604e6a4146deeb1c43dfa1e78e04
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2021-09-08 (Wed, 08 Sep 2021)

  Changed paths:
    M libcxx/include/__algorithm/stable_sort.h
    M libcxx/include/__hash_table
    M libcxx/include/__memory/uninitialized_algorithms.h
    M libcxx/include/__split_buffer
    M libcxx/include/deque
    M libcxx/include/list
    M libcxx/include/string
    M libcxx/include/vector
    M libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
    M libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
    M libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
    M libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
    M libcxx/test/support/MoveOnly.h

  Log Message:
  -----------
  [libc++] Comma-operator-proof a lot of algorithm/container code.

Detected by evil-izing the widely used `MoveOnly` testing type.
I had to patch some tests that were themselves using its comma operator,
but I think that's a worthwhile cost in order to catch more places
in our headers that needed comma-proofing.

The trick here is that even `++ptr, SomeClass()` can find a comma operator
by ADL, if `ptr` is of type `Evil*`. (A comma between two operands
of non-class-or-enum type is always treated as the built-in
comma, without ADL. But if either operand is class-or-enum, then
ADL happens for _both_ operands' types.)

Differential Revision: https://reviews.llvm.org/D109414




More information about the All-commits mailing list