Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 1 | //===--- GoogleTidyModule.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 | |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 10 | #include "../ClangTidy.h" |
| 11 | #include "../ClangTidyModule.h" |
| 12 | #include "../ClangTidyModuleRegistry.h" |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 13 | #include "AvoidCStyleCastsCheck.h" |
Alexander Kornienko | 72f1e75 | 2014-06-18 09:33:46 +0000 | [diff] [blame] | 14 | #include "ExplicitConstructorCheck.h" |
Benjamin Kramer | 47c4d10 | 2014-07-15 09:50:32 +0000 | [diff] [blame] | 15 | #include "ExplicitMakePairCheck.h" |
Benjamin Kramer | 14d42d9 | 2014-07-15 16:47:09 +0000 | [diff] [blame^] | 16 | #include "NamedParameterCheck.h" |
Benjamin Kramer | feff134 | 2014-07-15 12:48:14 +0000 | [diff] [blame] | 17 | #include "OverloadedUnaryAndCheck.h" |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 18 | |
| 19 | using namespace clang::ast_matchers; |
| 20 | |
| 21 | namespace clang { |
| 22 | namespace tidy { |
| 23 | |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 24 | class GoogleModule : public ClangTidyModule { |
| 25 | public: |
Alexander Kornienko | 21f3b77 | 2014-03-05 13:01:24 +0000 | [diff] [blame] | 26 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 27 | CheckFactories.addCheckFactory( |
Benjamin Kramer | 47c4d10 | 2014-07-15 09:50:32 +0000 | [diff] [blame] | 28 | "google-build-explicit-make-pair", |
| 29 | new ClangTidyCheckFactory<build::ExplicitMakePairCheck>()); |
| 30 | CheckFactories.addCheckFactory( |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 31 | "google-explicit-constructor", |
| 32 | new ClangTidyCheckFactory<ExplicitConstructorCheck>()); |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 33 | CheckFactories.addCheckFactory( |
Benjamin Kramer | feff134 | 2014-07-15 12:48:14 +0000 | [diff] [blame] | 34 | "google-runtime-operator", |
| 35 | new ClangTidyCheckFactory<runtime::OverloadedUnaryAndCheck>()); |
| 36 | CheckFactories.addCheckFactory( |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 37 | "google-readability-casting", |
| 38 | new ClangTidyCheckFactory<readability::AvoidCStyleCastsCheck>()); |
Benjamin Kramer | 14d42d9 | 2014-07-15 16:47:09 +0000 | [diff] [blame^] | 39 | CheckFactories.addCheckFactory( |
| 40 | "google-readability-function", |
| 41 | new ClangTidyCheckFactory<readability::NamedParameterCheck>()); |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 42 | } |
| 43 | }; |
| 44 | |
| 45 | // Register the GoogleTidyModule using this statically initialized variable. |
| 46 | static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module", |
| 47 | "Adds Google lint checks."); |
| 48 | |
| 49 | // This anchor is used to force the linker to link in the generated object file |
| 50 | // and thus register the GoogleModule. |
| 51 | volatile int GoogleModuleAnchorSource = 0; |
| 52 | |
| 53 | } // namespace tidy |
| 54 | } // namespace clang |