[Lldb-commits] [lldb] r240299 - Cleanup the code a bit to make it more readable.
Greg Clayton
gclayton at apple.com
Mon Jun 22 10:38:30 PDT 2015
Author: gclayton
Date: Mon Jun 22 12:38:30 2015
New Revision: 240299
URL: http://llvm.org/viewvc/llvm-project?rev=240299&view=rev
Log:
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.
Modified:
lldb/trunk/source/API/SBValue.cpp
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=240299&r1=240298&r2=240299&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Mon Jun 22 12:38:30 2015
@@ -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())
More information about the lldb-commits
mailing list