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"
|
|
|
|
#include "RedundantSmartptrGetCheck.h"
|
2015-03-16 08:32:25 +08:00
|
|
|
#include "RedundantStringCStrCheck.h"
|
2015-01-23 23:10:37 +08:00
|
|
|
#include "ShrinkToFitCheck.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-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");
|
|
|
|
CheckFactories.registerCheck<ShrinkToFitCheck>("readability-shrink-to-fit");
|
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
|