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

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 10:56:24 PST 2021


dblaikie added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:587-589
+  // Hide set_size() to avoid misuse.
+  void set_size(size_type N) { SuperClass::set_size(N); }
+
----------------
dexonsmith wrote:
> dblaikie wrote:
> > I think maybe this can be removed entirely - all the call sites use "this->set_size", so I think they'd find that in the base class?
> My goal was to downgrade from `protected` to `private`, since there's no reason to let subclasses of SmallVectorImpl access this either. WDYT? Not worth it? Better comment?
ah - somewhere between "not worth it" and "if you like".

If you want to do this, though - maybe a "using SuperClass::set_size" would be workable/better than the wrapper function? (not 100% sure that will work, but I think it should)


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

https://reviews.llvm.org/D115380



More information about the llvm-commits mailing list