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