@@ -2716,34 +2716,30 @@ ValueObjectSP ValueObject::CreateConstantValue(ConstString name) {
2716
2716
2717
2717
ValueObjectSP ValueObject::GetQualifiedRepresentationIfAvailable (
2718
2718
lldb::DynamicValueType dynValue, bool synthValue) {
2719
- ValueObjectSP result_sp (GetSP ());
2720
-
2719
+ ValueObjectSP result_sp;
2721
2720
switch (dynValue) {
2722
2721
case lldb::eDynamicCanRunTarget:
2723
2722
case lldb::eDynamicDontRunTarget: {
2724
- if (!result_sp->IsDynamic ()) {
2725
- if (result_sp->GetDynamicValue (dynValue))
2726
- result_sp = result_sp->GetDynamicValue (dynValue);
2727
- }
2723
+ if (!IsDynamic ())
2724
+ result_sp = GetDynamicValue (dynValue);
2728
2725
} break ;
2729
2726
case lldb::eNoDynamicValues: {
2730
- if (result_sp->IsDynamic ()) {
2731
- if (result_sp->GetStaticValue ())
2732
- result_sp = result_sp->GetStaticValue ();
2733
- }
2727
+ if (IsDynamic ())
2728
+ result_sp = GetStaticValue ();
2734
2729
} break ;
2735
2730
}
2731
+ if (!result_sp)
2732
+ result_sp = GetSP ();
2733
+ assert (result_sp);
2736
2734
2737
- if (synthValue) {
2738
- if (!result_sp->IsSynthetic ()) {
2739
- if (result_sp->GetSyntheticValue ())
2740
- result_sp = result_sp->GetSyntheticValue ();
2741
- }
2742
- } else {
2743
- if (result_sp->IsSynthetic ()) {
2744
- if (result_sp->GetNonSyntheticValue ())
2745
- result_sp = result_sp->GetNonSyntheticValue ();
2746
- }
2735
+ bool is_synthetic = result_sp->IsSynthetic ();
2736
+ if (synthValue && !is_synthetic) {
2737
+ if (auto synth_sp = result_sp->GetSyntheticValue ())
2738
+ return synth_sp;
2739
+ }
2740
+ if (!synthValue && is_synthetic) {
2741
+ if (auto non_synth_sp = result_sp->GetNonSyntheticValue ())
2742
+ return non_synth_sp;
2747
2743
}
2748
2744
2749
2745
return result_sp;
0 commit comments