[Lldb-commits] [lldb] r118976 - in /lldb/trunk: include/lldb/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Symbol/ lldb.xcodeproj/ source/Commands/ source/Core/ source/Expression/ source/Plugins/ABI/MacOSX-i386/ source/Plugins/ABI/SysV-x86_64/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/SymbolFile/DWARF/ source/Plugins/SymbolFile/Symtab/ source/Symbol/ source/Target/

Greg Clayton gclayton at apple.com
Fri Nov 12 19:52:48 PST 2010


Author: gclayton
Date: Fri Nov 12 21:52:47 2010
New Revision: 118976

URL: http://llvm.org/viewvc/llvm-project?rev=118976&view=rev
Log:
Modified the lldb_private::Type clang type resolving code to handle three
cases when getting the clang type:
- need only a forward declaration
- need a clang type that can be used for layout (members and args/return types)
- need a full clang type

This allows us to partially parse the clang types and be as lazy as possible.
The first case is when we just need to declare a type and we will complete it
later. The forward declaration happens only for class/union/structs and enums.
The layout type allows us to resolve the full clang type _except_ if we have
any modifiers on a pointer or reference (both R and L value). In this case
when we are adding members or function args or return types, we only need to
know how the type will be laid out and we can defer completing the pointee
type until we later need it. The last type means we need a full definition for
the clang type.

Did some renaming of some enumerations to get rid of the old "DC" prefix (which
stands for DebugCore which is no longer around).

Modified the clang namespace support to be almost ready to be fed to the
expression parser. I made a new ClangNamespaceDecl class that can carry around
the AST and the namespace decl so we can copy it into the expression AST. I
modified the symbol vendor and symbol file plug-ins to use this new class.



Added:
    lldb/trunk/include/lldb/Symbol/ClangNamespaceDecl.h
    lldb/trunk/source/Symbol/ClangNamespaceDecl.cpp
Modified:
    lldb/trunk/include/lldb/Core/ConstString.h
    lldb/trunk/include/lldb/Core/Value.h
    lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
    lldb/trunk/include/lldb/Symbol/ClangASTContext.h
    lldb/trunk/include/lldb/Symbol/SymbolContext.h
    lldb/trunk/include/lldb/Symbol/SymbolFile.h
    lldb/trunk/include/lldb/Symbol/SymbolVendor.h
    lldb/trunk/include/lldb/Symbol/Type.h
    lldb/trunk/include/lldb/lldb-forward.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/Commands/CommandObjectArgs.cpp
    lldb/trunk/source/Commands/CommandObjectCall.cpp
    lldb/trunk/source/Core/Value.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Core/ValueObjectChild.cpp
    lldb/trunk/source/Core/ValueObjectConstResult.cpp
    lldb/trunk/source/Core/ValueObjectRegister.cpp
    lldb/trunk/source/Core/ValueObjectVariable.cpp
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Expression/ClangExpressionVariable.cpp
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Expression/DWARFExpression.cpp
    lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
    lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/Function.cpp
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Symbol/SymbolVendor.cpp
    lldb/trunk/source/Symbol/Type.cpp
    lldb/trunk/source/Target/ThreadPlanTracer.cpp

Modified: lldb/trunk/include/lldb/Core/ConstString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConstString.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ConstString.h (original)
+++ lldb/trunk/include/lldb/Core/ConstString.h Fri Nov 12 21:52:47 2010
@@ -134,8 +134,8 @@
     /// @endcode
     ///
     /// @return
-    ///     A pointer to this object if the string isn't empty, NULL
-    ///     otherwise.
+    ///     /b True this object contains a valid non-empty C string, \b 
+    ///     false otherwise.
     //------------------------------------------------------------------
     operator bool() const
     {

Modified: lldb/trunk/include/lldb/Core/Value.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Value.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Value.h (original)
+++ lldb/trunk/include/lldb/Core/Value.h Fri Nov 12 21:52:47 2010
@@ -44,10 +44,10 @@
                                         // m_context contains...
                                         // ====================
         eContextTypeInvalid,            // undefined
-        eContextTypeOpaqueClangQualType,// void * (an opaque clang::QualType * that can be fed to "static QualType QualType::getFromOpaquePtr(void *)")
-        eContextTypeDCRegisterInfo,     // lldb::RegisterInfo *
-        eContextTypeDCType,             // Type *
-        eContextTypeDCVariable,         // Variable *
+        eContextTypeClangType,          // void * (an opaque clang::QualType * that can be fed to "static QualType QualType::getFromOpaquePtr(void *)")
+        eContextTypeRegisterInfo,       // lldb::RegisterInfo *
+        eContextTypeLLDBType,           // lldb_private::Type *
+        eContextTypeVariable,           // lldb_private::Variable *
         eContextTypeValue               // Value * (making this a proxy value.  Used when putting locals on the DWARF expression parser stack)
     };
 

Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Fri Nov 12 21:52:47 2010
@@ -93,6 +93,10 @@
     const ConstString &
     GetPersistentResultName ();
     
+    clang::NamespaceDecl *
+    AddNamespace (NameSearchContext &context, 
+                  const ClangNamespaceDecl &namespace_decl);
+
     //------------------------------------------------------------------
     /// [Used by IRForTarget] Add a variable to the list of persistent
     ///     variables for the process.

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Nov 12 21:52:47 2010
@@ -144,6 +144,11 @@
              clang::ASTContext *source_context,
              lldb::clang_type_t clang_type);
     
