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

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 16:54:37 PST 2020


silvas marked 2 inline comments as done.
silvas 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);
----------------
dexonsmith wrote:
> 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`).
Good catch!


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