summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp6
-rw-r--r--clang-tools-extra/test/clang-tidy/google-readability-function.cpp9
2 files changed, 11 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp b/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp
index c10b2a3d35a..ab901bc2821 100644
--- a/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp
@@ -77,10 +77,10 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
auto D = diag(FirstParm->getLocation(),
"all parameters should be named in a function");
- // Fallback to an unused marker.
- StringRef NewName = "unused";
-
for (auto P : UnnamedParams) {
+ // Fallback to an unused marker.
+ StringRef NewName = "unused";
+
// If the method is overridden, try to copy the name from the base method
// into the overrider.
const auto *M = dyn_cast<CXXMethodDecl>(P.first);
diff --git a/clang-tools-extra/test/clang-tidy/google-readability-function.cpp b/clang-tools-extra/test/clang-tidy/google-readability-function.cpp
index 65680263aa5..701c5fc4288 100644
--- a/clang-tools-extra/test/clang-tidy/google-readability-function.cpp
+++ b/clang-tools-extra/test/clang-tidy/google-readability-function.cpp
@@ -74,6 +74,13 @@ struct Derived : public Base {
void FDef(int);
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: all parameters should be named in a function
// CHECK-FIXES: void FDef(int /*n*/);
-void FDef(int n) {};
+void FDef(int n) {}
+
+void FDef2(int, int);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: all parameters should be named in a function
+// CHECK-FIXES: void FDef2(int /*n*/, int /*unused*/);
+void FDef2(int n, int) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: all parameters should be named in a function
+// CHECK-FIXES: void FDef2(int n, int /*unused*/) {}
void FNoDef(int);
OpenPOWER on IntegriCloud