summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2014-12-05 01:26:42 +0000
committerSean Callanan <scallanan@apple.com>2014-12-05 01:26:42 +0000
commitc631b64fab30f30b36781e819add0a264d03ed7e (patch)
tree9aec3256999f5c33daf0bf4a1285e11bca003118
parent99214ab599be3999a1360380c0a9de440cb34b41 (diff)
downloadbcm5719-llvm-c631b64fab30f30b36781e819add0a264d03ed7e.tar.gz
bcm5719-llvm-c631b64fab30f30b36781e819add0a264d03ed7e.zip
Additional changes required by r223433.
llvm-svn: 223435
-rw-r--r--lldb/include/lldb/Expression/ClangModulesDeclVendor.h58
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp61
2 files changed, 85 insertions, 34 deletions
diff --git a/lldb/include/lldb/Expression/ClangModulesDeclVendor.h b/lldb/include/lldb/Expression/ClangModulesDeclVendor.h
new file mode 100644
index 00000000000..a35b86a665f
--- /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 <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_) */
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index d488993b90d..e46762c7579 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 <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 (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<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 (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 <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::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 <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,
OpenPOWER on IntegriCloud