[Lldb-commits] [lldb] r138279 - in /lldb/trunk: include/lldb/Core/DataVisualization.h include/lldb/Core/FormatManager.h lldb.xcodeproj/project.pbxproj source/Commands/CommandObjectFrame.cpp source/Commands/CommandObjectType.cpp source/Core/DataVisualization.cpp source/Core/FormatManager.cpp source/Core/ValueObject.cpp source/Interpreter/CommandObjectScript.cpp

Enrico Granata granata.enrico at gmail.com
Mon Aug 22 15:03:47 PDT 2011


Author: enrico
Date: Mon Aug 22 17:03:47 2011
New Revision: 138279

URL: http://llvm.org/viewvc/llvm-project?rev=138279&view=rev
Log:
More cleanups ; Separated implementation of FormatManager from class DataVisualization as a front-end by using separate .h/.cpp files - Final aim is to break up FormatManager.h/cpp into several separate files

Added:
    lldb/trunk/include/lldb/Core/DataVisualization.h
    lldb/trunk/source/Core/DataVisualization.cpp
Modified:
    lldb/trunk/include/lldb/Core/FormatManager.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Commands/CommandObjectType.cpp
    lldb/trunk/source/Core/FormatManager.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Interpreter/CommandObjectScript.cpp

Added: lldb/trunk/include/lldb/Core/DataVisualization.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataVisualization.h?rev=138279&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Core/DataVisualization.h (added)
+++ lldb/trunk/include/lldb/Core/DataVisualization.h Mon Aug 22 17:03:47 2011
@@ -0,0 +1,144 @@
+//===-- DataVisualization.h ----------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_DataVisualization_h_
+#define lldb_DataVisualization_h_
+
+// C Includes
+// C++ Includes
+
+// <locale> is not strictly-speaking a requirement for DataVisualization.h
+// but including it ensures a smooth compilation of STLUtils.h. if <locale>
+// is not included, a macro definition of isspace() and other cctype functions occurs
+// which prevents <ostream> from getting included correctly. at least, this is what
+// happens on OSX Lion. If other OSs don't have this side effect, you may want to
+// #if defined (__APPLE__) this include directive
+#include <locale>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-forward-rtti.h"
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/FormatClasses.h"
+#include "lldb/Core/FormatManager.h"
+
+namespace lldb_private {
+
+// this class is the high-level front-end of LLDB Data Visualization
+// code in FormatManager.h/cpp is the low-level implementation of this feature
+// clients should refer to this class as the entry-point into the data formatters
+// unless they have a good reason to bypass this and go to the backend
+class DataVisualization
+{
+public:
+    
+    // use this call to force the FM to consider itself updated even when there is no apparent reason for that
+    static void
+    ForceUpdate();
+    
+    static uint32_t
+    GetCurrentRevision ();
+    
+    class ValueFormats
+    {
+    public:
+        static bool
+        Get (ValueObject& valobj, lldb::DynamicValueType use_dynamic, lldb::ValueFormatSP &entry);
+        
+        static void
+        Add (const ConstString &type, const lldb::ValueFormatSP &entry);
+        
+        static bool
+        Delete (const ConstString &type);
+        
+        static void
+        Clear ();
+        
+        static void
+        LoopThrough (ValueFormat::ValueCallback callback, void* callback_baton);
+        
+        static uint32_t
+        GetCount ();
+    };
+    
+    static bool
+    GetSummaryFormat(ValueObject& valobj,
+                     lldb::DynamicValueType use_dynamic,
+                     lldb::SummaryFormatSP& entry);
+    static bool
+    GetSyntheticChildren(ValueObject& valobj,
+                         lldb::DynamicValueType use_dynamic,
+                         lldb::SyntheticChildrenSP& entry);
+    
+    static bool
+    AnyMatches(ConstString type_name,
+               FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
+               bool only_enabled = true,
+               const char** matching_category = NULL,
+               FormatCategory::FormatCategoryItems* matching_type = NULL);
+    
+    class NamedSummaryFormats
+    {
+    public:
+        static bool
+        Get (const ConstString &type, lldb::SummaryFormatSP &entry);
+        
+        static void
+        Add (const ConstString &type, const lldb::SummaryFormatSP &entry);
+        
+        static bool
+        Delete (const ConstString &type);
+        
+        static void
+        Clear ();
+        
+        static void
+        LoopThrough (SummaryFormat::SummaryCallback callback, void* callback_baton);
+        
+        static uint32_t
+        GetCount ();
+    };
+    
+    class Categories
+    {
+    public:
+        
+        static bool
+        Get (const ConstString &category, lldb::FormatCategorySP &entry);
+        
+        static void
+        Add (const ConstString &category);
+        
+        static bool
+        Delete (const ConstString &category);
+        
+        static void
+        Clear ();
+        
+        static void
+        Clear (ConstString &category);
+        
+        static void
+        Enable (ConstString& category);
+        
+        static void
+        Disable (ConstString& category);
+        
+        static void
+        LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
+        
+        static uint32_t
+        GetCount ();
+    };
+};
+
+    
+} // namespace lldb_private
+
+#endif	// lldb_DataVisualization_h_

Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=138279&r1=138278&r2=138279&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Mon Aug 22 17:03:47 2011
@@ -65,6 +65,10 @@
 
 namespace lldb_private {
     
+// this file (and its. cpp) contain the low-level implementation of LLDB Data Visualization
+// class DataVisualization is the high-level front-end of this feature
+// clients should refer to that class as the entry-point into the data formatters
+// unless they have a good reason to bypass it and prefer to use this file's objects directly
 class IFormatChangeListener
 {
 public:
@@ -137,7 +141,7 @@
     typedef typename MapType::iterator MapIterator;
     typedef bool(*CallbackType)(void*, KeyType, const ValueSP&);
     
-    FormatMap(IFormatChangeListener* lst = NULL) :
+    FormatMap(IFormatChangeListener* lst) :
     m_map(),
     m_map_mutex(Mutex::eMutexTypeRecursive),
     listener(lst)
@@ -258,7 +262,7 @@
     friend class FormatCategory;
 
     FormatNavigator(std::string name,
-                    IFormatChangeListener* lst = NULL) :
+                    IFormatChangeListener* lst) :
     m_format_map(lst),
     m_name(name),
     m_id_cs(ConstString("id"))
@@ -713,15 +717,19 @@
 
 public:
     
-    enum FormatCategoryItem
+    //------------------------------------------------------------------
+    /// Format category entry types
+    //------------------------------------------------------------------    
+    typedef enum FormatCategoryItem
     {
         eSummary =         0x0001,
         eRegexSummary =    0x1001,
         eFilter =          0x0002,
         eRegexFilter =     0x1002,
         eSynth =           0x0004,
-        eRegexSynth =      0x1004
-    };
+        eRegexSynth =      0x1004,
+        eAllItems =        0xFFFF
+    } FormatCategoryItem;
     
     typedef uint16_t FormatCategoryItems;
     static const uint16_t ALL_ITEM_TYPES = 0xFFFF;
