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