Move a bunch of summary formatters to oneliner mode. This makes more cases eligible for oneline printing, and fixes rdar://18120906

llvm-svn: 221701
This commit is contained in:
Enrico Granata 2014-11-11 19:52:12 +00:00
parent a9c28b68cd
commit 944547deab
2 changed files with 41 additions and 34 deletions

View File

@ -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,
@ -1260,40 +1275,34 @@ FormatManager::LoadObjCFormatters()
ConstString("CFRange"),
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);
AddOneLineSummary (appkit_category_sp,
ConstString("NSPoint"),
objc_flags);
AddOneLineSummary (appkit_category_sp,
ConstString("NSSize"),
objc_flags);
AddOneLineSummary (appkit_category_sp,
ConstString("NSRect"),
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 (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}",

View File

@ -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')