clang-tools 10.0.0

LLVMTidyModule.cpp
Go to the documentation of this file.
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 "../readability/QualifiedAutoCheck.h"
14 #include "HeaderGuardCheck.h"
15 #include "IncludeOrderCheck.h"
16 #include "PreferIsaOrDynCastInConditionalsCheck.h"
17 #include "PreferRegisterOverUnsignedCheck.h"
18 #include "TwineLocalCheck.h"
19
20 namespace clang {
21 namespace tidy {
22 namespace llvm_check {
23
24 class LLVMModule : public ClangTidyModule {
25 public:
26 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
27 CheckFactories.registerCheck<LLVMHeaderGuardCheck>("llvm-header-guard");
28 CheckFactories.registerCheck<IncludeOrderCheck>("llvm-include-order");
29 CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
30 "llvm-namespace-comment");
31 CheckFactories.registerCheck<PreferIsaOrDynCastInConditionalsCheck>(
32 "llvm-prefer-isa-or-dyn-cast-in-conditionals");
33 CheckFactories.registerCheck<PreferRegisterOverUnsignedCheck>(
34 "llvm-prefer-register-over-unsigned");
35 CheckFactories.registerCheck<readability::QualifiedAutoCheck>(
36 "llvm-qualified-auto");
37 CheckFactories.registerCheck<TwineLocalCheck>("llvm-twine-local");
38 }
39 };
40
41 // Register the LLVMTidyModule using this statically initialized variable.
42 static ClangTidyModuleRegistry::Add<LLVMModule> X("llvm-module",
43 "Adds LLVM lint checks.");
44
45 } // namespace llvm_check
46
47 // This anchor is used to force the linker to link in the generated object file
48 // and thus register the LLVMModule.
49 volatile int LLVMModuleAnchorSource = 0;
50
51 } // namespace tidy
52 } // namespace clang
clang::tidy::readability::QualifiedAutoCheck
Finds variables declared as auto that could be declared as: &#39;auto*&#39; or &#39;const auto *&#39; and reference v...
Definition: QualifiedAutoCheck.h:24
IncludeOrderCheck.h
HeaderGuardCheck.h
clang::tidy::llvm_check::TwineLocalCheck
Looks for local Twine variables which are prone to use after frees and should be generally avoided...
Definition: TwineLocalCheck.h:20
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:58
clang::tidy::llvm_check::X
static ClangTidyModuleRegistry::Add< LLVMModule > X("llvm-module", "Adds LLVM lint checks.")
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
clang::tidy::llvm_check::LLVMHeaderGuardCheck
Finds and fixes header guards that do not adhere to LLVM style.
Definition: HeaderGuardCheck.h:27
clang::tidy::LLVMModuleAnchorSource
volatile int LLVMModuleAnchorSource
Definition: LLVMTidyModule.cpp:49
PreferIsaOrDynCastInConditionalsCheck.h
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:80
clang::tidy::llvm_check::LLVMModule
Definition: LLVMTidyModule.cpp:24
clang::tidy::llvm_check::LLVMModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Definition: LLVMTidyModule.cpp:26
TwineLocalCheck.h
clang::tidy::llvm_check::IncludeOrderCheck
Checks the correct order of #includes.
Definition: IncludeOrderCheck.h:21
clang::tidy::readability::NamespaceCommentCheck
Checks that long namespaces have a closing comment.
Definition: NamespaceCommentCheck.h:24
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::tidy::llvm_check::PreferRegisterOverUnsignedCheck
Historically, LLVM has used unsigned to represent registers.
Definition: PreferRegisterOverUnsignedCheck.h:24
PreferRegisterOverUnsignedCheck.h
clang::tidy::llvm_check::PreferIsaOrDynCastInConditionalsCheck
Looks at conditionals and finds and replaces cases of cast<>, which will assert rather than return a ...
Definition: PreferIsaOrDynCastInConditionalsCheck.h:51