@@ -816,60 +824,14 @@
     
     
     void
-    Clear (FormatCategoryItems items = ALL_ITEM_TYPES)
-    {
-        if ( (items & eSummary) == eSummary )
-            m_summary_nav->Clear();
-        if ( (items & eRegexSummary) == eRegexSummary )
-            m_regex_summary_nav->Clear();
-        if ( (items & eFilter)  == eFilter )
-            m_filter_nav->Clear();
-        if ( (items & eRegexFilter) == eRegexFilter )
-            m_regex_filter_nav->Clear();
-        if ( (items & eSynth)  == eSynth )
-            m_synth_nav->Clear();
-        if ( (items & eRegexSynth) == eRegexSynth )
-            m_regex_synth_nav->Clear();
-    }
+    Clear (FormatCategoryItems items = ALL_ITEM_TYPES);
     
     bool
-    Delete(ConstString name,
-           FormatCategoryItems items = ALL_ITEM_TYPES)
-    {
-        bool success = false;
-        if ( (items & eSummary) == eSummary )
-            success = m_summary_nav->Delete(name) || success;
-        if ( (items & eRegexSummary) == eRegexSummary )
-            success = m_regex_summary_nav->Delete(name) || success;
-        if ( (items & eFilter)  == eFilter )
-            success = m_filter_nav->Delete(name) || success;
-        if ( (items & eRegexFilter) == eRegexFilter )
-            success = m_regex_filter_nav->Delete(name) || success;
-        if ( (items & eSynth)  == eSynth )
-            success = m_synth_nav->Delete(name) || success;
-        if ( (items & eRegexSynth) == eRegexSynth )
-            success = m_regex_synth_nav->Delete(name) || success;
-        return success;
-    }
+    Delete (ConstString name,
+            FormatCategoryItems items = ALL_ITEM_TYPES);
     
     uint32_t
