forked from OSchip/llvm-project
misc-unused-parameters: Properly handle static class members.
Not sure why I wrote what I wrote before. llvm-svn: 243403
This commit is contained in:
parent
78ee5cc8e1
commit
718029ba6b
|
@ -70,10 +70,11 @@ void UnusedParametersCheck::warnOnUnusedParameter(
|
|||
};
|
||||
|
||||
// Comment out parameter name for non-local functions.
|
||||
if ((Function->isExternallyVisible() &&
|
||||
Function->getStorageClass() != StorageClass::SC_Static) ||
|
||||
UsedByRef()) {
|
||||
if (Function->isExternallyVisible() || UsedByRef()) {
|
||||
SourceRange RemovalRange(Param->getLocation(), Param->getLocEnd());
|
||||
// Note: We always add a space before the '/*' to not accidentally create a
|
||||
// '*/*' for pointer types, which doesn't start a comment. clang-format will
|
||||
// clean this up afterwards.
|
||||
MyDiag << FixItHint::CreateReplacement(
|
||||
RemovalRange, (Twine(" /*") + Param->getName() + "*/").str());
|
||||
return;
|
||||
|
|
|
@ -57,6 +57,12 @@ static void someCallSites() {
|
|||
staticFunctionE();
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
static void f(int i) {}
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning
|
||||
// CHECK-FIXES: static void f(int /*i*/) {}
|
||||
};
|
||||
|
||||
namespace {
|
||||
class C {
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue