[PATCH] D93780: ADT: Fix reference invalidation in N-element SmallVector::append and insert

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 15:47:29 PST 2020


dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/unittests/ADT/SmallVectorTest.cpp:1123
+  // use-after-free here.
+  V.append(V.capacity(), V.front());
+  EXPECT_EQ(1, V.back());
----------------
Might be worth making this V.capacity() - V.size() + 1 to make it more precise? While V.capacity() will always be enough, I think (to me at least) that might make the test a bit harder to read, since capacity() may be significantly more than needed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93780/new/

https://reviews.llvm.org/D93780



More information about the llvm-commits mailing list