Index: include/lldb/DataFormatters/TypeSummary.h =================================================================== --- include/lldb/DataFormatters/TypeSummary.h +++ include/lldb/DataFormatters/TypeSummary.h @@ -162,6 +162,22 @@ m_flags &= ~lldb::eTypeOptionHideChildren; return *this; } + + bool + GetHideEmptyAggregates () const + { + return (m_flags & lldb::eTypeOptionHideEmptyAggregates) == lldb::eTypeOptionHideEmptyAggregates; + } + + Flags& + SetHideEmptyAggregates (bool value = true) + { + if (value) + m_flags |= lldb::eTypeOptionHideEmptyAggregates; + else + m_flags &= ~lldb::eTypeOptionHideEmptyAggregates; + return *this; + } bool GetDontShowValue () const @@ -279,6 +295,12 @@ { return !m_flags.GetDontShowChildren(); } + + virtual bool + DoesPrintEmptyAggregates () const + { + return !m_flags.GetHideEmptyAggregates(); + } virtual bool DoesPrintValue (ValueObject* valobj) const Index: include/lldb/DataFormatters/ValueObjectPrinter.h =================================================================== --- include/lldb/DataFormatters/ValueObjectPrinter.h +++ include/lldb/DataFormatters/ValueObjectPrinter.h @@ -344,6 +344,9 @@ bool ShouldPrintChildren (bool is_failed_description, uint32_t& curr_ptr_depth); + + bool + ShouldPrintEmptyAggregates (); ValueObject* GetValueObjectForChildrenGeneration (); Index: include/lldb/lldb-enumerations.h =================================================================== --- include/lldb/lldb-enumerations.h +++ include/lldb/lldb-enumerations.h @@ -729,15 +729,16 @@ //---------------------------------------------------------------------- FLAGS_ENUM(TypeOptions) { - eTypeOptionNone = (0u), - eTypeOptionCascade = (1u << 0), - eTypeOptionSkipPointers = (1u << 1), - eTypeOptionSkipReferences = (1u << 2), - eTypeOptionHideChildren = (1u << 3), - eTypeOptionHideValue = (1u << 4), - eTypeOptionShowOneLiner = (1u << 5), - eTypeOptionHideNames = (1u << 6), - eTypeOptionNonCacheable = (1u << 7) + eTypeOptionNone = (0u), + eTypeOptionCascade = (1u << 0), + eTypeOptionSkipPointers = (1u << 1), + eTypeOptionSkipReferences = (1u << 2), + eTypeOptionHideChildren = (1u << 3), + eTypeOptionHideValue = (1u << 4), + eTypeOptionShowOneLiner = (1u << 5), + eTypeOptionHideNames = (1u << 6), + eTypeOptionNonCacheable = (1u << 7), + eTypeOptionHideEmptyAggregates = (1u << 8) }; //---------------------------------------------------------------------- Index: source/DataFormatters/ValueObjectPrinter.cpp =================================================================== --- source/DataFormatters/ValueObjectPrinter.cpp +++ source/DataFormatters/ValueObjectPrinter.cpp @@ -480,6 +480,17 @@ return false; } +bool +ValueObjectPrinter::ShouldPrintEmptyAggregates () +{ + TypeSummaryImpl* entry = GetSummaryFormatter(); + + if (!entry) + return true; + + return entry->DoesPrintEmptyAggregates(); +} + ValueObject* ValueObjectPrinter::GetValueObjectForChildrenGeneration () { @@ -582,7 +593,7 @@ if (ShouldPrintValueObject()) { // if it has a synthetic value, then don't print {}, the synthetic children are probably only being used to vend a value - if (m_valobj->DoesProvideSyntheticValue()) + if (m_valobj->DoesProvideSyntheticValue() || !ShouldPrintEmptyAggregates()) m_stream->PutCString( "\n"); else m_stream->PutCString(" {}\n");