[Lldb-commits] [lldb] r318164 - Add check for self-assignment. NFC
Don Hinton via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 14 10:19:41 PST 2017
Author: dhinton
Date: Tue Nov 14 10:19:41 2017
New Revision: 318164
URL: http://llvm.org/viewvc/llvm-project?rev=318164&view=rev
Log:
Add check for self-assignment. NFC
Differential Revision: https://reviews.llvm.org/D39578
Modified:
lldb/trunk/source/Core/RegisterValue.cpp
lldb/trunk/source/Core/Value.cpp
Modified: lldb/trunk/source/Core/RegisterValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=318164&r1=318163&r2=318164&view=diff
==============================================================================
--- lldb/trunk/source/Core/RegisterValue.cpp (original)
+++ lldb/trunk/source/Core/RegisterValue.cpp Tue Nov 14 10:19:41 2017
@@ -539,6 +539,9 @@ bool RegisterValue::SignExtend(uint32_t
}
bool RegisterValue::CopyValue(const RegisterValue &rhs) {
+ if (this == &rhs)
+ return rhs.m_type == eTypeInvalid ? false : true;
+
m_type = rhs.m_type;
switch (m_type) {
case eTypeInvalid:
Modified: lldb/trunk/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=318164&r1=318163&r2=318164&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Tue Nov 14 10:19:41 2017
@@ -142,6 +142,9 @@ Type *Value::GetType() {
}
size_t Value::AppendDataToHostBuffer(const Value &rhs) {
+ if (this == &rhs)
+ return 0;
+
size_t curr_size = m_data_buffer.GetByteSize();
Status error;
switch (rhs.GetValueType()) {
More information about the lldb-commits
mailing list