+    static clang::Decl *
+    CopyDecl (clang::ASTContext *dest_context, 
+              clang::ASTContext *source_context,
+              clang::Decl *source_decl);
+
     static bool
     AreTypesSame(clang::ASTContext *ast_context,
                  lldb::clang_type_t type1,

Added: lldb/trunk/include/lldb/Symbol/ClangNamespaceDecl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangNamespaceDecl.h?rev=118976&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangNamespaceDecl.h (added)
+++ lldb/trunk/include/lldb/Symbol/ClangNamespaceDecl.h Fri Nov 12 21:52:47 2010
@@ -0,0 +1,100 @@
+//===-- ClangNamespaceDecl.h ------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ClangNamespaceDecl_h_
+#define liblldb_ClangNamespaceDecl_h_
+
+#include "lldb/lldb-include.h"
+#include "lldb/Core/ClangForward.h"
+
+namespace lldb_private {
+    
+class ClangNamespaceDecl
+{
+public:
+    ClangNamespaceDecl () :
+        m_ast (NULL),
+        m_namespace_decl (NULL)
+    {
+    }
+
+    ClangNamespaceDecl (clang::ASTContext *ast, clang::NamespaceDecl *namespace_decl) :
+        m_ast (ast),
+        m_namespace_decl (namespace_decl)
+    {
+    }
+    
+    ClangNamespaceDecl (const ClangNamespaceDecl &rhs) :
+        m_ast (rhs.m_ast),
+        m_namespace_decl (rhs.m_namespace_decl)
+    {
+    }
+
+    const ClangNamespaceDecl &
+    operator = (const ClangNamespaceDecl &rhs)
+    {
+        m_ast = rhs.m_ast;
+        m_namespace_decl = rhs.m_namespace_decl;
+        return *this;
+    }
+    
+    //------------------------------------------------------------------
+    /// Convert to bool operator.
+    ///
+    /// This allows code to check a ClangNamespaceDecl object to see if 
+    /// it contains a valid namespace decl using code such as:
+    ///
+    /// @code
+    /// ClangNamespaceDecl ns_decl(...);
+    /// if (ns_decl)
+    /// { ...
+    /// @endcode
+    ///
+    /// @return
+    ///     /b True this object contains a valid namespace decl, \b 
+    ///     false otherwise.
+    //------------------------------------------------------------------
+    operator bool() const
+    {
+        return m_ast != NULL && m_namespace_decl != NULL;
+    }
+    
+    clang::ASTContext *
+    GetASTContext() const
+    { 
+        return m_ast; 
+    }
+
+    void
+    SetASTContext (clang::ASTContext *ast)
+    { 
+        m_ast = ast;
+    }
+
+    clang::NamespaceDecl *
+    GetNamespaceDecl () const
+    {
+        return m_namespace_decl;
+    }
+
+    void
+    SetNamespaceDecl (clang::NamespaceDecl *namespace_decl)
+    {
+        m_namespace_decl = namespace_decl;
+    }
+
+protected:
+    clang::ASTContext  *m_ast;
+    clang::NamespaceDecl *m_namespace_decl;
+};
+    
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_ClangNamespaceDecl_h_

Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Fri Nov 12 21:52:47 2010
@@ -15,6 +15,7 @@
 
 #include "lldb/lldb-private.h"
 #include "lldb/Core/Address.h"
+#include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Symbol/LineEntry.h"
 
 namespace lldb_private {
@@ -208,6 +209,10 @@
                          bool append, 
                          SymbolContextList &sc_list) const;
 
+
+    ClangNamespaceDecl
+    FindNamespace (const ConstString &name) const;
+
     //------------------------------------------------------------------
     /// Find a variable matching the given name, working out from this
     /// symbol context.
@@ -215,8 +220,8 @@
     /// @return
     ///     A shared pointer to the variable found.
     //------------------------------------------------------------------
-    lldb::VariableSP
-    FindVariableByName (const char *name) const;
+    //lldb::VariableSP
+    //FindVariableByName (const char *name) const;
 
     //------------------------------------------------------------------
     /// Find a type matching the given name, working out from this

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Fri Nov 12 21:52:47 2010
@@ -12,6 +12,8 @@
 
 #include "lldb/lldb-private.h"
 #include "lldb/Core/PluginInterface.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/ClangNamespaceDecl.h"
 #include "lldb/Symbol/Type.h"
 
 namespace lldb_private {
@@ -81,7 +83,7 @@
     virtual uint32_t        FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) = 0;
 //  virtual uint32_t        FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0;
     virtual TypeList *      GetTypeList ();
-    virtual clang::NamespaceDecl *
+    virtual ClangNamespaceDecl
                             FindNamespace (const SymbolContext& sc, 
                                            const ConstString &name) = 0;
 

Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Fri Nov 12 21:52:47 2010
@@ -16,6 +16,7 @@
 #include "lldb/Core/ModuleChild.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Host/Mutex.h"
+#include "lldb/Symbol/ClangNamespaceDecl.h"
 #include "lldb/Symbol/TypeList.h"
 
 
@@ -126,12 +127,9 @@
                uint32_t max_matches, 
                TypeList& types);
 
-//    virtual uint32_t
-//    FindTypes (const SymbolContext& sc, 
-//               const RegularExpression& regex, 
-//               bool append, 
-//               uint32_t max_matches, 
-//               TypeList& types);
+    virtual lldb_private::ClangNamespaceDecl
+    FindNamespace (const SymbolContext& sc, 
+                   const ConstString &name);
     
     virtual uint32_t
     GetNumCompileUnits();

Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Fri Nov 12 21:52:47 2010
@@ -21,10 +21,10 @@
 class Type : public UserID
 {
 public:
-    typedef enum
+    typedef enum EncodingDataTypeTag
     {
         eEncodingInvalid,
-        eEncodingIsUID,         ///< This type is the type whose UID is m_encoding_uid
+        eEncodingIsUID,                 ///< This type is the type whose UID is m_encoding_uid
         eEncodingIsConstUID,            ///< This type is the type whose UID is m_encoding_uid with the const qualifier added
         eEncodingIsRestrictUID,         ///< This type is the type whose UID is m_encoding_uid with the restrict qualifier added
         eEncodingIsVolatileUID,         ///< This type is the type whose UID is m_encoding_uid with the volatile qualifier added
@@ -35,6 +35,14 @@
         eEncodingIsSyntheticUID
     } EncodingDataType;
 
+    typedef enum ResolveStateTag
+    {
+        eResolveStateUnresolved = 0,
+        eResolveStateForward    = 1,
+        eResolveStateLayout     = 2,
+        eResolveStateFull       = 3
+    } ResolveState;
+
     Type (lldb::user_id_t uid,
           SymbolFile* symbol_file,
           const ConstString &name,
@@ -44,7 +52,7 @@
           EncodingDataType encoding_type,
           const Declaration& decl,
           lldb::clang_type_t clang_qual_type,
-          bool is_forward_decl);
+          ResolveState clang_type_resolve_state);
     
     // This makes an invalid type.  Used for functions that return a Type when they
     // get an error.
@@ -177,6 +185,12 @@
     lldb::clang_type_t 
     GetClangType ();
 
+    // Get the clang type, and resolve definitions enough so that the type could
+    // have layout performed. This allows ptrs and refs to class/struct/union/enum 
+    // types remain forward declarations.
+    lldb::clang_type_t 
+    GetClangLayoutType ();
+
     // Get the clang type and leave class/struct/union/enum types as forward
     // declarations if they haven't already been fully defined.
     lldb::clang_type_t 
@@ -203,6 +217,12 @@
     static int
     Compare(const Type &a, const Type &b);
 
+    void
+    SetEncodingType (Type *encoding_type)
+    {
+        m_encoding_type = encoding_type;
+    }
+
 protected:
     ConstString m_name;
     SymbolFile *m_symbol_file;
@@ -213,14 +233,12 @@
     uint32_t m_byte_size;
     Declaration m_decl;
     lldb::clang_type_t m_clang_type;
-    bool    m_is_forward_decl:1,
-            m_encoding_type_forward_decl_resolved:1,
-            m_encoding_type_decl_resolved:1;
+    ResolveState m_clang_type_resolve_state;
 
     Type *
     GetEncodingType ();
     
-    bool ResolveClangType(bool forward_decl_is_ok = false);
+    bool ResolveClangType (ResolveState clang_type_resolve_state);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Fri Nov 12 21:52:47 2010
@@ -41,6 +41,8 @@
 class   Broadcaster;
 class   CPPLanguageRuntime;
 class   ClangASTContext;
+class   ClangASTType;
+class   ClangNamespaceDecl;
 class   ClangExpression;
 class   ClangExpressionDeclMap;
 class   ClangExpressionVariable;

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Nov 12 21:52:47 2010
@@ -63,6 +63,8 @@
 		26680336116005EF008E1FE4 /* SBBreakpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF16CC7114086A1007A7B3F /* SBBreakpointLocation.cpp */; };
 		26680337116005F1008E1FE4 /* SBBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF16A9C11402D5B007A7B3F /* SBBreakpoint.cpp */; };
 		2668035C11601108008E1FE4 /* LLDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26680207115FD0ED008E1FE4 /* LLDB.framework */; };
+		266A42D6128E3FFB0090CF7C /* ClangNamespaceDecl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266A42D5128E3FFB0090CF7C /* ClangNamespaceDecl.cpp */; };
+		266A42D8128E40040090CF7C /* ClangNamespaceDecl.h in Headers */ = {isa = PBXBuildFile; fileRef = 266A42D7128E40040090CF7C /* ClangNamespaceDecl.h */; };
 		268F9D53123AA15200B91E9B /* SBSymbolContextList.h in Headers */ = {isa = PBXBuildFile; fileRef = 268F9D52123AA15200B91E9B /* SBSymbolContextList.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		268F9D55123AA16600B91E9B /* SBSymbolContextList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268F9D54123AA16600B91E9B /* SBSymbolContextList.cpp */; };
 		26B42B1F1187A92B0079C8C8 /* lldb-include.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42B1E1187A92B0079C8C8 /* lldb-include.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -567,6 +569,8 @@
 		266960611199F4230075C61A /* edit-swig-python-wrapper-file.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "edit-swig-python-wrapper-file.py"; sourceTree = "<group>"; };
 		266960621199F4230075C61A /* finish-swig-Python-lldb.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "finish-swig-Python-lldb.sh"; sourceTree = "<group>"; };
 		266960631199F4230075C61A /* sed-sources */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "sed-sources"; sourceTree = "<group>"; };
+		266A42D5128E3FFB0090CF7C /* ClangNamespaceDecl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangNamespaceDecl.cpp; path = source/Symbol/ClangNamespaceDecl.cpp; sourceTree = "<group>"; };
+		266A42D7128E40040090CF7C /* ClangNamespaceDecl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangNamespaceDecl.h; path = include/lldb/Symbol/ClangNamespaceDecl.h; sourceTree = "<group>"; };
 		2672D8461189055500FF4019 /* CommandObjectFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectFrame.cpp; path = source/Commands/CommandObjectFrame.cpp; sourceTree = "<group>"; };
 		2672D8471189055500FF4019 /* CommandObjectFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectFrame.h; path = source/Commands/CommandObjectFrame.h; sourceTree = "<group>"; };
 		2676A093119C93C8008A98EF /* StringExtractorGDBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringExtractorGDBRemote.cpp; path = source/Utility/StringExtractorGDBRemote.cpp; sourceTree = "<group>"; };
@@ -1783,6 +1787,8 @@
 				26BC7F1410F1B8EC00F91463 /* ClangASTContext.cpp */,
 				49E45FA911F660DC008F7B28 /* ClangASTType.h */,
 				49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */,
+				266A42D7128E40040090CF7C /* ClangNamespaceDecl.h */,
+				266A42D5128E3FFB0090CF7C /* ClangNamespaceDecl.cpp */,
 				26BC7C5710F1B6E900F91463 /* CompileUnit.h */,
 				26BC7F1510F1B8EC00F91463 /* CompileUnit.cpp */,
 				26BC7C5810F1B6E900F91463 /* Declaration.h */,
@@ -2374,6 +2380,7 @@
 				4C61978D12823D4300FAFFCC /* AppleObjCRuntime.h in Headers */,
 				4C61978F12823D4300FAFFCC /* AppleObjCRuntimeV1.h in Headers */,
 				4CC2A14D128C7409001531C4 /* ThreadPlanTracer.h in Headers */,
