diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-07 22:48:42 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-07 22:48:42 +0000 |
commit | f03e62a8008a8ad279a6ed157fb507095177d17a (patch) | |
tree | c37cd29529a212abfc833efe1d5c6aae468c3117 /lib/Support/SmallPtrSet.cpp | |
parent | 24e0e7c11fef4dd05fa72faf53846a323eb16bb5 (diff) |
Copy the right amount of elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/SmallPtrSet.cpp')
-rw-r--r-- | lib/Support/SmallPtrSet.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Support/SmallPtrSet.cpp b/lib/Support/SmallPtrSet.cpp index 92ffa49833..68d9c29411 100644 --- a/lib/Support/SmallPtrSet.cpp +++ b/lib/Support/SmallPtrSet.cpp @@ -241,7 +241,8 @@ void SmallPtrSetImpl::swap(SmallPtrSetImpl &RHS) { // If only RHS is small, copy the small elements into LHS and move the pointer // from LHS to RHS. if (!this->isSmall() && RHS.isSmall()) { - std::copy(RHS.SmallArray, RHS.SmallArray+CurArraySize, this->SmallArray); + std::copy(RHS.SmallArray, RHS.SmallArray+RHS.CurArraySize, + this->SmallArray); std::swap(this->NumElements, RHS.NumElements); std::swap(this->CurArraySize, RHS.CurArraySize); RHS.CurArray = this->CurArray; @@ -254,7 +255,8 @@ void SmallPtrSetImpl::swap(SmallPtrSetImpl &RHS) { // If only LHS is small, copy the small elements into RHS and move the pointer // from RHS to LHS. if (this->isSmall() && !RHS.isSmall()) { - std::copy(this->SmallArray, this->SmallArray+CurArraySize, RHS.SmallArray); + std::copy(this->SmallArray, this->SmallArray+this->CurArraySize, + RHS.SmallArray); std::swap(RHS.NumElements, this->NumElements); std::swap(RHS.CurArraySize, this->CurArraySize); this->CurArray = RHS.CurArray; @@ -267,7 +269,7 @@ void SmallPtrSetImpl::swap(SmallPtrSetImpl &RHS) { // Both a small, just swap the small elements. assert(this->isSmall() && RHS.isSmall()); assert(this->CurArraySize == RHS.CurArraySize); - std::swap_ranges(this->SmallArray, this->SmallArray+CurArraySize, + std::swap_ranges(this->SmallArray, this->SmallArray+this->CurArraySize, RHS.SmallArray); std::swap(this->NumElements, RHS.NumElements); } |