From 522f45d99c8a18853093b41d8c77d43878e927b0 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Wed, 9 Dec 2015 19:49:40 +0000 Subject: [PATCH] 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 --- tools/gold/gold-plugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 016dca52382..08ff45d45eb 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -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 Combined(new Module("ld-temp.o", Context)); Linker L(*Combined, diagnosticHandler); -- 2.34.1