[PATCH] D53025: [clang-tidy] implement new check for const return types.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 26 06:31:45 PDT 2018
ymandel added inline comments.
================
Comment at: clang-tidy/readability/ConstValueReturnCheck.cpp:107
+ diag(Def->getInnerLocStart(), "return type %0 is 'const'-qualified "
+ "hindering compiler optimizations")
+ << Def->getReturnType();
----------------
aaron.ballman wrote:
> It seems strange to me that this is in the readability module but the diagnostic here is about compiler optimizations. Should this be in the performance module instead? Or should this diagnostic be reworded about the readability concerns?
Good point. The readability angle is that the const clutters the code to no benefit. That is, even if it was performance neutral, I'd still want to discourage this practice. But, it does seem like the primary impact is performance.
I'm fine either way -- moving it to performance or emphasizing the clutter of the unhelpful "const". I'm inclined to moving it, but don't have good sense of how strict these hierarchies are. What do you think?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D53025
More information about the cfe-commits
mailing list