Skip to content

Commit 50c387b

Browse files
authored
Merge pull request #1088 from CodaFi/why-I-R-ta
Update for the removal of the LLVMContext parameter
2 parents 9357c68 + 4b97308 commit 50c387b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "swift/AST/DiagnosticEngine.h"
5959
#include "swift/AST/DiagnosticConsumer.h"
6060
#include "swift/AST/IRGenOptions.h"
61+
#include "swift/AST/IRGenRequests.h"
6162
#include "swift/AST/Module.h"
6263
#include "swift/AST/ModuleLoader.h"
6364
#include "swift/Demangling/Demangle.h"
@@ -1659,11 +1660,15 @@ unsigned SwiftExpressionParser::Parse(DiagnosticManager &diagnostic_manager,
16591660
std::lock_guard<std::recursive_mutex> global_context_locker(
16601661
IRExecutionUnit::GetLLVMGlobalContextMutex());
16611662

1662-
m_module = swift::performIRGeneration(
1663+
auto GenModule = swift::performIRGeneration(
16631664
swift_ast_ctx->GetIRGenOptions(), &parsed_expr->module,
16641665
std::move(sil_module), "lldb_module",
16651666
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);
16671672
}
16681673

16691674
if (swift_ast_ctx->HasErrors()) {
@@ -1813,10 +1818,9 @@ Status SwiftExpressionParser::PrepareForExecution(
18131818

18141819
std::vector<std::string> features;
18151820

1816-
std::unique_ptr<llvm::LLVMContext> llvm_context_up;
18171821
// m_module is handed off here.
18181822
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,
18201824
exe_ctx.GetTargetSP(), sc, features));
18211825

18221826
// TODO: figure out some way to work ClangExpressionDeclMap into

lldb/source/Symbol/SwiftASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4885,7 +4885,7 @@ swift::irgen::IRGenModule &SwiftASTContext::GetIRGenModule() {
48854885
IRExecutionUnit::GetLLVMGlobalContextMutex());
48864886
m_ir_gen_module_ap.reset(new swift::irgen::IRGenModule(
48874887
ir_generator, ir_generator.createTargetMachine(), nullptr,
4888-
GetGlobalLLVMContext(), ir_gen_opts.ModuleName, PSPs.OutputFilename,
4888+
ir_gen_opts.ModuleName, PSPs.OutputFilename,
48894889
PSPs.MainInputFilenameForDebugInfo, ""));
48904890
llvm::Module *llvm_module = m_ir_gen_module_ap->getModule();
48914891
llvm_module->setDataLayout(data_layout.getStringRepresentation());

0 commit comments

Comments
 (0)