aaron.ballman added a comment.

In https://reviews.llvm.org/D12839#582828, @malcolm.parsons wrote:

> The modernize-pass-by-value check does the same thing:
>
>   test/clang-tidy/misc-move-constructor-init.cpp:98:12: warning: pass by 
> value and use std::move [modernize-pass-by-value]
>     Positive(Movable M) : M_(M) {}
>              ^
>                              std::move( )
>   test/clang-tidy/misc-move-constructor-init.cpp:98:28: warning: value 
> argument 'M' can be moved to avoid copy [misc-move-constructor-init]
>     Positive(Movable M) : M_(M) {}
>                              ^
>
>
> Do we need two checks for this?


This overlap is unfortunate. misc-move-constructor-init is for move constructor 
initializer lists which accidentally initialize a member or base through a copy 
constructor rather than a move constructor. Consider:

  struct B { B(B&&); B(const B&); };
  struct D {
    D(D &&d) : B(d) {} // Oops, calling B(const B&) not B(B&&)
    D(const D &d) : B(d) {}

modernize-pass-by-value is slightly different in that it is concerned with the 
parameter of an arbitrary function being something that is movable if you pass 
it by value instead of passing it by reference.

So misc-move-constructor-init cares about move constructor initializer lists 
while modernize-pass-by-value cares about the parameters of a function.


https://reviews.llvm.org/D12839



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to