@@ -523,7 +523,6 @@ bool DumpValueObjectOptions::PointerDepth::CanAllowExpansion() const {
523
523
}
524
524
525
525
bool ValueObjectPrinter::ShouldPrintChildren (
526
- bool is_failed_description,
527
526
DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
528
527
const bool is_ref = IsRef ();
529
528
const bool is_ptr = IsPtr ();
@@ -532,6 +531,10 @@ bool ValueObjectPrinter::ShouldPrintChildren(
532
531
if (is_uninit)
533
532
return false ;
534
533
534
+ // If we have reached the maximum depth we shouldn't print any more children.
535
+ if (HasReachedMaximumDepth ())
536
+ return false ;
537
+
535
538
// if the user has specified an element count, always print children as it is
536
539
// explicit user demand being honored
537
540
if (m_options.m_pointer_as_array )
@@ -542,38 +545,37 @@ bool ValueObjectPrinter::ShouldPrintChildren(
542
545
if (m_options.m_use_objc )
543
546
return false ;
544
547
545
- if (is_failed_description || !HasReachedMaximumDepth ()) {
546
- // We will show children for all concrete types. We won't show pointer
547
- // contents unless a pointer depth has been specified. We won't reference
548
- // contents unless the reference is the root object (depth of zero).
548
+ bool print_children = true ;
549
+ if (TypeSummaryImpl *type_summary = GetSummaryFormatter ())
550
+ print_children = type_summary->DoesPrintChildren (m_valobj);
549
551
550
- // Use a new temporary pointer depth in case we override the current
551
- // pointer depth below...
552
+ // We will show children for all concrete types. We won't show pointer
553
+ // contents unless a pointer depth has been specified. We won't reference
554
+ // contents unless the reference is the root object (depth of zero).
552
555
553
- if (is_ptr || is_ref) {
554
- // We have a pointer or reference whose value is an address. Make sure
555
- // that address is not NULL
556
- AddressType ptr_address_type;
557
- if (m_valobj->GetPointerValue (&ptr_address_type) == 0 )
558
- return false ;
556
+ // Use a new temporary pointer depth in case we override the current
557
+ // pointer depth below...
559
558
560
- const bool is_root_level = m_curr_depth == 0 ;
559
+ if (is_ptr || is_ref) {
560
+ // We have a pointer or reference whose value is an address. Make sure
561
+ // that address is not NULL
562
+ AddressType ptr_address_type;
563
+ if (m_valobj->GetPointerValue (&ptr_address_type) == 0 )
564
+ return false ;
561
565
562
- if (is_ref && is_root_level) {
563
- // If this is the root object (depth is zero) that we are showing and
564
- // it is a reference, and no pointer depth has been supplied print out
565
- // what it references. Don't do this at deeper depths otherwise we can
566
- // end up with infinite recursion...
567
- return true ;
568
- }
566
+ const bool is_root_level = m_curr_depth == 0 ;
569
567
570
- return curr_ptr_depth.CanAllowExpansion (false , entry, m_valobj,
571
- m_summary);
568
+ if (is_ref && is_root_level && print_children) {
569
+ // If this is the root object (depth is zero) that we are showing and
570
+ // it is a reference, and no pointer depth has been supplied print out
571
+ // what it references. Don't do this at deeper depths otherwise we can
572
+ // end up with infinite recursion...
573
+ return true ;
572
574
}
573
-
574
- return (!entry || entry->DoesPrintChildren (m_valobj) || m_summary.empty ());
575
+ return curr_ptr_depth.CanAllowExpansion (false , entry, m_valobj, m_summary);
575
576
}
576
- return false ;
577
+
578
+ return print_children || m_summary.empty ();
577
579
}
578
580
579
581
bool ValueObjectPrinter::ShouldExpandEmptyAggregates () {
@@ -806,14 +808,10 @@ bool ValueObjectPrinter::PrintChildrenOneLiner(bool hide_names) {
806
808
807
809
void ValueObjectPrinter::PrintChildrenIfNeeded (bool value_printed,
808
810
bool summary_printed) {
809
- // This flag controls whether we tried to display a description for this
810
- // object and failed if that happens, we want to display the children if any.
811
- bool is_failed_description =
812
- !PrintObjectDescriptionIfNeeded (value_printed, summary_printed);
811
+ PrintObjectDescriptionIfNeeded (value_printed, summary_printed);
813
812
814
813
DumpValueObjectOptions::PointerDepth curr_ptr_depth = m_ptr_depth;
815
- const bool print_children =
816
- ShouldPrintChildren (is_failed_description, curr_ptr_depth);
814
+ const bool print_children = ShouldPrintChildren (curr_ptr_depth);
817
815
const bool print_oneline =
818
816
(curr_ptr_depth.CanAllowExpansion () || m_options.m_show_types ||
819
817
!m_options.m_allow_oneliner_mode || m_options.m_flat_output ||
0 commit comments