From: Sean Callanan Date: Fri, 5 Dec 2014 01:26:42 +0000 (+0000) Subject: Additional changes required by r223433. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c631b64fab30f30b36781e819add0a264d03ed7e;p=platform%2Fupstream%2Fllvm.git Additional changes required by r223433. llvm-svn: 223435 --- diff --git a/lldb/include/lldb/Expression/ClangModulesDeclVendor.h b/lldb/include/lldb/Expression/ClangModulesDeclVendor.h new file mode 100644 index 0000000..a35b86a --- /dev/null +++ b/lldb/include/lldb/Expression/ClangModulesDeclVendor.h @@ -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 + +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 &path, Stream &error_stream) = 0; +}; + +} +#endif /* defined(_lldb_ClangModulesDeclVendor_) */ diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index d488993..e46762c7 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -753,19 +753,19 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context, 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 types; + std::vector 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 (NameSearchContext &context, 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(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 (NameSearchContext &context, break; } - context.AddTypeDecl(copied_clang_type); + context.AddNamedDecl(copied_named_decl); } while(0); } @@ -1184,31 +1185,27 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context) 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 types; + std::vector 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(runtime_clang_type); - - if (!runtime_interface_type) + ObjCInterfaceDecl *runtime_interface_decl = dyn_cast(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::FindObjCPropertyAndIvarDecls (NameSearchContext &context) 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 types; + std::vector 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(runtime_clang_type); - - if (!runtime_interface_type) + DeclFromUser runtime_iface_decl(dyn_cast(decls[0])); + + if (!runtime_iface_decl.IsValid()) break; - DeclFromUser runtime_iface_decl(runtime_interface_type->getDecl()); - if (log) log->Printf("CAS::FOPD[%d] trying runtime (ObjCInterfaceDecl*)%p/(ASTContext*)%p...", current_id,