hintonda created this revision. These two methods are essentially assignents, but don't check for self-assignment and use memcpy for member variables.
Since they aren't actually operator=(), it's unclear what should be done: - check and shortcut - assert - allow but s/memcpy/memmove/ https://reviews.llvm.org/D39578 Files: source/Core/RegisterValue.cpp source/Core/Value.cpp Index: source/Core/Value.cpp =================================================================== --- source/Core/Value.cpp +++ source/Core/Value.cpp @@ -143,6 +143,8 @@ } size_t Value::AppendDataToHostBuffer(const Value &rhs) { + // FIXME: What should we do if this == &rhs? + // If we allow, change s/memcpy/memmove/ below. size_t curr_size = m_data_buffer.GetByteSize(); Status error; switch (rhs.GetValueType()) { Index: source/Core/RegisterValue.cpp =================================================================== --- source/Core/RegisterValue.cpp +++ source/Core/RegisterValue.cpp @@ -539,6 +539,11 @@ } bool RegisterValue::CopyValue(const RegisterValue &rhs) { + // Maintain current behavior, but guard against self-assignment (see memcpy + // below).? + if (this == &rhs) + return rhs.m_type == eTypeInvalid ? false : true; + m_type = rhs.m_type; switch (m_type) { case eTypeInvalid:
Index: source/Core/Value.cpp =================================================================== --- source/Core/Value.cpp +++ source/Core/Value.cpp @@ -143,6 +143,8 @@ } size_t Value::AppendDataToHostBuffer(const Value &rhs) { + // FIXME: What should we do if this == &rhs? + // If we allow, change s/memcpy/memmove/ below. size_t curr_size = m_data_buffer.GetByteSize(); Status error; switch (rhs.GetValueType()) { Index: source/Core/RegisterValue.cpp =================================================================== --- source/Core/RegisterValue.cpp +++ source/Core/RegisterValue.cpp @@ -539,6 +539,11 @@ } bool RegisterValue::CopyValue(const RegisterValue &rhs) { + // Maintain current behavior, but guard against self-assignment (see memcpy + // below).? + if (this == &rhs) + return rhs.m_type == eTypeInvalid ? false : true; + m_type = rhs.m_type; switch (m_type) { case eTypeInvalid:
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits