aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/SmallVector.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrey.golubev@intel.com>2024-01-22 10:39:11 +0200
committerGitHub <noreply@github.com>2024-01-22 00:39:11 -0800
commit5fb39efe680642c6cab072560efa3bfce6646fb0 (patch)
treebe337a43d47aa33ac94bbd77369b6654f6cdc21f /llvm/lib/Support/SmallVector.cpp
parentf36845d0c696023ea97931a4201b43ddfababf9c (diff)
downloadllvm-5fb39efe680642c6cab072560efa3bfce6646fb0.zip
llvm-5fb39efe680642c6cab072560efa3bfce6646fb0.tar.gz
llvm-5fb39efe680642c6cab072560efa3bfce6646fb0.tar.bz2
[LLVM][ADT] Explicitly convert size_t values to SmallVector's size type (#77939)
Multiple places rely on implicit conversion when assigning 'size_t' values to the member fields (size or capacity) of SmallVector. Depending on the platform / compiler configuration, this may result in narrowing conversion warnings (especially given that the size type of SmallVector's member fields is determined based on type T - in SmallVector<T>). To avoid the problem altogether, make the conversions explicit. Co-authored-by: Orest Chura <orest.chura@intel.com>
Diffstat (limited to 'llvm/lib/Support/SmallVector.cpp')
-rw-r--r--llvm/lib/Support/SmallVector.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp
index f7e7e80..b6ce378 100644
--- a/llvm/lib/Support/SmallVector.cpp
+++ b/llvm/lib/Support/SmallVector.cpp
@@ -153,8 +153,7 @@ void SmallVectorBase<Size_T>::grow_pod(void *FirstEl, size_t MinSize,
NewElts = replaceAllocation(NewElts, TSize, NewCapacity, size());
}
- this->BeginX = NewElts;
- this->Capacity = NewCapacity;
+ this->set_allocation_range(NewElts, NewCapacity);
}
template class llvm::SmallVectorBase<uint32_t>;