|
58 | 58 | #include "swift/AST/DiagnosticEngine.h"
|
59 | 59 | #include "swift/AST/DiagnosticConsumer.h"
|
60 | 60 | #include "swift/AST/IRGenOptions.h"
|
| 61 | +#include "swift/AST/IRGenRequests.h" |
61 | 62 | #include "swift/AST/Module.h"
|
62 | 63 | #include "swift/AST/ModuleLoader.h"
|
63 | 64 | #include "swift/Demangling/Demangle.h"
|
@@ -1659,11 +1660,15 @@ unsigned SwiftExpressionParser::Parse(DiagnosticManager &diagnostic_manager,
|
1659 | 1660 | std::lock_guard<std::recursive_mutex> global_context_locker(
|
1660 | 1661 | IRExecutionUnit::GetLLVMGlobalContextMutex());
|
1661 | 1662 |
|
1662 |
| - m_module = swift::performIRGeneration( |
| 1663 | + auto GenModule = swift::performIRGeneration( |
1663 | 1664 | swift_ast_ctx->GetIRGenOptions(), &parsed_expr->module,
|
1664 | 1665 | std::move(sil_module), "lldb_module",
|
1665 | 1666 | swift::PrimarySpecificPaths("", parsed_expr->main_filename),
|
1666 |
| - SwiftASTContext::GetGlobalLLVMContext(), llvm::ArrayRef<std::string>()); |
| 1667 | + llvm::ArrayRef<std::string>()); |
| 1668 | + |
| 1669 | + auto ContextAndModule = std::move(GenModule).release(); |
| 1670 | + m_llvm_context.reset(ContextAndModule.first); |
| 1671 | + m_module.reset(ContextAndModule.second); |
1667 | 1672 | }
|
1668 | 1673 |
|
1669 | 1674 | if (swift_ast_ctx->HasErrors()) {
|
@@ -1813,10 +1818,9 @@ Status SwiftExpressionParser::PrepareForExecution(
|
1813 | 1818 |
|
1814 | 1819 | std::vector<std::string> features;
|
1815 | 1820 |
|
1816 |
| - std::unique_ptr<llvm::LLVMContext> llvm_context_up; |
1817 | 1821 | // m_module is handed off here.
|
1818 | 1822 | m_execution_unit_sp.reset(
|
1819 |
| - new IRExecutionUnit(llvm_context_up, m_module, function_name, |
| 1823 | + new IRExecutionUnit(m_llvm_context, m_module, function_name, |
1820 | 1824 | exe_ctx.GetTargetSP(), sc, features));
|
1821 | 1825 |
|
1822 | 1826 | // TODO: figure out some way to work ClangExpressionDeclMap into
|
|
0 commit comments