Add check for self-assignment. NFC

Differential Revision: https://reviews.llvm.org/D39578

llvm-svn: 318164
This commit is contained in:
Don Hinton 2017-11-14 18:19:41 +00:00
parent 28f3d5cb3e
commit f031e48f45
2 changed files with 6 additions and 0 deletions

View File

@ -539,6 +539,9 @@ bool RegisterValue::SignExtend(uint32_t sign_bitpos) {
}
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:

View File

@ -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()) {