clang-tools 17.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 "MisplacedConstCheck.h"
19#include "NoRecursionCheck.h"
20#include "NonCopyableObjects.h"
23#include "StaticAssertCheck.h"
32namespace clang::tidy {
33namespace misc {
37 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
39 "misc-confusable-identifiers");
41 "misc-const-correctness");
43 "misc-definitions-in-headers");
45 "misc-misleading-bidirectional");
47 "misc-misleading-identifier");
48 CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const");
50 "misc-new-delete-overloads");
51 CheckFactories.registerCheck<NoRecursionCheck>("misc-no-recursion");
53 "misc-non-copyable-objects");
55 "misc-non-private-member-variables-in-classes");
57 "misc-redundant-expression");
58 CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
60 "misc-throw-by-value-catch-by-reference");
62 "misc-unconventional-assign-operator");
64 "misc-uniqueptr-reset-release");
66 "misc-unused-alias-decls");
68 "misc-unused-parameters");
70 "misc-unused-using-decls");
72 "misc-use-anonymous-namespace");
73 }
76} // namespace misc
78// Register the MiscTidyModule using this statically initialized variable.
79static ClangTidyModuleRegistry::Add<misc::MiscModule>
80 X("misc-module", "Adds miscellaneous lint checks.");
82// This anchor is used to force the linker to link in the generated object file
83// and thus register the MiscModule.
84volatile int MiscModuleAnchorSource = 0;
86} // 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.
Finds non-extern non-inline function and variable definitions in header files, which can lead to pote...
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