[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
Wed Jan 17 07:42:40 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:

one thing is whether `set_allocation_and_capacity` is a good name. to me, an "allocation" would mean both the start and the capacity (or end). so named the function `set_allocation_range`. There's however already `replaceAllocation()` that accepts both so maybe `set_allocation` is enough? anyways, guessing it's for you guys to decide what makes more sense here since you seem to interact with this code more.

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


More information about the llvm-commits mailing list