blob: 36e11d4cef905e2aecfef15d9c89e429fcfad6ef [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 Kramer14d42d92014-07-15 16:47:09 +000016#include "NamedParameterCheck.h"
Benjamin Kramerfeff1342014-07-15 12:48:14 +000017#include "OverloadedUnaryAndCheck.h"
Daniel Jasperd07c8402013-07-29 08:19:24 +000018
19using namespace clang::ast_matchers;
20
21namespace clang {
22namespace tidy {
23
Daniel Jasperd07c8402013-07-29 08:19:24 +000024class GoogleModule : public ClangTidyModule {
25public:
Alexander Kornienko21f3b772014-03-05 13:01:24 +000026 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Daniel Jasperd07c8402013-07-29 08:19:24 +000027 CheckFactories.addCheckFactory(
Benjamin Kramer47c4d102014-07-15 09:50:32 +000028 "google-build-explicit-make-pair",
29 new ClangTidyCheckFactory<build::ExplicitMakePairCheck>());
30 CheckFactories.addCheckFactory(
Daniel Jasperd07c8402013-07-29 08:19:24 +000031 "google-explicit-constructor",
32 new ClangTidyCheckFactory<ExplicitConstructorCheck>());
Alexander Kornienko276fc642014-06-29 22:19:53 +000033 CheckFactories.addCheckFactory(
Benjamin Kramerfeff1342014-07-15 12:48:14 +000034 "google-runtime-operator",
35 new ClangTidyCheckFactory<runtime::OverloadedUnaryAndCheck>());
36 CheckFactories.addCheckFactory(
Alexander Kornienko276fc642014-06-29 22:19:53 +000037 "google-readability-casting",
38 new ClangTidyCheckFactory<readability::AvoidCStyleCastsCheck>());
Benjamin Kramer14d42d92014-07-15 16:47:09 +000039 CheckFactories.addCheckFactory(
40 "google-readability-function",
41 new ClangTidyCheckFactory<readability::NamedParameterCheck>());
Daniel Jasperd07c8402013-07-29 08:19:24 +000042 }
43};
44
45// Register the GoogleTidyModule using this statically initialized variable.
46static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module",
47 "Adds Google lint checks.");
48
49// This anchor is used to force the linker to link in the generated object file
50// and thus register the GoogleModule.
51volatile int GoogleModuleAnchorSource = 0;
52
53} // namespace tidy
54} // namespace clang