-    GetCount (FormatCategoryItems items = ALL_ITEM_TYPES)
-    {
-        uint32_t count = 0;
-        if ( (items & eSummary) == eSummary )
-            count += m_summary_nav->GetCount();
-        if ( (items & eRegexSummary) == eRegexSummary )
-            count += m_regex_summary_nav->GetCount();
-        if ( (items & eFilter)  == eFilter )
-            count += m_filter_nav->GetCount();
-        if ( (items & eRegexFilter) == eRegexFilter )
-            count += m_regex_filter_nav->GetCount();
-        if ( (items & eSynth)  == eSynth )
-            count += m_synth_nav->GetCount();
-        if ( (items & eRegexSynth) == eRegexSynth )
-            count += m_regex_synth_nav->GetCount();
-        return count;
-    }
+    GetCount (FormatCategoryItems items = ALL_ITEM_TYPES);
     
     std::string
     GetName ()
@@ -945,7 +907,7 @@
     typedef MapType::iterator MapIterator;
     typedef bool(*CallbackType)(void*, const ValueSP&);
     
-    CategoryMap(IFormatChangeListener* lst = NULL) :
+    CategoryMap(IFormatChangeListener* lst) :
     m_map_mutex(Mutex::eMutexTypeRecursive),
     listener(lst),
     m_map(),
@@ -971,14 +933,14 @@
         if (iter == m_map.end())
             return false;
         m_map.erase(name);
-        DisableCategory(name);
+        Disable(name);
         if (listener)
             listener->Changed();
         return true;
     }
     
     void
-    EnableCategory (KeyType category_name)
+    Enable (KeyType category_name)
     {
         Mutex::Locker(m_map_mutex);
         ValueSP category;
@@ -1002,7 +964,7 @@
     };
     
     void
-    DisableCategory (KeyType category_name)
+    Disable (KeyType category_name)
     {
         Mutex::Locker(m_map_mutex);
         ValueSP category;
@@ -1136,7 +1098,6 @@
     friend class FormatManager;
 };
 
-
 class FormatManager : public IFormatChangeListener
 {
 private:
@@ -1153,20 +1114,14 @@
     
     FormatManager ();
     
-    CategoryMap&
-    Categories ()
-    {
-        return m_categories_map;
-    }
-    
     ValueNavigator&
-    Value ()
+    GetValueNavigator ()
     {
         return m_value_nav;
     }
     
     NamedSummariesMap&
-    NamedSummary ()
+    GetNamedSummaryNavigator ()
     {
         return m_named_summaries_map;
     }
@@ -1174,13 +1129,13 @@
     void
     EnableCategory (const ConstString& category_name)
     {
-        m_categories_map.EnableCategory(category_name);
+        m_categories_map.Enable(category_name);
     }
     
     void
     DisableCategory (const ConstString& category_name)
     {
-        m_categories_map.DisableCategory(category_name);
+        m_categories_map.Disable(category_name);
     }
     
     void
@@ -1201,20 +1156,9 @@
         m_categories_map.LoopThrough(callback, param);
     }
     
-    FormatCategory::SummaryNavigatorSP
-    Summary(const char* category_name = NULL)
-    {
-        return Category(category_name)->GetSummaryNavigator();
-    }
-    
-    FormatCategory::RegexSummaryNavigatorSP
-    RegexSummary (const char* category_name = NULL)
-    {
-        return Category(category_name)->GetRegexSummaryNavigator();
-    }
-    
     lldb::FormatCategorySP
-    Category (const char* category_name = NULL)
+    Category (const char* category_name = NULL,
+              bool can_create = true)
     {
         if (!category_name)
             return Category(m_default_category_name);
@@ -1222,14 +1166,19 @@
     }
     
     lldb::FormatCategorySP
