[all-commits] [llvm/llvm-project] 491429: Reapply "ADT: Fix reference invalidation in SmallV...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Wed Jan 13 19:50:57 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 49142991a685bd427d7e877c29c77371dfb7634c
      https://github.com/llvm/llvm-project/commit/49142991a685bd427d7e877c29c77371dfb7634c
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2021-01-13 (Wed, 13 Jan 2021)

  Changed paths:
    M llvm/include/llvm/ADT/SmallVector.h
    M llvm/unittests/ADT/SmallVectorTest.cpp

  Log Message:
  -----------
  Reapply "ADT: Fix reference invalidation in SmallVector::push_back and single-element insert"

This reverts commit 56d1ffb927d03958a7a31442596df749264a7792, reapplying
9abac60309006db00eca0af406c2e16bef26807c, removing insert_one_maybe_copy
and using a helper called forward_value_param instead. This avoids use
of `std::is_same` (or any SFINAE), so I'm hoping it's more portable and
MSVC will be happier.

Original commit message follows:

For small enough, trivially copyable `T`, take the argument by value in
`SmallVector::push_back` and copy it when forwarding to
`SmallVector::insert_one_impl`. Otherwise, when growing, update the
argument appropriately.

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




More information about the All-commits mailing list