[Lldb-commits] [lldb] r180588 - Make a synthetic children provider for the ObjC Class type

Enrico Granata egranata at apple.com
Thu Apr 25 17:59:02 PDT 2013


Author: enrico
Date: Thu Apr 25 19:59:02 2013
New Revision: 180588

URL: http://llvm.org/viewvc/llvm-project?rev=180588&view=rev
Log:
Make a synthetic children provider for the ObjC Class type


Modified:
    lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h
    lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
    lldb/trunk/source/DataFormatters/FormatManager.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h?rev=180588&r1=180587&r2=180588&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h Thu Apr 25 19:59:02 2013
@@ -81,6 +81,8 @@ namespace lldb_private {
         bool
         ObjCClassSummaryProvider (ValueObject& valobj, Stream& stream);
         
+        SyntheticChildrenFrontEnd* ObjCClassSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
+        
         template<bool name_entries>
         bool
         NSDictionarySummaryProvider (ValueObject& valobj, Stream& stream);

Modified: lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp?rev=180588&r1=180587&r2=180588&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp Thu Apr 25 19:59:02 2013
@@ -761,6 +761,56 @@ lldb_private::formatters::ObjCClassSumma
     return true;
 }
 
+class ObjCClassSyntheticChildrenFrontEnd : public SyntheticChildrenFrontEnd
+{
+public:
+    ObjCClassSyntheticChildrenFrontEnd (lldb::ValueObjectSP valobj_sp) :
+    SyntheticChildrenFrontEnd(*valobj_sp.get())
+    {
+    }
+    
+    virtual size_t
+    CalculateNumChildren ()
+    {
+        return 0;
+    }
+    
+    virtual lldb::ValueObjectSP
+    GetChildAtIndex (size_t idx)
+    {
+        return lldb::ValueObjectSP();
+    }
+    
+    virtual bool
+    Update()
+    {
+        return false;
+    }
+    
+    virtual bool
+    MightHaveChildren ()
+    {
+        return false;
+    }
+    
+    virtual size_t
+    GetIndexOfChildWithName (const ConstString &name)
+    {
+        return UINT32_MAX;
+    }
+    
+    virtual
+    ~ObjCClassSyntheticChildrenFrontEnd ()
+    {
+    }
+};
+
+SyntheticChildrenFrontEnd*
+lldb_private::formatters::ObjCClassSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
+{
+    return new ObjCClassSyntheticChildrenFrontEnd(valobj_sp);
+}
+
 template<bool needs_at>
 bool
 lldb_private::formatters::NSDataSummaryProvider (ValueObject& valobj, Stream& stream)

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=180588&r1=180587&r2=180588&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Thu Apr 25 19:59:02 2013
@@ -770,6 +770,11 @@ FormatManager::LoadObjCFormatters()
     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("SEL *"), objc_flags);
     
     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCClassSummaryProvider, "Class summary provider", ConstString("Class"), objc_flags);
+    
+    SyntheticChildren::Flags class_synth_flags;
+    class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
+    
+    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::ObjCClassSyntheticFrontEndCreator, "Class synthetic children", ConstString("Class"), class_synth_flags);
 #endif // LLDB_DISABLE_PYTHON
 
     objc_flags.SetSkipPointers(false);





More information about the lldb-commits mailing list