blob: 5f25832e8a66297aa7ffa708fa0886ba170f8247 [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"
13#include "PassByValueCheck.h"
14
15using namespace clang::ast_matchers;
16
17namespace clang {
18namespace tidy {
19namespace modernize {
20
21class ModernizeModule : public ClangTidyModule {
22public:
23 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
24 CheckFactories.registerCheck<PassByValueCheck>("modernize-pass-by-value");
25 }
26
27 ClangTidyOptions getModuleOptions() override {
28 ClangTidyOptions Options;
29 auto &Opts = Options.CheckOptions;
30 Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google".
31 return Options;
32 }
33};
34
35// Register the ModernizeTidyModule using this statically initialized variable.
36static ClangTidyModuleRegistry::Add<ModernizeModule> X("modernize-module",
37 "Add modernize checks.");
38
39} // namespace modernize
40
41// This anchor is used to force the linker to link in the generated object file
42// and thus register the ModernizeModule.
43volatile int ModernizeModuleAnchorSource = 0;
44
45} // namespace tidy
46} // namespace clang