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

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 17 05:41:13 PDT 2016


alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

Apart from the other reviewers' comments, I have a few concerns:

1. The "performance-returning-type" name is missing an important part of information. Maybe "performance-return-value-conversion", "performance-return-value-copy", "performance-type-conversion-on-return", "performance-return-different-type" or something like that.
2. The "expression could be wrapped with std::move" warning is close to useless. There are many things that "could be", but the main question is "why"? The first thing the message has to explain, is what's wrong with the current state, and only then suggest a solution. Also think about cases where the suggested solution is not the optimal one (e.g. changing the return type is better).
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).


Repository:
  rL LLVM

http://reviews.llvm.org/D21303





More information about the cfe-commits mailing list