+				266A42D8128E40040090CF7C /* ClangNamespaceDecl.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2445,6 +2452,7 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
 			compatibilityVersion = "Xcode 3.1";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				en,
@@ -2876,6 +2884,7 @@
 				4C61978C12823D4300FAFFCC /* AppleObjCRuntime.cpp in Sources */,
 				4C61978E12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp in Sources */,
 				4CC2A149128C73ED001531C4 /* ThreadPlanTracer.cpp in Sources */,
+				266A42D6128E3FFB0090CF7C /* ClangNamespaceDecl.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2933,7 +2942,6 @@
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				ONLY_ACTIVE_ARCH = YES;
 				PREBINDING = NO;
 				VALID_ARCHS = "x86_64 i386";
 			};
@@ -2964,7 +2972,6 @@
 		26579F6A126A25920007C5CB /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_FIX_AND_CONTINUE = YES;

Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Fri Nov 12 21:52:47 2010
@@ -249,7 +249,7 @@
             return false;
         }
                      
-        value.SetContext (Value::eContextTypeOpaqueClangQualType, type);
+        value.SetContext (Value::eContextTypeClangType, type);
         
         value_list.PushValue(value);
     }

Modified: lldb/trunk/source/Commands/CommandObjectCall.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCall.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCall.cpp Fri Nov 12 21:52:47 2010
@@ -257,7 +257,7 @@
                 
                 
                 void *cstr_type = exe_ctx.target->GetScratchClangASTContext()->GetCStringType(true);
-                val.SetContext (Value::eContextTypeOpaqueClangQualType, cstr_type);
+                val.SetContext (Value::eContextTypeClangType, cstr_type);
                 value_list.PushValue(val);
                 
                 success = true;

Modified: lldb/trunk/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Fri Nov 12 21:52:47 2010
@@ -287,7 +287,7 @@
     if (m_context_type == eContextTypeValue)
         return ((Value*)m_context)->GetRegisterInfo();
         
-    if (m_context_type == eContextTypeDCRegisterInfo)
+    if (m_context_type == eContextTypeRegisterInfo)
         return static_cast<RegisterInfo *> (m_context);
     return NULL;
 }
@@ -298,7 +298,7 @@
     if (m_context_type == eContextTypeValue)
         return ((Value*)m_context)->GetType();
     
-    if (m_context_type == eContextTypeDCType)
+    if (m_context_type == eContextTypeLLDBType)
         return static_cast<Type *> (m_context);
     return NULL;
 }
@@ -336,12 +336,12 @@
     {
     default:
     case eContextTypeInvalid:
-    case eContextTypeOpaqueClangQualType:          // clang::Type *
-    case eContextTypeDCRegisterInfo:     // RegisterInfo *
-    case eContextTypeDCType:             // Type *
+    case eContextTypeClangType:          // clang::Type *
+    case eContextTypeRegisterInfo:     // RegisterInfo *
+    case eContextTypeLLDBType:             // Type *
         break;
 
-    case eContextTypeDCVariable:         // Variable *
+    case eContextTypeVariable:         // Variable *
         ResolveValue(exe_ctx, ast_context);
         return true;
     }
@@ -365,7 +365,7 @@
             error_ptr->SetErrorString ("Invalid context type, there is no way to know how much memory to read.");
         break;
 
-    case eContextTypeOpaqueClangQualType:
+    case eContextTypeClangType:
         if (ast_context == NULL)
         {
             if (error_ptr)
@@ -378,7 +378,7 @@
         }
         break;
 
-    case eContextTypeDCRegisterInfo:     // RegisterInfo *
+    case eContextTypeRegisterInfo:     // RegisterInfo *
         if (GetRegisterInfo())
             byte_size = GetRegisterInfo()->byte_size;
         else if (error_ptr)
@@ -386,14 +386,14 @@
 
         break;
 
-    case eContextTypeDCType:             // Type *
+    case eContextTypeLLDBType:             // Type *
         if (GetType())
             byte_size = GetType()->GetByteSize();
         else if (error_ptr)
             error_ptr->SetErrorString ("Can't determine byte size with NULL Type *.");
         break;
 
-    case eContextTypeDCVariable:         // Variable *
+    case eContextTypeVariable:         // Variable *
         if (GetVariable())
             byte_size = GetVariable()->GetType()->GetByteSize();
         else if (error_ptr)
@@ -428,18 +428,18 @@
     case eContextTypeInvalid:
         break;
 
-    case eContextTypeOpaqueClangQualType:
+    case eContextTypeClangType:
         return m_context;
 
-    case eContextTypeDCRegisterInfo:
+    case eContextTypeRegisterInfo:
         break;    // TODO: Eventually convert into a clang type?
 
-    case eContextTypeDCType:
+    case eContextTypeLLDBType:
         if (GetType())
             return GetType()->GetClangType();
         break;
 
-    case eContextTypeDCVariable:
+    case eContextTypeVariable:
         if (GetVariable())
             return GetVariable()->GetType()->GetClangType();
         break;
@@ -460,20 +460,20 @@
     case eContextTypeInvalid:
         break;
 
-    case eContextTypeOpaqueClangQualType:
+    case eContextTypeClangType:
         return ClangASTType::GetFormat (m_context);
 
-    case eContextTypeDCRegisterInfo:
+    case eContextTypeRegisterInfo:
         if (GetRegisterInfo())
             return GetRegisterInfo()->format;
         break;
 
-    case eContextTypeDCType:
+    case eContextTypeLLDBType:
         if (GetType())
             return GetType()->GetFormat();
         break;
 
-    case eContextTypeDCVariable:
+    case eContextTypeVariable:
         if (GetVariable())
             return GetVariable()->GetType()->GetFormat();
         break;
@@ -669,7 +669,7 @@
         }
     }
     
-    if (m_context_type == eContextTypeOpaqueClangQualType)
+    if (m_context_type == eContextTypeClangType)
     {
         void *opaque_clang_qual_type = GetClangType();
         switch (m_value_type)
@@ -731,7 +731,7 @@
     if (m_context_type == eContextTypeValue)
         return ((Value*)m_context)->GetVariable();
     
-    if (m_context_type == eContextTypeDCVariable)
+    if (m_context_type == eContextTypeVariable)
         return static_cast<Variable *> (m_context);
     return NULL;
 }
@@ -757,10 +757,10 @@
     switch (context_type)
     {
     case eContextTypeInvalid:               return "invalid";
-    case eContextTypeOpaqueClangQualType:   return "clang::Type *";
-    case eContextTypeDCRegisterInfo:        return "RegisterInfo *";
-    case eContextTypeDCType:                return "Type *";
-    case eContextTypeDCVariable:            return "Variable *";
+    case eContextTypeClangType:   return "clang::Type *";
+    case eContextTypeRegisterInfo:        return "RegisterInfo *";
+    case eContextTypeLLDBType:                return "Type *";
+    case eContextTypeVariable:            return "Variable *";
     case eContextTypeValue:                 return "Value"; // TODO: Sean, more description here?
     };
     return "???";

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Nov 12 21:52:47 2010
@@ -179,7 +179,7 @@
                 break;
 
             case Value::eValueTypeScalar:
-                if (m_value.GetContextType() == Value::eContextTypeDCRegisterInfo)
+                if (m_value.GetContextType() == Value::eContextTypeRegisterInfo)
                 {
                     RegisterInfo *reg_info = m_value.GetRegisterInfo();
                     if (reg_info)
@@ -611,9 +611,9 @@
 
                 switch (context_type)
                 {
-                case Value::eContextTypeOpaqueClangQualType:
-                case Value::eContextTypeDCType:
-                case Value::eContextTypeDCVariable:
+                case Value::eContextTypeClangType:
+                case Value::eContextTypeLLDBType:
+                case Value::eContextTypeVariable:
                     {
                         clang_type_t clang_type = GetClangType ();
                         if (clang_type)
@@ -638,7 +638,7 @@
                     }
                     break;
 
-                case Value::eContextTypeDCRegisterInfo:
+                case Value::eContextTypeRegisterInfo:
                     {
                         const RegisterInfo *reg_info = m_value.GetRegisterInfo();
                         if (reg_info)

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Fri Nov 12 21:52:47 2010
@@ -135,7 +135,7 @@
     {
         if (parent->UpdateValueIfNeeded(exe_scope))
         {
-            m_value.SetContext(Value::eContextTypeOpaqueClangQualType, m_clang_type);
+            m_value.SetContext(Value::eContextTypeClangType, m_clang_type);
 
             // Copy the parent scalar value and the scalar value type
             m_value.GetScalar() = parent->GetValue().GetScalar();

Modified: lldb/trunk/source/Core/ValueObjectConstResult.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResult.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResult.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResult.cpp Fri Nov 12 21:52:47 2010
@@ -44,7 +44,7 @@
     m_data.SetData(data_sp);
     m_value.GetScalar() = (uintptr_t)data_sp->GetBytes();
     m_value.SetValueType(Value::eValueTypeHostAddress);
-    m_value.SetContext(Value::eContextTypeOpaqueClangQualType, clang_type);
+    m_value.SetContext(Value::eContextTypeClangType, clang_type);
     m_name = name;
     SetIsConstant ();
     SetValueIsValid(true);

Modified: lldb/trunk/source/Core/ValueObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectRegister.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectRegister.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectRegister.cpp Fri Nov 12 21:52:47 2010
@@ -319,7 +319,7 @@
     {
         if (m_reg_ctx->ReadRegisterBytes (m_reg_num, m_data))
         {
-            m_value.SetContext(Value::eContextTypeDCRegisterInfo, (void *)m_reg_info);
+            m_value.SetContext(Value::eContextTypeRegisterInfo, (void *)m_reg_info);
             m_value.SetValueType(Value::eValueTypeHostAddress);
             m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
             SetValueIsValid (true);

Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Fri Nov 12 21:52:47 2010
@@ -120,7 +120,7 @@
     Value old_value(m_value);
     if (expr.Evaluate (&exe_ctx, GetClangAST(), loclist_base_load_addr, NULL, m_value, &m_error))
     {
-        m_value.SetContext(Value::eContextTypeDCVariable, variable);
+        m_value.SetContext(Value::eContextTypeVariable, variable);
 
         Value::ValueType value_type = m_value.GetValueType();
 
@@ -184,7 +184,7 @@
                 // Copy the Value and set the context to use our Variable
                 // so it can extract read its value into m_data appropriately
                 Value value(m_value);
-                value.SetContext(Value::eContextTypeDCVariable, variable);
+                value.SetContext(Value::eContextTypeVariable, variable);
                 m_error = value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0);
             }
             break;

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Nov 12 21:52:47 2010
@@ -23,6 +23,7 @@
 #include "lldb/Expression/ClangASTSource.h"
 #include "lldb/Expression/ClangPersistentVariables.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangNamespaceDecl.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -760,7 +761,7 @@
         break;
     case Value::eValueTypeScalar:
         {
-            if (location_value->GetContextType() != Value::eContextTypeDCRegisterInfo)
+            if (location_value->GetContextType() != Value::eContextTypeRegisterInfo)
             {
                 StreamString ss;
                 
@@ -1019,6 +1020,18 @@
                 else if (non_extern_symbol)
                     AddOneFunction(context, NULL, non_extern_symbol);
             }
+
+            ClangNamespaceDecl namespace_decl (m_sym_ctx.FindNamespace(name));
+            if (namespace_decl)
+            {
+//                clang::NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decl);
+//                if (clang_namespace_decl)
+//                {
+//                    // TODO: is this how we get the decl lookups to be called for
+//                    // this namespace??
+//                    clang_namespace_decl->setHasExternalLexicalStorage();
+//                }
+            }
         }
     }
     else
@@ -1179,7 +1192,7 @@
         type_to_use = var_opaque_type;
     
     if (var_location.get()->GetContextType() == Value::eContextTypeInvalid)
-        var_location.get()->SetContext(Value::eContextTypeOpaqueClangQualType, type_to_use);
+        var_location.get()->SetContext(Value::eContextTypeClangType, type_to_use);
     
     if (var_location.get()->GetValueType() == Value::eValueTypeFileAddress)
     {
@@ -1279,6 +1292,19 @@
     }
 }
 
+clang::NamespaceDecl *
+ClangExpressionDeclMap::AddNamespace (NameSearchContext &context, const ClangNamespaceDecl &namespace_decl)
+{
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+    
+    
+    clang::Decl *copied_decl = ClangASTContext::CopyDecl (context.GetASTContext(),
+                                                          namespace_decl.GetASTContext(),
+                                                          namespace_decl.GetNamespaceDecl());
+
+    return dyn_cast<clang::NamespaceDecl>(copied_decl);
+}
+
 void
 ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
                                        Function* fun,

Modified: lldb/trunk/source/Expression/ClangExpressionVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionVariable.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionVariable.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionVariable.cpp Fri Nov 12 21:52:47 2010
@@ -83,7 +83,7 @@
     if (m_data_sp.get() == NULL)
         return false;
     
-    value.SetContext(Value::eContextTypeOpaqueClangQualType, m_user_type.GetOpaqueQualType());
+    value.SetContext(Value::eContextTypeClangType, m_user_type.GetOpaqueQualType());
     value.SetValueType(Value::eValueTypeHostAddress);
     value.GetScalar() = (uintptr_t)m_data_sp->GetBytes();
     clang::ASTContext *ast_context = m_user_type.GetASTContext();

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Nov 12 21:52:47 2010
@@ -327,7 +327,7 @@
         // Special case: if it's a pointer, don't do anything (the ABI supports passing cstrings)
         
         if (arg_value->GetValueType() == Value::eValueTypeHostAddress &&
-            arg_value->GetContextType() == Value::eContextTypeOpaqueClangQualType &&
+            arg_value->GetContextType() == Value::eContextTypeClangType &&
             ClangASTContext::IsPointerType(arg_value->GetClangType()))
             continue;
         
@@ -421,7 +421,7 @@
     uint32_t offset = 0;
     uint64_t return_integer = data.GetMaxU64(&offset, m_return_size);
     
-    ret_value.SetContext (Value::eContextTypeOpaqueClangQualType, m_function_return_qual_type);
+    ret_value.SetContext (Value::eContextTypeClangType, m_function_return_qual_type);
     ret_value.SetValueType(Value::eValueTypeScalar);
     ret_value.GetScalar() = return_integer;
     return true;

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Nov 12 21:52:47 2010
@@ -658,7 +658,7 @@
             else
             {
                 value.SetValueType (Value::eValueTypeScalar);
-                value.SetContext (Value::eContextTypeDCRegisterInfo, const_cast<RegisterInfo *>(reg_context->GetRegisterInfoAtIndex(native_reg)));
+                value.SetContext (Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_context->GetRegisterInfoAtIndex(native_reg)));
 
                 if (reg_context->ReadRegisterValue (native_reg, value.GetScalar()))
                     return true;
@@ -2121,7 +2121,7 @@
                     return false;
                 }
             
-                if (array_val.GetContextType() != Value::eContextTypeOpaqueClangQualType)
+                if (array_val.GetContextType() != Value::eContextTypeClangType)
                 {
                     if (error_ptr)
                         error_ptr->SetErrorString("Arrays without Clang types are unhandled at this time.");
@@ -2169,7 +2169,7 @@
                 
                 Value member;
                 
-                member.SetContext(Value::eContextTypeOpaqueClangQualType, member_type);
+                member.SetContext(Value::eContextTypeClangType, member_type);
                 member.SetValueType(array_val.GetValueType());
                 
                 addr_t array_base = (addr_t)array_val.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
@@ -2212,7 +2212,7 @@
                 StreamString new_value(Stream::eBinary, 4, eByteOrderHost);
                 switch (context_type)
                 {
-                case Value::eContextTypeOpaqueClangQualType:
+                case Value::eContextTypeClangType:
                     {
                         void *clang_type = stack.back().GetClangType();
                         
@@ -2427,7 +2427,7 @@
                 tmp = stack.back();
                 stack.pop_back();
                 
-                if (tmp.GetContextType() != Value::eContextTypeOpaqueClangQualType)
+                if (tmp.GetContextType() != Value::eContextTypeClangType)
                 {
                     if (error_ptr)
                         error_ptr->SetErrorString("Item at top of expression stack must have a Clang type");
@@ -2450,7 +2450,7 @@
                 tmp.ResolveValue(exe_ctx, ast_context);
                 
                 tmp.SetValueType(value_type);
-                tmp.SetContext(Value::eContextTypeOpaqueClangQualType, target_type);
+                tmp.SetContext(Value::eContextTypeClangType, target_type);
                 
                 stack.push_back(tmp);
             }
@@ -2483,7 +2483,7 @@
                 Value *proxy = expr_local_variable->CreateProxy();
                 stack.push_back(*proxy);
                 delete proxy;
-                //stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, expr_local_variable->GetClangType());
+                //stack.back().SetContext (Value::eContextTypeClangType, expr_local_variable->GetClangType());
                 */
             }
             break;
