Fix a bug in the data formatters where summary strings would not look into the non-synthetic value for child members if the ValueObject being formatted happened to have a synthetic value
rdar://15630776
llvm-svn: 232114
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index f186da8..afe6587 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -141,19 +141,27 @@
struct GetValueForExpressionPathOptions
{
+ enum class SyntheticChildrenTraversal
+ {
+ None,
+ ToSynthetic,
+ FromSynthetic,
+ Both
+ };
+
bool m_check_dot_vs_arrow_syntax;
bool m_no_fragile_ivar;
bool m_allow_bitfields_syntax;
- bool m_no_synthetic_children;
+ SyntheticChildrenTraversal m_synthetic_children_traversal;
GetValueForExpressionPathOptions(bool dot = false,
bool no_ivar = false,
bool bitfield = true,
- bool no_synth = false) :
+ SyntheticChildrenTraversal synth_traverse = SyntheticChildrenTraversal::ToSynthetic) :
m_check_dot_vs_arrow_syntax(dot),
m_no_fragile_ivar(no_ivar),
m_allow_bitfields_syntax(bitfield),
- m_no_synthetic_children(no_synth)
+ m_synthetic_children_traversal(synth_traverse)
{
}
@@ -200,16 +208,9 @@
}
GetValueForExpressionPathOptions&
- DoAllowSyntheticChildren()
+ SetSyntheticChildrenTraversal(SyntheticChildrenTraversal traverse)
{
- m_no_synthetic_children = false;
- return *this;
- }
-
- GetValueForExpressionPathOptions&
- DontAllowSyntheticChildren()
- {
- m_no_synthetic_children = true;
+ m_synthetic_children_traversal = traverse;
return *this;
}
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index 20190bbd..ef37110 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -766,7 +766,7 @@
ValueObject::ExpressionPathAftermath what_next = (do_deref_pointer ?
ValueObject::eExpressionPathAftermathDereference : ValueObject::eExpressionPathAftermathNothing);
ValueObject::GetValueForExpressionPathOptions options;
- options.DontCheckDotVsArrowSyntax().DoAllowBitfieldSyntax().DoAllowFragileIVar().DoAllowSyntheticChildren();
+ options.DontCheckDotVsArrowSyntax().DoAllowBitfieldSyntax().DoAllowFragileIVar().SetSyntheticChildrenTraversal(ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal::Both);
ValueObject* target = NULL;
const char* var_name_final_if_array_range = NULL;
size_t close_bracket_index = llvm::StringRef::npos;
diff --git a/lldb/source/DataFormatters/LibCxx.cpp b/lldb/source/DataFormatters/LibCxx.cpp
index 728ad84..5bbf53d 100644
--- a/lldb/source/DataFormatters/LibCxx.cpp
+++ b/lldb/source/DataFormatters/LibCxx.cpp
@@ -266,7 +266,7 @@
NULL,
NULL,
NULL,
- ValueObject::GetValueForExpressionPathOptions().DontCheckDotVsArrowSyntax().DontAllowSyntheticChildren(),
+ ValueObject::GetValueForExpressionPathOptions().DontCheckDotVsArrowSyntax().SetSyntheticChildrenTraversal(ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal::None),
NULL).get();
return false;
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py b/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
index 36ff60b..9c3bed1 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
@@ -14,14 +14,12 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@dsym_test
- @unittest2.expectedFailure("rdar://15630776 - Summary cannot reference non-synthetic children if synthetic children exist")
def test_with_dsym_and_run_command(self):
"""Test data formatter commands."""
self.buildDsym()
self.data_formatter_commands()
@dwarf_test
- @unittest2.expectedFailure("rdar://15630776 - Summary cannot reference non-synthetic children if synthetic children exist")
def test_with_dwarf_and_run_command(self):
"""Test data formatter commands."""
self.buildDwarf()