clang-tools 18.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"
35namespace clang::tidy {
36namespace misc {
40 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
42 "misc-confusable-identifiers");
44 "misc-const-correctness");
46 "misc-coroutine-hostile-raii");
48 "misc-definitions-in-headers");
50 "misc-header-include-cycle");
51 CheckFactories.registerCheck<IncludeCleanerCheck>("misc-include-cleaner");
53 "misc-misleading-bidirectional");
55 "misc-misleading-identifier");
56 CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const");
58 "misc-new-delete-overloads");
59 CheckFactories.registerCheck<NoRecursionCheck>("misc-no-recursion");
61 "misc-non-copyable-objects");
63 "misc-non-private-member-variables-in-classes");
65 "misc-redundant-expression");
66 CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
68 "misc-throw-by-value-catch-by-reference");
70 "misc-unconventional-assign-operator");
72 "misc-uniqueptr-reset-release");
74 "misc-unused-alias-decls");
76 "misc-unused-parameters");
78 "misc-unused-using-decls");
80 "misc-use-anonymous-namespace");
81 }
84} // namespace misc
86// Register the MiscTidyModule using this statically initialized variable.
87static ClangTidyModuleRegistry::Add<misc::MiscModule>
88 X("misc-module", "Adds miscellaneous lint checks.");
90// This anchor is used to force the linker to link in the generated object file
91// and thus register the MiscModule.
92volatile int MiscModuleAnchorSource = 0;
94} // 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...
volatile int MiscModuleAnchorSource