aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
diff options
context:
space:
mode:
authorMatthias Gehre <M.Gehre@gmx.de>2019-07-16 21:19:00 +0000
committerMatthias Gehre <M.Gehre@gmx.de>2019-07-16 21:19:00 +0000
commitffca322266fcd431f7f17ae42ef3f665a3157d39 (patch)
tree46de7531ad2069cd4dd4a480d4f67fb11a10446a /clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
parent40580d36c4de7dfbff897ab72cc4e535c33d09c5 (diff)
downloadllvm-ffca322266fcd431f7f17ae42ef3f665a3157d39.zip
llvm-ffca322266fcd431f7f17ae42ef3f665a3157d39.tar.gz
llvm-ffca322266fcd431f7f17ae42ef3f665a3157d39.tar.bz2
[clang-tidy] initial version of readability-convert-member-functions-to-static
Summary: Finds non-static member functions that can be made ``static``. I have run this check (repeatedly) over llvm-project. It made 1708 member functions ``static``. Out of those, I had to exclude 22 via ``NOLINT`` because their address was taken and stored in a variable of pointer-to-member type (e.g. passed to llvm::StringSwitch). It also made 243 member functions ``const``. (This is currently very conservative to have no false-positives and can hopefully be extended in the future.) You can find the results here: https://github.com/mgehre/llvm-project/commits/static_const_eval Reviewers: alexfh, aaron.ballman Subscribers: mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61749 llvm-svn: 366265
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index 5b2aed4..5005ba3 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -13,6 +13,7 @@
#include "BracesAroundStatementsCheck.h"
#include "ConstReturnTypeCheck.h"
#include "ContainerSizeEmptyCheck.h"
+#include "ConvertMemberFunctionsToStatic.h"
#include "DeleteNullPointerCheck.h"
#include "DeletedDefaultCheck.h"
#include "ElseAfterReturnCheck.h"
@@ -57,6 +58,8 @@ public:
"readability-const-return-type");
CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
"readability-container-size-empty");
+ CheckFactories.registerCheck<ConvertMemberFunctionsToStatic>(
+ "readability-convert-member-functions-to-static");
CheckFactories.registerCheck<DeleteNullPointerCheck>(
"readability-delete-null-pointer");
CheckFactories.registerCheck<DeletedDefaultCheck>(