1 //===--- LLVMTidyModule.cpp - clang-tidy ----------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "../ClangTidy.h"
10 #include "../ClangTidyModule.h"
11 #include "../ClangTidyModuleRegistry.h"
12 #include "../readability/NamespaceCommentCheck.h"
13 #include "HeaderGuardCheck.h"
14 #include "IncludeOrderCheck.h"
15 #include "TwineLocalCheck.h"
16 
17 namespace clang {
18 namespace tidy {
19 namespace llvm {
20 
21 class LLVMModule : public ClangTidyModule {
22 public:
23   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
24     CheckFactories.registerCheck<LLVMHeaderGuardCheck>("llvm-header-guard");
25     CheckFactories.registerCheck<IncludeOrderCheck>("llvm-include-order");
26     CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
27         "llvm-namespace-comment");
28     CheckFactories.registerCheck<TwineLocalCheck>("llvm-twine-local");
29   }
30 };
31 
32 // Register the LLVMTidyModule using this statically initialized variable.
33 static ClangTidyModuleRegistry::Add<LLVMModule> X("llvm-module",
34                                                   "Adds LLVM lint checks.");
35 
36 } // namespace llvm
37 
38 // This anchor is used to force the linker to link in the generated object file
39 // and thus register the LLVMModule.
40 volatile int LLVMModuleAnchorSource = 0;
41 
42 } // namespace tidy
43 } // namespace clang
44