Remove Variant::swap (unused) because TypedValue::operator= is scary

TypedValue::operator= is potentially dangerous when you don't
know where the TypedValue is actually living.  The reason is it copies
the m_aux from the rhs over the m_aux on the lhs, so if your
TypedValue happens to live inside an HphpArray you can apparently
break HphpArray invariants.

Since we still often cast TypedValues to Variants when they live in
HphpArrays, using TypedValue::operator= inside of Variant needs to be
forbidden.  It also is dubious (probably wrong) in any tv_helpers
functions that mutate externally-owned TypedValues.  This particular
function turns out to be dead code anyway.
Esse commit está contido em:
Jordan DeLong
2013-06-27 22:13:29 -07:00
commit de Sara Golemon
commit 652f0e7b2a
-12
Ver Arquivo
@@ -516,18 +516,6 @@ class Variant : private TypedValue {
return m_type == KindOfRef ? m_data.pref->var()->m_data.dbl : m_data.dbl;
}
/**
* Can just swap the data between variants sometimes to avoid inc and decref
*/
void swap(Variant &other) {
static_assert(sizeof(Variant) == sizeof(TypedValue), "Reimplement this");
auto& lhs = reinterpret_cast<TypedValue&>(*this);
auto& rhs = reinterpret_cast<TypedValue&>(other);
auto val = lhs;
lhs = rhs;
rhs = val;
}
/**
* Operators
*/