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 "MisplacedConstCheck.h" 16 #include "UnconventionalAssignOperatorCheck.h" 17 #include "BoolPointerImplicitConversionCheck.h" 18 #include "DanglingHandleCheck.h" 19 #include "DefinitionsInHeadersCheck.h" 20 #include "FoldInitTypeCheck.h" 21 #include "ForwardDeclarationNamespaceCheck.h" 22 #include "InaccurateEraseCheck.h" 23 #include "IncorrectRoundings.h" 24 #include "InefficientAlgorithmCheck.h" 25 #include "MacroParenthesesCheck.h" 26 #include "MacroRepeatedSideEffectsCheck.h" 27 #include "MisplacedWideningCastCheck.h" 28 #include "MoveConstantArgumentCheck.h" 29 #include "MoveConstructorInitCheck.h" 30 #include "MultipleStatementMacroCheck.h" 31 #include "NewDeleteOverloadsCheck.h" 32 #include "NoexceptMoveConstructorCheck.h" 33 #include "NonCopyableObjects.h" 34 #include "PointerAndIntegralOperationCheck.h" 35 #include "RedundantExpressionCheck.h" 36 #include "SizeofContainerCheck.h" 37 #include "SizeofExpressionCheck.h" 38 #include "StaticAssertCheck.h" 39 #include "StringConstructorCheck.h" 40 #include "StringIntegerAssignmentCheck.h" 41 #include "StringLiteralWithEmbeddedNulCheck.h" 42 #include "SuspiciousMissingCommaCheck.h" 43 #include "SuspiciousSemicolonCheck.h" 44 #include "SuspiciousStringCompareCheck.h" 45 #include "SwappedArgumentsCheck.h" 46 #include "ThrowByValueCatchByReferenceCheck.h" 47 #include "UndelegatedConstructor.h" 48 #include "UniqueptrResetReleaseCheck.h" 49 #include "UnusedAliasDeclsCheck.h" 50 #include "UnusedParametersCheck.h" 51 #include "UnusedRAIICheck.h" 52 #include "UnusedUsingDeclsCheck.h" 53 #include "VirtualNearMissCheck.h" 54 55 namespace clang { 56 namespace tidy { 57 namespace misc { 58 59 class MiscModule : public ClangTidyModule { 60 public: 61 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 62 CheckFactories.registerCheck<ArgumentCommentCheck>("misc-argument-comment"); 63 CheckFactories.registerCheck<AssertSideEffectCheck>( 64 "misc-assert-side-effect"); 65 CheckFactories.registerCheck<MisplacedConstCheck>( 66 "misc-misplaced-const"); 67 CheckFactories.registerCheck<UnconventionalAssignOperatorCheck>( 68 "misc-unconventional-assign-operator"); 69 CheckFactories.registerCheck<BoolPointerImplicitConversionCheck>( 70 "misc-bool-pointer-implicit-conversion"); 71 CheckFactories.registerCheck<DanglingHandleCheck>( 72 "misc-dangling-handle"); 73 CheckFactories.registerCheck<DefinitionsInHeadersCheck>( 74 "misc-definitions-in-headers"); 75 CheckFactories.registerCheck<FoldInitTypeCheck>( 76 "misc-fold-init-type"); 77 CheckFactories.registerCheck<ForwardDeclarationNamespaceCheck>( 78 "misc-forward-declaration-namespace"); 79 CheckFactories.registerCheck<InaccurateEraseCheck>( 80 "misc-inaccurate-erase"); 81 CheckFactories.registerCheck<IncorrectRoundings>( 82 "misc-incorrect-roundings"); 83 CheckFactories.registerCheck<InefficientAlgorithmCheck>( 84 "misc-inefficient-algorithm"); 85 CheckFactories.registerCheck<MacroParenthesesCheck>( 86 "misc-macro-parentheses"); 87 CheckFactories.registerCheck<MacroRepeatedSideEffectsCheck>( 88 "misc-macro-repeated-side-effects"); 89 CheckFactories.registerCheck<MisplacedWideningCastCheck>( 90 "misc-misplaced-widening-cast"); 91 CheckFactories.registerCheck<MoveConstantArgumentCheck>( 92 "misc-move-const-arg"); 93 CheckFactories.registerCheck<MoveConstructorInitCheck>( 94 "misc-move-constructor-init"); 95 CheckFactories.registerCheck<MultipleStatementMacroCheck>( 96 "misc-multiple-statement-macro"); 97 CheckFactories.registerCheck<NewDeleteOverloadsCheck>( 98 "misc-new-delete-overloads"); 99 CheckFactories.registerCheck<NoexceptMoveConstructorCheck>( 100 "misc-noexcept-move-constructor"); 101 CheckFactories.registerCheck<NonCopyableObjectsCheck>( 102 "misc-non-copyable-objects"); 103 CheckFactories.registerCheck<PointerAndIntegralOperationCheck>( 104 "misc-pointer-and-integral-operation"); 105 CheckFactories.registerCheck<RedundantExpressionCheck>( 106 "misc-redundant-expression"); 107 CheckFactories.registerCheck<SizeofContainerCheck>("misc-sizeof-container"); 108 CheckFactories.registerCheck<SizeofExpressionCheck>( 109 "misc-sizeof-expression"); 110 CheckFactories.registerCheck<StaticAssertCheck>( 111 "misc-static-assert"); 112 CheckFactories.registerCheck<StringConstructorCheck>( 113 "misc-string-constructor"); 114 CheckFactories.registerCheck<StringIntegerAssignmentCheck>( 115 "misc-string-integer-assignment"); 116 CheckFactories.registerCheck<StringLiteralWithEmbeddedNulCheck>( 117 "misc-string-literal-with-embedded-nul"); 118 CheckFactories.registerCheck<SuspiciousMissingCommaCheck>( 119 "misc-suspicious-missing-comma"); 120 CheckFactories.registerCheck<SuspiciousSemicolonCheck>( 121 "misc-suspicious-semicolon"); 122 CheckFactories.registerCheck<SuspiciousStringCompareCheck>( 123 "misc-suspicious-string-compare"); 124 CheckFactories.registerCheck<SwappedArgumentsCheck>( 125 "misc-swapped-arguments"); 126 CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>( 127 "misc-throw-by-value-catch-by-reference"); 128 CheckFactories.registerCheck<UndelegatedConstructorCheck>( 129 "misc-undelegated-constructor"); 130 CheckFactories.registerCheck<UniqueptrResetReleaseCheck>( 131 "misc-uniqueptr-reset-release"); 132 CheckFactories.registerCheck<UnusedAliasDeclsCheck>( 133 "misc-unused-alias-decls"); 134 CheckFactories.registerCheck<UnusedParametersCheck>( 135 "misc-unused-parameters"); 136 CheckFactories.registerCheck<UnusedRAIICheck>("misc-unused-raii"); 137 CheckFactories.registerCheck<UnusedUsingDeclsCheck>( 138 "misc-unused-using-decls"); 139 CheckFactories.registerCheck<VirtualNearMissCheck>( 140 "misc-virtual-near-miss"); 141 } 142 }; 143 144 } // namespace misc 145 146 // Register the MiscTidyModule using this statically initialized variable. 147 static ClangTidyModuleRegistry::Add<misc::MiscModule> 148 X("misc-module", "Adds miscellaneous lint checks."); 149 150 // This anchor is used to force the linker to link in the generated object file 151 // and thus register the MiscModule. 152 volatile int MiscModuleAnchorSource = 0; 153 154 } // namespace tidy 155 } // namespace clang 156