-    Category (const ConstString& category_name)
+    Category (const ConstString& category_name,
+              bool can_create = true)
     {
         if (!category_name)
             return Category(m_default_category_name);
         lldb::FormatCategorySP category;
         if (m_categories_map.Get(category_name, category))
             return category;
-        Categories().Add(category_name,lldb::FormatCategorySP(new FormatCategory(this, category_name.AsCString())));
+        
+        if (!can_create)
+            return lldb::FormatCategorySP();
+        
+        m_categories_map.Add(category_name,lldb::FormatCategorySP(new FormatCategory(this, category_name.AsCString())));
         return Category(category_name);
     }
     
@@ -1300,6 +1249,12 @@
     ~FormatManager ()
     {
     }
+    
+    CategoryMap&
+    GetCategories ()
+    {
+        return m_categories_map;
+    }
 
 private:    
     ValueNavigator m_value_nav;
@@ -1310,112 +1265,8 @@
     ConstString m_default_category_name;
     ConstString m_system_category_name;
     ConstString m_gnu_cpp_category_name;
-};
-
-class DataVisualization
-{
-public:
-    
-    // use this call to force the FM to consider itself updated even when there is no apparent reason for that
-    static void
-    ForceUpdate();
     
-    static uint32_t
-    GetCurrentRevision ();
-    
-    class ValueFormats
-    {
-    public:
-        static bool
-        Get (ValueObject& valobj, lldb::DynamicValueType use_dynamic, lldb::ValueFormatSP &entry);
-        
-        static void
-        Add (const ConstString &type, const lldb::ValueFormatSP &entry);
-        
-        static bool
-        Delete (const ConstString &type);
-        
-        static void
-        Clear ();
-        
-        static void
-        LoopThrough (ValueFormat::ValueCallback callback, void* callback_baton);
-        
-        static uint32_t
-        GetCount ();
-    };
-    
-    static bool
-    GetSummaryFormat(ValueObject& valobj,
-                     lldb::DynamicValueType use_dynamic,
-                     lldb::SummaryFormatSP& entry);
-    static bool
-    GetSyntheticChildren(ValueObject& valobj,
-                         lldb::DynamicValueType use_dynamic,
-                         lldb::SyntheticChildrenSP& entry);
-    
-    static bool
-    AnyMatches(ConstString type_name,
-               FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
-               bool only_enabled = true,
-               const char** matching_category = NULL,
-               FormatCategory::FormatCategoryItems* matching_type = NULL);
-    
-    class NamedSummaryFormats
-    {
-    public:
-        static bool
-        Get (const ConstString &type, lldb::SummaryFormatSP &entry);
-        
-        static void
-        Add (const ConstString &type, const lldb::SummaryFormatSP &entry);
-        
-        static bool
-        Delete (const ConstString &type);
-        
-        static void
-        Clear ();
-        
-        static void
-        LoopThrough (SummaryFormat::SummaryCallback callback, void* callback_baton);
-        
-        static uint32_t
-        GetCount ();
-    };
-    
-    class Categories
-    {
-    public:
-        
-        static bool
-        Get (const ConstString &category, lldb::FormatCategorySP &entry);
-        
-        static void
-        Add (const ConstString &category);
-        
-        static bool
-        Delete (const ConstString &category);
-        
-        static void
-        Clear ();
-        
-        static void
-        Clear (ConstString &category);
-        
-        static void
-        Enable (ConstString& category);
-        
-        static void
-        Disable (ConstString& category);
-        
-        static void
-        LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
-        
-        static uint32_t
-        GetCount ();
-    };
 };
-
     
 } // namespace lldb_private
 

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=138279&r1=138278&r2=138279&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Aug 22 17:03:47 2011
@@ -409,6 +409,7 @@
 		94611EB213CCA4A4003A22AF /* RefCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94611EB113CCA4A4003A22AF /* RefCounter.cpp */; };
 		9463D4CD13B1798800C230D4 /* CommandObjectType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9463D4CC13B1798800C230D4 /* CommandObjectType.cpp */; };
 		9467E65213C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */; };
+		9470A8F01402DFFB0056FF61 /* DataVisualization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9470A8EF1402DFFB0056FF61 /* DataVisualization.cpp */; };
 		94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */; };
 		9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
