[clang-tools-extra] r243403 - misc-unused-parameters: Properly handle static class members.
Daniel Jasper
djasper at google.com
Tue Jul 28 03:39:26 PDT 2015
Author: djasper
Date: Tue Jul 28 05:39:25 2015
New Revision: 243403
URL: http://llvm.org/viewvc/llvm-project?rev=243403&view=rev
Log:
misc-unused-parameters: Properly handle static class members.
Not sure why I wrote what I wrote before.
Modified:
clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp?rev=243403&r1=243402&r2=243403&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp Tue Jul 28 05:39:25 2015
@@ -70,10 +70,11 @@ void UnusedParametersCheck::warnOnUnused
};
// 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;
Modified: clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.cpp?rev=243403&r1=243402&r2=243403&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.cpp Tue Jul 28 05:39:25 2015
@@ -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:
More information about the cfe-commits
mailing list