blob: 962245b2a08118ef2f7821c2f89857a38beb6768 [file] [log] [blame]
Alexander Kornienkofc650862015-08-14 13:17:11 +00001//===--- ModernizeTidyModule.cpp - clang-tidy -----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "../ClangTidy.h"
11#include "../ClangTidyModule.h"
12#include "../ClangTidyModuleRegistry.h"
Alexander Kornienko04970842015-08-19 09:11:46 +000013#include "LoopConvertCheck.h"
Alexander Kornienkofc650862015-08-14 13:17:11 +000014#include "PassByValueCheck.h"
15
16using namespace clang::ast_matchers;
17
18namespace clang {
19namespace tidy {
20namespace modernize {
21
22class ModernizeModule : public ClangTidyModule {
23public:
24 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Alexander Kornienko04970842015-08-19 09:11:46 +000025 CheckFactories.registerCheck<LoopConvertCheck>("modernize-loop-convert");
Alexander Kornienkofc650862015-08-14 13:17:11 +000026 CheckFactories.registerCheck<PassByValueCheck>("modernize-pass-by-value");
27 }
28
29 ClangTidyOptions getModuleOptions() override {
30 ClangTidyOptions Options;
31 auto &Opts = Options.CheckOptions;
Alexander Kornienko04970842015-08-19 09:11:46 +000032 Opts["modernize-loop-convert.MinConfidence"] = "reasonable";
Alexander Kornienkofc650862015-08-14 13:17:11 +000033 Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google".
34 return Options;
35 }
36};
37
38// Register the ModernizeTidyModule using this statically initialized variable.
39static ClangTidyModuleRegistry::Add<ModernizeModule> X("modernize-module",
40 "Add modernize checks.");
41
42} // namespace modernize
43
44// This anchor is used to force the linker to link in the generated object file
45// and thus register the ModernizeModule.
46volatile int ModernizeModuleAnchorSource = 0;
47
48} // namespace tidy
49} // namespace clang