Use a forwarding constructor instead of an init method.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 1 Dec 2015 18:46:19 +0000 (18:46 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 1 Dec 2015 18:46:19 +0000 (18:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254435 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Linker/Linker.h
lib/Linker/LinkModules.cpp

index 3f6c7b6c69422a82fb3d57fb2c520061bbd3db1f..7ac457856a1940d7b281bfc8e3e2cb048fa27868 100644 (file)
@@ -93,7 +93,6 @@ public:
                           unsigned Flags = Flags::None);
 
 private:
-  void init(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
   Module *Composite;
 
   IdentifiedStructTypeSet IdentifiedStructTypes;
index c57c70e322abb93dbe3bee6d59f184593d0f7a35..9aff43f319907eded8a584c356fddf369b87e3fa 100644 (file)
@@ -2032,7 +2032,7 @@ bool Linker::IdentifiedStructTypeSet::hasType(StructType *Ty) {
   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, DiagnosticHandlerFunction DiagnosticHandler) {
   }
 }
 
-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;