diff options
author | dim <dim@FreeBSD.org> | 2015-09-06 18:36:24 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-09-06 18:36:24 +0000 |
commit | 4238dc458ed9a048965af111b979fd51d288f22c (patch) | |
tree | 3d3ed1e1987dbe6444294b1b4e249814b97b97a5 /include/clang/Analysis/Support/BumpVector.h | |
parent | 6416b56f5a3923c6c264b46365e16718ccabf081 (diff) | |
download | FreeBSD-src-4238dc458ed9a048965af111b979fd51d288f22c.zip FreeBSD-src-4238dc458ed9a048965af111b979fd51d288f22c.tar.gz |
Import clang 3.7.0 release (r246257).
Diffstat (limited to 'include/clang/Analysis/Support/BumpVector.h')
-rw-r--r-- | include/clang/Analysis/Support/BumpVector.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/clang/Analysis/Support/BumpVector.h b/include/clang/Analysis/Support/BumpVector.h index 841adf6..3abe32d 100644 --- a/include/clang/Analysis/Support/BumpVector.h +++ b/include/clang/Analysis/Support/BumpVector.h @@ -223,14 +223,15 @@ void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) { T *NewElts = C.getAllocator().template Allocate<T>(NewCapacity); // Copy the elements over. - if (std::is_class<T>::value) { - std::uninitialized_copy(Begin, End, NewElts); - // Destroy the original elements. - destroy_range(Begin, End); - } - else { - // Use memcpy for PODs (std::uninitialized_copy optimizes to memmove). - memcpy(NewElts, Begin, CurSize * sizeof(T)); + if (Begin != End) { + if (std::is_class<T>::value) { + std::uninitialized_copy(Begin, End, NewElts); + // Destroy the original elements. + destroy_range(Begin, End); + } else { + // Use memcpy for PODs (std::uninitialized_copy optimizes to memmove). + memcpy(NewElts, Begin, CurSize * sizeof(T)); + } } // For now, leak 'Begin'. We can add it back to a freelist in |