[PATCH] D17491: Add performance check to flag function parameters of expensive to copy types that can be safely converted to const references.
Felix Berger via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 27 20:51:14 PST 2016
flx added inline comments.
================
Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:41
@@ +40,3 @@
+ Function->parameters().begin();
+ if (Index >= Function->getNumParams()) {
+ return;
----------------
alexfh wrote:
> Please add a comment about when this happens (template parameter packs? C-style variadic functions?).
I"m not sure when this can happen. Should I remove it and we add it if we find a case?
================
Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:62
@@ +61,3 @@
+ "consider making it a const reference")
+ << Param->getName();
+ // Do not propose fixes in macros since we cannot place them correctly.
----------------
alexfh wrote:
> What if parameter doesn't have a name? Should we print an index ("parameter #n is copied ...").
Good point. Added test and index code.
http://reviews.llvm.org/D17491
More information about the cfe-commits
mailing list