[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
Tue Mar 22 21:01:35 PDT 2016


flx added inline comments.

================
Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:42
@@ +41,3 @@
+                  decl().bind("param"));
+  Finder->addMatcher(
+      functionDecl(isDefinition(), unless(cxxMethodDecl(isOverride())),
----------------
alexfh wrote:
> Can you first try adding tests with template parameter packs and C-style variadic functions?
Ran over large corpus and the check is not needed. Removed.

================
Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:56
@@ +55,3 @@
+                       Function->parameters().begin();
+  if (Index >= Function->getNumParams()) {
+    return;
----------------
alexfh wrote:
> nit: No braces around single-line `if` bodies.
Code is gone. Was not needed.

================
Comment at: test/clang-tidy/performance-unnecessary-value-param.cpp:52
@@ +51,3 @@
+void positiveUnnamedParam(const ExpensiveToCopyType) {
+  // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the const qualified parameter #1
+}
----------------
fowles wrote:
> no fix for this case?
Good point. Added.


http://reviews.llvm.org/D17491





More information about the cfe-commits mailing list