@@ -2548,7 +2548,7 @@
             else
             {
                 void *clang_type = (void *)opcodes.GetMaxU64(&offset, sizeof(void*));
-                stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, clang_type);
+                stack.back().SetContext (Value::eContextTypeClangType, clang_type);
             }
             break;
         //----------------------------------------------------------------------

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Fri Nov 12 21:52:47 2010
@@ -234,7 +234,7 @@
             {
             default:
                 return false;
-            case Value::eContextTypeOpaqueClangQualType:
+            case Value::eContextTypeClangType:
                 {
                     void *val_type = val->GetClangType();
                     uint32_t cstr_length;
@@ -433,7 +433,7 @@
         {
             default:
                 return false;
-            case Value::eContextTypeOpaqueClangQualType:
+            case Value::eContextTypeClangType:
             {
                 void *value_type = value->GetClangType();
                 bool is_signed;
@@ -472,7 +472,7 @@
     {
         default:
             return false;
-        case Value::eContextTypeOpaqueClangQualType:
+        case Value::eContextTypeClangType:
         {
             // Extract the Clang AST context from the PC so that we can figure out type
             // sizes

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Fri Nov 12 21:52:47 2010
@@ -304,7 +304,7 @@
         {
         default:
             return false;
-        case Value::eContextTypeOpaqueClangQualType:
+        case Value::eContextTypeClangType:
             {
                 void *value_type = value->GetClangType();
                 bool is_signed;
@@ -347,7 +347,7 @@
     {
         default:
             return false;
-        case Value::eContextTypeOpaqueClangQualType:
+        case Value::eContextTypeClangType:
         {
             void *value_type = value.GetClangType();
             bool is_signed;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Fri Nov 12 21:52:47 2010
@@ -97,7 +97,7 @@
         void *opaque_type_ptr = ast_context->GetBuiltInType_objc_id();
         if (opaque_type_ptr == NULL)
             opaque_type_ptr = ast_context->GetVoidPtrType(false);
-        value.SetContext(Value::eContextTypeOpaqueClangQualType, opaque_type_ptr);    
+        value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);    
     }
 
     ValueList arg_value_list;
@@ -109,7 +109,7 @@
     
     void *return_qualtype = ast_context->GetCStringType(true);
     Value ret;
-    ret.SetContext(Value::eContextTypeOpaqueClangQualType, return_qualtype);
+    ret.SetContext(Value::eContextTypeClangType, return_qualtype);
     
     // Now we're ready to call the function:
     ClangFunction func(target_triple, ast_context, return_qualtype, *function_address, arg_value_list);

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Fri Nov 12 21:52:47 2010
@@ -74,15 +74,15 @@
     }
     
     uint32_t offset_ptr = 0;
-    uint16_t header_size = data.GetU16(&offset_ptr);
-    uint16_t descriptor_size = data.GetU16(&offset_ptr);
-    size_t num_descriptors = data.GetU32(&offset_ptr);
+    const uint16_t header_size = data.GetU16(&offset_ptr);
+    const uint16_t descriptor_size = data.GetU16(&offset_ptr);
+    const size_t num_descriptors = data.GetU32(&offset_ptr);
     
     m_next_region = data.GetPointer(&offset_ptr);
     
     // If the header size is 0, that means we've come in too early before this data is set up.
     // Set ourselves as not valid, and continue.
-    if (header_size == 0)
+    if (header_size == 0 || num_descriptors == 0)
     {
         m_valid = false;
         return;
@@ -100,8 +100,8 @@
     // to compute it over and over.
     
     // Ingest the whole descriptor array:
-    lldb::addr_t desc_ptr = m_header_addr + header_size;
-    size_t desc_array_size = num_descriptors * descriptor_size;
+    const lldb::addr_t desc_ptr = m_header_addr + header_size;
+    const size_t desc_array_size = num_descriptors * descriptor_size;
     DataBufferSP data_sp(new DataBufferHeap (desc_array_size, '\0'));
     uint8_t* dst = (uint8_t*)data_sp->GetBytes();
 
@@ -291,7 +291,7 @@
         Value input_value;
         void *clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false);
         input_value.SetValueType (Value::eValueTypeScalar);
-        input_value.SetContext (Value::eContextTypeOpaqueClangQualType, clang_void_ptr_type);
+        input_value.SetContext (Value::eContextTypeClangType, clang_void_ptr_type);
         argument_values.PushValue(input_value);
         
         bool success = abi->GetArgumentValues (*(context->exe_ctx.thread), argument_values);
@@ -515,7 +515,7 @@
         Value input_value;
         void *clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false);
         input_value.SetValueType (Value::eValueTypeScalar);
-        input_value.SetContext (Value::eContextTypeOpaqueClangQualType, clang_void_ptr_type);
+        input_value.SetContext (Value::eContextTypeClangType, clang_void_ptr_type);
         
         int obj_index;
         int sel_index;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Nov 12 21:52:47 2010
@@ -1158,7 +1158,7 @@
                             accessibility = default_accessibility;
                         member_accessibilities.push_back(accessibility);
 
-                        GetClangASTContext().AddFieldToRecordType (class_clang_type, name, member_type->GetClangType(), accessibility, bit_size);
+                        GetClangASTContext().AddFieldToRecordType (class_clang_type, name, member_type->GetClangLayoutType(), accessibility, bit_size);
                     }
                 }
             }
@@ -1226,16 +1226,16 @@
                         }
                     }
 
-                    Type *base_class_dctype = ResolveTypeUID(encoding_uid);
-                    assert(base_class_dctype);
+                    Type *base_class_type = ResolveTypeUID(encoding_uid);
+                    assert(base_class_type);
                     
                     if (class_language == eLanguageTypeObjC)
                     {
-                        GetClangASTContext().SetObjCSuperClass(class_clang_type, base_class_dctype->GetClangType());
+                        GetClangASTContext().SetObjCSuperClass(class_clang_type, base_class_type->GetClangType());
                     }
                     else
                     {
-                        base_classes.push_back (GetClangASTContext().CreateBaseClassSpecifier (base_class_dctype->GetClangType(), accessibility, is_virtual, is_base_of_class));
+                        base_classes.push_back (GetClangASTContext().CreateBaseClassSpecifier (base_class_type->GetClangType(), accessibility, is_virtual, is_base_of_class));
                         assert(base_classes.back());
                     }
                 }
