[Lldb-commits] [lldb] r138307 - in /lldb/trunk: include/lldb/Core/FormatManager.h include/lldb/Core/FormatNavigator.h include/lldb/lldb-private-enumerations.h lldb.xcodeproj/project.pbxproj source/Commands/CommandObjectType.cpp source/Core/DataVisualization.cpp source/Core/FormatManager.cpp

Enrico Granata granata.enrico at gmail.com
Mon Aug 22 16:45:15 PDT 2011


Author: enrico
Date: Mon Aug 22 18:45:15 2011
New Revision: 138307

URL: http://llvm.org/viewvc/llvm-project?rev=138307&view=rev
Log:
Separated FormatNavigator and FormatManager in two different files ; moved FormatCategoryItem enum out of FormatManager.h as a debugger-wide lldb_private enum ; minor style cleanups

Added:
    lldb/trunk/include/lldb/Core/FormatNavigator.h
Modified:
    lldb/trunk/include/lldb/Core/FormatManager.h
    lldb/trunk/include/lldb/lldb-private-enumerations.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/Commands/CommandObjectType.cpp
    lldb/trunk/source/Core/DataVisualization.cpp
    lldb/trunk/source/Core/FormatManager.cpp

Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=138307&r1=138306&r2=138307&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Mon Aug 22 18:45:15 2011
@@ -11,55 +11,17 @@
 #define lldb_FormatManager_h_
 
 // C Includes
-
-#include <stdint.h>
-#include <unistd.h>
-
 // C++ Includes
 
-#ifdef __GNUC__
-#include <ext/hash_map>
-
-namespace std
-{
-    using namespace __gnu_cxx;
-}
-
-#else
-#include <hash_map>
-#endif
-
-#include <list>
-#include <map>
-#include <stack>
-
 // Other libraries and framework includes
-#include "clang/AST/DeclCXX.h"
-#include "clang/AST/Type.h"
-#include "clang/AST/DeclObjC.h"
-
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
 
-#include "lldb/Core/Communication.h"
-#include "lldb/Core/FormatClasses.h"
-#include "lldb/Core/InputReaderStack.h"
-#include "lldb/Core/Listener.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/RegularExpression.h"
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/SourceManager.h"
-#include "lldb/Core/UserID.h"
-#include "lldb/Core/UserSettingsController.h"
-#include "lldb/Core/ValueObject.h"
+#include "lldb/Core/FormatNavigator.h"
 #include "lldb/Interpreter/ScriptInterpreterPython.h"
 #include "lldb/Target/ExecutionContext.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Platform.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/StackFrame.h"
-#include "lldb/Target/TargetList.h"
 
 using lldb::LogSP;
 
@@ -69,629 +31,6 @@
 // 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:
