[llvm] r266538 - LTO: Use a common LibLTOCodeGenerator::init, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 16 15:25:37 PDT 2016


Author: dexonsmith
Date: Sat Apr 16 17:25:36 2016
New Revision: 266538

URL: http://llvm.org/viewvc/llvm-project?rev=266538&view=rev
Log:
LTO: Use a common LibLTOCodeGenerator::init, NFC

Modified:
    llvm/trunk/tools/lto/lto.cpp

Modified: llvm/trunk/tools/lto/lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=266538&r1=266537&r2=266538&view=diff
==============================================================================
--- llvm/trunk/tools/lto/lto.cpp (original)
+++ llvm/trunk/tools/lto/lto.cpp Sat Apr 16 17:25:36 2016
@@ -119,16 +119,18 @@ static void handleLibLTODiagnostic(lto_c
 // libLTO API semantics, which require that the code generator owns the object
 // file.
 struct LibLTOCodeGenerator : LTOCodeGenerator {
-  LibLTOCodeGenerator() : LTOCodeGenerator(*LTOContext) {
-    setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
+  LibLTOCodeGenerator() : LTOCodeGenerator(*LTOContext) { init(); }
   LibLTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
       : LTOCodeGenerator(*Context), OwnedContext(std::move(Context)) {
-    setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
+    init();
+  }
 
   // Reset the module first in case MergedModule is created in OwnedContext.
   // Module must be destructed before its context gets destructed.
   ~LibLTOCodeGenerator() { resetMergedModule(); }
 
+  void init() { setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
+
   std::unique_ptr<MemoryBuffer> NativeObjectFile;
   std::unique_ptr<LLVMContext> OwnedContext;
 };




More information about the llvm-commits mailing list