@@ -1187,6 +1188,8 @@
 		9463D4CE13B179A500C230D4 /* CommandObjectType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommandObjectType.h; path = source/Commands/CommandObjectType.h; sourceTree = "<group>"; };
 		9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeHierarchyNavigator.cpp; path = source/Symbol/TypeHierarchyNavigator.cpp; sourceTree = "<group>"; };
 		9467E65413C3D98900B3B6F3 /* TypeHierarchyNavigator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeHierarchyNavigator.h; path = include/lldb/Symbol/TypeHierarchyNavigator.h; sourceTree = "<group>"; };
+		9470A8EE1402DF940056FF61 /* DataVisualization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DataVisualization.h; path = include/lldb/Core/DataVisualization.h; sourceTree = "<group>"; };
+		9470A8EF1402DFFB0056FF61 /* DataVisualization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataVisualization.cpp; path = source/Core/DataVisualization.cpp; sourceTree = "<group>"; };
 		94A9112B13D5DEF80046D8A6 /* FormatClasses.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatClasses.h; path = include/lldb/Core/FormatClasses.h; sourceTree = "<group>"; };
 		94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FormatClasses.cpp; path = source/Core/FormatClasses.cpp; sourceTree = "<group>"; };
 		94B6E76013D8833C005F417F /* ValueObjectSyntheticFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectSyntheticFilter.h; path = include/lldb/Core/ValueObjectSyntheticFilter.h; sourceTree = "<group>"; };
@@ -1916,6 +1919,8 @@
 				26BC7E7310F1B85900F91463 /* DataBufferMemoryMap.cpp */,
 				26BC7D5A10F1B77400F91463 /* DataExtractor.h */,
 				26BC7E7110F1B85900F91463 /* DataExtractor.cpp */,
+				9470A8EE1402DF940056FF61 /* DataVisualization.h */,
+				9470A8EF1402DFFB0056FF61 /* DataVisualization.cpp */,
 				263664941140A4C10075843B /* Debugger.h */,
 				263664921140A4930075843B /* Debugger.cpp */,
 				26BC7D5E10F1B77400F91463 /* Disassembler.h */,
@@ -3294,6 +3299,7 @@
 				266DFE9413FD64D200D0C574 /* OperatingSystemMacOSXKernel.cpp in Sources */,
 				266DFE9713FD656E00D0C574 /* OperatingSystem.cpp in Sources */,
 				26954EBE1401EE8B00294D09 /* DynamicRegisterInfo.cpp in Sources */,
