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
This commit is contained in:
Greg Clayton 2015-06-22 17:38:30 +00:00
parent 610962061f
commit 7d1483f51c
1 changed files with 14 additions and 4 deletions

View File

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