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

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 15:01:31 PST 2015


> On 2015-Dec-01, at 10:46, Rafael Espindola via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 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,

We can use these now?!  I missed that memo.

> [this](const DiagnosticInfo &DI) {
> +        Composite->getContext().diagnose(DI);
> +      }) {}
> 
> void Linker::deleteModule() {
>   delete Composite;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list