forked from OSchip/llvm-project
[clang-tidy] Don't suggest naming the dummy argument of a post-inc operator overload.
llvm-svn: 216868
This commit is contained in:
parent
e77b2948b4
commit
fec6705db0
|
@ -55,6 +55,12 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
if (!Parm->getName().empty())
|
||||
continue;
|
||||
|
||||
// Don't warn on the dummy argument on post-inc and post-dec operators.
|
||||
if ((Function->getOverloadedOperator() == OO_PlusPlus ||
|
||||
Function->getOverloadedOperator() == OO_MinusMinus) &&
|
||||
Parm->getType()->isSpecificBuiltinType(BuiltinType::Int))
|
||||
continue;
|
||||
|
||||
// Sanity check the source locations.
|
||||
if (!Parm->getLocation().isValid() || Parm->getLocation().isMacroID() ||
|
||||
!SM.isWrittenInSameFile(Parm->getLocStart(), Parm->getLocation()))
|
||||
|
|
|
@ -39,9 +39,7 @@ void operator delete[](void * /*x*/) throw();
|
|||
|
||||
struct X {
|
||||
X operator++(int) {}
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: all parameters should be named in a function
|
||||
// CHECK-FIXES: X operator++(int /*unused*/) {}
|
||||
X operator--(int /*unused*/) {}
|
||||
X operator--(int) {}
|
||||
|
||||
X(X&) = delete;
|
||||
X &operator=(X&) = default;
|
||||
|
@ -87,3 +85,21 @@ void FDef2(int n, int) {}
|
|||
// CHECK-FIXES: void FDef2(int n, int /*unused*/) {}
|
||||
|
||||
void FNoDef(int);
|
||||
|
||||
class Z {};
|
||||
|
||||
Z &operator++(Z&) {}
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
|
||||
// CHECK-FIXES: Z &operator++(Z& /*unused*/) {}
|
||||
|
||||
Z &operator++(Z&, int) {}
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
|
||||
// CHECK-FIXES: Z &operator++(Z& /*unused*/, int) {}
|
||||
|
||||
Z &operator--(Z&) {}
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
|
||||
// CHECK-FIXES: Z &operator--(Z& /*unused*/) {}
|
||||
|
||||
Z &operator--(Z&, int) {}
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
|
||||
// CHECK-FIXES: Z &operator--(Z& /*unused*/, int) {}
|
||||
|
|
Loading…
Reference in New Issue