[PATCH] D12839: Extend MoveConstructorInitCheck to also flag constructor arguments passed by value and can be moved assigned to fields.

Malcolm Parsons via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 15:17:42 PDT 2016


malcolm.parsons added a comment.

In https://reviews.llvm.org/D12839#585256, @aaron.ballman wrote:

> 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:


The main check is, but the additional sub-check added in this patch is already handled by modernize-pass-by-value.

> 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.

The doc for modernize-pass-by-value says:

  Currently, only constructors are transformed to make use of pass-by-value.
  Contributions that handle other situations are welcome!


https://reviews.llvm.org/D12839





More information about the cfe-commits mailing list