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