[Lldb-commits] [PATCH] D39578: Fix a couple of self-assignments using memcpy.

Don Hinton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 13 14:26:42 PST 2017


hintonda updated this revision to Diff 122730.
hintonda added a comment.

- Address comments.


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
@@ -142,6 +142,9 @@
 }
 
 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()) {
Index: source/Core/RegisterValue.cpp
===================================================================
--- source/Core/RegisterValue.cpp
+++ source/Core/RegisterValue.cpp
@@ -539,6 +539,9 @@
 }
 
 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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39578.122730.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171113/998eb8b7/attachment.bin>


More information about the lldb-commits mailing list