[Lldb-commits] [lldb] r221701 - Move a bunch of summary formatters to oneliner mode. This makes more cases eligible for oneline printing, and fixes rdar://18120906

Enrico Granata egranata at apple.com
Tue Nov 11 11:52:13 PST 2014


Author: enrico
Date: Tue Nov 11 13:52:12 2014
New Revision: 221701

URL: http://llvm.org/viewvc/llvm-project?rev=221701&view=rev
Log:
Move a bunch of summary formatters to oneliner mode. This makes more cases eligible for oneline printing, and fixes rdar://18120906

Modified:
    lldb/trunk/source/DataFormatters/FormatManager.cpp
    lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=221701&r1=221700&r2=221701&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Tue Nov 11 13:52:12 2014
@@ -919,6 +919,21 @@ AddStringSummary(TypeCategoryImpl::Share
         category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
 }
 
+static void
+AddOneLineSummary (TypeCategoryImpl::SharedPointer category_sp,
+                   ConstString type_name,
+                   TypeSummaryImpl::Flags flags,
+                   bool regex = false)
+{
+    flags.SetShowMembersOneLiner(true);
+    lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, ""));
+    
+    if (regex)
+        category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
+    else
+        category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
+}
+
 #ifndef LLDB_DISABLE_PYTHON
 static void
 AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
@@ -1261,39 +1276,33 @@ FormatManager::LoadObjCFormatters()
                      objc_flags);
 
     AddStringSummary(appkit_category_sp,
-                     "(x=${var.x}, y=${var.y})",
-                     ConstString("NSPoint"),
-                     objc_flags);
-    AddStringSummary(appkit_category_sp,
                      "location=${var.location}, length=${var.length}",
                      ConstString("NSRange"),
                      objc_flags);
     AddStringSummary(appkit_category_sp,
-                     "${var.origin}, ${var.size}",
-                     ConstString("NSRect"),
-                     objc_flags);
-    AddStringSummary(appkit_category_sp,
                      "(${var.origin}, ${var.size}), ...",
                      ConstString("NSRectArray"),
                      objc_flags);
-    AddStringSummary(appkit_category_sp,
-                     "(width=${var.width}, height=${var.height})",
-                     ConstString("NSSize"),
-                     objc_flags);
     
-    
-    AddStringSummary(coregraphics_category_sp,
-                     "(width=${var.width}, height=${var.height})",
-                     ConstString("CGSize"),
-                     objc_flags);
-    AddStringSummary(coregraphics_category_sp,
-                     "(x=${var.x}, y=${var.y})",
-                     ConstString("CGPoint"),
-                     objc_flags);
-    AddStringSummary(coregraphics_category_sp,
-                     "origin=${var.origin} size=${var.size}",
-                     ConstString("CGRect"),
-                     objc_flags);
+    AddOneLineSummary (appkit_category_sp,
+                       ConstString("NSPoint"),
+                       objc_flags);
+    AddOneLineSummary (appkit_category_sp,
+                       ConstString("NSSize"),
+                       objc_flags);
+    AddOneLineSummary (appkit_category_sp,
+                       ConstString("NSRect"),
+                       objc_flags);
+    
+    AddOneLineSummary (coregraphics_category_sp,
+                       ConstString("CGSize"),
+                       objc_flags);
+    AddOneLineSummary (coregraphics_category_sp,
+                       ConstString("CGPoint"),
+                       objc_flags);
+    AddOneLineSummary (coregraphics_category_sp,
+                       ConstString("CGRect"),
+                       objc_flags);
     
     AddStringSummary(coreservices_category_sp,
                      "red=${var.red} green=${var.green} blue=${var.blue}",

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=221701&r1=221700&r2=221701&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Tue Nov 11 13:52:12 2014
@@ -574,16 +574,14 @@ class ObjCDataFormatterTestCase(TestBase
         self.runCmd("log timers enable")
         expect_strings = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
          '(CFRange) cf_range = location=4 length=4',
-         '(NSPoint) ns_point = (x=4, y=4)',
+         '(NSPoint) ns_point = (x = 4, y = 4)',
          '(NSRange) ns_range = location=4, length=4',
-         '(NSRect *) ns_rect_ptr = (x=1, y=1), (width=5, height=5)',
-         '(NSRect) ns_rect = (x=1, y=1), (width=5, height=5)',
-         '(NSRectArray) ns_rect_arr = ((x=1, y=1), (width=5, height=5)), ...',
-         '(NSSize) ns_size = (width=5, height=7)',
-         '(NSSize *) ns_size_ptr = (width=5, height=7)',
-         '(CGSize) cg_size = (width=1, height=6)',
-         '(CGPoint) cg_point = (x=2, y=7)',
-         '(CGRect) cg_rect = origin=(x=1, y=2) size=(width=7, height=7)',
+         '(NSRect) ns_rect = (origin = (x = 1, y = 1), size = (width = 5, height = 5))',
+         '(NSRectArray) ns_rect_arr = ((x = 1, y = 1), (width = 5, height = 5)), ...',
+         '(NSSize) ns_size = (width = 5, height = 7)',
+         '(CGSize) cg_size = (width = 1, height = 6)',
+         '(CGPoint) cg_point = (x = 2, y = 7)',
+         '(CGRect) cg_rect = (origin = (x = 1, y = 2), size = (width = 7, height = 7))',
          '(Rect) rect = (t=4, l=8, b=4, r=7)',
          '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)',
          '(Point) point = (v=7, h=12)',
@@ -594,7 +592,7 @@ class ObjCDataFormatterTestCase(TestBase
          
         if self.getArchitecture() in ['i386', 'x86_64']:
             expect_strings.append('(HIPoint) hi_point = (x=7, y=12)')
-            expect_strings.append('(HIRect) hi_rect = origin=(x=3, y=5) size=(width=4, height=6)')
+            expect_strings.append('(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)')
             expect_strings.append('(RGBColor) rgb_color = red=3 green=56 blue=35')
             expect_strings.append('(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35')
             





More information about the lldb-commits mailing list