[PATCH] D77621: ADT: SmallVector size & capacity use word-size integers when elements are small.

Andrew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 15:53:33 PDT 2020


browneee added a comment.

I'm open to suggestions to resolve the clang tidy naming warnings. I would prefer to leave grow_pod the same, to minimize changes.

@dexonsmith I am not a committer, if the last changes looks good please submit for me. Thanks!



================
Comment at: llvm/include/llvm/ADT/SmallVector.h:52
+  // The maximum size depends on size_type used.
+  static constexpr size_t SizeMax() {
+    return std::numeric_limits<Size_T>::max();
----------------
dexonsmith wrote:
> STL data structures have a name for this called `max_size()`.  Should we be consistent with that?
Good question.

This brought my attention to the existing SmallVectorTemplateCommon::max_size() which also needed to be updated.
I'm going to name this new function SizeTypeMax to best describe what it provides, and leave it separate from max_size().


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:179
+  using Base::empty;
+  using Base::size;
+
----------------
dexonsmith wrote:
> Optionally we could expose `max_size()` as well.
Not done. Updated existing max_size() instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77621





More information about the llvm-commits mailing list