Skip to content

Commit c89e4ca

Browse files
author
Enrico Granata
committed
One should actually not do one-line printing of nested aggregates even if they are not the base class
This check was overly strict. Relax it. While one could conceivably want nested one-lining: (Foo) aFoo = (x = 1, y = (t = 3, q = “Hello), z = 3.14) the spirit of this feature is mostly to make *SMALL LINEAR* structs come out more compact. Aggregates with children and no summary for now just disable the one-lining. Define a one-liner summary to override :) llvm-svn: 193218
1 parent 133ac87 commit c89e4ca

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lldb/source/DataFormatters/FormatManager.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,14 @@ FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj)
374374
return false;
375375
}
376376

377-
// if there is a base-class...
378-
if (child_sp->IsBaseClass())
377+
// if this child has children..
378+
if (child_sp->GetNumChildren())
379379
{
380-
// and it has children..
381-
if (child_sp->GetNumChildren())
382-
{
383-
// ...and no summary...
384-
// (if it had a summary and the summary wanted children, we would have bailed out anyway
385-
// so this only makes us bail out if this has no summary and we would then print children)
386-
if (!child_sp->GetSummaryFormat())
387-
return false; // then bail out
388-
}
380+
// ...and no summary...
381+
// (if it had a summary and the summary wanted children, we would have bailed out anyway
382+
// so this only makes us bail out if this has no summary and we would then print children)
383+
if (!child_sp->GetSummaryFormat())
384+
return false; // then bail out
389385
}
390386
}
391387
return true;

0 commit comments

Comments
 (0)