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" |
| 13 | #include "PassByValueCheck.h" |
| 14 | |
| 15 | using namespace clang::ast_matchers; |
| 16 | |
| 17 | namespace clang { |
| 18 | namespace tidy { |
| 19 | namespace modernize { |
| 20 | |
| 21 | class ModernizeModule : public ClangTidyModule { |
| 22 | public: |
| 23 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
| 24 | CheckFactories.registerCheck<PassByValueCheck>("modernize-pass-by-value"); |
| 25 | } |
| 26 | |
| 27 | ClangTidyOptions getModuleOptions() override { |
| 28 | ClangTidyOptions Options; |
| 29 | auto &Opts = Options.CheckOptions; |
| 30 | Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google". |
| 31 | return Options; |
| 32 | } |
| 33 | }; |
| 34 | |
| 35 | // Register the ModernizeTidyModule using this statically initialized variable. |
| 36 | static ClangTidyModuleRegistry::Add<ModernizeModule> X("modernize-module", |
| 37 | "Add modernize checks."); |
| 38 | |
| 39 | } // namespace modernize |
| 40 | |
| 41 | // This anchor is used to force the linker to link in the generated object file |
| 42 | // and thus register the ModernizeModule. |
| 43 | volatile int ModernizeModuleAnchorSource = 0; |
| 44 | |
| 45 | } // namespace tidy |
| 46 | } // namespace clang |