[Lldb-commits] [lldb] r193218 - One should actually not do one-line printing of nested aggregates even if they are not the base class

Enrico Granata egranata at apple.com
Tue Oct 22 18:34:31 PDT 2013


Author: enrico
Date: Tue Oct 22 20:34:31 2013
New Revision: 193218

URL: http://llvm.org/viewvc/llvm-project?rev=193218&view=rev
Log:
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 :)

Modified:
    lldb/trunk/source/DataFormatters/FormatManager.cpp

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=193218&r1=193217&r2=193218&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Tue Oct 22 20:34:31 2013
@@ -374,18 +374,14 @@ FormatManager::ShouldPrintAsOneLiner (Va
                 return false;
         }
         
-        // if there is a base-class...
-        if (child_sp->IsBaseClass())
+        // if this child has children..
+        if (child_sp->GetNumChildren())
         {
-            // and it has children..
-            if (child_sp->GetNumChildren())
-            {
-                // ...and no summary...
-                // (if it had a summary and the summary wanted children, we would have bailed out anyway
-                //  so this only makes us bail out if this has no summary and we would then print children)
-                if (!child_sp->GetSummaryFormat())
-                    return false; // then bail out
-            }
+            // ...and no summary...
+            // (if it had a summary and the summary wanted children, we would have bailed out anyway
+            //  so this only makes us bail out if this has no summary and we would then print children)
+            if (!child_sp->GetSummaryFormat())
+                return false; // then bail out
         }
     }
     return true;





More information about the lldb-commits mailing list