[PATCH] D115380: ADT: Make SmallVector::set_size() private

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 14:08:10 PST 2021


dexonsmith added a comment.

In D115380#3180943 <https://reviews.llvm.org/D115380#3180943>, @dblaikie wrote:

> Sounds good - if the only places we're trying to use unitiliazide values is where they're POD (can you confirm that's the case/maybe mention it in the commit message that the extra power was unneeded), then removing this more powerful version that could be used for non-POD uninitialized values seems helpful.

Right, that's the idea. The one place I found doing something non-POD was ASTMatchers / https://reviews.llvm.org/D115379. It was:

  V.reserve(size);
  for (I : 0..size)
    savePointer(new (V[I]) T());
  V.set_size();

and I changed it to:

  V.reserve(Size);
  for (I : 0..Size)
    savePointer(&V.emplace_back());

which seems more clear to me.

I'll expand the commit message to discuss that.


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

https://reviews.llvm.org/D115380



More information about the llvm-commits mailing list