@@ -2100,36 +2100,42 @@
 }
 
 
-clang::NamespaceDecl *
+ClangNamespaceDecl
 SymbolFileDWARF::FindNamespace (const SymbolContext& sc, 
                                 const ConstString &name)
 {
+    ClangNamespaceDecl namespace_decl;
     DWARFDebugInfo* info = DebugInfo();
-    if (info == NULL)
-        return 0;
-
-    // Index if we already haven't to make sure the compile units
-    // get indexed and make their global DIE index list
-    if (!m_indexed)
-        Index ();
-
-    DWARFCompileUnit* curr_cu = NULL;
-    DWARFCompileUnit* prev_cu = NULL;
-    const DWARFDebugInfoEntry* die = NULL;
-    std::vector<NameToDIE::Info> die_info_array;
-    const size_t num_matches = m_namespace_index.Find (name, die_info_array);
-    for (size_t i=0; i<num_matches; ++i, prev_cu = curr_cu)
+    if (info)
     {
-        curr_cu = info->GetCompileUnitAtIndex(die_info_array[i].cu_idx);
-        
-        if (curr_cu != prev_cu)
-            curr_cu->ExtractDIEsIfNeeded (false);
+        // Index if we already haven't to make sure the compile units
+        // get indexed and make their global DIE index list
+        if (!m_indexed)
+            Index ();
+
+        DWARFCompileUnit* curr_cu = NULL;
+        DWARFCompileUnit* prev_cu = NULL;
+        const DWARFDebugInfoEntry* die = NULL;
+        std::vector<NameToDIE::Info> die_info_array;
+        const size_t num_matches = m_namespace_index.Find (name, die_info_array);
+        for (size_t i=0; i<num_matches; ++i, prev_cu = curr_cu)
+        {
+            curr_cu = info->GetCompileUnitAtIndex(die_info_array[i].cu_idx);
+            
+            if (curr_cu != prev_cu)
+                curr_cu->ExtractDIEsIfNeeded (false);
 
-        die = curr_cu->GetDIEAtIndexUnchecked(die_info_array[i].die_idx);
+            die = curr_cu->GetDIEAtIndexUnchecked(die_info_array[i].die_idx);
 
-        return ResolveNamespaceDIE (curr_cu, die);
+            clang::NamespaceDecl *clang_namespace_decl = ResolveNamespaceDIE (curr_cu, die);
+            if (clang_namespace_decl)
+            {
+                namespace_decl.SetASTContext (GetClangASTContext().getASTContext());
+                namespace_decl.SetNamespaceDecl (clang_namespace_decl);
+            }
+        }
     }
-    return NULL;
+    return namespace_decl;
 }
 
 uint32_t
@@ -2700,6 +2706,10 @@
             DWARFDebugInfoEntry::Attributes attributes;
             const char *type_name_cstr = NULL;
             ConstString type_name_const_str;
+            Type::ResolveState resolve_state = Type::eResolveStateUnresolved;
+            size_t byte_size = 0;
+            Declaration decl;
+
             Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
             clang_type_t clang_type = NULL;
 
@@ -2719,9 +2729,7 @@
                     m_die_to_type[die] = DIE_IS_BEING_PARSED;
 
                     const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
-                    Declaration decl;
                     uint32_t encoding = 0;
-                    size_t byte_size = 0;
                     lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
 
                     if (num_attributes > 0)
