diff options
author | Angel Garcia Gomez <angelgarcia@google.com> | 2015-10-21 12:58:15 +0000 |
---|---|---|
committer | Angel Garcia Gomez <angelgarcia@google.com> | 2015-10-21 12:58:15 +0000 |
commit | 8dedeb0230c589ca121098f8051a35eb5fb53848 (patch) | |
tree | 3f77020d05c442b64ee9b064d08d0a71f1ff8ec9 /clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp | |
parent | baf54a8ad5710d54bc6cc8fd2e7f1fcfabc9c503 (diff) | |
download | bcm5719-llvm-8dedeb0230c589ca121098f8051a35eb5fb53848.tar.gz bcm5719-llvm-8dedeb0230c589ca121098f8051a35eb5fb53848.zip |
Add modernize-use-default check to clang-tidy.
Summary:
Add a check that replaces empty bodies of special member functions with '= default;'.
For now, it is only implemented for the default constructor and the destructor, which are the easier cases.
The copy-constructor and the copy-assignment operator cases will be implemented later.
I applied this check to the llvm code base and found 627 warnings (385 in llvm, 9 in compiler-rt, 220 in clang and 13 in clang-tools-extra).
Applying the fixes didn't break any build or test, it only caused a -Wpedantic warning in lib/Target/Mips/MipsOptionRecord.h:33 becaused it replaced
virtual ~MipsOptionRecord(){}; to virtual ~MipsOptionRecord()= default;;
Reviewers: klimek
Subscribers: george.burgess.iv, Eugene.Zelenko, alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13871
llvm-svn: 250897
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp index b780cb8aca5..d7463abf30f 100644 --- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp @@ -16,6 +16,7 @@ #include "ReplaceAutoPtrCheck.h" #include "ShrinkToFitCheck.h" #include "UseAutoCheck.h" +#include "UseDefaultCheck.h" #include "UseNullptrCheck.h" #include "UseOverrideCheck.h" @@ -29,13 +30,13 @@ class ModernizeModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { CheckFactories.registerCheck<LoopConvertCheck>("modernize-loop-convert"); - CheckFactories.registerCheck<MakeUniqueCheck>( - "modernize-make-unique"); + CheckFactories.registerCheck<MakeUniqueCheck>("modernize-make-unique"); CheckFactories.registerCheck<PassByValueCheck>("modernize-pass-by-value"); CheckFactories.registerCheck<ReplaceAutoPtrCheck>( "modernize-replace-auto-ptr"); CheckFactories.registerCheck<ShrinkToFitCheck>("modernize-shrink-to-fit"); CheckFactories.registerCheck<UseAutoCheck>("modernize-use-auto"); + CheckFactories.registerCheck<UseDefaultCheck>("modernize-use-default"); CheckFactories.registerCheck<UseNullptrCheck>("modernize-use-nullptr"); CheckFactories.registerCheck<UseOverrideCheck>("modernize-use-override"); } @@ -45,7 +46,7 @@ public: auto &Opts = Options.CheckOptions; Opts["modernize-loop-convert.MinConfidence"] = "reasonable"; Opts["modernize-loop-convert.NamingStyle"] = "CamelCase"; - Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google". + Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google". Opts["modernize-replace-auto-ptr.IncludeStyle"] = "llvm"; // Also: "google". // Comma-separated list of macros that behave like NULL. |