[llvm] r254435 - Use a forwarding constructor instead of an init method.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 10:46:19 PST 2015


Author: rafael
Date: Tue Dec  1 12:46:19 2015
New Revision: 254435

URL: http://llvm.org/viewvc/llvm-project?rev=254435&view=rev
Log:
Use a forwarding constructor instead of an init method.

Modified:
    llvm/trunk/include/llvm/Linker/Linker.h
    llvm/trunk/lib/Linker/LinkModules.cpp

Modified: llvm/trunk/include/llvm/Linker/Linker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker/Linker.h?rev=254435&r1=254434&r2=254435&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Linker/Linker.h (original)
+++ llvm/trunk/include/llvm/Linker/Linker.h Tue Dec  1 12:46:19 2015
@@ -93,7 +93,6 @@ public:
                           unsigned Flags = Flags::None);
 
 private:
-  void init(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
   Module *Composite;
 
   IdentifiedStructTypeSet IdentifiedStructTypes;

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=254435&r1=254434&r2=254435&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Tue Dec  1 12:46:19 2015
@@ -2032,7 +2032,7 @@ bool Linker::IdentifiedStructTypeSet::ha
   return *I == Ty;
 }
 
-void Linker::init(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
+Linker::Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
   this->Composite = M;
   this->DiagnosticHandler = DiagnosticHandler;
 
@@ -2046,15 +2046,10 @@ void Linker::init(Module *M, DiagnosticH
   }
 }
 
-Linker::Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
-  init(M, DiagnosticHandler);
-}
-
-Linker::Linker(Module *M) {
-  init(M, [this](const DiagnosticInfo &DI) {
-    Composite->getContext().diagnose(DI);
-  });
-}
+Linker::Linker(Module *M)
+    : Linker(M, [this](const DiagnosticInfo &DI) {
+        Composite->getContext().diagnose(DI);
+      }) {}
 
 void Linker::deleteModule() {
   delete Composite;




More information about the llvm-commits mailing list