-    virtual void
-    Changed () = 0;
-    
-    virtual
-    ~IFormatChangeListener () {}
-    
-    virtual uint32_t
-    GetCurrentRevision () = 0;
-    
-};
-    
-static inline bool
-IsWhitespace (char c)
-{
-    return ( (c == ' ') || (c == '\t') || (c == '\v') || (c == '\f') );
-}
-
-static inline bool
-HasPrefix (const char* str1, const char* str2)
-{
-    return ( ::strstr(str1, str2) == str1 );
-}
-    
-// if the user tries to add formatters for, say, "struct Foo"
-// those will not match any type because of the way we strip qualifiers from typenames
-// this method looks for the case where the user is adding a "class","struct","enum" or "union" Foo
-// and strips the unnecessary qualifier
-static ConstString
-GetValidTypeName_Impl (const ConstString& type)
-{
-    int strip_len = 0;
-    
-    if (type == false)
-        return type;
-    
-    const char* type_cstr = type.AsCString();
-    
-    if ( HasPrefix(type_cstr, "class ") )
-        strip_len = 6;
-    else if ( HasPrefix(type_cstr, "enum ") )
-        strip_len = 5;
-    else if ( HasPrefix(type_cstr, "struct ") )
-        strip_len = 7;
-    else if ( HasPrefix(type_cstr, "union ") )
-        strip_len = 6;
-    
-    if (strip_len == 0)
-        return type;
-    
-    type_cstr += strip_len;
-    while (IsWhitespace(*type_cstr) && ++type_cstr)
-        ;
-    
-    return ConstString(type_cstr);
-}
-    
-template<typename KeyType, typename ValueType>
-class FormatNavigator;
-
-template<typename KeyType, typename ValueType>
-class FormatMap
-{
-public:
-
-    typedef typename ValueType::SharedPointer ValueSP;
-    typedef std::map<KeyType, ValueSP> MapType;
-    typedef typename MapType::iterator MapIterator;
-    typedef bool(*CallbackType)(void*, KeyType, const ValueSP&);
-    
-    FormatMap(IFormatChangeListener* lst) :
-    m_map(),
-    m_map_mutex(Mutex::eMutexTypeRecursive),
-    listener(lst)
-    {
-    }
-    
-    void
-    Add(KeyType name,
-        const ValueSP& entry)
-    {
-        if (listener)
-            entry->m_my_revision = listener->GetCurrentRevision();
-        else
-            entry->m_my_revision = 0;
-
-        Mutex::Locker(m_map_mutex);
-        m_map[name] = entry;
-        if (listener)
-            listener->Changed();
-    }
-    
-    bool
-    Delete (KeyType name)
-    {
-        Mutex::Locker(m_map_mutex);
-        MapIterator iter = m_map.find(name);
-        if (iter == m_map.end())
-            return false;
-        m_map.erase(name);
-        if (listener)
-            listener->Changed();
-        return true;
-    }
-    
-    void
-    Clear ()
-    {
-        Mutex::Locker(m_map_mutex);
-        m_map.clear();
-        if (listener)
-            listener->Changed();
-    }
-    
-    bool
-    Get(KeyType name,
-        ValueSP& entry)
-    {
-        Mutex::Locker(m_map_mutex);
-        MapIterator iter = m_map.find(name);
-        if (iter == m_map.end())
-            return false;
-        entry = iter->second;
-        return true;
-    }
-    
-    void
-    LoopThrough (CallbackType callback, void* param)
-    {
-        if (callback)
-        {
-            Mutex::Locker(m_map_mutex);
-            MapIterator pos, end = m_map.end();
-            for (pos = m_map.begin(); pos != end; pos++)
-            {
-                KeyType type = pos->first;
-                if (!callback(param, type, pos->second))
-                    break;
-            }
-        }
-    }
-    
-    uint32_t
-    GetCount ()
-    {
-        return m_map.size();
-    }
-    
-protected:
-    MapType m_map;    
-    Mutex m_map_mutex;
-    IFormatChangeListener* listener;
-    
-    MapType&
-    map ()
-    {
-        return m_map;
-    }
-    
-    Mutex&
-    mutex ()
-    {
-        return m_map_mutex;
-    }
-    
-    friend class FormatNavigator<KeyType, ValueType>;
-    friend class FormatManager;
-    
-};
-    
-template<typename KeyType, typename ValueType>
-class FormatNavigator
-{
-protected:
-    typedef FormatMap<KeyType,ValueType> BackEndType;
-    
-    template<typename, typename>
-    struct Types { };
-
-public:
-    typedef typename BackEndType::MapType MapType;
-    typedef typename MapType::iterator MapIterator;
-    typedef typename MapType::key_type MapKeyType;
-    typedef typename MapType::mapped_type MapValueType;
-    typedef typename BackEndType::CallbackType CallbackType;
-        
-    typedef typename lldb::SharedPtr<FormatNavigator<KeyType, ValueType> >::Type SharedPointer;
-    
-    friend class FormatCategory;
-
-    FormatNavigator(std::string name,
-                    IFormatChangeListener* lst) :
-    m_format_map(lst),
-    m_name(name),
-    m_id_cs(ConstString("id"))
-    {
-    }
-    
-    void
-    Add (const MapKeyType &type, const MapValueType& entry)
-    {
-        Add_Impl(type, entry, Types<KeyType,ValueType>());
-    }
-    
-    bool
-    Delete (ConstString type)
-    {
-        return Delete_Impl(type, Types<KeyType, ValueType>());
-    }
-        
-    bool
-    Get(ValueObject& valobj,
-        MapValueType& entry,
-        lldb::DynamicValueType use_dynamic,
-        uint32_t* why = NULL)
-    {
-        uint32_t value = lldb::eFormatterChoiceCriterionDirectChoice;
-        clang::QualType type = clang::QualType::getFromOpaquePtr(valobj.GetClangType());
-        bool ret = Get(valobj, type, entry, use_dynamic, value);
-        if (ret)
-            entry = MapValueType(entry);
-        else
-            entry = MapValueType();        
-        if (why)
-            *why = value;
-        return ret;
-    }
-    
-    void
-    Clear ()
-    {
-        m_format_map.Clear();
-    }
-    
-    void
-    LoopThrough (CallbackType callback, void* param)
-    {
-        m_format_map.LoopThrough(callback,param);
-    }
-    
-    uint32_t
-    GetCount ()
-    {
-        return m_format_map.GetCount();
-    }
-    
-protected:
-        
-    BackEndType m_format_map;
-    
-    std::string m_name;
-    
-    DISALLOW_COPY_AND_ASSIGN(FormatNavigator);
-    
-    ConstString m_id_cs;
-                           
-    template<typename K, typename V>
-    void
-    Add_Impl (const MapKeyType &type, const MapValueType& entry, Types<K,V>)
-    {
-       m_format_map.Add(type,entry);
-    }
-
-    template<typename V>
-    void Add_Impl (const ConstString &type, const MapValueType& entry, Types<ConstString,V>)
-    {
-       m_format_map.Add(GetValidTypeName_Impl(type), entry);
-    }
-
-    template<typename K, typename V>
-    bool
-    Delete_Impl (ConstString type, Types<K,V>)
-    {
-       return m_format_map.Delete(type);
-    }
-
-    template<typename V>
-    bool
-    Delete_Impl (ConstString type, Types<lldb::RegularExpressionSP,V>)
-    {
-       Mutex& x_mutex = m_format_map.mutex();
-        lldb_private::Mutex::Locker locker(x_mutex);
-       MapIterator pos, end = m_format_map.map().end();
-       for (pos = m_format_map.map().begin(); pos != end; pos++)
-       {
-           lldb::RegularExpressionSP regex = pos->first;
-           if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
-           {
-               m_format_map.map().erase(pos);
-               if (m_format_map.listener)
-                   m_format_map.listener->Changed();
-               return true;
-           }
-       }
-       return false;
-    }    
-
-    template<typename K, typename V>
-    bool
-    Get_Impl (ConstString type, MapValueType& entry, Types<K,V>)
-    {
-       return m_format_map.Get(type, entry);
-    }
-
-    template<typename V>
-    bool
-    Get_Impl (ConstString key, MapValueType& value, Types<lldb::RegularExpressionSP,V>)
-    {
-        Mutex& x_mutex = m_format_map.mutex();
-        lldb_private::Mutex::Locker locker(x_mutex);
-       MapIterator pos, end = m_format_map.map().end();
-       for (pos = m_format_map.map().begin(); pos != end; pos++)
-       {
-           lldb::RegularExpressionSP regex = pos->first;
-           if (regex->Execute(key.AsCString()))
-           {
-               value = pos->second;
-               return true;
-           }
-       }
-       return false;
-    }
-
-    bool
-    Get (ConstString type, MapValueType& entry)
-    {
-        return Get_Impl(type, entry, Types<KeyType,ValueType>());
-    }
-    
-    bool Get_ObjC(ValueObject& valobj,
-             ObjCLanguageRuntime::ObjCISA isa,
-             MapValueType& entry,
-             uint32_t& reason)
-    {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-        if (log)
-            log->Printf("going to an Objective-C dynamic scanning");
-        Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
-        ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
-        if (runtime == NULL)
-        {
-            if (log)
-                log->Printf("no valid ObjC runtime, bailing out");
-            return false;
-        }
-        if (runtime->IsValidISA(isa) == false)
-        {
-            if (log)
-                log->Printf("invalid ISA, bailing out");
-            return false;
-        }
-        ConstString name = runtime->GetActualTypeName(isa);
-        if (log)
-            log->Printf("looking for formatter for %s", name.GetCString());
-        if (Get(name, entry))
-        {
-            if (log)
-                log->Printf("direct match found, returning");
-            return true;
-        }
-        if (log)
-            log->Printf("no direct match");
-        ObjCLanguageRuntime::ObjCISA parent = runtime->GetParentClass(isa);
-        if (runtime->IsValidISA(parent) == false)
-        {
-            if (log)
-                log->Printf("invalid parent ISA, bailing out");
-            return false;
-        }
-        if (parent == isa)
-        {
-            if (log)
-                log->Printf("parent-child loop, bailing out");
-            return false;
-        }
-        if (Get_ObjC(valobj, parent, entry, reason))
-        {
-            reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
-            return true;
-        }
-        return false;
-    }
-    
-    bool Get(ValueObject& valobj,
-             clang::QualType type,
-             MapValueType& entry,
-             lldb::DynamicValueType use_dynamic,
-             uint32_t& reason)
-    {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-        if (type.isNull())
-        {
-            if (log)
-                log->Printf("type is NULL, returning");
-            return false;
-        }
-        // clang::QualType type = q_type.getUnqualifiedType();
-        type.removeLocalConst(); type.removeLocalVolatile(); type.removeLocalRestrict();
-        const clang::Type* typePtr = type.getTypePtrOrNull();
-        if (!typePtr)
-        {
-            if (log)
-                log->Printf("type is NULL, returning");
-            return false;
-        }
-        ConstString typeName(ClangASTType::GetTypeNameForQualType(type).c_str());
-        if (valobj.GetBitfieldBitSize() > 0)
-        {
-            // for bitfields, append size to the typename so one can custom format them
-            StreamString sstring;
-            sstring.Printf("%s:%d",typeName.AsCString(),valobj.GetBitfieldBitSize());
-            ConstString bitfieldname = ConstString(sstring.GetData());
-            if (log)
-                log->Printf("appended bitfield info, final result is %s", bitfieldname.GetCString());
-            if (Get(bitfieldname, entry))
-            {
-                if (log)
-                    log->Printf("bitfield direct match found, returning");
-                return true;
-            }
-            else
-            {
-                reason |= lldb::eFormatterChoiceCriterionStrippedBitField;
-                if (log)
-                    log->Printf("no bitfield direct match");
-            }
-        }
-        if (log)
-            log->Printf("trying to get %s for VO name %s of type %s",
-                        m_name.c_str(),
-                        valobj.GetName().AsCString(),
-                        typeName.AsCString());
-        if (Get(typeName, entry))
-        {
-            if (log)
-                log->Printf("direct match found, returning");
-            return true;
-        }
-        if (log)
-            log->Printf("no direct match");
-        // look for a "base type", whatever that means
-        if (typePtr->isReferenceType())
-        {
-            if (log)
-                log->Printf("stripping reference");
-            if (Get(valobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->m_skip_references)
-            {
-                reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
-                return true;
-            }
-        }
-        if (use_dynamic != lldb::eNoDynamicValues &&
-            (/*strstr(typeName, "id") == typeName ||*/
-             ClangASTType::GetMinimumLanguage(valobj.GetClangAST(), valobj.GetClangType()) == lldb::eLanguageTypeObjC))
-        {
-            if (log)
-                log->Printf("this is an ObjC 'id', let's do dynamic search");
-            Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
-            ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
-            if (runtime == NULL)
-            {
-                if (log)
-                    log->Printf("no valid ObjC runtime, skipping dynamic");
-            }
-            else
-            {
-                if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
-                {
-                    reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
-                    return true;
-                }
-            }
-        }
-        else if (use_dynamic != lldb::eNoDynamicValues && log)
-        {
-            log->Printf("typename: %s, typePtr = %p, id = %p",
-                        typeName.AsCString(), typePtr, valobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr());
-        }
-        else if (log)
-        {
-            log->Printf("no dynamic");
-        }
-        if (typePtr->isPointerType())
-        {
-            if (log)
-                log->Printf("stripping pointer");
-            clang::QualType pointee = typePtr->getPointeeType();
-            if (Get(valobj, pointee, entry, use_dynamic, reason) && !entry->m_skip_pointers)
-            {
-                reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
-                return true;
-            }
-        }
-        if (typePtr->isObjCObjectPointerType())
-        {
-            if (use_dynamic != lldb::eNoDynamicValues &&
-                typeName == m_id_cs)
-            {
-                if (log)
-                    log->Printf("this is an ObjC 'id', let's do dynamic search");
-                Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
-                ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
-                if (runtime == NULL)
-                {
-                    if (log)
-                        log->Printf("no valid ObjC runtime, skipping dynamic");
-                }
-                else
-                {
-                    if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
-                    {
-                        reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
-                        return true;
-                    }
-                }
-            }
-            if (log)
-                log->Printf("stripping ObjC pointer");
-            
-            // For some reason, C++ can quite easily obtain the type hierarchy for a ValueObject
-            // even if the VO represent a pointer-to-class, as long as the typePtr is right
-            // Objective-C on the other hand cannot really complete an @interface when
-            // the VO refers to a pointer-to- at interface
-
-            Error error;
-            ValueObject* target = valobj.Dereference(error).get();
-            if (error.Fail() || !target)
-                return false;
-            if (Get(*target, typePtr->getPointeeType(), entry, use_dynamic, reason) && !entry->m_skip_pointers)
-            {
-                reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
-                return true;
-            }
-        }
-        const clang::ObjCObjectType *objc_class_type = typePtr->getAs<clang::ObjCObjectType>();
-        if (objc_class_type)
-        {
-            if (log)
-                log->Printf("working with ObjC");
-            clang::ASTContext *ast = valobj.GetClangAST();
-            if (ClangASTContext::GetCompleteType(ast, valobj.GetClangType()) && !objc_class_type->isObjCId())
-            {
-                clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
-                if (class_interface_decl)
-                {
-                    if (log)
-                        log->Printf("got an ObjCInterfaceDecl");
-                    clang::ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
-                    if (superclass_interface_decl)
-                    {
-                        if (log)
-                            log->Printf("got a parent class for this ObjC class");
-                        clang::QualType ivar_qual_type(ast->getObjCInterfaceType(superclass_interface_decl));
-                        if (Get(valobj, ivar_qual_type, entry, use_dynamic, reason) && entry->m_cascades)
-                        {
-                            reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
-                            return true;
-                        }
-                    }
-                }
-            }
-        }
-        // for C++ classes, navigate up the hierarchy
-        if (typePtr->isRecordType())
-        {
-            if (log)
-                log->Printf("working with C++");
-            clang::CXXRecordDecl* record = typePtr->getAsCXXRecordDecl();
-            if (record)
-            {
-                if (!record->hasDefinition())
-                    ClangASTContext::GetCompleteType(valobj.GetClangAST(), valobj.GetClangType());
-                if (record->hasDefinition())
-                {
-                    clang::CXXRecordDecl::base_class_iterator pos,end;
-                    if (record->getNumBases() > 0)
-                    {
-                        if (log)
-                            log->Printf("look into bases");
-                        end = record->bases_end();
-                        for (pos = record->bases_begin(); pos != end; pos++)
-                        {
-                            if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
-                            {
-                                reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
-                                return true;
-                            }
-                        }
-                    }
-                    if (record->getNumVBases() > 0)
-                    {
-                        if (log)
-                            log->Printf("look into VBases");
-                        end = record->vbases_end();
-                        for (pos = record->vbases_begin(); pos != end; pos++)
-                        {
-                            if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
-                            {
-                                reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
-                                return true;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        // try to strip typedef chains
-        const clang::TypedefType* type_tdef = type->getAs<clang::TypedefType>();
-        if (type_tdef)
-        {
-            if (log)
-                log->Printf("stripping typedef");
-            if ((Get(valobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->m_cascades)
-            {
-                reason |= lldb::eFormatterChoiceCriterionNavigatedTypedefs;
-                return true;
-            }
-        }
-        return false;
-    }
-};
     
 class CategoryMap;
     
@@ -716,21 +55,7 @@
     typedef RegexSynthNavigator::MapType RegexSynthMap;
 
 public:
-    
-    //------------------------------------------------------------------
-    /// Format category entry types
-    //------------------------------------------------------------------    
-    typedef enum FormatCategoryItem
-    {
-        eSummary =         0x0001,
-        eRegexSummary =    0x1001,
-        eFilter =          0x0002,
-        eRegexFilter =     0x1002,
-        eSynth =           0x0004,
-        eRegexSynth =      0x1004,
-        eAllItems =        0xFFFF
-    } FormatCategoryItem;
-    
+        
     typedef uint16_t FormatCategoryItems;
     static const uint16_t ALL_ITEM_TYPES = 0xFFFF;
     
@@ -741,8 +66,8 @@
     typedef SynthNavigator::SharedPointer SynthNavigatorSP;
     typedef RegexSynthNavigator::SharedPointer RegexSynthNavigatorSP;
 
-    FormatCategory(IFormatChangeListener* clist,
-                   std::string name);
+    FormatCategory (IFormatChangeListener* clist,
+                    std::string name);
     
     SummaryNavigatorSP
     GetSummaryNavigator ()
@@ -787,10 +112,10 @@
     }
         
     bool
-    Get(ValueObject& valobj,
-        lldb::SummaryFormatSP& entry,
-        lldb::DynamicValueType use_dynamic,
-        uint32_t* reason = NULL)
+    Get (ValueObject& valobj,
+         lldb::SummaryFormatSP& entry,
+         lldb::DynamicValueType use_dynamic,
+         uint32_t* reason = NULL)
     {
         if (!IsEnabled())
             return false;
@@ -803,23 +128,23 @@
     }
     
     bool
-    Get(ValueObject& valobj,
-        lldb::SyntheticChildrenSP& entry,
-        lldb::DynamicValueType use_dynamic,
-        uint32_t* reason = NULL);
+    Get (ValueObject& valobj,
+         lldb::SyntheticChildrenSP& entry,
+         lldb::DynamicValueType use_dynamic,
+         uint32_t* reason = NULL);
     
     // just a shortcut for GetSummaryNavigator()->Clear; GetRegexSummaryNavigator()->Clear()
     void
     ClearSummaries ()
     {
-        Clear(eSummary | eRegexSummary);
+        Clear(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
     }
     
     // just a shortcut for (GetSummaryNavigator()->Delete(name) || GetRegexSummaryNavigator()->Delete(name))
     bool
     DeleteSummaries (ConstString name)
     {
-        return Delete(name, (eSummary | eRegexSummary));
+        return Delete(name, (eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary));
     }
     
     
@@ -840,11 +165,11 @@
     }
     
     bool
-    AnyMatches(ConstString type_name,
-               FormatCategoryItems items = ALL_ITEM_TYPES,
-               bool only_enabled = true,
-               const char** matching_category = NULL,
-               FormatCategoryItems* matching_type = NULL);
+    AnyMatches (ConstString type_name,
+                FormatCategoryItems items = ALL_ITEM_TYPES,
+                bool only_enabled = true,
+                const char** matching_category = NULL,
+                FormatCategoryItems* matching_type = NULL);
     
     typedef lldb::SharedPtr<FormatCategory>::Type SharedPointer;
     
@@ -907,17 +232,17 @@
     typedef MapType::iterator MapIterator;
     typedef bool(*CallbackType)(void*, const ValueSP&);
     
-    CategoryMap(IFormatChangeListener* lst) :
-    m_map_mutex(Mutex::eMutexTypeRecursive),
-    listener(lst),
-    m_map(),
-    m_active_categories()
+    CategoryMap (IFormatChangeListener* lst) :
+        m_map_mutex(Mutex::eMutexTypeRecursive),
+        listener(lst),
+        m_map(),
+        m_active_categories()
     {
     }
     
     void
-    Add(KeyType name,
-        const ValueSP& entry)
+    Add (KeyType name,
+         const ValueSP& entry)
     {
         Mutex::Locker(m_map_mutex);
         m_map[name] = entry;
@@ -985,8 +310,8 @@
     }
     
     bool
-    Get(KeyType name,
-        ValueSP& entry)
+    Get (KeyType name,
+         ValueSP& entry)
     {
         Mutex::Locker(m_map_mutex);
         MapIterator iter = m_map.find(name);
@@ -1000,11 +325,11 @@
     LoopThrough (CallbackType callback, void* param);
     
     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)
+    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)
     {
         Mutex::Locker(m_map_mutex);
         
@@ -1028,9 +353,9 @@
     }
     
     bool
-    Get(ValueObject& valobj,
-        lldb::SummaryFormatSP& entry,
-        lldb::DynamicValueType use_dynamic)
+    Get (ValueObject& valobj,
+         lldb::SummaryFormatSP& entry,
+         lldb::DynamicValueType use_dynamic)
     {
         Mutex::Locker(m_map_mutex);
         
@@ -1050,9 +375,9 @@
     }
     
     bool
-    Get(ValueObject& valobj,
-        lldb::SyntheticChildrenSP& entry,
-        lldb::DynamicValueType use_dynamic)
+    Get (ValueObject& valobj,
+         lldb::SyntheticChildrenSP& entry,
+         lldb::DynamicValueType use_dynamic)
     {
         Mutex::Locker(m_map_mutex);
         
@@ -1084,7 +409,7 @@
         return m_map;
     }
     
-    ActiveCategoriesList& active_list()
+    ActiveCategoriesList& active_list ()
     {
         return m_active_categories;
     }
@@ -1138,16 +463,22 @@
         m_categories_map.Disable(category_name);
     }
     
-    void
-    EnableCategory (const char* category_name)
+    bool
+    DeleteCategory (const ConstString& category_name)
     {
-        EnableCategory(ConstString(category_name));
+        return m_categories_map.Delete(category_name);
     }
     
     void
-    DisableCategory (const char* category_name)
+    ClearCategories ()
     {
-        DisableCategory(ConstString(category_name));
+        return m_categories_map.Clear();
+    }
+    
+    uint32_t
+    GetCategoriesCount ()
+    {
+        return m_categories_map.GetCount();
     }
     
     void
@@ -1183,26 +514,26 @@
     }
     
     bool
-    Get(ValueObject& valobj,
-        lldb::SummaryFormatSP& entry,
-        lldb::DynamicValueType use_dynamic)
+    Get (ValueObject& valobj,
+         lldb::SummaryFormatSP& entry,
+         lldb::DynamicValueType use_dynamic)
     {
         return m_categories_map.Get(valobj, entry, use_dynamic);
     }
     bool
-    Get(ValueObject& valobj,
-        lldb::SyntheticChildrenSP& entry,
-        lldb::DynamicValueType use_dynamic)
+    Get (ValueObject& valobj,
+         lldb::SyntheticChildrenSP& entry,
+         lldb::DynamicValueType use_dynamic)
     {
         return m_categories_map.Get(valobj, entry, use_dynamic);
     }
     
     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)
+    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)
     {
         return m_categories_map.AnyMatches(type_name,
                                            items,
@@ -1232,7 +563,7 @@
     // when DataExtractor dumps a vectorOfT, it uses a predefined format for each item
     // this method returns it, or eFormatInvalid if vector_format is not a vectorOf
     static lldb::Format
-    GetSingleItemFormat(lldb::Format vector_format);
+    GetSingleItemFormat (lldb::Format vector_format);
     
     void
     Changed ()
@@ -1250,12 +581,6 @@
     {
     }
     
-    CategoryMap&
-    GetCategories ()
-    {
-        return m_categories_map;
-    }
-
 private:    
     ValueNavigator m_value_nav;
     NamedSummariesMap m_named_summaries_map;
@@ -1266,6 +591,12 @@
     ConstString m_system_category_name;
     ConstString m_gnu_cpp_category_name;
     
+    CategoryMap&
+    GetCategories ()
+    {
+        return m_categories_map;
+    }
+    
 };
     
 } // namespace lldb_private

Added: lldb/trunk/include/lldb/Core/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatNavigator.h?rev=138307&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatNavigator.h (added)
+++ lldb/trunk/include/lldb/Core/FormatNavigator.h Mon Aug 22 18:45:15 2011
@@ -0,0 +1,686 @@
+//===-- FormatNavigator.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_FormatNavigator_h_
+#define lldb_FormatNavigator_h_
+
+// C Includes
+
+#include <stdint.h>
+#include <unistd.h>
+
+// C++ Includes
+
+#ifdef __GNUC__
+#include <ext/hash_map>
+
+namespace std
+{
+    using namespace __gnu_cxx;
+}
+
+#else
+#include <hash_map>
+#endif
+
+#include <map>
+
+// Other libraries and framework includes
+#include "clang/AST/DeclCXX.h"
+#include "clang/AST/Type.h"
+#include "clang/AST/DeclObjC.h"
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/FormatClasses.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Core/RegularExpression.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/TargetList.h"
+
+using lldb::LogSP;
+
+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:
+    virtual void
+    Changed () = 0;
+    
+    virtual
+    ~IFormatChangeListener () {}
+    
+    virtual uint32_t
+    GetCurrentRevision () = 0;
+    
+};
+    
+static inline bool
+IsWhitespace (char c)
+{
+    return ( (c == ' ') || (c == '\t') || (c == '\v') || (c == '\f') );
+}
+
+static inline bool
+HasPrefix (const char* str1, const char* str2)
+{
+    return ( ::strstr(str1, str2) == str1 );
+}
+    
+// if the user tries to add formatters for, say, "struct Foo"
+// those will not match any type because of the way we strip qualifiers from typenames
+// this method looks for the case where the user is adding a "class","struct","enum" or "union" Foo
+// and strips the unnecessary qualifier
+static ConstString
+GetValidTypeName_Impl (const ConstString& type)
+{
+    int strip_len = 0;
+    
+    if (type == false)
+        return type;
+    
+    const char* type_cstr = type.AsCString();
+    
+    if ( HasPrefix(type_cstr, "class ") )
+        strip_len = 6;
+    else if ( HasPrefix(type_cstr, "enum ") )
+        strip_len = 5;
+    else if ( HasPrefix(type_cstr, "struct ") )
+        strip_len = 7;
+    else if ( HasPrefix(type_cstr, "union ") )
+        strip_len = 6;
+    
+    if (strip_len == 0)
+        return type;
+    
+    type_cstr += strip_len;
+    while (IsWhitespace(*type_cstr) && ++type_cstr)
+        ;
+    
+    return ConstString(type_cstr);
+}
+    
+template<typename KeyType, typename ValueType>
+class FormatNavigator;
+
+template<typename KeyType, typename ValueType>
+class FormatMap
+{
+public:
+
+    typedef typename ValueType::SharedPointer ValueSP;
+    typedef std::map<KeyType, ValueSP> MapType;
+    typedef typename MapType::iterator MapIterator;
+    typedef bool(*CallbackType)(void*, KeyType, const ValueSP&);
+    
+    FormatMap(IFormatChangeListener* lst) :
+    m_map(),
+    m_map_mutex(Mutex::eMutexTypeRecursive),
+    listener(lst)
+    {
+    }
+    
+    void
+    Add(KeyType name,
+        const ValueSP& entry)
+    {
+        if (listener)
+            entry->m_my_revision = listener->GetCurrentRevision();
+        else
+            entry->m_my_revision = 0;
+
+        Mutex::Locker(m_map_mutex);
+        m_map[name] = entry;
+        if (listener)
+            listener->Changed();
+    }
+    
+    bool
+    Delete (KeyType name)
+    {
+        Mutex::Locker(m_map_mutex);
+        MapIterator iter = m_map.find(name);
+        if (iter == m_map.end())
+            return false;
+        m_map.erase(name);
+        if (listener)
+            listener->Changed();
+        return true;
+    }
+    
+    void
+    Clear ()
+    {
+        Mutex::Locker(m_map_mutex);
+        m_map.clear();
+        if (listener)
+            listener->Changed();
+    }
+    
+    bool
+    Get(KeyType name,
+        ValueSP& entry)
+    {
+        Mutex::Locker(m_map_mutex);
+        MapIterator iter = m_map.find(name);
+        if (iter == m_map.end())
+            return false;
+        entry = iter->second;
+        return true;
+    }
+    
+    void
+    LoopThrough (CallbackType callback, void* param)
+    {
+        if (callback)
+        {
+            Mutex::Locker(m_map_mutex);
+            MapIterator pos, end = m_map.end();
+            for (pos = m_map.begin(); pos != end; pos++)
+            {
+                KeyType type = pos->first;
+                if (!callback(param, type, pos->second))
+                    break;
+            }
+        }
+    }
+    
+    uint32_t
+    GetCount ()
+    {
+        return m_map.size();
+    }
+    
+protected:
+    MapType m_map;    
+    Mutex m_map_mutex;
+    IFormatChangeListener* listener;
+    
+    MapType&
+    map ()
+    {
+        return m_map;
+    }
+    
+    Mutex&
+    mutex ()
+    {
+        return m_map_mutex;
+    }
+    
+    friend class FormatNavigator<KeyType, ValueType>;
+    friend class FormatManager;
+    
+};
+    
+template<typename KeyType, typename ValueType>
+class FormatNavigator
+{
+protected:
+    typedef FormatMap<KeyType,ValueType> BackEndType;
+    
+    template<typename, typename>
+    struct Types { };
+
+public:
+    typedef typename BackEndType::MapType MapType;
+    typedef typename MapType::iterator MapIterator;
+    typedef typename MapType::key_type MapKeyType;
+    typedef typename MapType::mapped_type MapValueType;
+    typedef typename BackEndType::CallbackType CallbackType;
+        
+    typedef typename lldb::SharedPtr<FormatNavigator<KeyType, ValueType> >::Type SharedPointer;
+    
+    friend class FormatCategory;
+
+    FormatNavigator(std::string name,
+                    IFormatChangeListener* lst) :
+    m_format_map(lst),
+    m_name(name),
+    m_id_cs(ConstString("id"))
+    {
+    }
+    
+    void
+    Add (const MapKeyType &type, const MapValueType& entry)
+    {
+        Add_Impl(type, entry, Types<KeyType,ValueType>());
+    }
+    
+    bool
+    Delete (ConstString type)
+    {
+        return Delete_Impl(type, Types<KeyType, ValueType>());
+    }
+        
+    bool
+    Get(ValueObject& valobj,
+        MapValueType& entry,
+        lldb::DynamicValueType use_dynamic,
+        uint32_t* why = NULL)
+    {
+        uint32_t value = lldb::eFormatterChoiceCriterionDirectChoice;
+        clang::QualType type = clang::QualType::getFromOpaquePtr(valobj.GetClangType());
+        bool ret = Get(valobj, type, entry, use_dynamic, value);
+        if (ret)
+            entry = MapValueType(entry);
+        else
+            entry = MapValueType();        
+        if (why)
+            *why = value;
+        return ret;
+    }
+    
+    void
+    Clear ()
+    {
+        m_format_map.Clear();
+    }
+    
+    void
+    LoopThrough (CallbackType callback, void* param)
+    {
+        m_format_map.LoopThrough(callback,param);
+    }
+    
+    uint32_t
+    GetCount ()
+    {
+        return m_format_map.GetCount();
+    }
+    
+protected:
+        
+    BackEndType m_format_map;
+    
+    std::string m_name;
+    
+    DISALLOW_COPY_AND_ASSIGN(FormatNavigator);
+    
+    ConstString m_id_cs;
+                           
+    template<typename K, typename V>
+    void
+    Add_Impl (const MapKeyType &type, const MapValueType& entry, Types<K,V>)
+    {
+       m_format_map.Add(type,entry);
+    }
+
+    template<typename V>
+    void Add_Impl (const ConstString &type, const MapValueType& entry, Types<ConstString,V>)
+    {
+       m_format_map.Add(GetValidTypeName_Impl(type), entry);
+    }
+
+    template<typename K, typename V>
+    bool
+    Delete_Impl (ConstString type, Types<K,V>)
+    {
+       return m_format_map.Delete(type);
+    }
+
+    template<typename V>
+    bool
+    Delete_Impl (ConstString type, Types<lldb::RegularExpressionSP,V>)
+    {
+       Mutex& x_mutex = m_format_map.mutex();
+        lldb_private::Mutex::Locker locker(x_mutex);
+       MapIterator pos, end = m_format_map.map().end();
+       for (pos = m_format_map.map().begin(); pos != end; pos++)
+       {
+           lldb::RegularExpressionSP regex = pos->first;
+           if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
+           {
+               m_format_map.map().erase(pos);
+               if (m_format_map.listener)
+                   m_format_map.listener->Changed();
+               return true;
+           }
+       }
+       return false;
+    }    
+
+    template<typename K, typename V>
+    bool
+    Get_Impl (ConstString type, MapValueType& entry, Types<K,V>)
+    {
+       return m_format_map.Get(type, entry);
+    }
+
+    template<typename V>
+    bool
+    Get_Impl (ConstString key, MapValueType& value, Types<lldb::RegularExpressionSP,V>)
+    {
+        Mutex& x_mutex = m_format_map.mutex();
+        lldb_private::Mutex::Locker locker(x_mutex);
+       MapIterator pos, end = m_format_map.map().end();
+       for (pos = m_format_map.map().begin(); pos != end; pos++)
+       {
+           lldb::RegularExpressionSP regex = pos->first;
+           if (regex->Execute(key.AsCString()))
+           {
+               value = pos->second;
+               return true;
+           }
+       }
+       return false;
+    }
+
+    bool
+    Get (ConstString type, MapValueType& entry)
+    {
+        return Get_Impl(type, entry, Types<KeyType,ValueType>());
+    }
+    
+    bool Get_ObjC(ValueObject& valobj,
+             ObjCLanguageRuntime::ObjCISA isa,
+             MapValueType& entry,
+             uint32_t& reason)
+    {
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+        if (log)
+            log->Printf("going to an Objective-C dynamic scanning");
+        Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
+        ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
+        if (runtime == NULL)
+        {
+            if (log)
+                log->Printf("no valid ObjC runtime, bailing out");
+            return false;
+        }
+        if (runtime->IsValidISA(isa) == false)
+        {
+            if (log)
+                log->Printf("invalid ISA, bailing out");
+            return false;
+        }
+        ConstString name = runtime->GetActualTypeName(isa);
+        if (log)
+            log->Printf("looking for formatter for %s", name.GetCString());
+        if (Get(name, entry))
+        {
+            if (log)
+                log->Printf("direct match found, returning");
+            return true;
+        }
+        if (log)
+            log->Printf("no direct match");
+        ObjCLanguageRuntime::ObjCISA parent = runtime->GetParentClass(isa);
+        if (runtime->IsValidISA(parent) == false)
+        {
+            if (log)
+                log->Printf("invalid parent ISA, bailing out");
+            return false;
+        }
+        if (parent == isa)
+        {
+            if (log)
+                log->Printf("parent-child loop, bailing out");
+            return false;
+        }
+        if (Get_ObjC(valobj, parent, entry, reason))
+        {
+            reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
+            return true;
+        }
+        return false;
+    }
+    
+    bool Get(ValueObject& valobj,
+             clang::QualType type,
+             MapValueType& entry,
+             lldb::DynamicValueType use_dynamic,
+             uint32_t& reason)
+    {
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+        if (type.isNull())
+        {
+            if (log)
+                log->Printf("type is NULL, returning");
+            return false;
+        }
+        // clang::QualType type = q_type.getUnqualifiedType();
+        type.removeLocalConst(); type.removeLocalVolatile(); type.removeLocalRestrict();
+        const clang::Type* typePtr = type.getTypePtrOrNull();
+        if (!typePtr)
+        {
+            if (log)
+                log->Printf("type is NULL, returning");
+            return false;
+        }
+        ConstString typeName(ClangASTType::GetTypeNameForQualType(type).c_str());
+        if (valobj.GetBitfieldBitSize() > 0)
+        {
+            // for bitfields, append size to the typename so one can custom format them
+            StreamString sstring;
+            sstring.Printf("%s:%d",typeName.AsCString(),valobj.GetBitfieldBitSize());
+            ConstString bitfieldname = ConstString(sstring.GetData());
+            if (log)
+                log->Printf("appended bitfield info, final result is %s", bitfieldname.GetCString());
+            if (Get(bitfieldname, entry))
+            {
+                if (log)
+                    log->Printf("bitfield direct match found, returning");
+                return true;
+            }
+            else
+            {
+                reason |= lldb::eFormatterChoiceCriterionStrippedBitField;
+                if (log)
+                    log->Printf("no bitfield direct match");
+            }
+        }
+        if (log)
+            log->Printf("trying to get %s for VO name %s of type %s",
+                        m_name.c_str(),
+                        valobj.GetName().AsCString(),
+                        typeName.AsCString());
+        if (Get(typeName, entry))
+        {
+            if (log)
+                log->Printf("direct match found, returning");
+            return true;
+        }
+        if (log)
+            log->Printf("no direct match");
+        // look for a "base type", whatever that means
+        if (typePtr->isReferenceType())
+        {
+            if (log)
+                log->Printf("stripping reference");
+            if (Get(valobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->m_skip_references)
+            {
+                reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
+                return true;
+            }
+        }
+        if (use_dynamic != lldb::eNoDynamicValues &&
+            (/*strstr(typeName, "id") == typeName ||*/
+             ClangASTType::GetMinimumLanguage(valobj.GetClangAST(), valobj.GetClangType()) == lldb::eLanguageTypeObjC))
+        {
+            if (log)
+                log->Printf("this is an ObjC 'id', let's do dynamic search");
+            Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
+            ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
+            if (runtime == NULL)
+            {
+                if (log)
+                    log->Printf("no valid ObjC runtime, skipping dynamic");
+            }
+            else
+            {
+                if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
+                {
+                    reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
+                    return true;
+                }
+            }
+        }
+        else if (use_dynamic != lldb::eNoDynamicValues && log)
+        {
+            log->Printf("typename: %s, typePtr = %p, id = %p",
+                        typeName.AsCString(), typePtr, valobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr());
+        }
+        else if (log)
+        {
+            log->Printf("no dynamic");
+        }
+        if (typePtr->isPointerType())
+        {
+            if (log)
+                log->Printf("stripping pointer");
+            clang::QualType pointee = typePtr->getPointeeType();
+            if (Get(valobj, pointee, entry, use_dynamic, reason) && !entry->m_skip_pointers)
+            {
+                reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
+                return true;
+            }
+        }
+        if (typePtr->isObjCObjectPointerType())
+        {
+            if (use_dynamic != lldb::eNoDynamicValues &&
+                typeName == m_id_cs)
+            {
+                if (log)
+                    log->Printf("this is an ObjC 'id', let's do dynamic search");
+                Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
+                ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
+                if (runtime == NULL)
+                {
+                    if (log)
+                        log->Printf("no valid ObjC runtime, skipping dynamic");
+                }
+                else
+                {
+                    if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
+                    {
+                        reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
+                        return true;
+                    }
+                }
+            }
+            if (log)
+                log->Printf("stripping ObjC pointer");
+            
+            // For some reason, C++ can quite easily obtain the type hierarchy for a ValueObject
+            // even if the VO represent a pointer-to-class, as long as the typePtr is right
+            // Objective-C on the other hand cannot really complete an @interface when
+            // the VO refers to a pointer-to- at interface
+
+            Error error;
+            ValueObject* target = valobj.Dereference(error).get();
+            if (error.Fail() || !target)
+                return false;
+            if (Get(*target, typePtr->getPointeeType(), entry, use_dynamic, reason) && !entry->m_skip_pointers)
+            {
+                reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
+                return true;
+            }
+        }
+        const clang::ObjCObjectType *objc_class_type = typePtr->getAs<clang::ObjCObjectType>();
+        if (objc_class_type)
+        {
+            if (log)
+                log->Printf("working with ObjC");
+            clang::ASTContext *ast = valobj.GetClangAST();
+            if (ClangASTContext::GetCompleteType(ast, valobj.GetClangType()) && !objc_class_type->isObjCId())
+            {
+                clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+                if (class_interface_decl)
+                {
+                    if (log)
+                        log->Printf("got an ObjCInterfaceDecl");
+                    clang::ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
+                    if (superclass_interface_decl)
+                    {
+                        if (log)
+                            log->Printf("got a parent class for this ObjC class");
+                        clang::QualType ivar_qual_type(ast->getObjCInterfaceType(superclass_interface_decl));
+                        if (Get(valobj, ivar_qual_type, entry, use_dynamic, reason) && entry->m_cascades)
+                        {
+                            reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
+                            return true;
+                        }
+                    }
+                }
+            }
+        }
+        // for C++ classes, navigate up the hierarchy
+        if (typePtr->isRecordType())
+        {
+            if (log)
+                log->Printf("working with C++");
+            clang::CXXRecordDecl* record = typePtr->getAsCXXRecordDecl();
+            if (record)
+            {
+                if (!record->hasDefinition())
+                    ClangASTContext::GetCompleteType(valobj.GetClangAST(), valobj.GetClangType());
+                if (record->hasDefinition())
+                {
+                    clang::CXXRecordDecl::base_class_iterator pos,end;
+                    if (record->getNumBases() > 0)
+                    {
+                        if (log)
+                            log->Printf("look into bases");
+                        end = record->bases_end();
+                        for (pos = record->bases_begin(); pos != end; pos++)
+                        {
+                            if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
+                            {
+                                reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
+                                return true;
+                            }
+                        }
+                    }
+                    if (record->getNumVBases() > 0)
+                    {
+                        if (log)
+                            log->Printf("look into VBases");
+                        end = record->vbases_end();
+                        for (pos = record->vbases_begin(); pos != end; pos++)
+                        {
+                            if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
+                            {
+                                reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
+                                return true;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        // try to strip typedef chains
+        const clang::TypedefType* type_tdef = type->getAs<clang::TypedefType>();
+        if (type_tdef)
+        {
+            if (log)
+                log->Printf("stripping typedef");
+            if ((Get(valobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->m_cascades)
+            {
+                reason |= lldb::eFormatterChoiceCriterionNavigatedTypedefs;
+                return true;
+            }
+        }
+        return false;
+    }
+};
+
+} // namespace lldb_private
+
+#endif	// lldb_FormatNavigator_h_

Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=138307&r1=138306&r2=138307&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-private-enumerations.h Mon Aug 22 18:45:15 2011
@@ -200,6 +200,19 @@
 
 }  InstructionType;
     
+    
+//------------------------------------------------------------------
+/// Format category entry types
+//------------------------------------------------------------------    
+typedef enum FormatCategoryItem
+{
+    eFormatCategoryItemSummary =         0x0001,
+    eFormatCategoryItemRegexSummary =    0x1001,
+    eFormatCategoryItemFilter =          0x0002,
+    eFormatCategoryItemRegexFilter =     0x1002,
+    eFormatCategoryItemSynth =           0x0004,
+    eFormatCategoryItemRegexSynth =      0x1004,
+} FormatCategoryItem;
 
 } // namespace lldb
 

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=138307&r1=138306&r2=138307&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Aug 22 18:45:15 2011
@@ -1190,6 +1190,7 @@
 		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>"; };
+		94A8287514031D05006C37A8 /* FormatNavigator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatNavigator.h; path = include/lldb/Core/FormatNavigator.h; 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>"; };
@@ -1950,6 +1951,7 @@
 				94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */,
 				9415F61613B2C0DC00A52B36 /* FormatManager.h */,
 				9415F61713B2C0EF00A52B36 /* FormatManager.cpp */,
+				94A8287514031D05006C37A8 /* FormatNavigator.h */,
 				26F7305F139D8FC900FD51C7 /* History.h */,
 				26F73061139D8FDB00FD51C7 /* History.cpp */,
 				9AA69DBB118A029E00D753A0 /* InputReader.h */,

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=138307&r1=138306&r2=138307&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Aug 22 18:45:15 2011
@@ -1169,7 +1169,7 @@
                         const lldb::FormatCategorySP& cate)
     {
         ConstString *name = (ConstString*)param;
-        cate->Delete(*name, FormatCategory::eSummary | FormatCategory::eRegexSummary);
+        cate->Delete(*name, eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
         return true;
     }
 
@@ -1540,7 +1540,7 @@
         const char* cate_name = cate->GetName().c_str();
         
         // if the category is disabled or empty and there is no regex, just skip it
-        if ((cate->IsEnabled() == false || cate->GetCount(FormatCategory::eSummary | FormatCategory::eRegexSummary) == 0) && param->cate_regex == NULL)
+        if ((cate->IsEnabled() == false || cate->GetCount(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary) == 0) && param->cate_regex == NULL)
             return true;
         
         // if we have a regex and this category does not match it, just skip it
@@ -2046,7 +2046,7 @@
         CommandReturnObject* result = param->result;
         
         // if the category is disabled or empty and there is no regex, just skip it
-        if ((cate->IsEnabled() == false || cate->GetCount(FormatCategory::eFilter | FormatCategory::eRegexFilter) == 0) && param->cate_regex == NULL)
+        if ((cate->IsEnabled() == false || cate->GetCount(eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter) == 0) && param->cate_regex == NULL)
             return true;
         
         // if we have a regex and this category does not match it, just skip it
@@ -2256,7 +2256,7 @@
         const char* cate_name = cate->GetName().c_str();
         
         // if the category is disabled or empty and there is no regex, just skip it
-        if ((cate->IsEnabled() == false || cate->GetCount(FormatCategory::eSynth | FormatCategory::eRegexSynth) == 0) && param->cate_regex == NULL)
+        if ((cate->IsEnabled() == false || cate->GetCount(eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth) == 0) && param->cate_regex == NULL)
             return true;
         
         // if we have a regex and this category does not match it, just skip it
@@ -2397,7 +2397,7 @@
                         const lldb::FormatCategorySP& cate)
     {
         ConstString *name = (ConstString*)param;
-        return cate->Delete(*name, FormatCategory::eFilter | FormatCategory::eRegexFilter);
+        return cate->Delete(*name, eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter);
     }
     
 public:
@@ -2559,7 +2559,7 @@
                         const lldb::FormatCategorySP& cate)
     {
         ConstString* name = (ConstString*)param;
-        return cate->Delete(*name, FormatCategory::eSynth | FormatCategory::eRegexSynth);
+        return cate->Delete(*name, eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth);
     }
     
 public:
@@ -2716,7 +2716,7 @@
     PerCategoryCallback(void* param,
                         const lldb::FormatCategorySP& cate)
     {
-        cate->Clear(FormatCategory::eFilter | FormatCategory::eRegexFilter);
+        cate->Clear(eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter);
         return true;
         
     }
@@ -2842,7 +2842,7 @@
     PerCategoryCallback(void* param,
                         const lldb::FormatCategorySP& cate)
     {
-        cate->Clear(FormatCategory::eSynth | FormatCategory::eRegexSynth);
+        cate->Clear(eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth);
         return true;
         
     }
@@ -3209,7 +3209,7 @@
     DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
     
     if (category->AnyMatches(type_name,
-                             FormatCategory::eFilter | FormatCategory::eRegexFilter,
+                             eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter,
                              false))
     {
         if (error)
@@ -3386,7 +3386,7 @@
         DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
         
         if (category->AnyMatches(type_name,
-                                 FormatCategory::eSynth | FormatCategory::eRegexSynth,
+                                 eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth,
                                  false))
         {
             if (error)

Modified: lldb/trunk/source/Core/DataVisualization.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataVisualization.cpp?rev=138307&r1=138306&r2=138307&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataVisualization.cpp (original)
+++ lldb/trunk/source/Core/DataVisualization.cpp Mon Aug 22 18:45:15 2011
@@ -27,7 +27,7 @@
 }
 
 void
-DataVisualization::ForceUpdate()
+DataVisualization::ForceUpdate ()
 {
     GetFormatManager().Changed();
 }
@@ -39,62 +39,62 @@
 }
 
 bool
-DataVisualization::ValueFormats::Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, lldb::ValueFormatSP &entry)
+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)
+DataVisualization::ValueFormats::Add (const ConstString &type, const lldb::ValueFormatSP &entry)
 {
     GetFormatManager().GetValueNavigator().Add(FormatManager::GetValidTypeName(type),entry);
 }
 
 bool
-DataVisualization::ValueFormats::Delete(const ConstString &type)
+DataVisualization::ValueFormats::Delete (const ConstString &type)
 {
     return GetFormatManager().GetValueNavigator().Delete(type);
 }
 
 void
-DataVisualization::ValueFormats::Clear()
+DataVisualization::ValueFormats::Clear ()
 {
     GetFormatManager().GetValueNavigator().Clear();
 }
 
 void
-DataVisualization::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
+DataVisualization::ValueFormats::LoopThrough (ValueFormat::ValueCallback callback, void* callback_baton)
 {
     GetFormatManager().GetValueNavigator().LoopThrough(callback, callback_baton);
 }
 
 uint32_t
-DataVisualization::ValueFormats::GetCount()
+DataVisualization::ValueFormats::GetCount ()
 {
     return GetFormatManager().GetValueNavigator().GetCount();
 }
 
 bool
-DataVisualization::GetSummaryFormat(ValueObject& valobj,
-                                       lldb::DynamicValueType use_dynamic,
-                                       lldb::SummaryFormatSP& entry)
+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)
+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)
+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,
@@ -104,39 +104,39 @@
 }
 
 bool
-DataVisualization::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
+DataVisualization::Categories::Get (const ConstString &category, lldb::FormatCategorySP &entry)
 {
     entry = GetFormatManager().Category(category);
     return true;
 }
 
 void
-DataVisualization::Categories::Add(const ConstString &category)
+DataVisualization::Categories::Add (const ConstString &category)
 {
     GetFormatManager().Category(category);
 }
 
 bool
-DataVisualization::Categories::Delete(const ConstString &category)
+DataVisualization::Categories::Delete (const ConstString &category)
 {
     GetFormatManager().DisableCategory(category);
-    return GetFormatManager().GetCategories().Delete(category);
+    return GetFormatManager().DeleteCategory(category);
 }
 
 void
-DataVisualization::Categories::Clear()
+DataVisualization::Categories::Clear ()
 {
-    GetFormatManager().GetCategories().Clear();
+    GetFormatManager().ClearCategories();
 }
 
 void
-DataVisualization::Categories::Clear(ConstString &category)
+DataVisualization::Categories::Clear (ConstString &category)
 {
     GetFormatManager().Category(category)->ClearSummaries();
 }
 
 void
-DataVisualization::Categories::Enable(ConstString& category)
+DataVisualization::Categories::Enable (ConstString& category)
 {
     if (GetFormatManager().Category(category)->IsEnabled() == false)
         GetFormatManager().EnableCategory(category);
@@ -148,56 +148,56 @@
 }
 
 void
-DataVisualization::Categories::Disable(ConstString& category)
+DataVisualization::Categories::Disable (ConstString& category)
 {
     if (GetFormatManager().Category(category)->IsEnabled() == true)
         GetFormatManager().DisableCategory(category);
 }
 
 void
-DataVisualization::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
+DataVisualization::Categories::LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton)
 {
     GetFormatManager().LoopThroughCategories(callback, callback_baton);
 }
 
 uint32_t
