[PATCH] D92522: [SmallVector] Allow SmallVector<T>

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 16:27:14 PST 2020


dexonsmith added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:930
+  size_t PreferredInlineBytes =
+      kPreferredSmallVectorSizeof - sizeof(SmallVectorImpl<T>);
+  size_t NumElementsThatFit = PreferredInlineBytes / sizeof(T);
----------------
dblaikie wrote:
> Could/should this be `sizeof(SmallVector<T, 0>)`? So that if we move members around for any reason (it's SmallVector, so it's not likely to get willy-nilly refactoring of this kind, but just on principle) this would still correctly capture the size of the SmallVector base footprint before inline buffer?
There could be difference, if it matters (not sure it does), since there's an `alignas` on `SmallVector<T, 0>` (IIRC, somehow used in `isSmall`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92522



More information about the llvm-commits mailing list