OSDN Git Service

ADT: Fix reference invalidation in SmallVector::resize
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 20 Nov 2020 01:12:27 +0000 (17:12 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 14 Jan 2021 04:48:08 +0000 (20:48 -0800)
commit260a856c2abcef49c7cb3bdcd999701db3e2af38
tree691ae23214743865ca45e2e70c778e43735fe269
parent752fafda3dbf1f4885c64408a13ddb67c91ccb13
ADT: Fix reference invalidation in SmallVector::resize

For small enough, trivially copyable `T`, take the parameter by-value in
`SmallVector::resize`.  Otherwise, when growing, update the arugment
appropriately.

Differential Revision: https://reviews.llvm.org/D93781
llvm/include/llvm/ADT/SmallVector.h
llvm/unittests/ADT/SmallVectorTest.cpp