-DataVisualization::Categories::GetCount()
+DataVisualization::Categories::GetCount ()
 {
-    return GetFormatManager().GetCategories().GetCount();
+    return GetFormatManager().GetCategoriesCount();
 }
 
 bool
-DataVisualization::NamedSummaryFormats::Get(const ConstString &type, lldb::SummaryFormatSP &entry)
+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)
+DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::SummaryFormatSP &entry)
 {
     GetFormatManager().GetNamedSummaryNavigator().Add(FormatManager::GetValidTypeName(type),entry);
 }
 
 bool
-DataVisualization::NamedSummaryFormats::Delete(const ConstString &type)
+DataVisualization::NamedSummaryFormats::Delete (const ConstString &type)
 {
     return GetFormatManager().GetNamedSummaryNavigator().Delete(type);
 }
 
 void
-DataVisualization::NamedSummaryFormats::Clear()
+DataVisualization::NamedSummaryFormats::Clear ()
 {
     GetFormatManager().GetNamedSummaryNavigator().Clear();
 }
 
 void
-DataVisualization::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
+DataVisualization::NamedSummaryFormats::LoopThrough (SummaryFormat::SummaryCallback callback, void* callback_baton)
 {
     GetFormatManager().GetNamedSummaryNavigator().LoopThrough(callback, callback_baton);
 }
 
 uint32_t
