clang-tools 19.0.0git
Go to the documentation of this file.
1//===--- MiscTidyModule.cpp - clang-tidy ----------------------------------===//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9#include "../ClangTidy.h"
10#include "../ClangTidyModule.h"
11#include "../ClangTidyModuleRegistry.h"
17#include "IncludeCleanerCheck.h"
20#include "MisplacedConstCheck.h"
22#include "NoRecursionCheck.h"
23#include "NonCopyableObjects.h"
26#include "StaticAssertCheck.h"
36namespace clang::tidy {
37namespace misc {
41 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
43 "misc-confusable-identifiers");
45 "misc-const-correctness");
47 "misc-coroutine-hostile-raii");
49 "misc-definitions-in-headers");
51 "misc-header-include-cycle");
52 CheckFactories.registerCheck<IncludeCleanerCheck>("misc-include-cleaner");
54 "misc-misleading-bidirectional");
56 "misc-misleading-identifier");
57 CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const");
59 "misc-new-delete-overloads");
60 CheckFactories.registerCheck<NoRecursionCheck>("misc-no-recursion");
62 "misc-non-copyable-objects");
64 "misc-non-private-member-variables-in-classes");
66 "misc-redundant-expression");
67 CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
69 "misc-throw-by-value-catch-by-reference");
71 "misc-unconventional-assign-operator");
73 "misc-uniqueptr-reset-release");
75 "misc-unused-alias-decls");
77 "misc-unused-parameters");
79 "misc-unused-using-decls");
81 "misc-use-anonymous-namespace");
83 "misc-use-internal-linkage");
84 }
87} // namespace misc
89// Register the MiscTidyModule using this statically initialized variable.
90static ClangTidyModuleRegistry::Add<misc::MiscModule>
91 X("misc-module", "Adds miscellaneous lint checks.");
93// This anchor is used to force the linker to link in the generated object file
94// and thus register the MiscModule.
95volatile int MiscModuleAnchorSource = 0;
97} // namespace clang::tidy
int X
A collection of ClangTidyCheckFactory instances.
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Finds symbol which have confusable identifiers, i.e.
This check warns on variables which could be declared const but are not.
Detects when objects of certain hostile RAII types persists across suspension points in a coroutine.
Finds non-extern non-inline function and variable definitions in header files, which can lead to pote...
Check detects cyclic #include dependencies between user-defined headers.
Checks for unused and missing includes.
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
This check diagnoses when a const qualifier is applied to a typedef to a pointer type rather than to ...
Finds strongly connected functions (by analyzing call graph for SCC's that are loops),...
The check flags dereferences and non-pointer declarations of objects that are not meant to be passed ...
This checker finds classes that not only contain the data (non-static member variables),...
The checker detects expressions that are redundant, because they contain ineffective,...
Replaces assert() with static_assert() if the condition is evaluatable at compile time.
Finds declarations of assignment operators with the wrong return and/or argument types and definition...
Find and replace unique_ptr::reset(release()) with std::move().
Finds unused namespace alias declarations.
Finds unused parameters and fixes them, so that -Wunused-parameter can be turned on.
Finds unused using declarations.
Warns when using 'static' functions or variables at global scope, and suggests moving them to an anon...
Detects variables and functions that can be marked as static or moved into an anonymous namespace to ...
volatile int MiscModuleAnchorSource