[llvm] [LLVM][ADT] Explicitly convert size_t values to SmallVector's size type (PR #77939)

Andrei Golubev via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 05:23:54 PST 2024


================
@@ -468,7 +469,7 @@ void SmallVectorTemplateBase<T, TriviallyCopyable>::takeAllocationForGrow(
     free(this->begin());
 
   this->BeginX = NewElts;
-  this->Capacity = NewCapacity;
+  this->Capacity = static_cast<SmallVectorSizeType<T>>(NewCapacity);
----------------
andrey-golubev wrote:

i'm actually hesitant a bit: the `set_capacity()` has a much broader usage scope than the new function. i guess there are also cases when we only want to set the capacity?

https://github.com/llvm/llvm-project/pull/77939


More information about the llvm-commits mailing list