@@ -2758,47 +2766,21 @@
                     switch (tag)
                     {
                     default:
+                        break;
+
                     case DW_TAG_base_type:
+                        resolve_state = Type::eResolveStateFull;
                         clang_type = ast.GetBuiltinTypeForDWARFEncodingAndBitSize (type_name_cstr, 
                                                                                    encoding, 
                                                                                    byte_size * 8);
                         break;
 
-                    case DW_TAG_pointer_type:
-                        // The encoding_uid will be embedded into the
-                        // Type object and will be looked up when the Type::GetClangType()
-                        encoding_data_type = Type::eEncodingIsPointerUID;
-                        break;
-
-                    case DW_TAG_reference_type:
-                        // The encoding_uid will be embedded into the
-                        // Type object and will be looked up when the Type::GetClangType()
-                        encoding_data_type = Type::eEncodingIsLValueReferenceUID;
-                        break;
-
-                    case DW_TAG_typedef:
-                        // The encoding_uid will be embedded into the
-                        // Type object and will be looked up when the Type::GetClangType()
-                        encoding_data_type = Type::eEncodingIsTypedefUID;
-                        break;
-
-                    case DW_TAG_const_type:
-                        // The encoding_uid will be embedded into the
-                        // Type object and will be looked up when the Type::GetClangType()
-                        encoding_data_type = Type::eEncodingIsConstUID; //ClangASTContext::AddConstModifier (clang_type);
-                        break;
-
-                    case DW_TAG_restrict_type:
-                        // The encoding_uid will be embedded into the
-                        // Type object and will be looked up when the Type::GetClangType()
-                        encoding_data_type = Type::eEncodingIsRestrictUID; //ClangASTContext::AddRestrictModifier (clang_type);
-                        break;
-
-                    case DW_TAG_volatile_type:
-                        // The encoding_uid will be embedded into the
-                        // Type object and will be looked up when the Type::GetClangType()
-                        encoding_data_type = Type::eEncodingIsVolatileUID; //ClangASTContext::AddVolatileModifier (clang_type);
-                        break;
+                    case DW_TAG_pointer_type:   encoding_data_type = Type::eEncodingIsPointerUID;           break;
+                    case DW_TAG_reference_type: encoding_data_type = Type::eEncodingIsLValueReferenceUID;   break;
+                    case DW_TAG_typedef:        encoding_data_type = Type::eEncodingIsTypedefUID;           break;
+                    case DW_TAG_const_type:     encoding_data_type = Type::eEncodingIsConstUID;             break;
+                    case DW_TAG_restrict_type:  encoding_data_type = Type::eEncodingIsRestrictUID;          break;
+                    case DW_TAG_volatile_type:  encoding_data_type = Type::eEncodingIsVolatileUID;          break;
                     }
 
                     if (type_name_cstr != NULL && sc.comp_unit != NULL && 
@@ -2811,14 +2793,18 @@
                         if (type_name_const_str == g_objc_type_name_id)
                         {
                             clang_type = ast.GetBuiltInType_objc_id();
+                            resolve_state = Type::eResolveStateFull;
+
                         }
                         else if (type_name_const_str == g_objc_type_name_Class)
                         {
                             clang_type = ast.GetBuiltInType_objc_Class();
+                            resolve_state = Type::eResolveStateFull;
                         }
                         else if (type_name_const_str == g_objc_type_name_selector)
                         {
                             clang_type = ast.GetBuiltInType_objc_selector();
+                            resolve_state = Type::eResolveStateFull;
                         }
                     }
                         
@@ -2831,7 +2817,7 @@
                                              encoding_data_type, 
                                              &decl, 
                                              clang_type, 
-                                             clang_type == NULL));
+                                             resolve_state));
                     
                     m_die_to_type[die] = type_sp.get();
 
@@ -2853,10 +2839,8 @@
                     // Set a bit that lets us know that we are currently parsing this
                     m_die_to_type[die] = DIE_IS_BEING_PARSED;
 
-                    size_t byte_size = 0;
                     LanguageType class_language = eLanguageTypeUnknown;
                     //bool struct_is_class = false;
-                    Declaration decl;
                     const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
                     if (num_attributes > 0)
                     {
@@ -2974,7 +2958,6 @@
                     // parameters in any class methods need it for the clang 
                     // types for function prototypes. 
                     m_die_to_decl_ctx[die] = ClangASTContext::GetDeclContextForType (clang_type);
-                    const bool is_forward_decl = die->HasChildren();
                     type_sp.reset (new Type (die->GetOffset(), 
                                              this, 
                                              type_name_const_str, 
@@ -2984,7 +2967,7 @@
                                              Type::eEncodingIsUID, 
                                              &decl, 
                                              clang_type, 
-                                             is_forward_decl));
+                                             Type::eResolveStateForward));
                     
                     m_die_to_type[die] = type_sp.get();
 
@@ -3013,9 +2996,7 @@
                     // Set a bit that lets us know that we are currently parsing this
                     m_die_to_type[die] = DIE_IS_BEING_PARSED;
 
-                    size_t byte_size = 0;
                     lldb::user_id_t encoding_uid = DW_INVALID_OFFSET;
-                    Declaration decl;
 
                     const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
                     if (num_attributes > 0)
@@ -3086,7 +3067,7 @@
                                                  Type::eEncodingIsUID,
                                                  &decl, 
                                                  clang_type, 
-                                                 true));
+                                                 Type::eResolveStateForward));
                         
                         m_die_to_type[die] = type_sp.get();
 
@@ -3111,7 +3092,6 @@
 
                     const char *mangled = NULL;
                     dw_offset_t type_die_offset = DW_INVALID_OFFSET;
-                    Declaration decl;
                     bool is_variadic = false;
                     bool is_inline = false;
                     bool is_static = false;
@@ -3202,7 +3182,7 @@
                         func_type = ResolveTypeUID(type_die_offset);
 
                     if (func_type)
-                        return_clang_type = func_type->GetClangForwardType();
+                        return_clang_type = func_type->GetClangLayoutType();
                     else
                         return_clang_type = ast.GetBuiltInType_void();
 
@@ -3339,7 +3319,7 @@
                                              Type::eEncodingIsUID, 
                                              &decl, 
                                              clang_type, 
-                                             false));
+                                             Type::eResolveStateFull));
                     
                     m_die_to_type[die] = type_sp.get();
                     assert(type_sp.get());
@@ -3351,9 +3331,7 @@
                     // Set a bit that lets us know that we are currently parsing this
                     m_die_to_type[die] = DIE_IS_BEING_PARSED;
 
-                    size_t byte_size = 0;
                     lldb::user_id_t type_die_offset = DW_INVALID_OFFSET;
-                    Declaration decl;
                     int64_t first_index = 0;
                     uint32_t byte_stride = 0;
                     uint32_t bit_stride = 0;
@@ -3432,11 +3410,12 @@
                                                      empty_name, 
                                                      array_element_bit_stride / 8, 
                                                      NULL, 
-                                                     LLDB_INVALID_UID, 
+                                                     type_die_offset, 
                                                      Type::eEncodingIsUID, 
                                                      &decl, 
                                                      clang_type, 
-                                                     false));
+                                                     Type::eResolveStateFull));
+                            type_sp->SetEncodingType (element_type);
                             m_die_to_type[die] = type_sp.get();
                         }
                     }
@@ -3471,14 +3450,14 @@
                         Type *pointee_type = ResolveTypeUID(type_die_offset);
                         Type *class_type = ResolveTypeUID(containing_type_die_offset);
                         
-                        clang_type_t pointee_clang_type = pointee_type->GetClangType();
-                        clang_type_t class_clang_type = class_type->GetClangType();
+                        clang_type_t pointee_clang_type = pointee_type->GetClangForwardType();
+                        clang_type_t class_clang_type = class_type->GetClangLayoutType();
 
                         clang_type = ast.CreateMemberPointerType(pointee_clang_type, 
                                                                  class_clang_type);
 
-                        size_t byte_size = ClangASTType::GetClangTypeBitWidth (ast.getASTContext(), 
-                                                                               clang_type) / 8;
+                        byte_size = ClangASTType::GetClangTypeBitWidth (ast.getASTContext(), 
+                                                                       clang_type) / 8;
 
                         type_sp.reset( new Type (die->GetOffset(), 
                                                  this, 
@@ -3489,7 +3468,7 @@
                                                  Type::eEncodingIsUID, 
                                                  NULL, 
                                                  clang_type, 
-                                                 false));
+                                                 Type::eResolveStateForward));
                         m_die_to_type[die] = type_sp.get();
                     }
                                             

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Nov 12 21:52:47 2010
@@ -110,7 +110,7 @@
     virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
 //  virtual uint32_t        FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb::Type::Encoding encoding, lldb::user_id_t udt_uid, lldb_private::TypeList& types);
     virtual lldb_private::TypeList *GetTypeList ();
-    virtual clang::NamespaceDecl *
+    virtual lldb_private::ClangNamespaceDecl
             FindNamespace (const lldb_private::SymbolContext& sc, 
                            const lldb_private::ConstString &name);
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Fri Nov 12 21:52:47 2010
@@ -953,11 +953,11 @@
 //}
 
 
