2013-07-29 16:19:24 +08:00
|
|
|
//===--- GoogleTidyModule.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"
|
2014-06-30 06:19:53 +08:00
|
|
|
#include "AvoidCStyleCastsCheck.h"
|
2014-06-18 17:33:46 +08:00
|
|
|
#include "ExplicitConstructorCheck.h"
|
2014-07-15 17:50:32 +08:00
|
|
|
#include "ExplicitMakePairCheck.h"
|
2014-07-16 22:30:19 +08:00
|
|
|
#include "MemsetZeroLengthCheck.h"
|
2014-07-16 00:47:09 +08:00
|
|
|
#include "NamedParameterCheck.h"
|
2014-07-15 20:48:14 +08:00
|
|
|
#include "OverloadedUnaryAndCheck.h"
|
2014-07-16 18:00:14 +08:00
|
|
|
#include "StringReferenceMemberCheck.h"
|
2014-07-16 22:16:56 +08:00
|
|
|
#include "UnnamedNamespaceInHeaderCheck.h"
|
|
|
|
#include "UsingNamespaceDirectiveCheck.h"
|
2013-07-29 16:19:24 +08:00
|
|
|
|
|
|
|
using namespace clang::ast_matchers;
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
|
|
|
|
class GoogleModule : public ClangTidyModule {
|
|
|
|
public:
|
2014-03-05 21:01:24 +08:00
|
|
|
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
|
2014-07-15 17:50:32 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-build-explicit-make-pair",
|
|
|
|
new ClangTidyCheckFactory<build::ExplicitMakePairCheck>());
|
2014-07-16 22:16:56 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-build-namespaces",
|
|
|
|
new ClangTidyCheckFactory<build::UnnamedNamespaceInHeaderCheck>());
|
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-build-using-namespace",
|
|
|
|
new ClangTidyCheckFactory<build::UsingNamespaceDirectiveCheck>());
|
2013-07-29 16:19:24 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-explicit-constructor",
|
|
|
|
new ClangTidyCheckFactory<ExplicitConstructorCheck>());
|
2014-07-15 20:48:14 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-runtime-operator",
|
|
|
|
new ClangTidyCheckFactory<runtime::OverloadedUnaryAndCheck>());
|
2014-07-16 18:00:14 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-runtime-member-string-references",
|
|
|
|
new ClangTidyCheckFactory<runtime::StringReferenceMemberCheck>());
|
2014-07-16 22:30:19 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-runtime-memset",
|
|
|
|
new ClangTidyCheckFactory<runtime::MemsetZeroLengthCheck>());
|
2014-06-30 06:19:53 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-readability-casting",
|
|
|
|
new ClangTidyCheckFactory<readability::AvoidCStyleCastsCheck>());
|
2014-07-16 00:47:09 +08:00
|
|
|
CheckFactories.addCheckFactory(
|
|
|
|
"google-readability-function",
|
|
|
|
new ClangTidyCheckFactory<readability::NamedParameterCheck>());
|
2013-07-29 16:19:24 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Register the GoogleTidyModule using this statically initialized variable.
|
|
|
|
static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module",
|
|
|
|
"Adds Google lint checks.");
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link in the generated object file
|
|
|
|
// and thus register the GoogleModule.
|
|
|
|
volatile int GoogleModuleAnchorSource = 0;
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|