Delay context construction to when/if it is needed in gold plugin (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255146 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Teresa Johnson 2015-12-09 19:49:40 +00:00
parent a63df07eda
commit 522f45d99c

View File

@ -900,9 +900,6 @@ static ld_plugin_status allSymbolsReadHook(raw_fd_ostream *ApiFile) {
if (Modules.empty())
return LDPS_OK;
LLVMContext Context;
Context.setDiagnosticHandler(diagnosticHandlerForContext, nullptr, true);
// If we are doing ThinLTO compilation, simply build the combined
// function index/summary and emit it. We don't need to parse the modules
// and link them in this case.
@ -937,6 +934,9 @@ static ld_plugin_status allSymbolsReadHook(raw_fd_ostream *ApiFile) {
exit(0);
}
LLVMContext Context;
Context.setDiagnosticHandler(diagnosticHandlerForContext, nullptr, true);
std::unique_ptr<Module> Combined(new Module("ld-temp.o", Context));
Linker L(*Combined, diagnosticHandler);