-clang::NamespaceDecl *
+ClangNamespaceDecl
 SymbolFileDWARFDebugMap::FindNamespace (const lldb_private::SymbolContext& sc, 
                                         const lldb_private::ConstString &name)
 {
-    clang::NamespaceDecl *matching_namespace = NULL;
+    ClangNamespaceDecl matching_namespace;
     SymbolFileDWARF *oso_dwarf;
 
     if (sc.comp_unit)

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Fri Nov 12 21:52:47 2010
@@ -71,7 +71,7 @@
     virtual uint32_t        FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
     virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
 //  virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types);
-    virtual clang::NamespaceDecl *
+    virtual lldb_private::ClangNamespaceDecl
             FindNamespace (const lldb_private::SymbolContext& sc, 
                            const lldb_private::ConstString &name);
 

Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Fri Nov 12 21:52:47 2010
@@ -277,10 +277,10 @@
     return NULL;
 }
 
-clang::NamespaceDecl *
+ClangNamespaceDecl 
 SymbolFileSymtab::FindNamespace (const SymbolContext& sc, const ConstString &name)
 {
-    return NULL;
+    return ClangNamespaceDecl();
 }
 
 uint32_t

Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h Fri Nov 12 21:52:47 2010
@@ -101,7 +101,7 @@
 //  virtual uint32_t
 //  FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::TypeList& types);
 
-    virtual clang::NamespaceDecl *
+    virtual lldb_private::ClangNamespaceDecl
     FindNamespace (const lldb_private::SymbolContext& sc, 
                    const lldb_private::ConstString &name);
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Nov 12 21:52:47 2010
@@ -740,6 +740,23 @@
     return dst.getAsOpaquePtr();
 }
 
+
+clang::Decl *
+ClangASTContext::CopyDecl (ASTContext *dest_context, 
+                           ASTContext *source_context,
+                           clang::Decl *source_decl)
+{
+    // null_client's ownership is transferred to diagnostics
+    NullDiagnosticClient *null_client = new NullDiagnosticClient;
+    Diagnostic diagnostics(null_client);
+    FileManager file_manager;
+    ASTImporter importer(diagnostics,
+                         *dest_context, file_manager,
+                         *source_context, file_manager);
+    
+    return importer.Import(source_decl);
+}
+
 bool
 ClangASTContext::AreTypesSame(ASTContext *ast_context,
              clang_type_t type1,

Added: lldb/trunk/source/Symbol/ClangNamespaceDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangNamespaceDecl.cpp?rev=118976&view=auto
==============================================================================
--- lldb/trunk/source/Symbol/ClangNamespaceDecl.cpp (added)
+++ lldb/trunk/source/Symbol/ClangNamespaceDecl.cpp Fri Nov 12 21:52:47 2010
@@ -0,0 +1,11 @@
+//===-- ClangNamespaceDecl.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/Symbol/ClangNamespaceDecl.h"
+

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Fri Nov 12 21:52:47 2010
@@ -413,8 +413,18 @@
     CalculateSymbolContext (&sc);
     // Null out everything below the CompUnit 'cause we don't actually know these.
 
-    size_t bit_size = ClangASTType::GetClangTypeBitWidth ((GetType()->GetClangASTContext().getASTContext()), fun_return_qualtype.getAsOpaquePtr());
-    Type return_type (0, GetType()->GetSymbolFile(), fun_return_name, bit_size, sc.comp_unit, 0, Type::eEncodingIsSyntheticUID, Declaration(), fun_return_qualtype.getAsOpaquePtr(), false);
+    size_t bit_size = ClangASTType::GetClangTypeBitWidth (GetType()->GetClangASTContext().getASTContext(), 
+                                                          fun_return_qualtype.getAsOpaquePtr());
+    Type return_type (0, 
+                      GetType()->GetSymbolFile(), 
+                      fun_return_name, 
+                      bit_size, 
+                      sc.comp_unit, 
+                      0, 
+                      Type::eEncodingIsSyntheticUID, 
+                      Declaration(), 
+                      fun_return_qualtype.getAsOpaquePtr(), 
+                      Type::eResolveStateFull);
     return return_type;
 }
 
@@ -455,7 +465,16 @@
         // Null out everything below the CompUnit 'cause we don't actually know these.
 
         size_t bit_size = ClangASTType::GetClangTypeBitWidth ((GetType()->GetClangASTContext().getASTContext()), arg_qualtype.getAsOpaquePtr());
-        Type arg_type (0, GetType()->GetSymbolFile(), arg_return_name, bit_size, sc.comp_unit, 0, Type::eEncodingIsSyntheticUID, Declaration(), arg_qualtype.getAsOpaquePtr(), false);
+        Type arg_type (0, 
+                       GetType()->GetSymbolFile(), 
+                       arg_return_name, 
+                       bit_size, 
+                       sc.comp_unit, 
+                       0, 
+                       Type::eEncodingIsSyntheticUID, 
+                       Declaration(), 
+                       arg_qualtype.getAsOpaquePtr(), 
+                       Type::eResolveStateFull);
         return arg_type;
     }
 

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Fri Nov 12 21:52:47 2010
@@ -400,6 +400,14 @@
     return false;
 }
 
+ClangNamespaceDecl
+SymbolContext::FindNamespace (const ConstString &name) const
+{
+    ClangNamespaceDecl namespace_decl;
+    if (module_sp)
+        namespace_decl = module_sp->GetSymbolVendor()->FindNamespace (*this, name);
+    return namespace_decl;
+}
 
 size_t
 SymbolContext::FindFunctionsByName (const ConstString &name, bool append, SymbolContextList &sc_list) const
@@ -422,12 +430,12 @@
     return sc_list.GetSize();
 }
 
-lldb::VariableSP
-SymbolContext::FindVariableByName (const char *name) const
-{
-    lldb::VariableSP return_value;
-    return return_value;
-}
+//lldb::VariableSP
+//SymbolContext::FindVariableByName (const char *name) const
+//{
+//    lldb::VariableSP return_value;
+//    return return_value;
+//}
 
 lldb::TypeSP
 SymbolContext::FindTypeByName (const ConstString &name) const

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Fri Nov 12 21:52:47 2010
@@ -261,22 +261,16 @@
         types.Clear();
     return 0;
 }
-//
-//uint32_t
-//SymbolVendor::FindTypes(const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types)
-//{
-//  Mutex::Locker locker(m_mutex);
-//  if (m_sym_file_ap.get())
-//  {
-//      lldb::user_id_t udt_uid = LLDB_INVALID_UID;
-//
-//      if (encoding == Type::user_defined_type)
-//          udt_uid = UserDefType::GetUserDefTypeUID(udt_name);
-//
-//      return m_sym_file_ap->FindTypes(sc, regex, append, max_matches, encoding, udt_uid, types);
-//  }
-//  return 0;
-//}
+
+ClangNamespaceDecl
+SymbolVendor::FindNamespace(const SymbolContext& sc, const ConstString &name)
+{
+    Mutex::Locker locker(m_mutex);
+    ClangNamespaceDecl namespace_decl;
+    if (m_sym_file_ap.get())
+        namespace_decl = m_sym_file_ap->FindNamespace (sc, name);
+    return namespace_decl;
+}
 
 void
 SymbolVendor::Dump(Stream *s)

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Fri Nov 12 21:52:47 2010
@@ -39,7 +39,7 @@
     EncodingDataType encoding_data_type,
     const Declaration& decl,
     clang_type_t clang_type,
-    bool is_forward_decl
+    ResolveState clang_type_resolve_state
 ) :
     UserID (uid),
     m_name (name),
@@ -51,9 +51,7 @@
     m_byte_size (byte_size),
     m_decl (decl),
     m_clang_type (clang_type),
-    m_is_forward_decl (is_forward_decl),
-    m_encoding_type_forward_decl_resolved (false),
-    m_encoding_type_decl_resolved (false)
+    m_clang_type_resolve_state (clang_type ? clang_type_resolve_state : eResolveStateUnresolved)
 {
 }
 
@@ -66,9 +64,9 @@
     m_encoding_uid_type (eEncodingInvalid),
     m_encoding_uid (0),
     m_byte_size (0),
-    m_is_forward_decl (false),
     m_decl (),
-    m_clang_type (NULL)
+    m_clang_type (NULL),
+    m_clang_type_resolve_state (eResolveStateUnresolved)
 {
 }
 
@@ -86,9 +84,9 @@
         m_encoding_uid_type = rhs.m_encoding_uid_type;
         m_encoding_uid = rhs.m_encoding_uid;
         m_byte_size = rhs.m_byte_size;
-        m_is_forward_decl = rhs.m_is_forward_decl;
         m_decl = rhs.m_decl;
         m_clang_type = rhs.m_clang_type;
+        m_clang_type_resolve_state = rhs.m_clang_type_resolve_state;
     }
     return *this;
 }
