blob: ea46ca9384113c841a3103323ea094748d20d3f8 [file] [log] [blame]
Daniel Jasperd07c8402013-07-29 08:19:24 +00001//===--- LLVMTidyModule.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"
Chandler Carruth3cbd71c2015-01-14 11:24:38 +000013#include "../readability/NamespaceCommentCheck.h"
Benjamin Kramer498cce52014-08-13 13:57:57 +000014#include "HeaderGuardCheck.h"
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000015#include "IncludeOrderCheck.h"
Benjamin Kramer190e2cf2014-07-08 14:32:17 +000016#include "TwineLocalCheck.h"
Daniel Jasperd07c8402013-07-29 08:19:24 +000017
18namespace clang {
19namespace tidy {
Alexander Kornienko0a6ce9f2015-03-02 12:39:18 +000020namespace llvm {
Daniel Jasperd07c8402013-07-29 08:19:24 +000021
Daniel Jasperd07c8402013-07-29 08:19:24 +000022class LLVMModule : public ClangTidyModule {
23public:
Alexander Kornienko21f3b772014-03-05 13:01:24 +000024 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Alexander Kornienkobe8c1432014-09-10 11:06:43 +000025 CheckFactories.registerCheck<LLVMHeaderGuardCheck>("llvm-header-guard");
26 CheckFactories.registerCheck<IncludeOrderCheck>("llvm-include-order");
Alexander Kornienko33fc3db2014-09-22 10:41:39 +000027 CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
Alexander Kornienkobe8c1432014-09-10 11:06:43 +000028 "llvm-namespace-comment");
29 CheckFactories.registerCheck<TwineLocalCheck>("llvm-twine-local");
Daniel Jasperd07c8402013-07-29 08:19:24 +000030 }
31};
32
33// Register the LLVMTidyModule using this statically initialized variable.
34static ClangTidyModuleRegistry::Add<LLVMModule> X("llvm-module",
35 "Adds LLVM lint checks.");
36
Alexander Kornienko0a6ce9f2015-03-02 12:39:18 +000037} // namespace llvm
38
Daniel Jasperd07c8402013-07-29 08:19:24 +000039// This anchor is used to force the linker to link in the generated object file
40// and thus register the LLVMModule.
41volatile int LLVMModuleAnchorSource = 0;
42
43} // namespace tidy
44} // namespace clang