[PATCH] D21303: [clang-tidy] Adds performance-returning-type check.

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 17 07:31:56 PDT 2016


Prazek added a comment.

In http://reviews.llvm.org/D21303#460814, @alexfh wrote:

> 3. What's so special about `return`? Looks like a more general problem is: passing an lvalue to a function/constructor/operator by const reference where it could instead be moved (the lvalue isn't used afterwards and the appropriate overload for rvalue reference is available).


Yes, you are right. We could generalize it more to suggest std::move for any last usage of variable (if there would be rvalue overload), but it is harde to do than this. The special thing about return, is that in most cases you shouldn't write 'return std::move(...)', so we want to find the cases where you should do it.


Repository:
  rL LLVM

http://reviews.llvm.org/D21303





More information about the cfe-commits mailing list