clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

LLVMTidyModule.cpp
Go to the documentation of this file.
1 //===--- 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
10 #include "../ClangTidy.h"
11 #include "../ClangTidyModule.h"
12 #include "../ClangTidyModuleRegistry.h"
13 #include "../readability/NamespaceCommentCheck.h"
14 #include "HeaderGuardCheck.h"
15 #include "IncludeOrderCheck.h"
16 #include "TwineLocalCheck.h"
17
18 namespace clang {
19 namespace tidy {
20 namespace llvm {
21
22 class LLVMModule : public ClangTidyModule {
23 public:
24 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
25 CheckFactories.registerCheck<LLVMHeaderGuardCheck>("llvm-header-guard");
26 CheckFactories.registerCheck<IncludeOrderCheck>("llvm-include-order");
27 CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
28 "llvm-namespace-comment");
29 CheckFactories.registerCheck<TwineLocalCheck>("llvm-twine-local");
30 }
31 };
32
33 // Register the LLVMTidyModule using this statically initialized variable.
34 static ClangTidyModuleRegistry::Add<LLVMModule> X("llvm-module",
35 "Adds LLVM lint checks.");
36
37 } // namespace llvm
38
39 // This anchor is used to force the linker to link in the generated object file
40 // and thus register the LLVMModule.
41 volatile int LLVMModuleAnchorSource = 0;
42
43 } // namespace tidy
44 } // namespace clang
IncludeOrderCheck.h
HeaderGuardCheck.h
clang::tidy::llvm::TwineLocalCheck
Looks for local Twine variables which are prone to use after frees and should be generally avoided...
Definition: TwineLocalCheck.h:21
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:58
clang::tidy::llvm::LLVMModule
Definition: LLVMTidyModule.cpp:22
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
clang::tidy::LLVMModuleAnchorSource
volatile int LLVMModuleAnchorSource
Definition: LLVMTidyModule.cpp:41
clang::tidy::llvm::LLVMModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Definition: LLVMTidyModule.cpp:24
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:83
TwineLocalCheck.h
clang::tidy::llvm::X
static ClangTidyModuleRegistry::Add< LLVMModule > X("llvm-module","Adds LLVM lint checks.")
clang::tidy::readability::NamespaceCommentCheck
Checks that long namespaces have a closing comment.
Definition: NamespaceCommentCheck.h:25
clang::tidy::llvm::IncludeOrderCheck
Checks the correct order of #includes.
Definition: IncludeOrderCheck.h:22
clang::tidy::llvm::LLVMHeaderGuardCheck
Finds and fixes header guards that do not adhere to LLVM style.
Definition: HeaderGuardCheck.h:20