[PATCH] D115382: ADT: Avoid using SmallVector::set_size() in SmallString
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 9 12:09:42 PST 2021
dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.
================
Comment at: llvm/include/llvm/ADT/SmallString.h:79
for (const StringRef &Ref : Refs) {
- this->uninitialized_copy(Ref.begin(), Ref.end(), CurEnd);
- CurEnd += Ref.size();
+ this->uninitialized_copy(Ref.begin(), Ref.end(),
+ this->begin() + CurrentSize);
----------------
Should this use copy, rather than uninitialized_copy? Technically the chars are already constructed, they're just uninitialized - this code would technically cause the same memory to be reconstructed? (I mean, we're only talking about rerunning pseudo constructors so I /think/ it's technically fine either way - but may be simpler to think about using copy?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115382/new/
https://reviews.llvm.org/D115382
More information about the llvm-commits
mailing list