clang-tools  11.0.0git
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 for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "../ClangTidy.h"
10 #include "../ClangTidyModule.h"
11 #include "../ClangTidyModuleRegistry.h"
13 #include "MisplacedConstCheck.h"
15 #include "NoRecursionCheck.h"
16 #include "NonCopyableObjects.h"
19 #include "StaticAssertCheck.h"
23 #include "UnusedAliasDeclsCheck.h"
24 #include "UnusedParametersCheck.h"
25 #include "UnusedUsingDeclsCheck.h"
27 namespace clang {
28 namespace tidy {
29 namespace misc {
31 class MiscModule : public ClangTidyModule {
32 public:
33  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
35  "misc-definitions-in-headers");
36  CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const");
37  CheckFactories.registerCheck<NewDeleteOverloadsCheck>(
38  "misc-new-delete-overloads");
39  CheckFactories.registerCheck<NoRecursionCheck>("misc-no-recursion");
40  CheckFactories.registerCheck<NonCopyableObjectsCheck>(
41  "misc-non-copyable-objects");
43  "misc-non-private-member-variables-in-classes");
45  "misc-redundant-expression");
46  CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
48  "misc-throw-by-value-catch-by-reference");
50  "misc-unconventional-assign-operator");
52  "misc-uniqueptr-reset-release");
53  CheckFactories.registerCheck<UnusedAliasDeclsCheck>(
54  "misc-unused-alias-decls");
55  CheckFactories.registerCheck<UnusedParametersCheck>(
56  "misc-unused-parameters");
57  CheckFactories.registerCheck<UnusedUsingDeclsCheck>(
58  "misc-unused-using-decls");
59  }
60 };
62 } // namespace misc
64 // Register the MiscTidyModule using this statically initialized variable.
65 static ClangTidyModuleRegistry::Add<misc::MiscModule>
66  X("misc-module", "Adds miscellaneous lint checks.");
68 // This anchor is used to force the linker to link in the generated object file
69 // and thus register the MiscModule.
70 volatile int MiscModuleAnchorSource = 0;
72 } // namespace tidy
73 } // namespace clang
This check diagnoses when a const qualifier is applied to a typedef to a pointer type rather than to ...
Find and replace unique_ptr::reset(release()) with std::move().
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
checks for locations that do not throw by value
Replaces assert() with static_assert() if the condition is evaluatable at compile time...
Finds unused namespace alias declarations.
This checker finds classes that not only contain the data (non-static member variables), but also have logic (non-static member functions), and diagnoses all member variables that have any other scope other than private.
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
A collection of ClangTidyCheckFactory instances.
Finds unused using declarations.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
The check flags dereferences and non-pointer declarations of objects that are not meant to be passed ...
static ClangTidyModuleRegistry::Add< bugprone::BugproneModule > X("bugprone-module", "Adds checks for bugprone code constructs.")
The checker detects expressions that are redundant, because they contain ineffective, useless parts.
volatile int MiscModuleAnchorSource
Finds non-extern non-inline function and variable definitions in header files, which can lead to pote...
Finds declarations of assignment operators with the wrong return and/or argument types and definition...
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Finds unused parameters and fixes them, so that -Wunused-parameter can be turned on.
Finds strongly connected functions (by analyzing call graph for SCC&#39;s that are loops), diagnoses each function in the cycle, and displays one example of possible call graph loop (recursion).