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 | 22842f89e43e70ab73d1bdb5297db29aa9403a2b (patch) | |
tree | e4fb85e68b13c763fe9e0380cc97b8bff87e25e9 /llvm/lib/Support/SmallPtrSet.cpp | |
parent | fba33af11cd61808d32a70c678d542a76f6ec5a6 (diff) | |
download | bcm5719-llvm-22842f89e43e70ab73d1bdb5297db29aa9403a2b.tar.gz bcm5719-llvm-22842f89e43e70ab73d1bdb5297db29aa9403a2b.zip |
Copy the right amount of elements.
llvm-svn: 152254
Diffstat (limited to 'llvm/lib/Support/SmallPtrSet.cpp')
-rw-r--r-- | llvm/lib/Support/SmallPtrSet.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Support/SmallPtrSet.cpp b/llvm/lib/Support/SmallPtrSet.cpp index 92ffa49833d..68d9c29411f 100644 --- a/llvm/lib/Support/SmallPtrSet.cpp +++ b/llvm/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); } |