@@ -190,7 +188,7 @@
 {
     if (!(m_name))
     {
-        if (ResolveClangType(true))
+        if (ResolveClangType(eResolveStateForward))
         {
             std::string type_name = ClangASTContext::GetTypeName (m_clang_type);
             if (!type_name.empty())
@@ -220,7 +218,7 @@
     lldb::Format format
 )
 {
-    if (ResolveClangType(true))
+    if (ResolveClangType(eResolveStateForward))
     {
         if (show_types)
         {
@@ -251,11 +249,8 @@
 lldb_private::Type *
 lldb_private::Type::GetEncodingType ()
 {
-    if (m_encoding_type == NULL)
-    {
-        if (m_encoding_uid != LLDB_INVALID_UID)
-            m_encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
-    }
+    if (m_encoding_type == NULL && m_encoding_uid != LLDB_INVALID_UID)
+        m_encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
     return m_encoding_type;
 }
     
@@ -279,7 +274,7 @@
                     m_byte_size = encoding_type->GetByteSize();
                 if (m_byte_size == 0)
                 {
-                    uint64_t bit_width = ClangASTType::GetClangTypeBitWidth (GetClangAST(), GetClangType());
+                    uint64_t bit_width = ClangASTType::GetClangTypeBitWidth (GetClangAST(), GetClangLayoutType());
                     m_byte_size = (bit_width + 7 ) / 8;
                 }
             }
@@ -300,7 +295,7 @@
 uint32_t
 lldb_private::Type::GetNumChildren (bool omit_empty_base_classes)
 {
-    if (!ResolveClangType())
+    if (!ResolveClangType(eResolveStateFull))
         return 0;
     return ClangASTContext::GetNumChildren (m_clang_type, omit_empty_base_classes);
 
@@ -309,7 +304,7 @@
 bool
 lldb_private::Type::IsAggregateType ()
 {
-    if (ResolveClangType())
+    if (ResolveClangType(eResolveStateForward))
         return ClangASTContext::IsAggregateType (m_clang_type);
     return false;
 }
@@ -318,7 +313,7 @@
 lldb_private::Type::GetFormat ()
 {
     // Make sure we resolve our type if it already hasn't been.
-    if (!ResolveClangType())
+    if (!ResolveClangType(eResolveStateForward))
         return lldb::eFormatInvalid;
     return lldb_private::ClangASTType::GetFormat (m_clang_type);
 }
@@ -329,7 +324,7 @@
 lldb_private::Type::GetEncoding (uint32_t &count)
 {
     // Make sure we resolve our type if it already hasn't been.
-    if (!ResolveClangType())
+    if (!ResolveClangType(eResolveStateForward))
         return lldb::eEncodingInvalid;
 
     return lldb_private::ClangASTType::GetEncoding (m_clang_type, count);
@@ -422,18 +417,23 @@
 }
 
 bool
-lldb_private::Type::ResolveClangType (bool forward_decl_is_ok)
+lldb_private::Type::ResolveClangType (ResolveState clang_type_resolve_state)
 {
+    Type *encoding_type = NULL;
     if (m_clang_type == NULL)
     {
         TypeList *type_list = GetTypeList();
-        Type *encoding_type = GetEncodingType();
+        encoding_type = GetEncodingType();
         if (encoding_type)
         {
             switch (m_encoding_uid_type)
             {
             case eEncodingIsUID:
-                m_clang_type = encoding_type->GetClangType();
+                if (encoding_type->ResolveClangType(clang_type_resolve_state))
+                {
+                    m_clang_type = encoding_type->m_clang_type;
+                    m_clang_type_resolve_state = encoding_type->m_clang_type_resolve_state;
+                }
                 break;
 
             case eEncodingIsConstUID:
@@ -518,11 +518,9 @@
     }
     
     // Check if we have a forward reference to a class/struct/union/enum?
-    if (m_clang_type != NULL && 
-        m_is_forward_decl == true && 
-        forward_decl_is_ok == false)
+    if (m_clang_type && m_clang_type_resolve_state < clang_type_resolve_state)
     {
-        m_is_forward_decl = false;
+        m_clang_type_resolve_state = eResolveStateFull;
         if (!ClangASTType::IsDefined (m_clang_type))
         {
             // We have a forward declaration, we need to resolve it to a complete
@@ -533,45 +531,25 @@
     
     // If we have an encoding type, then we need to make sure it is 
     // resolved appropriately.
-    if (m_encoding_type_decl_resolved == false)
+    if (m_encoding_uid != LLDB_INVALID_UID)
     {
-        if ((forward_decl_is_ok == true  && !m_encoding_type_forward_decl_resolved) ||
-            (forward_decl_is_ok == false))
+        if (encoding_type == NULL)
+            encoding_type = GetEncodingType();
+        if (encoding_type)
         {
-            Type *encoding_type = GetEncodingType ();
-            if (encoding_type != NULL)
-            {
-                bool forward_decl_is_ok_for_encoding = forward_decl_is_ok;
-//                switch (m_encoding_uid_type)
-//                {
-//                case eEncodingIsPointerUID:
-//                case eEncodingIsLValueReferenceUID:
-//                case eEncodingIsRValueReferenceUID:
-//                    forward_decl_is_ok_for_encoding = true;
-//                    break;
-//                default:
-//                    break;
-//                }
-                
-                if (encoding_type->ResolveClangType (forward_decl_is_ok_for_encoding))
-                {
-                    // We have at least resolve the forward declaration for our
-                    // encoding type...
-                    m_encoding_type_forward_decl_resolved = true;
-                
-                    // Check if we fully resolved our encoding type, and if so
-                    // mark it as having been completely resolved.
-                    if (forward_decl_is_ok_for_encoding == false)
-                        m_encoding_type_decl_resolved = true;
-                }
-            }
-            else
+            ResolveState encoding_clang_type_resolve_state = eResolveStateFull;
+            switch (m_encoding_uid_type)
             {
-                // We don't have an encoding type, so mark everything as being 
-                // resolved so we don't get into this if statement again
-                m_encoding_type_decl_resolved = true;
-                m_encoding_type_forward_decl_resolved = true;
+            case eEncodingIsPointerUID:
+            case eEncodingIsLValueReferenceUID:
+            case eEncodingIsRValueReferenceUID:
+                if (clang_type_resolve_state == eResolveStateLayout)
+                    encoding_clang_type_resolve_state = eResolveStateForward;
+                break;
+            default:
+                break;
             }
+            encoding_type->ResolveClangType (encoding_clang_type_resolve_state);
         }
     }
     return m_clang_type != NULL;
@@ -592,29 +570,30 @@
     bool &child_is_base_class
 )
 {
-    if (!ResolveClangType())
-        return NULL;
-
-    std::string name_str;
-    clang_type_t child_qual_type = GetClangASTContext().GetChildClangTypeAtIndex (
-            parent_name,
-            m_clang_type,
-            idx,
-            transparent_pointers,
-            omit_empty_base_classes,
-            name_str,
-            child_byte_size,
-            child_byte_offset,
-            child_bitfield_bit_size,
-            child_bitfield_bit_offset,
-            child_is_base_class);
-
-    if (child_qual_type)
+    clang_type_t child_qual_type = NULL;
+    
+    if (GetClangType())
     {
-        if (!name_str.empty())
-            name.SetCString(name_str.c_str());
-        else
-            name.Clear();
+        std::string name_str;
+        child_qual_type = GetClangASTContext().GetChildClangTypeAtIndex (parent_name,
+                                                                         m_clang_type,
+                                                                         idx,
+                                                                         transparent_pointers,
+                                                                         omit_empty_base_classes,
+                                                                         name_str,
+                                                                         child_byte_size,
+                                                                         child_byte_offset,
+                                                                         child_bitfield_bit_size,
+                                                                         child_bitfield_bit_offset,
+                                                                         child_is_base_class);
+        
+        if (child_qual_type)
+        {
+            if (!name_str.empty())
+                name.SetCString(name_str.c_str());
+            else
+                name.Clear();
+        }
     }
     return child_qual_type;
 }
@@ -623,16 +602,21 @@
 clang_type_t 
 lldb_private::Type::GetClangType ()
 {
-    const bool forward_decl_is_ok = false;
-    ResolveClangType(forward_decl_is_ok);
+    ResolveClangType(eResolveStateFull);
+    return m_clang_type;
+}
+
+clang_type_t 
+lldb_private::Type::GetClangLayoutType ()
+{
+    ResolveClangType(eResolveStateLayout);
     return m_clang_type;
 }
 
 clang_type_t 
 lldb_private::Type::GetClangForwardType ()
 {
-    const bool forward_decl_is_ok = true;
-    ResolveClangType (forward_decl_is_ok);
+    ResolveClangType (eResolveStateForward);
     return m_clang_type;
 }
 

Modified: lldb/trunk/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTracer.cpp?rev=118976&r1=118975&r2=118976&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTracer.cpp Fri Nov 12 21:52:47 2010
@@ -245,7 +245,7 @@
         {
             Value value;
             value.SetValueType (Value::eValueTypeScalar);
-            value.SetContext (Value::eContextTypeOpaqueClangQualType, m_intptr_type.GetOpaqueQualType());
+            value.SetContext (Value::eContextTypeClangType, m_intptr_type.GetOpaqueQualType());
             value_list.PushValue (value);
         }
         





More information about the lldb-commits mailing list