clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MiscTidyModule.cpp
Go to the documentation of this file.
1 //===--- MiscTidyModule.cpp - clang-tidy ----------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "../ClangTidy.h"
11 #include "../ClangTidyModule.h"
12 #include "../ClangTidyModuleRegistry.h"
13 #include "ArgumentCommentCheck.h"
14 #include "AssertSideEffectCheck.h"
15 #include "AssignOperatorSignatureCheck.h"
16 #include "BoolPointerImplicitConversionCheck.h"
17 #include "DefinitionsInHeadersCheck.h"
18 #include "InaccurateEraseCheck.h"
19 #include "InefficientAlgorithmCheck.h"
20 #include "MacroParenthesesCheck.h"
21 #include "MacroRepeatedSideEffectsCheck.h"
22 #include "MoveConstantArgumentCheck.h"
23 #include "MoveConstructorInitCheck.h"
24 #include "NewDeleteOverloadsCheck.h"
25 #include "NoexceptMoveConstructorCheck.h"
26 #include "NonCopyableObjects.h"
27 #include "SizeofContainerCheck.h"
28 #include "StaticAssertCheck.h"
29 #include "StringIntegerAssignmentCheck.h"
30 #include "SwappedArgumentsCheck.h"
31 #include "ThrowByValueCatchByReferenceCheck.h"
32 #include "UndelegatedConstructor.h"
33 #include "UniqueptrResetReleaseCheck.h"
34 #include "UnusedAliasDeclsCheck.h"
35 #include "UnusedParametersCheck.h"
36 #include "UnusedRAIICheck.h"
37 #include "VirtualNearMissCheck.h"
38
39 namespace clang {
40 namespace tidy {
41 namespace misc {
42
43 class MiscModule : public ClangTidyModule {
44 public:
45 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
46 CheckFactories.registerCheck<ArgumentCommentCheck>("misc-argument-comment");
47 CheckFactories.registerCheck<AssertSideEffectCheck>(
48 "misc-assert-side-effect");
49 CheckFactories.registerCheck<AssignOperatorSignatureCheck>(
50 "misc-assign-operator-signature");
51 CheckFactories.registerCheck<BoolPointerImplicitConversionCheck>(
52 "misc-bool-pointer-implicit-conversion");
53 CheckFactories.registerCheck<DefinitionsInHeadersCheck>(
54 "misc-definitions-in-headers");
55 CheckFactories.registerCheck<InaccurateEraseCheck>(
56 "misc-inaccurate-erase");
57 CheckFactories.registerCheck<InefficientAlgorithmCheck>(
58 "misc-inefficient-algorithm");
59 CheckFactories.registerCheck<MacroParenthesesCheck>(
60 "misc-macro-parentheses");
61 CheckFactories.registerCheck<MacroRepeatedSideEffectsCheck>(
62 "misc-macro-repeated-side-effects");
63 CheckFactories.registerCheck<MoveConstantArgumentCheck>(
64 "misc-move-const-arg");
65 CheckFactories.registerCheck<MoveConstructorInitCheck>(
66 "misc-move-constructor-init");
67 CheckFactories.registerCheck<NewDeleteOverloadsCheck>(
68 "misc-new-delete-overloads");
69 CheckFactories.registerCheck<NoexceptMoveConstructorCheck>(
70 "misc-noexcept-move-constructor");
71 CheckFactories.registerCheck<NonCopyableObjectsCheck>(
72 "misc-non-copyable-objects");
73 CheckFactories.registerCheck<SizeofContainerCheck>("misc-sizeof-container");
74 CheckFactories.registerCheck<StaticAssertCheck>(
75 "misc-static-assert");
76 CheckFactories.registerCheck<StringIntegerAssignmentCheck>(
77 "misc-string-integer-assignment");
78 CheckFactories.registerCheck<SwappedArgumentsCheck>(
79 "misc-swapped-arguments");
80 CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
81 "misc-throw-by-value-catch-by-reference");
82 CheckFactories.registerCheck<UndelegatedConstructorCheck>(
83 "misc-undelegated-constructor");
84 CheckFactories.registerCheck<UniqueptrResetReleaseCheck>(
85 "misc-uniqueptr-reset-release");
86 CheckFactories.registerCheck<UnusedAliasDeclsCheck>(
87 "misc-unused-alias-decls");
88 CheckFactories.registerCheck<UnusedParametersCheck>(
89 "misc-unused-parameters");
90 CheckFactories.registerCheck<UnusedRAIICheck>("misc-unused-raii");
91 CheckFactories.registerCheck<VirtualNearMissCheck>(
92 "misc-virtual-near-miss");
93 }
94 };
95
96 } // namespace misc
97
98 // Register the MiscTidyModule using this statically initialized variable.
99 static ClangTidyModuleRegistry::Add<misc::MiscModule>
100 X("misc-module", "Adds miscellaneous lint checks.");
101
102 // This anchor is used to force the linker to link in the generated object file
103 // and thus register the MiscModule.
104 volatile int MiscModuleAnchorSource = 0;
105
106 } // namespace tidy
107 } // namespace clang
clang::tidy::MoveConstructorInitCheck
The check flags user-defined move constructors that have a ctor-initializer initializing a member or ...
Definition: MoveConstructorInitCheck.h:26
NonCopyableObjects.h
ArgumentCommentCheck.h
ThrowByValueCatchByReferenceCheck.h
clang::tidy::misc::MacroRepeatedSideEffectsCheck
Checks for repeated argument with side effects in macros.
Definition: MacroRepeatedSideEffectsCheck.h:20
clang::tidy::X
static ClangTidyModuleRegistry::Add< cert::CERTModule > X("cert-module","Adds lint checks corresponding to CERT secure coding guidelines.")
clang::tidy::misc::SwappedArgumentsCheck
Finds potentially swapped arguments by looking at implicit conversions.
Definition: SwappedArgumentsCheck.h:20
StaticAssertCheck.h
clang::tidy::misc::UniqueptrResetReleaseCheck
Find and replace unique_ptr::reset(release()) with std::move().
Definition: UniqueptrResetReleaseCheck.h:30
clang::tidy::misc::BoolPointerImplicitConversionCheck
Checks for conditions based on implicit conversion from a bool pointer to bool.
Definition: BoolPointerImplicitConversionCheck.h:30
StringIntegerAssignmentCheck.h
MacroRepeatedSideEffectsCheck.h
clang::tidy::AssertSideEffectCheck
Finds assert() with side effect.
Definition: AssertSideEffectCheck.h:34
SwappedArgumentsCheck.h
clang::tidy::misc::ArgumentCommentCheck
Definition: ArgumentCommentCheck.h:34
clang::tidy::misc::UnusedRAIICheck
Finds temporaries that look like RAII objects.
Definition: UnusedRAIICheck.h:23
InaccurateEraseCheck.h
clang::tidy::misc::UndelegatedConstructorCheck
Finds creation of temporary objects in constructors that look like a function call to another constru...
Definition: UndelegatedConstructor.h:24
clang::tidy::ThrowByValueCatchByReferenceCheck
checks for locations that do not throw by value
Definition: ThrowByValueCatchByReferenceCheck.h:29
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:58
clang::tidy::misc::VirtualNearMissCheck
Checks for near miss of virtual methods.
Definition: VirtualNearMissCheck.h:28
clang::tidy::SizeofContainerCheck
Find usages of sizeof on expressions of STL container types.
Definition: SizeofContainerCheck.h:23
NewDeleteOverloadsCheck.h
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:45
clang::tidy::NonCopyableObjectsCheck
The check flags dereferences and non-pointer declarations of objects that are not meant to be passed ...
Definition: NonCopyableObjects.h:20
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
AssignOperatorSignatureCheck.h
clang::tidy::misc::MiscModule
Definition: MiscTidyModule.cpp:43
clang::tidy::misc::MoveConstantArgumentCheck
Definition: MoveConstantArgumentCheck.h:19
BoolPointerImplicitConversionCheck.h
clang::tidy::UnusedParametersCheck
Finds unused parameters and fixes them, so that -Wunused-parameter can be turned on.
Definition: UnusedParametersCheck.h:20
clang::tidy::misc::AssignOperatorSignatureCheck
Finds declarations of assign operators with the wrong return and/or argument types.
Definition: AssignOperatorSignatureCheck.h:25
MacroParenthesesCheck.h
SizeofContainerCheck.h
VirtualNearMissCheck.h
UndelegatedConstructor.h
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:83
clang::tidy::misc::NewDeleteOverloadsCheck
Definition: NewDeleteOverloadsCheck.h:21
UnusedAliasDeclsCheck.h
clang::tidy::MacroParenthesesCheck
Finds macros that can have unexpected behaviour due to missing parentheses.
Definition: MacroParenthesesCheck.h:31
UnusedRAIICheck.h
clang::tidy::StringIntegerAssignmentCheck
Finds instances where an integer is assigned to a string.
Definition: StringIntegerAssignmentCheck.h:22
clang::tidy::StaticAssertCheck
Replaces assert() with static_assert() if the condition is evaluatable at compile time...
Definition: StaticAssertCheck.h:25
UnusedParametersCheck.h
clang::tidy::MiscModuleAnchorSource
volatile int MiscModuleAnchorSource
Definition: MiscTidyModule.cpp:104
AssertSideEffectCheck.h
NoexceptMoveConstructorCheck.h
clang::tidy::UnusedAliasDeclsCheck
Finds unused namespace alias declarations.
Definition: UnusedAliasDeclsCheck.h:19
clang::tidy::misc::DefinitionsInHeadersCheck
Definition: DefinitionsInHeadersCheck.h:28
MoveConstantArgumentCheck.h
UniqueptrResetReleaseCheck.h
InefficientAlgorithmCheck.h
DefinitionsInHeadersCheck.h
clang::tidy::misc::InaccurateEraseCheck
Checks for inaccurate use of the erase() method.
Definition: InaccurateEraseCheck.h:26
clang::tidy::NoexceptMoveConstructorCheck
The check flags user-defined move constructors and assignment operators not marked with noexcept or m...
Definition: NoexceptMoveConstructorCheck.h:25
clang::tidy::misc::InefficientAlgorithmCheck
Warns on inefficient use of STL algorithms on associative containers.
Definition: InefficientAlgorithmCheck.h:24
MoveConstructorInitCheck.h