xref: /llvm-project/clang-tools-extra/clang-tidy/ClangTidyModule.cpp (revision 1efc425551c0c7ac95cacad8f63dc31eb46c1f04)
1 //===--- 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"
15 
16 namespace clang {
17 namespace tidy {
18 
19 void ClangTidyCheckFactories::registerCheckFactory(StringRef Name,
20                                                    CheckFactory Factory) {
21   Factories[Name] = Factory;
22 }
23 
24 void ClangTidyCheckFactories::createChecks(
25     ClangTidyContext *Context,
26     std::vector<std::unique_ptr<ClangTidyCheck>> &Checks) {
27   GlobList &Filter = Context->getChecksFilter();
28   for (const auto &Factory : Factories) {
29     if (Filter.contains(Factory.first))
30       Checks.emplace_back(Factory.second(Factory.first, Context));
31   }
32 }
33 
34 ClangTidyOptions ClangTidyModule::getModuleOptions() {
35   return ClangTidyOptions();
36 }
37 
38 } // namespace tidy
39 } // namespace clang
40