summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Value.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-05-16 21:49:19 +0000
committerGreg Clayton <gclayton@apple.com>2014-05-16 21:49:19 +0000
commit5c6a2cd9201a5630a6d3a1f6876c6496df79e1a8 (patch)
treed68898bef26813fcd980eb695d9bce0d6b15e2e0 /lldb/source/Core/Value.cpp
parentc721a23882c3a0a9e3907b16ade6983e1e78c9b3 (diff)
downloadbcm5719-llvm-5c6a2cd9201a5630a6d3a1f6876c6496df79e1a8.tar.gz
bcm5719-llvm-5c6a2cd9201a5630a6d3a1f6876c6496df79e1a8.zip
Fix the copy constructor and assignement operator for the lldb_private::Value class to "do the right thing".
llvm-svn: 209036
Diffstat (limited to 'lldb/source/Core/Value.cpp')
-rw-r--r--lldb/source/Core/Value.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index 51a8c0334e0..09236799711 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -77,7 +77,8 @@ Value::Value(const Value &v) :
m_context_type (v.m_context_type),
m_data_buffer ()
{
- if ((uintptr_t)v.m_value.ULongLong(LLDB_INVALID_ADDRESS) == (uintptr_t)v.m_data_buffer.GetBytes())
+ const uintptr_t rhs_value = (uintptr_t)v.m_value.ULongLong(LLDB_INVALID_ADDRESS);
+ if ((rhs_value != 0) && (rhs_value == (uintptr_t)v.m_data_buffer.GetBytes()))
{
m_data_buffer.CopyData(v.m_data_buffer.GetBytes(),
v.m_data_buffer.GetByteSize());
@@ -97,7 +98,8 @@ Value::operator=(const Value &rhs)
m_context = rhs.m_context;
m_value_type = rhs.m_value_type;
m_context_type = rhs.m_context_type;
- if ((uintptr_t)rhs.m_value.ULongLong(LLDB_INVALID_ADDRESS) == (uintptr_t)rhs.m_data_buffer.GetBytes())
+ const uintptr_t rhs_value = (uintptr_t)rhs.m_value.ULongLong(LLDB_INVALID_ADDRESS);
+ if ((rhs_value != 0) && (rhs_value == (uintptr_t)rhs.m_data_buffer.GetBytes()))
{
m_data_buffer.CopyData(rhs.m_data_buffer.GetBytes(),
rhs.m_data_buffer.GetByteSize());
OpenPOWER on IntegriCloud