From 03a5042e4c9fe86ea8f56d4c5f81ee38cc8fd108 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 14 Apr 2016 21:31:46 +0000 Subject: [PATCH] Revert "Do not use llvm::getGlobalContext(), trying to nuke it from LLVM" This reverts commit r266365 and r266367, the contexts in the two places have to match. From: Mehdi Amini llvm-svn: 266373 --- lld/COFF/InputFiles.cpp | 3 +-- lld/COFF/SymbolTable.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 3c8aab5..088092e 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -320,9 +320,8 @@ void BitcodeFile::parse() { // Usually parse() is thread-safe, but bitcode file is an exception. std::lock_guard Lock(Mu); - llvm::LLVMContext Context; ErrorOr> ModOrErr = - LTOModule::createFromBuffer(Context, MB.getBufferStart(), + LTOModule::createFromBuffer(llvm::getGlobalContext(), MB.getBufferStart(), MB.getBufferSize(), llvm::TargetOptions()); error(ModOrErr, "Could not create lto module"); M = std::move(*ModOrErr); diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index c2d943f..189c3fe 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -369,8 +369,7 @@ void SymbolTable::addCombinedLTOObjects() { // Create an object file and add it to the symbol table by replacing any // DefinedBitcode symbols with the definitions in the object file. - LLVMContext Context; - LTOCodeGenerator CG(Context); + LTOCodeGenerator CG(getGlobalContext()); CG.setOptLevel(Config->LTOOptLevel); std::vector Objs = createLTOObjects(&CG); -- 2.7.4