@@ -502,7 +502,6 @@ bool DumpValueObjectOptions::PointerDepth::CanAllowExpansion() const {
502
502
}
503
503
504
504
bool ValueObjectPrinter::ShouldPrintChildren (
505
- bool is_failed_description,
506
505
DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
507
506
const bool is_ref = IsRef ();
508
507
const bool is_ptr = IsPtr ();
@@ -511,6 +510,10 @@ bool ValueObjectPrinter::ShouldPrintChildren(
511
510
if (is_uninit)
512
511
return false ;
513
512
513
+ // If we have reached the maximum depth we shouldn't print any more children.
514
+ if (HasReachedMaximumDepth ())
515
+ return false ;
516
+
514
517
// if the user has specified an element count, always print children as it is
515
518
// explicit user demand being honored
516
519
if (m_options.m_pointer_as_array )
@@ -523,37 +526,34 @@ bool ValueObjectPrinter::ShouldPrintChildren(
523
526
if (TypeSummaryImpl *type_summary = GetSummaryFormatter ())
524
527
print_children = type_summary->DoesPrintChildren (m_valobj);
525
528
526
- if (is_failed_description || !HasReachedMaximumDepth ()) {
527
- // We will show children for all concrete types. We won't show pointer
528
- // contents unless a pointer depth has been specified. We won't reference
529
- // contents unless the reference is the root object (depth of zero).
529
+ // We will show children for all concrete types. We won't show pointer
530
+ // contents unless a pointer depth has been specified. We won't reference
531
+ // contents unless the reference is the root object (depth of zero).
530
532
531
- // Use a new temporary pointer depth in case we override the current
532
- // pointer depth below...
533
+ // Use a new temporary pointer depth in case we override the current
534
+ // pointer depth below...
533
535
534
- if (is_ptr || is_ref) {
535
- // We have a pointer or reference whose value is an address. Make sure
536
- // that address is not NULL
537
- AddressType ptr_address_type;
538
- if (m_valobj->GetPointerValue (&ptr_address_type) == 0 )
539
- return false ;
536
+ if (is_ptr || is_ref) {
537
+ // We have a pointer or reference whose value is an address. Make sure
538
+ // that address is not NULL
539
+ AddressType ptr_address_type;
540
+ if (m_valobj->GetPointerValue (&ptr_address_type) == 0 )
541
+ return false ;
540
542
541
- const bool is_root_level = m_curr_depth == 0 ;
543
+ const bool is_root_level = m_curr_depth == 0 ;
542
544
543
- if (is_ref && is_root_level && print_children) {
544
- // If this is the root object (depth is zero) that we are showing and
545
- // it is a reference, and no pointer depth has been supplied print out
546
- // what it references. Don't do this at deeper depths otherwise we can
547
- // end up with infinite recursion...
548
- return true ;
549
- }
550
-
551
- return curr_ptr_depth.CanAllowExpansion ();
545
+ if (is_ref && is_root_level && print_children) {
546
+ // If this is the root object (depth is zero) that we are showing and
547
+ // it is a reference, and no pointer depth has been supplied print out
548
+ // what it references. Don't do this at deeper depths otherwise we can
549
+ // end up with infinite recursion...
550
+ return true ;
552
551
}
553
552
554
- return print_children || m_summary. empty ();
553
+ return curr_ptr_depth. CanAllowExpansion ();
555
554
}
556
- return false ;
555
+
556
+ return print_children || m_summary.empty ();
557
557
}
558
558
559
559
bool ValueObjectPrinter::ShouldExpandEmptyAggregates () {
@@ -794,14 +794,10 @@ bool ValueObjectPrinter::PrintChildrenOneLiner(bool hide_names) {
794
794
795
795
void ValueObjectPrinter::PrintChildrenIfNeeded (bool value_printed,
796
796
bool summary_printed) {
797
- // This flag controls whether we tried to display a description for this
798
- // object and failed if that happens, we want to display the children if any.
799
- bool is_failed_description =
800
- !PrintObjectDescriptionIfNeeded (value_printed, summary_printed);
797
+ PrintObjectDescriptionIfNeeded (value_printed, summary_printed);
801
798
802
799
DumpValueObjectOptions::PointerDepth curr_ptr_depth = m_ptr_depth;
803
- const bool print_children =
804
- ShouldPrintChildren (is_failed_description, curr_ptr_depth);
800
+ const bool print_children = ShouldPrintChildren (curr_ptr_depth);
805
801
const bool print_oneline =
806
802
(curr_ptr_depth.CanAllowExpansion () || m_options.m_show_types ||
807
803
!m_options.m_allow_oneliner_mode || m_options.m_flat_output ||
0 commit comments