[clang-tools-extra] r214703 - [clang-tidy] Fix unnamed parameter comment insertion with multiple parameters.
Benjamin Kramer
benny.kra at googlemail.com
Mon Aug 4 02:42:18 PDT 2014
Author: d0k
Date: Mon Aug 4 04:42:18 2014
New Revision: 214703
URL: http://llvm.org/viewvc/llvm-project?rev=214703&view=rev
Log:
[clang-tidy] Fix unnamed parameter comment insertion with multiple parameters.
Modified:
clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp
Modified: clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp?rev=214703&r1=214702&r2=214703&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp Mon Aug 4 04:42:18 2014
@@ -77,10 +77,10 @@ void NamedParameterCheck::check(const Ma
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);
Modified: clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp?rev=214703&r1=214702&r2=214703&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp Mon Aug 4 04:42:18 2014
@@ -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);
More information about the cfe-commits
mailing list