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 | |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 19 | ClangTidyCheckFactories::~ClangTidyCheckFactories() { |
Alexander Kornienko | fb9e92b | 2013-12-19 19:57:05 +0000 | [diff] [blame^] | 20 | for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E; |
| 21 | ++I) { |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 22 | delete I->second; |
| 23 | } |
| 24 | } |
| 25 | void ClangTidyCheckFactories::addCheckFactory(StringRef Name, |
| 26 | CheckFactoryBase *Factory) { |
| 27 | |
| 28 | Factories[Name] = Factory; |
| 29 | } |
| 30 | |
| 31 | void ClangTidyCheckFactories::createChecks( |
Alexander Kornienko | fb9e92b | 2013-12-19 19:57:05 +0000 | [diff] [blame^] | 32 | ChecksFilter &Filter, SmallVectorImpl<ClangTidyCheck *> &Checks) { |
| 33 | for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E; |
| 34 | ++I) { |
| 35 | if (Filter.IsCheckEnabled(I->first)) |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 36 | Checks.push_back(I->second->createCheck()); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | } // namespace tidy |
| 41 | } // namespace clang |