[Lldb-commits] [lldb] r223435 - Additional changes required by r223433.

Sean Callanan scallanan at apple.com
Thu Dec 4 17:26:42 PST 2014


Author: spyffe
Date: Thu Dec  4 19:26:42 2014
New Revision: 223435

URL: http://llvm.org/viewvc/llvm-project?rev=223435&view=rev
Log:
Additional changes required by r223433.

Added:
    lldb/trunk/include/lldb/Expression/ClangModulesDeclVendor.h
Modified:
    lldb/trunk/source/Expression/ClangASTSource.cpp

Added: lldb/trunk/include/lldb/Expression/ClangModulesDeclVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangModulesDeclVendor.h?rev=223435&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangModulesDeclVendor.h (added)
+++ lldb/trunk/include/lldb/Expression/ClangModulesDeclVendor.h Thu Dec  4 19:26:42 2014
@@ -0,0 +1,58 @@
+//===-- ClangModulesDeclVendor.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_ClangModulesDeclVendor_
+#define _liblldb_ClangModulesDeclVendor_
+
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/ClangForward.h"
+#include "lldb/Symbol/DeclVendor.h"
+#include "lldb/Target/Platform.h"
+
+#include <vector>
+
+namespace lldb_private
+{
+    
+class ClangModulesDeclVendor : public DeclVendor
+{
+public:
+    //------------------------------------------------------------------
+    // Constructors and Destructors
+    //------------------------------------------------------------------
+    ClangModulesDeclVendor();
+    
+    virtual
+    ~ClangModulesDeclVendor();
+    
+    static ClangModulesDeclVendor *
+    Create(Target &target);
+    
+    //------------------------------------------------------------------
+    /// Add a module to the list of modules to search.
+    ///
+    /// @param[in] path
+    ///     The path to the exact module to be loaded.  E.g., if the desired
+    ///     module is std.io, then this should be { "std", "io" }.
+    ///
+    /// @param[in] error_stream
+    ///     A stream to populate with the output of the Clang parser when
+    ///     it tries to load the module.
+    ///
+    /// @return
+    ///     True if the module could be loaded; false if not.  If the
+    ///     compiler encountered a fatal error during a previous module
+    ///     load, then this will always return false for this ModuleImporter.
+    //------------------------------------------------------------------
+    virtual bool
+    AddModule(std::vector<llvm::StringRef> &path, Stream &error_stream) = 0;
+};
+    
+}
+#endif /* defined(_lldb_ClangModulesDeclVendor_) */

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=223435&r1=223434&r2=223435&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Thu Dec  4 19:26:42 2014
@@ -753,19 +753,19 @@ ClangASTSource::FindExternalVisibleDecls
                 if (!language_runtime)
                     break;
 
-                TypeVendor *type_vendor = language_runtime->GetTypeVendor();
+                DeclVendor *decl_vendor = language_runtime->GetDeclVendor();
 
-                if (!type_vendor)
+                if (!decl_vendor)
                     break;
 
                 bool append = false;
                 uint32_t max_matches = 1;
-                std::vector <ClangASTType> types;
+                std::vector <clang::NamedDecl *> decls;
 
-                if (!type_vendor->FindTypes(name,
+                if (!decl_vendor->FindDecls(name,
                                             append,
                                             max_matches,
-                                            types))
+                                            decls))
                     break;
 
                 if (log)
@@ -774,10 +774,11 @@ ClangASTSource::FindExternalVisibleDecls
                                 current_id,
                                 name.GetCString());
                 }
-
-                ClangASTType copied_clang_type (GuardedCopyType(types[0]));
-
-                if (!copied_clang_type)
+                
+                clang::Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &decls[0]->getASTContext(), decls[0]);
+                clang::NamedDecl *copied_named_decl = copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
+                
+                if (!copied_named_decl)
                 {
                     if (log)
                         log->Printf("  CAS::FEVD[%u] - Couldn't export a type from the runtime",
@@ -786,7 +787,7 @@ ClangASTSource::FindExternalVisibleDecls
                     break;
                 }
 
-                context.AddTypeDecl(copied_clang_type);
+                context.AddNamedDecl(copied_named_decl);
             }
             while(0);
         }
@@ -1184,31 +1185,27 @@ ClangASTSource::FindObjCMethodDecls (Nam
         if (!language_runtime)
             break;
 
-        TypeVendor *type_vendor = language_runtime->GetTypeVendor();
+        DeclVendor *decl_vendor = language_runtime->GetDeclVendor();
 
-        if (!type_vendor)
+        if (!decl_vendor)
             break;
 
         ConstString interface_name(interface_decl->getNameAsString().c_str());
         bool append = false;
         uint32_t max_matches = 1;
-        std::vector <ClangASTType> types;
+        std::vector <clang::NamedDecl *> decls;
 
-        if (!type_vendor->FindTypes(interface_name,
+        if (!decl_vendor->FindDecls(interface_name,
                                     append,
                                     max_matches,
-                                    types))
+                                    decls))
             break;
 
-        const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr();
-
-        const ObjCInterfaceType *runtime_interface_type = dyn_cast<ObjCInterfaceType>(runtime_clang_type);
-
-        if (!runtime_interface_type)
+        ObjCInterfaceDecl *runtime_interface_decl = dyn_cast<ObjCInterfaceDecl>(decls[0]);
+        
+        if (!runtime_interface_decl)
             break;
 
-        ObjCInterfaceDecl *runtime_interface_decl = runtime_interface_type->getDecl();
-
         FindObjCMethodDeclsWithOrigin(current_id,
                                       context,
                                       runtime_interface_decl,
@@ -1354,30 +1351,26 @@ ClangASTSource::FindObjCPropertyAndIvarD
         if (!language_runtime)
             return;
 
-        TypeVendor *type_vendor = language_runtime->GetTypeVendor();
+        DeclVendor *decl_vendor = language_runtime->GetDeclVendor();
 
-        if (!type_vendor)
+        if (!decl_vendor)
             break;
 
         bool append = false;
         uint32_t max_matches = 1;
-        std::vector <ClangASTType> types;
+        std::vector <clang::NamedDecl *> decls;
 
-        if (!type_vendor->FindTypes(class_name,
+        if (!decl_vendor->FindDecls(class_name,
                                     append,
                                     max_matches,
-                                    types))
+                                    decls))
             break;
 
-        const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr();
-
-        const ObjCInterfaceType *runtime_interface_type = dyn_cast<ObjCInterfaceType>(runtime_clang_type);
-
-        if (!runtime_interface_type)
+        DeclFromUser<const ObjCInterfaceDecl> runtime_iface_decl(dyn_cast<ObjCInterfaceDecl>(decls[0]));
+        
+        if (!runtime_iface_decl.IsValid())
             break;
 
-        DeclFromUser<const ObjCInterfaceDecl> runtime_iface_decl(runtime_interface_type->getDecl());
-
         if (log)
             log->Printf("CAS::FOPD[%d] trying runtime (ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
                         current_id,





More information about the lldb-commits mailing list