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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 13:33:26 PDT 2020


nikic accepted this revision.
nikic added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:19
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
----------------
Is this include still needed?


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:84
 
+template <class Size_T> const size_t SmallVectorBase<Size_T>::SizeTypeMax;
+
----------------
Is this needed? I don't think it makes a lot of sense to allow odr-use of `SizeTypeMax`. As it's a protected member, it's only used in the SmallVector implementation, where we control how it is used.


================
Comment at: llvm/lib/Support/SmallVector.cpp:48
+  // Ensure we can fit the new capacity.
+  // This is only going to be applicable if the when the capacity is 32 bit.
+  if (MinCapacity > SizeTypeMax)
----------------
Nit: `if the when` => `if the` or `when`.


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