[llvm] r255146 - Delay context construction to when/if it is needed in gold plugin (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 11:49:41 PST 2015


Author: tejohnson
Date: Wed Dec  9 13:49:40 2015
New Revision: 255146

URL: http://llvm.org/viewvc/llvm-project?rev=255146&view=rev
Log:
Delay context construction to when/if it is needed in gold plugin (NFC)

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=255146&r1=255145&r2=255146&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Dec  9 13:49:40 2015
@@ -900,9 +900,6 @@ static ld_plugin_status allSymbolsReadHo
   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 allSymbolsReadHo
     exit(0);
   }
 
+  LLVMContext Context;
+  Context.setDiagnosticHandler(diagnosticHandlerForContext, nullptr, true);
+
   std::unique_ptr<Module> Combined(new Module("ld-temp.o", Context));
   Linker L(*Combined, diagnosticHandler);
 




More information about the llvm-commits mailing list