blob: 05787cf214dc6d7703b36468b645d4f79d983b31 [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 Kornienko72f1e752014-06-18 09:33:46 +000013#include "ExplicitConstructorCheck.h"
Daniel Jasperd07c8402013-07-29 08:19:24 +000014
15using namespace clang::ast_matchers;
16
17namespace clang {
18namespace tidy {
19
Daniel Jasperd07c8402013-07-29 08:19:24 +000020class GoogleModule : public ClangTidyModule {
21public:
Alexander Kornienko21f3b772014-03-05 13:01:24 +000022 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Daniel Jasperd07c8402013-07-29 08:19:24 +000023 CheckFactories.addCheckFactory(
24 "google-explicit-constructor",
25 new ClangTidyCheckFactory<ExplicitConstructorCheck>());
26 }
27};
28
29// Register the GoogleTidyModule using this statically initialized variable.
30static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module",
31 "Adds Google lint checks.");
32
33// This anchor is used to force the linker to link in the generated object file
34// and thus register the GoogleModule.
35volatile int GoogleModuleAnchorSource = 0;
36
37} // namespace tidy
38} // namespace clang