[Lldb-commits] [lldb] r192233 - <rdar://problem/12632394>

Enrico Granata egranata at apple.com
Tue Oct 8 13:59:02 PDT 2013


Author: enrico
Date: Tue Oct  8 15:59:02 2013
New Revision: 192233

URL: http://llvm.org/viewvc/llvm-project?rev=192233&view=rev
Log:
<rdar://problem/12632394>

Add a format for FourCharCode

This is now safe to do thanks to the "formats in categories" feature


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=192233&r1=192232&r2=192233&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Tue Oct  8 15:59:02 2013
@@ -563,6 +563,22 @@ FormatManager::FormatManager() :
 }
 
 static void
+AddFormat (TypeCategoryImpl::SharedPointer category_sp,
+           lldb::Format format,
+           ConstString type_name,
+           TypeFormatImpl::Flags flags,
+           bool regex = false)
+{
+    lldb::TypeFormatImplSP format_sp(new TypeFormatImpl(format, flags));
+    
+    if (regex)
+        category_sp->GetRegexValueNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),format_sp);
+    else
+        category_sp->GetValueNavigator()->Add(type_name, format_sp);
+}
+
+
+static void
 AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
                  const char* string,
                  ConstString type_name,
@@ -854,6 +870,11 @@ FormatManager::LoadSystemFormatters()
 
     AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "unichar summary provider", ConstString("unichar"), widechar_flags);
     
+    TypeFormatImpl::Flags fourchar_flags;
+    fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(true);
+    
+    AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"), fourchar_flags);
+    
 #endif
 }
 





More information about the lldb-commits mailing list