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"
|
|
|
|
#include "BracesAroundStatementsCheck.h"
|
2015-03-09 20:18:39 +08:00
|
|
|
#include "ContainerSizeEmptyCheck.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"
|
2015-10-25 23:31:25 +08:00
|
|
|
#include "ImplicitBoolCastCheck.h"
|
2015-09-10 18:07:11 +08:00
|
|
|
#include "InconsistentDeclarationParameterNameCheck.h"
|
2015-03-17 06:31:16 +08:00
|
|
|
#include "NamedParameterCheck.h"
|
2015-03-09 20:18:39 +08:00
|
|
|
#include "RedundantSmartptrGetCheck.h"
|
2015-03-16 08:32:25 +08:00
|
|
|
#include "RedundantStringCStrCheck.h"
|
2015-04-11 03:26:43 +08:00
|
|
|
#include "SimplifyBooleanExprCheck.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 {
|
|
|
|
CheckFactories.registerCheck<BracesAroundStatementsCheck>(
|
|
|
|
"readability-braces-around-statements");
|
2015-01-15 23:46:58 +08:00
|
|
|
CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
|
|
|
|
"readability-container-size-empty");
|
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");
|
2015-10-25 23:31:25 +08:00
|
|
|
CheckFactories.registerCheck<ImplicitBoolCastCheck>(
|
|
|
|
"readability-implicit-bool-cast");
|
2015-09-10 18:07:11 +08:00
|
|
|
CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>(
|
|
|
|
"readability-inconsistent-declaration-parameter-name");
|
2015-10-20 05:49:51 +08:00
|
|
|
CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
|
|
|
|
"readability-uniqueptr-delete-release");
|
2015-03-17 06:31:16 +08:00
|
|
|
CheckFactories.registerCheck<readability::NamedParameterCheck>(
|
|
|
|
"readability-named-parameter");
|
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");
|
2015-04-11 03:26:43 +08:00
|
|
|
CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
|
|
|
|
"readability-simplify-boolean-expr");
|
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
|