[PATCH] D77601: Make SmallVector assert if it cannot grow.

Andrew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 18:34:09 PDT 2020


browneee added inline comments.


================
Comment at: llvm/lib/Support/SmallVector.cpp:51
+  // default MinCapacity of 0, but the current capacity cannot be increased.
+  if (capacity() == size_t(UINT32_MAX))
+    report_bad_alloc_error("SmallVector capacity unable to grow");
----------------
tellenbach wrote:
> Can you use `Capacity` directly and omit the function call? 
I expect this call will be inlined, along with the existing calls to capacity() and size() in this function.
Using capacity() seems consistent with the rest of the SmallVector code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77601





More information about the llvm-commits mailing list