[PATCH] D93532: [ADT] Add resize_for_overwrite method to SmallVector.

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 13:11:55 PST 2020


dexonsmith added a comment.

I wonder if this can be tested, something like:

  V.push_back(5);
  V.pop_back();
  V.resize_for_overwrite(V.size() + 1);
  EXPECT_EQ(5, V.back());
  V.pop_back();
  V.resize(V.size() + 1);
  EXPECT_EQ(0, V.back());



================
Comment at: llvm/include/llvm/ADT/SmallVector.h:466
     if (N < this->size()) {
-      this->destroy_range(this->begin()+N, this->end());
+      this->destroy_range(this->begin() + N, this->end());
       this->set_size(N);
----------------
This whitespace change seems unrelated; can you commit separately?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93532



More information about the llvm-commits mailing list