2014-10-26 09:41:14 +08:00
|
|
|
//===--- ReadabilityTidyModule.cpp - clang-tidy ---------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "../ClangTidy.h"
|
|
|
|
#include "../ClangTidyModule.h"
|
|
|
|
#include "../ClangTidyModuleRegistry.h"
|
2016-03-30 19:31:33 +08:00
|
|
|
#include "AvoidConstParamsInDecls.h"
|
2014-10-26 09:41:14 +08:00
|
|
|
#include "BracesAroundStatementsCheck.h"
|
2015-03-09 20:18:39 +08:00
|
|
|
#include "ContainerSizeEmptyCheck.h"
|
2016-12-31 20:45:59 +08:00
|
|
|
#include "DeleteNullPointerCheck.h"
|
2016-04-13 19:33:40 +08:00
|
|
|
#include "DeletedDefaultCheck.h"
|
2015-01-15 03:37:54 +08:00
|
|
|
#include "ElseAfterReturnCheck.h"
|
2015-03-09 20:18:39 +08:00
|
|
|
#include "FunctionSizeCheck.h"
|
2015-08-19 19:15:36 +08:00
|
|
|
#include "IdentifierNamingCheck.h"
|
2017-08-08 22:53:52 +08:00
|
|
|
#include "ImplicitBoolConversionCheck.h"
|
2015-09-10 18:07:11 +08:00
|
|
|
#include "InconsistentDeclarationParameterNameCheck.h"
|
2017-02-14 18:03:27 +08:00
|
|
|
#include "MisleadingIndentationCheck.h"
|
2016-09-12 20:04:13 +08:00
|
|
|
#include "MisplacedArrayIndexCheck.h"
|
2015-03-17 06:31:16 +08:00
|
|
|
#include "NamedParameterCheck.h"
|
2016-08-23 18:09:08 +08:00
|
|
|
#include "NonConstParameterCheck.h"
|
2016-02-01 23:31:15 +08:00
|
|
|
#include "RedundantControlFlowCheck.h"
|
2016-11-01 21:26:15 +08:00
|
|
|
#include "RedundantDeclarationCheck.h"
|
2016-12-13 16:04:11 +08:00
|
|
|
#include "RedundantFunctionPtrDereferenceCheck.h"
|
2016-10-21 00:08:03 +08:00
|
|
|
#include "RedundantMemberInitCheck.h"
|
2015-03-09 20:18:39 +08:00
|
|
|
#include "RedundantSmartptrGetCheck.h"
|
2015-03-16 08:32:25 +08:00
|
|
|
#include "RedundantStringCStrCheck.h"
|
2016-02-26 07:57:23 +08:00
|
|
|
#include "RedundantStringInitCheck.h"
|
2015-04-11 03:26:43 +08:00
|
|
|
#include "SimplifyBooleanExprCheck.h"
|
2018-05-17 04:12:06 +08:00
|
|
|
#include "SimplifySubscriptExprCheck.h"
|
2017-08-08 23:33:48 +08:00
|
|
|
#include "StaticAccessedThroughInstanceCheck.h"
|
2016-04-05 19:42:08 +08:00
|
|
|
#include "StaticDefinitionInAnonymousNamespaceCheck.h"
|
2018-01-30 22:55:50 +08:00
|
|
|
#include "StringCompareCheck.h"
|
2015-10-20 05:49:51 +08:00
|
|
|
#include "UniqueptrDeleteReleaseCheck.h"
|
2014-10-26 09:41:14 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
namespace readability {
|
|
|
|
|
|
|
|
class ReadabilityModule : public ClangTidyModule {
|
|
|
|
public:
|
|
|
|
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
|
2016-03-30 19:31:33 +08:00
|
|
|
CheckFactories.registerCheck<AvoidConstParamsInDecls>(
|
|
|
|
"readability-avoid-const-params-in-decls");
|
2014-10-26 09:41:14 +08:00
|
|
|
CheckFactories.registerCheck<BracesAroundStatementsCheck>(
|
|
|
|
"readability-braces-around-statements");
|
2015-01-15 23:46:58 +08:00
|
|
|
CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
|
|
|
|
"readability-container-size-empty");
|
2016-12-31 20:45:59 +08:00
|
|
|
CheckFactories.registerCheck<DeleteNullPointerCheck>(
|
|
|
|
"readability-delete-null-pointer");
|
2016-04-13 19:33:40 +08:00
|
|
|
CheckFactories.registerCheck<DeletedDefaultCheck>(
|
|
|
|
"readability-deleted-default");
|
2015-01-15 03:37:54 +08:00
|
|
|
CheckFactories.registerCheck<ElseAfterReturnCheck>(
|
|
|
|
"readability-else-after-return");
|
2014-10-26 09:41:14 +08:00
|
|
|
CheckFactories.registerCheck<FunctionSizeCheck>(
|
|
|
|
"readability-function-size");
|
2015-08-19 19:15:36 +08:00
|
|
|
CheckFactories.registerCheck<IdentifierNamingCheck>(
|
|
|
|
"readability-identifier-naming");
|
2017-08-08 22:53:52 +08:00
|
|
|
CheckFactories.registerCheck<ImplicitBoolConversionCheck>(
|
|
|
|
"readability-implicit-bool-conversion");
|
2015-09-10 18:07:11 +08:00
|
|
|
CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>(
|
|
|
|
"readability-inconsistent-declaration-parameter-name");
|
2017-02-14 18:03:27 +08:00
|
|
|
CheckFactories.registerCheck<MisleadingIndentationCheck>(
|
|
|
|
"readability-misleading-indentation");
|
2016-09-12 20:04:13 +08:00
|
|
|
CheckFactories.registerCheck<MisplacedArrayIndexCheck>(
|
|
|
|
"readability-misplaced-array-index");
|
2016-12-13 16:04:11 +08:00
|
|
|
CheckFactories.registerCheck<RedundantFunctionPtrDereferenceCheck>(
|
|
|
|
"readability-redundant-function-ptr-dereference");
|
2016-10-21 00:08:03 +08:00
|
|
|
CheckFactories.registerCheck<RedundantMemberInitCheck>(
|
|
|
|
"readability-redundant-member-init");
|
2018-05-17 04:12:06 +08:00
|
|
|
CheckFactories.registerCheck<SimplifySubscriptExprCheck>(
|
|
|
|
"readability-simplify-subscript-expr");
|
2017-08-08 23:33:48 +08:00
|
|
|
CheckFactories.registerCheck<StaticAccessedThroughInstanceCheck>(
|
|
|
|
"readability-static-accessed-through-instance");
|
2016-04-05 19:42:08 +08:00
|
|
|
CheckFactories.registerCheck<StaticDefinitionInAnonymousNamespaceCheck>(
|
|
|
|
"readability-static-definition-in-anonymous-namespace");
|
2018-01-30 22:55:50 +08:00
|
|
|
CheckFactories.registerCheck<StringCompareCheck>(
|
|
|
|
"readability-string-compare");
|
2015-03-17 06:31:16 +08:00
|
|
|
CheckFactories.registerCheck<readability::NamedParameterCheck>(
|
|
|
|
"readability-named-parameter");
|
2016-08-23 18:09:08 +08:00
|
|
|
CheckFactories.registerCheck<NonConstParameterCheck>(
|
|
|
|
"readability-non-const-parameter");
|
2016-02-02 03:47:24 +08:00
|
|
|
CheckFactories.registerCheck<RedundantControlFlowCheck>(
|
|
|
|
"readability-redundant-control-flow");
|
2016-11-01 21:26:15 +08:00
|
|
|
CheckFactories.registerCheck<RedundantDeclarationCheck>(
|
|
|
|
"readability-redundant-declaration");
|
2015-03-09 20:18:39 +08:00
|
|
|
CheckFactories.registerCheck<RedundantSmartptrGetCheck>(
|
2014-10-26 09:41:14 +08:00
|
|
|
"readability-redundant-smartptr-get");
|
2015-03-16 08:32:25 +08:00
|
|
|
CheckFactories.registerCheck<RedundantStringCStrCheck>(
|
|
|
|
"readability-redundant-string-cstr");
|
2016-02-26 07:57:23 +08:00
|
|
|
CheckFactories.registerCheck<RedundantStringInitCheck>(
|
|
|
|
"readability-redundant-string-init");
|
2015-04-11 03:26:43 +08:00
|
|
|
CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
|
|
|
|
"readability-simplify-boolean-expr");
|
2016-02-02 03:47:24 +08:00
|
|
|
CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
|
|
|
|
"readability-uniqueptr-delete-release");
|
2014-10-26 09:41:14 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-03-16 08:32:25 +08:00
|
|
|
// Register the ReadabilityModule using this statically initialized variable.
|
|
|
|
static ClangTidyModuleRegistry::Add<ReadabilityModule>
|
|
|
|
X("readability-module", "Adds readability-related checks.");
|
2014-10-26 09:41:14 +08:00
|
|
|
|
2015-03-16 08:32:25 +08:00
|
|
|
} // namespace readability
|
2014-10-26 09:41:14 +08:00
|
|
|
|
|
|
|
// This anchor is used to force the linker to link in the generated object file
|
2015-03-16 08:32:25 +08:00
|
|
|
// and thus register the ReadabilityModule.
|
2014-10-26 09:41:14 +08:00
|
|
|
volatile int ReadabilityModuleAnchorSource = 0;
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|