blob: 11fa14faeeb51fff77eb85f9e591086ba0f76b17 [file] [log] [blame]
Daniel Jasperd07c8402013-07-29 08:19:24 +00001//===--- 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 Jasperd07c8402013-07-29 08:19:24 +000010#include "../ClangTidy.h"
11#include "../ClangTidyModule.h"
12#include "../ClangTidyModuleRegistry.h"
Alexander Kornienko276fc642014-06-29 22:19:53 +000013#include "AvoidCStyleCastsCheck.h"
Alexander Kornienko72f1e752014-06-18 09:33:46 +000014#include "ExplicitConstructorCheck.h"
Benjamin Kramer47c4d102014-07-15 09:50:32 +000015#include "ExplicitMakePairCheck.h"
Benjamin Kramer06e323a2014-08-29 14:38:46 +000016#include "IntegerTypesCheck.h"
Benjamin Kramerebab1502014-07-16 14:30:19 +000017#include "MemsetZeroLengthCheck.h"
Benjamin Kramer14d42d92014-07-15 16:47:09 +000018#include "NamedParameterCheck.h"
Benjamin Kramerfeff1342014-07-15 12:48:14 +000019#include "OverloadedUnaryAndCheck.h"
Benjamin Kramerb1039752014-07-16 10:00:14 +000020#include "StringReferenceMemberCheck.h"
Benjamin Kramer6be414d2014-09-18 12:53:13 +000021#include "TodoCommentCheck.h"
Benjamin Kramer2252cbf2014-07-16 14:16:56 +000022#include "UnnamedNamespaceInHeaderCheck.h"
23#include "UsingNamespaceDirectiveCheck.h"
Daniel Jasperd07c8402013-07-29 08:19:24 +000024
25using namespace clang::ast_matchers;
26
27namespace clang {
28namespace tidy {
29
Daniel Jasperd07c8402013-07-29 08:19:24 +000030class GoogleModule : public ClangTidyModule {
31public:
Alexander Kornienko21f3b772014-03-05 13:01:24 +000032 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Alexander Kornienkobe8c1432014-09-10 11:06:43 +000033 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 Kramer6be414d2014-09-18 12:53:13 +000053 CheckFactories.registerCheck<readability::TodoCommentCheck>(
54 "google-readability-todo");
Daniel Jasperd07c8402013-07-29 08:19:24 +000055 }
56};
57
58// Register the GoogleTidyModule using this statically initialized variable.
59static 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.
64volatile int GoogleModuleAnchorSource = 0;
65
66} // namespace tidy
67} // namespace clang