Skip to content

Commit bc31c7f

Browse files
committed
[NFC] Internalize the LLVMContext for LLVM IR Code Generation
1 parent 08fcf7d commit bc31c7f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,6 @@ static bool buildModuleFromInterface(const CompilerInvocation &Invocation,
779779

780780
static bool compileLLVMIR(const CompilerInvocation &Invocation,
781781
CompilerInstance &Instance) {
782-
auto &LLVMContext = getGlobalLLVMContext();
783-
784782
// Load in bitcode file.
785783
assert(Invocation.getFrontendOptions().InputsAndOutputs.hasSingleInput() &&
786784
"We expect a single input for bitcode input!");
@@ -800,8 +798,9 @@ static bool compileLLVMIR(const CompilerInvocation &Invocation,
800798
llvm::MemoryBuffer *MainFile = FileBufOrErr.get().get();
801799

802800
llvm::SMDiagnostic Err;
801+
auto LLVMContext = std::make_unique<llvm::LLVMContext>();
803802
std::unique_ptr<llvm::Module> Module =
804-
llvm::parseIR(MainFile->getMemBufferRef(), Err, LLVMContext);
803+
llvm::parseIR(MainFile->getMemBufferRef(), Err, *LLVMContext.get());
805804
if (!Module) {
806805
// TODO: Translate from the diagnostic info to the SourceManager location
807806
// if available.

0 commit comments

Comments
 (0)