[clang-tidy] Fix unnamed parameter comment insertion with multiple parameters.

llvm-svn: 214703
This commit is contained in:
Benjamin Kramer 2014-08-04 09:42:18 +00:00
parent 06e6f1cae2
commit 78cd5465f7
2 changed files with 11 additions and 4 deletions

View File

@ -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);

View File

@ -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);