[PATCH] D91744: ADT: Add assertions to SmallVector::insert, etc., for reference invalidation

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 14:33:48 PST 2020


dexonsmith created this revision.
dexonsmith added reviewers: silvas, mehdi_amini, dblaikie, njames93.
Herald added a subscriber: ributzka.
Herald added a project: LLVM.
dexonsmith requested review of this revision.

2c196bbc6bd897b3dcc1d87a3baac28e1e88df41 <https://reviews.llvm.org/rG2c196bbc6bd897b3dcc1d87a3baac28e1e88df41> asserted that
`SmallVector::push_back` doesn't invalidate the parameter when it needs
to grow. Do the same for `resize`, `append`, `assign`, `insert`, and
`emplace_back`.

For `emplace_back`, split the real implementation out to
`emplace_back_impl`, using `enable_if` to assert in `emplace_back` iff
there's a single `T` parameter.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91744

Files:
  llvm/include/llvm/ADT/SmallVector.h
  llvm/unittests/ADT/SmallVectorTest.cpp
  llvm/utils/TableGen/CodeGenSchedule.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91744.306224.patch
Type: text/x-patch
Size: 10585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201118/6c42779b/attachment.bin>


More information about the llvm-commits mailing list