Alexander Kornienko | fc65086 | 2015-08-14 13:17:11 +0000 | [diff] [blame] | 1 | //===--- ModernizeTidyModule.cpp - clang-tidy -----------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "../ClangTidy.h" |
| 11 | #include "../ClangTidyModule.h" |
| 12 | #include "../ClangTidyModuleRegistry.h" |
Alexander Kornienko | 0497084 | 2015-08-19 09:11:46 +0000 | [diff] [blame^] | 13 | #include "LoopConvertCheck.h" |
Alexander Kornienko | fc65086 | 2015-08-14 13:17:11 +0000 | [diff] [blame] | 14 | #include "PassByValueCheck.h" |
| 15 | |
| 16 | using namespace clang::ast_matchers; |
| 17 | |
| 18 | namespace clang { |
| 19 | namespace tidy { |
| 20 | namespace modernize { |
| 21 | |
| 22 | class ModernizeModule : public ClangTidyModule { |
| 23 | public: |
| 24 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
Alexander Kornienko | 0497084 | 2015-08-19 09:11:46 +0000 | [diff] [blame^] | 25 | CheckFactories.registerCheck<LoopConvertCheck>("modernize-loop-convert"); |
Alexander Kornienko | fc65086 | 2015-08-14 13:17:11 +0000 | [diff] [blame] | 26 | CheckFactories.registerCheck<PassByValueCheck>("modernize-pass-by-value"); |
| 27 | } |
| 28 | |
| 29 | ClangTidyOptions getModuleOptions() override { |
| 30 | ClangTidyOptions Options; |
| 31 | auto &Opts = Options.CheckOptions; |
Alexander Kornienko | 0497084 | 2015-08-19 09:11:46 +0000 | [diff] [blame^] | 32 | Opts["modernize-loop-convert.MinConfidence"] = "reasonable"; |
Alexander Kornienko | fc65086 | 2015-08-14 13:17:11 +0000 | [diff] [blame] | 33 | Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google". |
| 34 | return Options; |
| 35 | } |
| 36 | }; |
| 37 | |
| 38 | // Register the ModernizeTidyModule using this statically initialized variable. |
| 39 | static ClangTidyModuleRegistry::Add<ModernizeModule> X("modernize-module", |
| 40 | "Add modernize checks."); |
| 41 | |
| 42 | } // namespace modernize |
| 43 | |
| 44 | // This anchor is used to force the linker to link in the generated object file |
| 45 | // and thus register the ModernizeModule. |
| 46 | volatile int ModernizeModuleAnchorSource = 0; |
| 47 | |
| 48 | } // namespace tidy |
| 49 | } // namespace clang |