-DataVisualization::NamedSummaryFormats::GetCount()
+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=138307&r1=138306&r2=138307&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Mon Aug 22 18:45:15 2011
@@ -228,17 +228,17 @@
 void
 FormatCategory::Clear (FormatCategoryItems items)
 {
-    if ( (items & eSummary) == eSummary )
+    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
         m_summary_nav->Clear();
-    if ( (items & eRegexSummary) == eRegexSummary )
+    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
         m_regex_summary_nav->Clear();
-    if ( (items & eFilter)  == eFilter )
+    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
         m_filter_nav->Clear();
-    if ( (items & eRegexFilter) == eRegexFilter )
+    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
         m_regex_filter_nav->Clear();
-    if ( (items & eSynth)  == eSynth )
+    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
         m_synth_nav->Clear();
-    if ( (items & eRegexSynth) == eRegexSynth )
+    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
         m_regex_synth_nav->Clear();
 }
 
@@ -247,17 +247,17 @@
                         FormatCategoryItems items)
 {
     bool success = false;
-    if ( (items & eSummary) == eSummary )
+    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
         success = m_summary_nav->Delete(name) || success;
-    if ( (items & eRegexSummary) == eRegexSummary )
+    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
         success = m_regex_summary_nav->Delete(name) || success;
-    if ( (items & eFilter)  == eFilter )
+    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
         success = m_filter_nav->Delete(name) || success;
-    if ( (items & eRegexFilter) == eRegexFilter )
+    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
         success = m_regex_filter_nav->Delete(name) || success;
-    if ( (items & eSynth)  == eSynth )
+    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
         success = m_synth_nav->Delete(name) || success;
-    if ( (items & eRegexSynth) == eRegexSynth )
+    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
         success = m_regex_synth_nav->Delete(name) || success;
     return success;
 }
