| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 1 | //===--- ReadabilityTidyModule.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" | 
| Alexander Kornienko | e3ae0c6 | 2016-03-30 11:31:33 +0000 | [diff] [blame] | 13 | #include "AvoidConstParamsInDecls.h" | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 14 | #include "BracesAroundStatementsCheck.h" | 
| Alexander Kornienko | 1b677db | 2015-03-09 12:18:39 +0000 | [diff] [blame] | 15 | #include "ContainerSizeEmptyCheck.h" | 
| Gabor Horvath | 7510d9a | 2016-12-31 12:45:59 +0000 | [diff] [blame] | 16 | #include "DeleteNullPointerCheck.h" | 
| Alexander Kornienko | 4191b90 | 2016-04-13 11:33:40 +0000 | [diff] [blame] | 17 | #include "DeletedDefaultCheck.h" | 
| Daniel Jasper | 3b6018b | 2015-01-14 19:37:54 +0000 | [diff] [blame] | 18 | #include "ElseAfterReturnCheck.h" | 
| Alexander Kornienko | 1b677db | 2015-03-09 12:18:39 +0000 | [diff] [blame] | 19 | #include "FunctionSizeCheck.h" | 
| Alexander Kornienko | 76c2880 | 2015-08-19 11:15:36 +0000 | [diff] [blame] | 20 | #include "IdentifierNamingCheck.h" | 
| Alexander Kornienko | f1a6552 | 2017-08-08 14:53:52 +0000 | [diff] [blame] | 21 | #include "ImplicitBoolConversionCheck.h" | 
| Alexander Kornienko | 11d4d64 | 2015-09-10 10:07:11 +0000 | [diff] [blame] | 22 | #include "InconsistentDeclarationParameterNameCheck.h" | 
| Gabor Horvath | e647bd5 | 2017-02-14 10:03:27 +0000 | [diff] [blame] | 23 | #include "MisleadingIndentationCheck.h" | 
| Daniel Marjamaki | 03ea468 | 2016-09-12 12:04:13 +0000 | [diff] [blame] | 24 | #include "MisplacedArrayIndexCheck.h" | 
| Alexander Kornienko | c5bc68e | 2015-03-16 22:31:16 +0000 | [diff] [blame] | 25 | #include "NamedParameterCheck.h" | 
| Daniel Marjamaki | 9e4ecfa | 2016-08-23 10:09:08 +0000 | [diff] [blame] | 26 | #include "NonConstParameterCheck.h" | 
| Aaron Ballman | c3975b7 | 2016-02-01 15:31:15 +0000 | [diff] [blame] | 27 | #include "RedundantControlFlowCheck.h" | 
| Daniel Marjamaki | 399a50c | 2016-11-01 13:26:15 +0000 | [diff] [blame] | 28 | #include "RedundantDeclarationCheck.h" | 
| Malcolm Parsons | e7be4a0 | 2016-12-13 08:04:11 +0000 | [diff] [blame] | 29 | #include "RedundantFunctionPtrDereferenceCheck.h" | 
| Malcolm Parsons | 5c24a11 | 2016-10-20 16:08:03 +0000 | [diff] [blame] | 30 | #include "RedundantMemberInitCheck.h" | 
| Alexander Kornienko | 1b677db | 2015-03-09 12:18:39 +0000 | [diff] [blame] | 31 | #include "RedundantSmartptrGetCheck.h" | 
| Alexander Kornienko | 57a5c6b | 2015-03-16 00:32:25 +0000 | [diff] [blame] | 32 | #include "RedundantStringCStrCheck.h" | 
| Alexander Kornienko | 1612fa0 | 2016-02-25 23:57:23 +0000 | [diff] [blame] | 33 | #include "RedundantStringInitCheck.h" | 
| Alexander Kornienko | f5e72b0 | 2015-04-10 19:26:43 +0000 | [diff] [blame] | 34 | #include "SimplifyBooleanExprCheck.h" | 
| Gabor Horvath | 40b6512 | 2017-08-08 15:33:48 +0000 | [diff] [blame] | 35 | #include "StaticAccessedThroughInstanceCheck.h" | 
| Haojian Wu | c253f8b | 2016-04-05 11:42:08 +0000 | [diff] [blame] | 36 | #include "StaticDefinitionInAnonymousNamespaceCheck.h" | 
| Alexander Kornienko | 5c9c042 | 2018-01-30 14:55:50 +0000 | [diff] [blame] | 37 | #include "StringCompareCheck.h" | 
| Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 38 | #include "UniqueptrDeleteReleaseCheck.h" | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 39 |  | 
|  | 40 | namespace clang { | 
|  | 41 | namespace tidy { | 
|  | 42 | namespace readability { | 
|  | 43 |  | 
|  | 44 | class ReadabilityModule : public ClangTidyModule { | 
|  | 45 | public: | 
|  | 46 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { | 
| Alexander Kornienko | e3ae0c6 | 2016-03-30 11:31:33 +0000 | [diff] [blame] | 47 | CheckFactories.registerCheck<AvoidConstParamsInDecls>( | 
|  | 48 | "readability-avoid-const-params-in-decls"); | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 49 | CheckFactories.registerCheck<BracesAroundStatementsCheck>( | 
|  | 50 | "readability-braces-around-statements"); | 
| Alexander Kornienko | 4babd68 | 2015-01-15 15:46:58 +0000 | [diff] [blame] | 51 | CheckFactories.registerCheck<ContainerSizeEmptyCheck>( | 
|  | 52 | "readability-container-size-empty"); | 
| Gabor Horvath | 7510d9a | 2016-12-31 12:45:59 +0000 | [diff] [blame] | 53 | CheckFactories.registerCheck<DeleteNullPointerCheck>( | 
|  | 54 | "readability-delete-null-pointer"); | 
| Alexander Kornienko | 4191b90 | 2016-04-13 11:33:40 +0000 | [diff] [blame] | 55 | CheckFactories.registerCheck<DeletedDefaultCheck>( | 
|  | 56 | "readability-deleted-default"); | 
| Daniel Jasper | 3b6018b | 2015-01-14 19:37:54 +0000 | [diff] [blame] | 57 | CheckFactories.registerCheck<ElseAfterReturnCheck>( | 
|  | 58 | "readability-else-after-return"); | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 59 | CheckFactories.registerCheck<FunctionSizeCheck>( | 
|  | 60 | "readability-function-size"); | 
| Alexander Kornienko | 76c2880 | 2015-08-19 11:15:36 +0000 | [diff] [blame] | 61 | CheckFactories.registerCheck<IdentifierNamingCheck>( | 
|  | 62 | "readability-identifier-naming"); | 
| Alexander Kornienko | f1a6552 | 2017-08-08 14:53:52 +0000 | [diff] [blame] | 63 | CheckFactories.registerCheck<ImplicitBoolConversionCheck>( | 
|  | 64 | "readability-implicit-bool-conversion"); | 
| Alexander Kornienko | 11d4d64 | 2015-09-10 10:07:11 +0000 | [diff] [blame] | 65 | CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>( | 
|  | 66 | "readability-inconsistent-declaration-parameter-name"); | 
| Gabor Horvath | e647bd5 | 2017-02-14 10:03:27 +0000 | [diff] [blame] | 67 | CheckFactories.registerCheck<MisleadingIndentationCheck>( | 
|  | 68 | "readability-misleading-indentation"); | 
| Daniel Marjamaki | 03ea468 | 2016-09-12 12:04:13 +0000 | [diff] [blame] | 69 | CheckFactories.registerCheck<MisplacedArrayIndexCheck>( | 
|  | 70 | "readability-misplaced-array-index"); | 
| Malcolm Parsons | e7be4a0 | 2016-12-13 08:04:11 +0000 | [diff] [blame] | 71 | CheckFactories.registerCheck<RedundantFunctionPtrDereferenceCheck>( | 
|  | 72 | "readability-redundant-function-ptr-dereference"); | 
| Malcolm Parsons | 5c24a11 | 2016-10-20 16:08:03 +0000 | [diff] [blame] | 73 | CheckFactories.registerCheck<RedundantMemberInitCheck>( | 
|  | 74 | "readability-redundant-member-init"); | 
| Gabor Horvath | 40b6512 | 2017-08-08 15:33:48 +0000 | [diff] [blame] | 75 | CheckFactories.registerCheck<StaticAccessedThroughInstanceCheck>( | 
|  | 76 | "readability-static-accessed-through-instance"); | 
| Haojian Wu | c253f8b | 2016-04-05 11:42:08 +0000 | [diff] [blame] | 77 | CheckFactories.registerCheck<StaticDefinitionInAnonymousNamespaceCheck>( | 
|  | 78 | "readability-static-definition-in-anonymous-namespace"); | 
| Alexander Kornienko | 5c9c042 | 2018-01-30 14:55:50 +0000 | [diff] [blame] | 79 | CheckFactories.registerCheck<StringCompareCheck>( | 
|  | 80 | "readability-string-compare"); | 
| Alexander Kornienko | c5bc68e | 2015-03-16 22:31:16 +0000 | [diff] [blame] | 81 | CheckFactories.registerCheck<readability::NamedParameterCheck>( | 
|  | 82 | "readability-named-parameter"); | 
| Daniel Marjamaki | 9e4ecfa | 2016-08-23 10:09:08 +0000 | [diff] [blame] | 83 | CheckFactories.registerCheck<NonConstParameterCheck>( | 
|  | 84 | "readability-non-const-parameter"); | 
| Eugene Zelenko | dde3cd0 | 2016-02-01 19:47:24 +0000 | [diff] [blame] | 85 | CheckFactories.registerCheck<RedundantControlFlowCheck>( | 
|  | 86 | "readability-redundant-control-flow"); | 
| Daniel Marjamaki | 399a50c | 2016-11-01 13:26:15 +0000 | [diff] [blame] | 87 | CheckFactories.registerCheck<RedundantDeclarationCheck>( | 
|  | 88 | "readability-redundant-declaration"); | 
| Alexander Kornienko | 1b677db | 2015-03-09 12:18:39 +0000 | [diff] [blame] | 89 | CheckFactories.registerCheck<RedundantSmartptrGetCheck>( | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 90 | "readability-redundant-smartptr-get"); | 
| Alexander Kornienko | 57a5c6b | 2015-03-16 00:32:25 +0000 | [diff] [blame] | 91 | CheckFactories.registerCheck<RedundantStringCStrCheck>( | 
|  | 92 | "readability-redundant-string-cstr"); | 
| Alexander Kornienko | 1612fa0 | 2016-02-25 23:57:23 +0000 | [diff] [blame] | 93 | CheckFactories.registerCheck<RedundantStringInitCheck>( | 
|  | 94 | "readability-redundant-string-init"); | 
| Alexander Kornienko | f5e72b0 | 2015-04-10 19:26:43 +0000 | [diff] [blame] | 95 | CheckFactories.registerCheck<SimplifyBooleanExprCheck>( | 
|  | 96 | "readability-simplify-boolean-expr"); | 
| Eugene Zelenko | dde3cd0 | 2016-02-01 19:47:24 +0000 | [diff] [blame] | 97 | CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>( | 
|  | 98 | "readability-uniqueptr-delete-release"); | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 99 | } | 
|  | 100 | }; | 
|  | 101 |  | 
| Alexander Kornienko | 57a5c6b | 2015-03-16 00:32:25 +0000 | [diff] [blame] | 102 | // Register the ReadabilityModule using this statically initialized variable. | 
|  | 103 | static ClangTidyModuleRegistry::Add<ReadabilityModule> | 
|  | 104 | X("readability-module", "Adds readability-related checks."); | 
|  | 105 |  | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 106 | } // namespace readability | 
|  | 107 |  | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 108 | // This anchor is used to force the linker to link in the generated object file | 
| Alexander Kornienko | 57a5c6b | 2015-03-16 00:32:25 +0000 | [diff] [blame] | 109 | // and thus register the ReadabilityModule. | 
| Alexander Kornienko | 2192a8e | 2014-10-26 01:41:14 +0000 | [diff] [blame] | 110 | volatile int ReadabilityModuleAnchorSource = 0; | 
|  | 111 |  | 
|  | 112 | } // namespace tidy | 
|  | 113 | } // namespace clang |