mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
SmallPtrSet: Copy all the elements when swapping, not just numelements.
This fixes a build failure in webkit. Copying all elements shouldn't be necessary, I'll look out for a better fix soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152252 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -241,7 +241,7 @@ void SmallPtrSetImpl::swap(SmallPtrSetImpl &RHS) {
|
|||||||
// If only RHS is small, copy the small elements into LHS and move the pointer
|
// If only RHS is small, copy the small elements into LHS and move the pointer
|
||||||
// from LHS to RHS.
|
// from LHS to RHS.
|
||||||
if (!this->isSmall() && RHS.isSmall()) {
|
if (!this->isSmall() && RHS.isSmall()) {
|
||||||
std::copy(RHS.SmallArray, RHS.SmallArray+RHS.NumElements, this->SmallArray);
|
std::copy(RHS.SmallArray, RHS.SmallArray+CurArraySize, this->SmallArray);
|
||||||
std::swap(this->NumElements, RHS.NumElements);
|
std::swap(this->NumElements, RHS.NumElements);
|
||||||
std::swap(this->CurArraySize, RHS.CurArraySize);
|
std::swap(this->CurArraySize, RHS.CurArraySize);
|
||||||
RHS.CurArray = this->CurArray;
|
RHS.CurArray = this->CurArray;
|
||||||
@ -254,8 +254,7 @@ void SmallPtrSetImpl::swap(SmallPtrSetImpl &RHS) {
|
|||||||
// If only LHS is small, copy the small elements into RHS and move the pointer
|
// If only LHS is small, copy the small elements into RHS and move the pointer
|
||||||
// from RHS to LHS.
|
// from RHS to LHS.
|
||||||
if (this->isSmall() && !RHS.isSmall()) {
|
if (this->isSmall() && !RHS.isSmall()) {
|
||||||
std::copy(this->SmallArray, this->SmallArray+this->NumElements,
|
std::copy(this->SmallArray, this->SmallArray+CurArraySize, RHS.SmallArray);
|
||||||
RHS.SmallArray);
|
|
||||||
std::swap(RHS.NumElements, this->NumElements);
|
std::swap(RHS.NumElements, this->NumElements);
|
||||||
std::swap(RHS.CurArraySize, this->CurArraySize);
|
std::swap(RHS.CurArraySize, this->CurArraySize);
|
||||||
this->CurArray = RHS.CurArray;
|
this->CurArray = RHS.CurArray;
|
||||||
@ -268,8 +267,8 @@ void SmallPtrSetImpl::swap(SmallPtrSetImpl &RHS) {
|
|||||||
// Both a small, just swap the small elements.
|
// Both a small, just swap the small elements.
|
||||||
assert(this->isSmall() && RHS.isSmall());
|
assert(this->isSmall() && RHS.isSmall());
|
||||||
assert(this->CurArraySize == RHS.CurArraySize);
|
assert(this->CurArraySize == RHS.CurArraySize);
|
||||||
unsigned MaxElems = std::max(this->NumElements, RHS.NumElements);
|
std::swap_ranges(this->SmallArray, this->SmallArray+CurArraySize,
|
||||||
std::swap_ranges(this->SmallArray, this->SmallArray+MaxElems, RHS.SmallArray);
|
RHS.SmallArray);
|
||||||
std::swap(this->NumElements, RHS.NumElements);
|
std::swap(this->NumElements, RHS.NumElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user