aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp')
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 4a220790e50d..f3df589d7311 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -27,6 +27,7 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/SourceModule.h"
#include "lldb/Target/Target.h"
@@ -110,6 +111,9 @@ private:
ImportedModuleMap m_imported_modules;
ImportedModuleSet m_user_imported_modules;
const clang::ExternalASTMerger::OriginMap m_origin_map;
+ // We assume that every ASTContext has an ClangASTContext, so we also store
+ // a custom ClangASTContext for our internal ASTContext.
+ std::unique_ptr<ClangASTContext> m_ast_context;
};
} // anonymous namespace
@@ -143,7 +147,8 @@ void StoringDiagnosticConsumer::DumpDiagnostics(Stream &error_stream) {
}
}
-ClangModulesDeclVendor::ClangModulesDeclVendor() {}
+ClangModulesDeclVendor::ClangModulesDeclVendor()
+ : ClangDeclVendor(eClangModuleDeclVendor) {}
ClangModulesDeclVendor::~ClangModulesDeclVendor() {}
@@ -155,7 +160,11 @@ ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl(
: m_diagnostics_engine(std::move(diagnostics_engine)),
m_compiler_invocation(std::move(compiler_invocation)),
m_compiler_instance(std::move(compiler_instance)),
- m_parser(std::move(parser)), m_origin_map() {}
+ m_parser(std::move(parser)), m_origin_map() {
+
+ // Initialize our ClangASTContext.
+ m_ast_context.reset(new ClangASTContext(m_compiler_instance->getASTContext()));
+}
void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
std::set<ClangModulesDeclVendor::ModuleID> &exports,
@@ -237,11 +246,11 @@ bool ClangModulesDeclVendorImpl::AddModule(const SourceModule &module,
bool is_system = true;
bool is_framework = false;
- auto *dir =
+ auto dir =
HS.getFileMgr().getDirectory(module.search_path.GetStringRef());
if (!dir)
return error();
- auto *file = HS.lookupModuleMapFile(dir, is_framework);
+ auto *file = HS.lookupModuleMapFile(*dir, is_framework);
if (!file)
return error();
if (!HS.loadModuleMapFile(file, is_system))
@@ -562,8 +571,9 @@ ClangModulesDeclVendorImpl::DoGetModule(clang::ModuleIdPath path,
clang::ExternalASTMerger::ImporterSource
ClangModulesDeclVendorImpl::GetImporterSource() {
- return {m_compiler_instance->getASTContext(),
- m_compiler_instance->getFileManager(), m_origin_map};
+ return clang::ExternalASTMerger::ImporterSource(
+ m_compiler_instance->getASTContext(),
+ m_compiler_instance->getFileManager(), m_origin_map);
}
static const char *ModuleImportBufferName = "LLDBModulesMemoryBuffer";