Extend the TypeSystem's ShouldPrintAsOneLiner implementation so that the ValueObject itself also gets a say in the process; NFC

llvm-svn: 252516
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 1283893..2362ba5 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -568,7 +568,7 @@
     CompilerType compiler_type(valobj.GetCompilerType());
     if (compiler_type.IsValid())
     {
-        switch (compiler_type.ShouldPrintAsOneLiner())
+        switch (compiler_type.ShouldPrintAsOneLiner(&valobj))
         {
             case eLazyBoolNo:
                 return false;
@@ -590,6 +590,23 @@
         // something is wrong here - bail out
         if (!child_sp)
             return false;
+        
+        // also ask the child's type if it has any opinion
+        CompilerType child_compiler_type(child_sp->GetCompilerType());
+        if (child_compiler_type.IsValid())
+        {
+            switch (child_compiler_type.ShouldPrintAsOneLiner(child_sp.get()))
+            {
+                case eLazyBoolYes:
+                    // an opinion of yes is only binding for the child, so keep going
+                case eLazyBoolCalculate:
+                    break;
+                case eLazyBoolNo:
+                    // but if the child says no, then it's a veto on the whole thing
+                    return false;
+            }
+        }
+        
         // if we decided to define synthetic children for a type, we probably care enough
         // to show them, but avoid nesting children in children
         if (child_sp->GetSyntheticChildren().get() != nullptr)