Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 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" |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 15 | |
| 16 | namespace clang { |
| 17 | namespace tidy { |
| 18 | |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame] | 19 | void ClangTidyCheckFactories::registerCheckFactory(StringRef Name, |
| 20 | CheckFactory Factory) { |
Alexander Kornienko | d3fdcf8 | 2014-09-10 11:25:43 +0000 | [diff] [blame] | 21 | Factories[Name] = Factory; |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | void ClangTidyCheckFactories::createChecks( |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame] | 25 | ClangTidyContext *Context, |
| 26 | std::vector<std::unique_ptr<ClangTidyCheck>> &Checks) { |
| 27 | GlobList &Filter = Context->getChecksFilter(); |
Alexander Kornienko | df1e3cb | 2014-03-06 10:17:46 +0000 | [diff] [blame] | 28 | for (const auto &Factory : Factories) { |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame] | 29 | if (Filter.contains(Factory.first)) |
| 30 | Checks.emplace_back(Factory.second(Factory.first, Context)); |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 31 | } |
| 32 | } |
| 33 | |
Alexander Kornienko | 1efc425 | 2014-10-16 11:27:57 +0000 | [diff] [blame] | 34 | ClangTidyOptions ClangTidyModule::getModuleOptions() { |
| 35 | return ClangTidyOptions(); |
| 36 | } |
| 37 | |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 38 | } // namespace tidy |
| 39 | } // namespace clang |