summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp59
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py18
2 files changed, 42 insertions, 35 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index cfd6e0cdffe..aac3932bc28 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -919,6 +919,21 @@ AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
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}",
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
index fd0016b36e3..82314355c9d 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
@@ -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')
OpenPOWER on IntegriCloud