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"
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");
30  "llvm-namespace-comment");
32  "llvm-prefer-isa-or-dyn-cast-in-conditionals");
34  "llvm-prefer-register-over-unsigned");
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
Finds variables declared as auto that could be declared as: &#39;auto*&#39; or &#39;const auto *&#39; and reference v...
Looks for local Twine variables which are prone to use after frees and should be generally avoided...
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
static ClangTidyModuleRegistry::Add< LLVMModule > X("llvm-module", "Adds LLVM lint checks.")
A collection of ClangTidyCheckFactory instances.
Finds and fixes header guards that do not adhere to LLVM style.
volatile int LLVMModuleAnchorSource
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Checks the correct order of #includes.
Checks that long namespaces have a closing comment.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Historically, LLVM has used unsigned to represent registers.
Looks at conditionals and finds and replaces cases of cast<>, which will assert rather than return a ...