[PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

Felix Berger via cfe-commits cfe-commits at lists.llvm.org
Tue May 31 07:58:11 PDT 2016


flx added a comment.

In http://reviews.llvm.org/D20277#444023, @Prazek wrote:

> In http://reviews.llvm.org/D20277#436725, @flx wrote:
>
> > In http://reviews.llvm.org/D20277#436717, @Prazek wrote:
> >
> > > Cool check! Did you think about sugesting std::move for rvalue references if they are used once?
> >
> >
> > Thanks! I'm not sure this fits with what a user would expect from a check named "unnecessary-value-param" since in this case the parameter is not passed by value. Would a separate check make sense for this?
>
>
> Consider changing the name :) When I was thinking about the check for rvalue references, I wanted to name it "*-rvalue-ref-one-use". 
>  If it covers values also, maybe "performance-move-single-used-variable" or "performance-variable-one-use", or "performance-disposable-object" (If I translated it correctly).
>
> In my opinion there is no need to have separate check to to this, because the user would like to have both or none.


Renaming the check is a breaking change since it affects user's configurations. I'm working in a code base that doesn't allow r-value references outside of move constructors and assignment, but if you'd like to add handing the r-value reference case, that'd be great! I agree that with this change it make sense to handle r-value references here too.


http://reviews.llvm.org/D20277





More information about the cfe-commits mailing list