@@ -266,17 +266,17 @@
 FormatCategory::GetCount (FormatCategoryItems items)
 {
     uint32_t count = 0;
-    if ( (items & eSummary) == eSummary )
+    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
         count += m_summary_nav->GetCount();
-    if ( (items & eRegexSummary) == eRegexSummary )
+    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
         count += m_regex_summary_nav->GetCount();
-    if ( (items & eFilter)  == eFilter )
+    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
         count += m_filter_nav->GetCount();
-    if ( (items & eRegexFilter) == eRegexFilter )
+    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
         count += m_regex_filter_nav->GetCount();
-    if ( (items & eSynth)  == eSynth )
+    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
         count += m_synth_nav->GetCount();
-    if ( (items & eRegexSynth) == eRegexSynth )
+    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
         count += m_regex_synth_nav->GetCount();
     return count;
 }
@@ -295,69 +295,69 @@
     SyntheticFilter::SharedPointer filter;
     SyntheticScriptProvider::SharedPointer synth;
     
-    if ( (items & eSummary) == eSummary )
+    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
     {
         if (m_summary_nav->Get(type_name, summary))
         {
             if (matching_category)
                 *matching_category = m_name.c_str();
             if (matching_type)
-                *matching_type = eSummary;
+                *matching_type = eFormatCategoryItemSummary;
             return true;
         }
     }
