clang-tools  16.0.0git
MiscTidyModule.cpp
Go to the documentation of this file.
1 //===--- MiscTidyModule.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"
13 #include "ConstCorrectnessCheck.h"
16 #include "MisleadingIdentifier.h"
17 #include "MisplacedConstCheck.h"
19 #include "NoRecursionCheck.h"
20 #include "NonCopyableObjects.h"
23 #include "StaticAssertCheck.h"
27 #include "UnusedAliasDeclsCheck.h"
28 #include "UnusedParametersCheck.h"
29 #include "UnusedUsingDeclsCheck.h"
31 
32 namespace clang {
33 namespace tidy {
34 namespace misc {
35 
36 class MiscModule : public ClangTidyModule {
37 public:
38  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
40  "misc-confusable-identifiers");
41  CheckFactories.registerCheck<ConstCorrectnessCheck>(
42  "misc-const-correctness");
44  "misc-definitions-in-headers");
46  "misc-misleading-bidirectional");
48  "misc-misleading-identifier");
49  CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const");
50  CheckFactories.registerCheck<NewDeleteOverloadsCheck>(
51  "misc-new-delete-overloads");
52  CheckFactories.registerCheck<NoRecursionCheck>("misc-no-recursion");
53  CheckFactories.registerCheck<NonCopyableObjectsCheck>(
54  "misc-non-copyable-objects");
56  "misc-non-private-member-variables-in-classes");
58  "misc-redundant-expression");
59  CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
61  "misc-throw-by-value-catch-by-reference");
63  "misc-unconventional-assign-operator");
65  "misc-uniqueptr-reset-release");
66  CheckFactories.registerCheck<UnusedAliasDeclsCheck>(
67  "misc-unused-alias-decls");
68  CheckFactories.registerCheck<UnusedParametersCheck>(
69  "misc-unused-parameters");
70  CheckFactories.registerCheck<UnusedUsingDeclsCheck>(
71  "misc-unused-using-decls");
73  "misc-use-anonymous-namespace");
74  }
75 };
76 
77 } // namespace misc
78 
79 // Register the MiscTidyModule using this statically initialized variable.
80 static ClangTidyModuleRegistry::Add<misc::MiscModule>
81  X("misc-module", "Adds miscellaneous lint checks.");
82 
83 // This anchor is used to force the linker to link in the generated object file
84 // and thus register the MiscModule.
85 volatile int MiscModuleAnchorSource = 0;
86 
87 } // namespace tidy
88 } // namespace clang
UnusedParametersCheck.h
clang::tidy::misc::NewDeleteOverloadsCheck
Definition: NewDeleteOverloadsCheck.h:20
clang::tidy::misc::NonCopyableObjectsCheck
The check flags dereferences and non-pointer declarations of objects that are not meant to be passed ...
Definition: NonCopyableObjects.h:20
MisplacedConstCheck.h
StaticAssertCheck.h
clang::tidy::misc::MisleadingBidirectionalCheck
Definition: MisleadingBidirectional.h:18
NonPrivateMemberVariablesInClassesCheck.h
ConstCorrectnessCheck.h
clang::tidy::misc::UnusedAliasDeclsCheck
Finds unused namespace alias declarations.
Definition: UnusedAliasDeclsCheck.h:20
NewDeleteOverloadsCheck.h
clang::tidy::misc::UniqueptrResetReleaseCheck
Find and replace unique_ptr::reset(release()) with std::move().
Definition: UniqueptrResetReleaseCheck.h:30
clang::tidy::misc::DefinitionsInHeadersCheck
Finds non-extern non-inline function and variable definitions in header files, which can lead to pote...
Definition: DefinitionsInHeadersCheck.h:34
clang::tidy::misc::UnusedParametersCheck
Finds unused parameters and fixes them, so that -Wunused-parameter can be turned on.
Definition: UnusedParametersCheck.h:20
clang::tidy::misc::NonPrivateMemberVariablesInClassesCheck
This checker finds classes that not only contain the data (non-static member variables),...
Definition: NonPrivateMemberVariablesInClassesCheck.h:29
clang::tidy::misc::UseAnonymousNamespaceCheck
Warns when using 'static' functions or variables at global scope, and suggests moving them to an anon...
Definition: UseAnonymousNamespaceCheck.h:24
clang::tidy::misc::MiscModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
Definition: MiscTidyModule.cpp:38
MisleadingBidirectional.h
clang::tidy::misc::ConfusableIdentifierCheck
Finds symbol which have confusable identifiers, i.e.
Definition: ConfusableIdentifierCheck.h:23
clang::tidy::misc::NoRecursionCheck
Finds strongly connected functions (by analyzing call graph for SCC's that are loops),...
Definition: NoRecursionCheck.h:27
clang::tidy::misc::UnconventionalAssignOperatorCheck
Finds declarations of assignment operators with the wrong return and/or argument types and definition...
Definition: UnconventionalAssignOperatorCheck.h:29
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:28
ThrowByValueCatchByReferenceCheck.h
UseAnonymousNamespaceCheck.h
UnusedUsingDeclsCheck.h
clang::tidy::misc::StaticAssertCheck
Replaces assert() with static_assert() if the condition is evaluatable at compile time.
Definition: StaticAssertCheck.h:25
clang::tidy::misc::MisplacedConstCheck
This check diagnoses when a const qualifier is applied to a typedef to a pointer type rather than to ...
Definition: MisplacedConstCheck.h:23
clang::tidy::MiscModuleAnchorSource
volatile int MiscModuleAnchorSource
Definition: MiscTidyModule.cpp:85
DefinitionsInHeadersCheck.h
NoRecursionCheck.h
UniqueptrResetReleaseCheck.h
clang::tidy::misc::MiscModule
Definition: MiscTidyModule.cpp:36
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
MisleadingIdentifier.h
clang::tidy::misc::ThrowByValueCatchByReferenceCheck
checks for locations that do not throw by value
Definition: ThrowByValueCatchByReferenceCheck.h:29
ConfusableIdentifierCheck.h
clang::tidy::misc::RedundantExpressionCheck
The checker detects expressions that are redundant, because they contain ineffective,...
Definition: RedundantExpressionCheck.h:23
clang::tidy::misc::ConstCorrectnessCheck
This check warns on variables which could be declared const but are not.
Definition: ConstCorrectnessCheck.h:25
clang::tidy::X
static ClangTidyModuleRegistry::Add< altera::AlteraModule > X("altera-module", "Adds Altera FPGA OpenCL lint checks.")
UnconventionalAssignOperatorCheck.h
clang::tidy::misc::UnusedUsingDeclsCheck
Finds unused using declarations.
Definition: UnusedUsingDeclsCheck.h:24
UnusedAliasDeclsCheck.h
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:85
RedundantExpressionCheck.h
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:59
NonCopyableObjects.h
clang::tidy::misc::MisleadingIdentifierCheck
Definition: MisleadingIdentifier.h:18