Alexander Kornienko bd725b4537 [clang-tidy] Add use-nullptr check to clang-tidy.
Move UseNullptr from clang-modernize to modernize module in clang-tidy.

http://reviews.llvm.org/D12081

Patch by Angel Garcia!

llvm-svn: 245434
2015-08-19 13:13:12 +00:00

55 lines
1.8 KiB
C++

//===--- ModernizeTidyModule.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 "LoopConvertCheck.h"
#include "PassByValueCheck.h"
#include "UseNullptrCheck.h"
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace modernize {
class ModernizeModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
CheckFactories.registerCheck<LoopConvertCheck>("modernize-loop-convert");
CheckFactories.registerCheck<PassByValueCheck>("modernize-pass-by-value");
CheckFactories.registerCheck<UseNullptrCheck>("modernize-use-nullptr");
}
ClangTidyOptions getModuleOptions() override {
ClangTidyOptions Options;
auto &Opts = Options.CheckOptions;
Opts["modernize-loop-convert.MinConfidence"] = "reasonable";
Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google".
// Comma-separated list of user-defined macros that behave like NULL.
Opts["modernize-use-nullptr.UserNullMacros"] = "";
return Options;
}
};
// Register the ModernizeTidyModule using this statically initialized variable.
static ClangTidyModuleRegistry::Add<ModernizeModule> X("modernize-module",
"Add modernize checks.");
} // namespace modernize
// This anchor is used to force the linker to link in the generated object file
// and thus register the ModernizeModule.
volatile int ModernizeModuleAnchorSource = 0;
} // namespace tidy
} // namespace clang