-    if ( (items & eRegexSummary) == eRegexSummary )
+    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
     {
         if (m_regex_summary_nav->Get(type_name, summary))
         {
             if (matching_category)
                 *matching_category = m_name.c_str();
             if (matching_type)
-                *matching_type = eRegexSummary;
+                *matching_type = eFormatCategoryItemRegexSummary;
             return true;
         }
     }
-    if ( (items & eFilter)  == eFilter )
+    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
     {
         if (m_filter_nav->Get(type_name, filter))
         {
             if (matching_category)
                 *matching_category = m_name.c_str();
             if (matching_type)
-                *matching_type = eFilter;
+                *matching_type = eFormatCategoryItemFilter;
             return true;
         }
     }
-    if ( (items & eRegexFilter) == eRegexFilter )
+    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
     {
         if (m_regex_filter_nav->Get(type_name, filter))
         {
             if (matching_category)
                 *matching_category = m_name.c_str();
             if (matching_type)
-                *matching_type = eRegexFilter;
+                *matching_type = eFormatCategoryItemRegexFilter;
             return true;
         }
     }
-    if ( (items & eSynth)  == eSynth )
+    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
     {
         if (m_synth_nav->Get(type_name, synth))
         {
             if (matching_category)
                 *matching_category = m_name.c_str();
             if (matching_type)
-                *matching_type = eSynth;
+                *matching_type = eFormatCategoryItemSynth;
             return true;
         }
     }
-    if ( (items & eRegexSynth) == eRegexSynth )
+    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
     {
         if (m_regex_synth_nav->Get(type_name, synth))
         {
             if (matching_category)
                 *matching_category = m_name.c_str();
             if (matching_type)
-                *matching_type = eRegexSynth;
+                *matching_type = eFormatCategoryItemRegexSynth;
             return true;
         }
     }





More information about the lldb-commits mailing list