From: Greg Clayton Date: Mon, 22 Jun 2015 17:38:30 +0000 (+0000) Subject: Cleanup the code a bit to make it more readable. X-Git-Tag: llvmorg-3.7.0-rc1~1848 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d1483f51cc6a6ecb6e1802567592daf841f463d;p=platform%2Fupstream%2Fllvm.git Cleanup the code a bit to make it more readable. Add some if/then to avoid calling a function to get dynamic/synthetic types if we know we aren't going to need to call it. Avoid calling a function that returns a shared pointer twice: once for testing it and once for assigning it (even though that shared pointer is cached inside the value object), it just makes the code a bit clearer. llvm-svn: 240299 --- diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 112954e..72f30e3 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -150,10 +150,20 @@ public: return ValueObjectSP(); } - if (value_sp->GetDynamicValue(m_use_dynamic)) - value_sp = value_sp->GetDynamicValue(m_use_dynamic); - if (value_sp->GetSyntheticValue(m_use_synthetic)) - value_sp = value_sp->GetSyntheticValue(m_use_synthetic); + if (m_use_dynamic != eNoDynamicValues) + { + ValueObjectSP dynamic_sp = value_sp->GetDynamicValue(m_use_dynamic); + if (dynamic_sp) + value_sp = dynamic_sp; + } + + if (m_use_synthetic) + { + ValueObjectSP synthetic_sp = value_sp->GetSyntheticValue(m_use_synthetic); + if (synthetic_sp) + value_sp = synthetic_sp; + } + if (!value_sp) error.SetErrorString("invalid value object"); if (!m_name.IsEmpty())