blob: 34c17bbf5cfa6d9f76c5b5090cf2c2a0e3dab1bd [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 Kramer2252cbf2014-07-16 14:16:56 +000021#include "UnnamedNamespaceInHeaderCheck.h"
22#include "UsingNamespaceDirectiveCheck.h"
Daniel Jasperd07c8402013-07-29 08:19:24 +000023
24using namespace clang::ast_matchers;
25
26namespace clang {
27namespace tidy {
28
Daniel Jasperd07c8402013-07-29 08:19:24 +000029class GoogleModule : public ClangTidyModule {
30public:
Alexander Kornienko21f3b772014-03-05 13:01:24 +000031 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Alexander Kornienkobe8c1432014-09-10 11:06:43 +000032 CheckFactories.registerCheck<build::ExplicitMakePairCheck>(
33 "google-build-explicit-make-pair");
34 CheckFactories.registerCheck<build::UnnamedNamespaceInHeaderCheck>(
35 "google-build-namespaces");
36 CheckFactories.registerCheck<build::UsingNamespaceDirectiveCheck>(
37 "google-build-using-namespace");
38 CheckFactories.registerCheck<ExplicitConstructorCheck>(
39 "google-explicit-constructor");
40 CheckFactories.registerCheck<runtime::IntegerTypesCheck>(
41 "google-runtime-int");
42 CheckFactories.registerCheck<runtime::OverloadedUnaryAndCheck>(
43 "google-runtime-operator");
44 CheckFactories.registerCheck<runtime::StringReferenceMemberCheck>(
45 "google-runtime-member-string-references");
46 CheckFactories.registerCheck<runtime::MemsetZeroLengthCheck>(
47 "google-runtime-memset");
48 CheckFactories.registerCheck<readability::AvoidCStyleCastsCheck>(
49 "google-readability-casting");
50 CheckFactories.registerCheck<readability::NamedParameterCheck>(
51 "google-readability-function");
Daniel Jasperd07c8402013-07-29 08:19:24 +000052 }
53};
54
55// Register the GoogleTidyModule using this statically initialized variable.
56static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module",
57 "Adds Google lint checks.");
58
59// This anchor is used to force the linker to link in the generated object file
60// and thus register the GoogleModule.
61volatile int GoogleModuleAnchorSource = 0;
62
63} // namespace tidy
64} // namespace clang