[PATCH] D115380: ADT: Make SmallVector::set_size() private
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 11 18:31:56 PST 2022
dexonsmith updated this revision to Diff 399159.
dexonsmith added a comment.
Updated patch uses `using SuperClass::set_size` per @dblaikie's suggestion.
(No need for fresh eyes; just posting to get bots to run again in case there's some other user I missed (just found https://reviews.llvm.org/D117073 in MLIR with a last-minute grep).)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115380/new/
https://reviews.llvm.org/D115380
Files:
llvm/include/llvm/ADT/SmallVector.h
Index: llvm/include/llvm/ADT/SmallVector.h
===================================================================
--- llvm/include/llvm/ADT/SmallVector.h
+++ llvm/include/llvm/ADT/SmallVector.h
@@ -72,15 +72,11 @@
LLVM_NODISCARD bool empty() const { return !Size; }
+protected:
/// Set the array size to \p N, which the current array must have enough
/// capacity for.
///
/// This does not construct or destroy any elements in the vector.
- ///
- /// Clients can use this in conjunction with capacity() to write past the end
- /// of the buffer when they know that more elements are available, and only
- /// update the size later. This avoids the cost of value initializing elements
- /// which will only be overwritten.
void set_size(size_t N) {
assert(N <= capacity());
Size = N;
@@ -588,6 +584,9 @@
}
private:
+ // Make set_size() private to avoid misuse in subclasses.
+ using SuperClass::set_size;
+
template <bool ForOverwrite> void resizeImpl(size_type N) {
if (N == this->size())
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115380.399159.patch
Type: text/x-patch
Size: 1055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220112/a5478006/attachment.bin>
More information about the llvm-commits
mailing list