blob: 9dbf01619ced40b8f5ecc8c48a17b141d2f838ad [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) {
Alexander Kornienkodf1e3cb2014-03-06 10:17:46 +000027 for (const auto &Factory : Factories) {
Alexander Kornienko21375182017-05-17 14:39:47 +000028 if (Context->isCheckEnabled(Factory.first))
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000029 Checks.emplace_back(Factory.second(Factory.first, Context));
Daniel Jasperd07c8402013-07-29 08:19:24 +000030 }
31}
32
Alexander Kornienko1efc4252014-10-16 11:27:57 +000033ClangTidyOptions ClangTidyModule::getModuleOptions() {
34 return ClangTidyOptions();
35}
36
Daniel Jasperd07c8402013-07-29 08:19:24 +000037} // namespace tidy
38} // namespace clang