blob: 3a3ae82e6a97bd318176cd919020c3a81412d8ff [file] [log] [blame]
Daniel Jasperd07c8402013-07-29 08:19:24 +00001//===--- tools/extra/clang-tidy/ClangTidyModule.cpp - Clang tidy tool -----===//
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/// \file Implements classes required to build clang-tidy modules.
11///
12//===----------------------------------------------------------------------===//
13
14#include "ClangTidyModule.h"
Daniel Jasperd07c8402013-07-29 08:19:24 +000015
16namespace clang {
17namespace tidy {
18
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000019void ClangTidyCheckFactories::registerCheckFactory(StringRef Name,
20 CheckFactory Factory) {
Benjamin Kramer51a9cc92016-06-15 15:46:10 +000021 Factories[Name] = std::move(Factory);
Daniel Jasperd07c8402013-07-29 08:19:24 +000022}
23
24void ClangTidyCheckFactories::createChecks(
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000025 ClangTidyContext *Context,
26 std::vector<std::unique_ptr<ClangTidyCheck>> &Checks) {
27 GlobList &Filter = Context->getChecksFilter();
Alexander Kornienkodf1e3cb2014-03-06 10:17:46 +000028 for (const auto &Factory : Factories) {
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000029 if (Filter.contains(Factory.first))
30 Checks.emplace_back(Factory.second(Factory.first, Context));
Daniel Jasperd07c8402013-07-29 08:19:24 +000031 }
32}
33
Alexander Kornienko1efc4252014-10-16 11:27:57 +000034ClangTidyOptions ClangTidyModule::getModuleOptions() {
35 return ClangTidyOptions();
36}
37
Daniel Jasperd07c8402013-07-29 08:19:24 +000038} // namespace tidy
39} // namespace clang