+				9470A8F01402DFFB0056FF61 /* DataVisualization.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=138279&r1=138278&r2=138279&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Mon Aug 22 17:03:47 2011
@@ -13,8 +13,8 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Core/DataVisualization.h"
 #include "lldb/Core/Debugger.h"
-#include "lldb/Core/FormatManager.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/Timer.h"

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=138279&r1=138278&r2=138279&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Aug 22 17:03:47 2011
@@ -15,9 +15,9 @@
 
 // C++ Includes
 
+#include "lldb/Core/DataVisualization.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Debugger.h"
-#include "lldb/Core/FormatManager.h"
 #include "lldb/Core/InputReaderEZ.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/State.h"

Added: lldb/trunk/source/Core/DataVisualization.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataVisualization.cpp?rev=138279&view=auto
==============================================================================
--- lldb/trunk/source/Core/DataVisualization.cpp (added)
+++ lldb/trunk/source/Core/DataVisualization.cpp Mon Aug 22 17:03:47 2011
@@ -0,0 +1,203 @@
+//===-- DataVisualization.cpp ---------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Core/DataVisualization.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+#include "lldb/Core/Debugger.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static FormatManager&
+GetFormatManager()
+{
+    static FormatManager g_format_manager;
+    return g_format_manager;
+}
+
+void
+DataVisualization::ForceUpdate()
+{
+    GetFormatManager().Changed();
+}
+
+uint32_t
+DataVisualization::GetCurrentRevision ()
+{
+    return GetFormatManager().GetCurrentRevision();
+}
+
+bool
+DataVisualization::ValueFormats::Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, lldb::ValueFormatSP &entry)
+{
+    return GetFormatManager().GetValueNavigator().Get(valobj,entry, use_dynamic);
+}
+
+void
+DataVisualization::ValueFormats::Add(const ConstString &type, const lldb::ValueFormatSP &entry)
+{
+    GetFormatManager().GetValueNavigator().Add(FormatManager::GetValidTypeName(type),entry);
+}
+
+bool
+DataVisualization::ValueFormats::Delete(const ConstString &type)
+{
+    return GetFormatManager().GetValueNavigator().Delete(type);
+}
+
+void
+DataVisualization::ValueFormats::Clear()
+{
+    GetFormatManager().GetValueNavigator().Clear();
+}
+
+void
+DataVisualization::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
+{
+    GetFormatManager().GetValueNavigator().LoopThrough(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::ValueFormats::GetCount()
+{
+    return GetFormatManager().GetValueNavigator().GetCount();
+}
+
+bool
+DataVisualization::GetSummaryFormat(ValueObject& valobj,
+                                       lldb::DynamicValueType use_dynamic,
+                                       lldb::SummaryFormatSP& entry)
+{
+    return GetFormatManager().Get(valobj, entry, use_dynamic);
+}
+bool
+DataVisualization::GetSyntheticChildren(ValueObject& valobj,
+                                           lldb::DynamicValueType use_dynamic,
+                                           lldb::SyntheticChildrenSP& entry)
+{
+    return GetFormatManager().Get(valobj, entry, use_dynamic);
+}
+
+bool
+DataVisualization::AnyMatches(ConstString type_name,
+                                 FormatCategory::FormatCategoryItems items,
+                                 bool only_enabled,
+                                 const char** matching_category,
+                                 FormatCategory::FormatCategoryItems* matching_type)
+{
+    return GetFormatManager().AnyMatches(type_name,
+                                         items,
+                                         only_enabled,
+                                         matching_category,
+                                         matching_type);
+}
+
+bool
+DataVisualization::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
+{
+    entry = GetFormatManager().Category(category);
+    return true;
+}
+
+void
+DataVisualization::Categories::Add(const ConstString &category)
+{
+    GetFormatManager().Category(category);
+}
+
+bool
+DataVisualization::Categories::Delete(const ConstString &category)
+{
+    GetFormatManager().DisableCategory(category);
+    return GetFormatManager().GetCategories().Delete(category);
+}
+
+void
+DataVisualization::Categories::Clear()
+{
+    GetFormatManager().GetCategories().Clear();
+}
+
+void
+DataVisualization::Categories::Clear(ConstString &category)
+{
+    GetFormatManager().Category(category)->ClearSummaries();
+}
+
+void
+DataVisualization::Categories::Enable(ConstString& category)
+{
+    if (GetFormatManager().Category(category)->IsEnabled() == false)
+        GetFormatManager().EnableCategory(category);
+    else
+    {
+        GetFormatManager().DisableCategory(category);
+        GetFormatManager().EnableCategory(category);
+    }
+}
+
+void
+DataVisualization::Categories::Disable(ConstString& category)
+{
+    if (GetFormatManager().Category(category)->IsEnabled() == true)
+        GetFormatManager().DisableCategory(category);
+}
+
+void
+DataVisualization::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
+{
+    GetFormatManager().LoopThroughCategories(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::Categories::GetCount()
+{
+    return GetFormatManager().GetCategories().GetCount();
+}
+
+bool
+DataVisualization::NamedSummaryFormats::Get(const ConstString &type, lldb::SummaryFormatSP &entry)
+{
+    return GetFormatManager().GetNamedSummaryNavigator().Get(type,entry);
+}
+
+void
+DataVisualization::NamedSummaryFormats::Add(const ConstString &type, const lldb::SummaryFormatSP &entry)
+{
+    GetFormatManager().GetNamedSummaryNavigator().Add(FormatManager::GetValidTypeName(type),entry);
+}
+
+bool
+DataVisualization::NamedSummaryFormats::Delete(const ConstString &type)
+{
+    return GetFormatManager().GetNamedSummaryNavigator().Delete(type);
+}
+
+void
+DataVisualization::NamedSummaryFormats::Clear()
+{
+    GetFormatManager().GetNamedSummaryNavigator().Clear();
+}
+
+void
+DataVisualization::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
+{
+    GetFormatManager().GetNamedSummaryNavigator().LoopThrough(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::NamedSummaryFormats::GetCount()
+{
+    return GetFormatManager().GetNamedSummaryNavigator().GetCount();
+}
\ No newline at end of file

Modified: lldb/trunk/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=138279&r1=138278&r2=138279&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Mon Aug 22 17:03:47 2011
@@ -225,6 +225,62 @@
     }
 }
 
+void
+FormatCategory::Clear (FormatCategoryItems items)
+{
+    if ( (items & eSummary) == eSummary )
+        m_summary_nav->Clear();
+    if ( (items & eRegexSummary) == eRegexSummary )
+        m_regex_summary_nav->Clear();
+    if ( (items & eFilter)  == eFilter )
+        m_filter_nav->Clear();
+    if ( (items & eRegexFilter) == eRegexFilter )
+        m_regex_filter_nav->Clear();
+    if ( (items & eSynth)  == eSynth )
+        m_synth_nav->Clear();
+    if ( (items & eRegexSynth) == eRegexSynth )
+        m_regex_synth_nav->Clear();
+}
+
+bool
+FormatCategory::Delete (ConstString name,
+                        FormatCategoryItems items)
+{
+    bool success = false;
+    if ( (items & eSummary) == eSummary )
+        success = m_summary_nav->Delete(name) || success;
+    if ( (items & eRegexSummary) == eRegexSummary )
+        success = m_regex_summary_nav->Delete(name) || success;
+    if ( (items & eFilter)  == eFilter )
+        success = m_filter_nav->Delete(name) || success;
+    if ( (items & eRegexFilter) == eRegexFilter )
+        success = m_regex_filter_nav->Delete(name) || success;
+    if ( (items & eSynth)  == eSynth )
+        success = m_synth_nav->Delete(name) || success;
+    if ( (items & eRegexSynth) == eRegexSynth )
+        success = m_regex_synth_nav->Delete(name) || success;
+    return success;
+}
+
+uint32_t
+FormatCategory::GetCount (FormatCategoryItems items)
+{
+    uint32_t count = 0;
+    if ( (items & eSummary) == eSummary )
+        count += m_summary_nav->GetCount();
+    if ( (items & eRegexSummary) == eRegexSummary )
+        count += m_regex_summary_nav->GetCount();
+    if ( (items & eFilter)  == eFilter )
+        count += m_filter_nav->GetCount();
+    if ( (items & eRegexFilter) == eRegexFilter )
+        count += m_regex_filter_nav->GetCount();
+    if ( (items & eSynth)  == eSynth )
+        count += m_synth_nav->GetCount();
+    if ( (items & eRegexSynth) == eRegexSynth )
+        count += m_regex_synth_nav->GetCount();
+    return count;
+}
+
 bool
 FormatCategory::AnyMatches(ConstString type_name,
                            FormatCategoryItems items,
@@ -458,187 +514,4 @@
     EnableCategory(m_gnu_cpp_category_name);
     EnableCategory(m_default_category_name);
     
-}
-
-static FormatManager&
-GetFormatManager()
-{
-    static FormatManager g_format_manager;
-    return g_format_manager;
-}
-
-void
-DataVisualization::ForceUpdate()
-{
-    GetFormatManager().Changed();
-}
-
-uint32_t
-DataVisualization::GetCurrentRevision ()
-{
-    return GetFormatManager().GetCurrentRevision();
-}
-
-bool
-DataVisualization::ValueFormats::Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, lldb::ValueFormatSP &entry)
-{
-    return GetFormatManager().Value().Get(valobj,entry, use_dynamic);
-}
-
-void
-DataVisualization::ValueFormats::Add(const ConstString &type, const lldb::ValueFormatSP &entry)
-{
-    GetFormatManager().Value().Add(FormatManager::GetValidTypeName(type),entry);
-}
-
-bool
-DataVisualization::ValueFormats::Delete(const ConstString &type)
-{
-    return GetFormatManager().Value().Delete(type);
-}
-
-void
-DataVisualization::ValueFormats::Clear()
-{
-    GetFormatManager().Value().Clear();
-}
-
-void
-DataVisualization::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
-{
-    GetFormatManager().Value().LoopThrough(callback, callback_baton);
-}
-
-uint32_t
-DataVisualization::ValueFormats::GetCount()
-{
-    return GetFormatManager().Value().GetCount();
-}
-
-bool
-DataVisualization::GetSummaryFormat(ValueObject& valobj,
-                                       lldb::DynamicValueType use_dynamic,
-                                       lldb::SummaryFormatSP& entry)
-{
-    return GetFormatManager().Get(valobj, entry, use_dynamic);
-}
-bool
-DataVisualization::GetSyntheticChildren(ValueObject& valobj,
-                                           lldb::DynamicValueType use_dynamic,
-                                           lldb::SyntheticChildrenSP& entry)
-{
-    return GetFormatManager().Get(valobj, entry, use_dynamic);
-}
-
-bool
-DataVisualization::AnyMatches(ConstString type_name,
-                                 FormatCategory::FormatCategoryItems items,
-                                 bool only_enabled,
-                                 const char** matching_category,
-                                 FormatCategory::FormatCategoryItems* matching_type)
-{
-    return GetFormatManager().AnyMatches(type_name,
-                                         items,
-                                         only_enabled,
-                                         matching_category,
-                                         matching_type);
-}
-
-bool
-DataVisualization::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
-{
-    entry = GetFormatManager().Category(category);
-    return true;
-}
-
-void
-DataVisualization::Categories::Add(const ConstString &category)
-{
-    GetFormatManager().Category(category);
-}
-
-bool
-DataVisualization::Categories::Delete(const ConstString &category)
-{
-    GetFormatManager().DisableCategory(category);
-    return GetFormatManager().Categories().Delete(category);
-}
-
-void
-DataVisualization::Categories::Clear()
-{
-    GetFormatManager().Categories().Clear();
-}
-
-void
-DataVisualization::Categories::Clear(ConstString &category)
-{
-    GetFormatManager().Category(category)->ClearSummaries();
-}
-
-void
-DataVisualization::Categories::Enable(ConstString& category)
-{
-    if (GetFormatManager().Category(category)->IsEnabled() == false)
-        GetFormatManager().EnableCategory(category);
-    else
-    {
-        GetFormatManager().DisableCategory(category);
-        GetFormatManager().EnableCategory(category);
-    }
-}
-
-void
-DataVisualization::Categories::Disable(ConstString& category)
-{
-    if (GetFormatManager().Category(category)->IsEnabled() == true)
-        GetFormatManager().DisableCategory(category);
-}
-
-void
-DataVisualization::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
-{
-    GetFormatManager().LoopThroughCategories(callback, callback_baton);
-}
-
-uint32_t
-DataVisualization::Categories::GetCount()
-{
-    return GetFormatManager().Categories().GetCount();
-}
-
-bool
-DataVisualization::NamedSummaryFormats::Get(const ConstString &type, lldb::SummaryFormatSP &entry)
-{
-    return GetFormatManager().NamedSummary().Get(type,entry);
-}
-
-void
-DataVisualization::NamedSummaryFormats::Add(const ConstString &type, const lldb::SummaryFormatSP &entry)
-{
-    GetFormatManager().NamedSummary().Add(FormatManager::GetValidTypeName(type),entry);
-}
-
-bool
-DataVisualization::NamedSummaryFormats::Delete(const ConstString &type)
-{
-    return GetFormatManager().NamedSummary().Delete(type);
-}
-
-void
-DataVisualization::NamedSummaryFormats::Clear()
-{
-    GetFormatManager().NamedSummary().Clear();
-}
-
-void
-DataVisualization::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
-{
-    GetFormatManager().NamedSummary().LoopThrough(callback, callback_baton);
-}
-
-uint32_t
-DataVisualization::NamedSummaryFormats::GetCount()
-{
-    return GetFormatManager().NamedSummary().GetCount();
 }
\ No newline at end of file

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=138279&r1=138278&r2=138279&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Mon Aug 22 17:03:47 2011
@@ -19,8 +19,8 @@
 
 // Project includes
 #include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/DataVisualization.h"
 #include "lldb/Core/Debugger.h"
-#include "lldb/Core/FormatManager.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/ValueObjectChild.h"

Modified: lldb/trunk/source/Interpreter/CommandObjectScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.cpp?rev=138279&r1=138278&r2=138279&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectScript.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectScript.cpp Mon Aug 22 17:03:47 2011
@@ -14,8 +14,8 @@
 // Other libraries and framework includes
 // Project includes
 
+#include "lldb/Core/DataVisualization.h"
 #include "lldb/Core/Debugger.h"
-#include "lldb/Core/FormatManager.h"
 #include "lldb/Interpreter/Args.h"
 
 #include "lldb/Interpreter/CommandReturnObject.h"





More information about the lldb-commits mailing list