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 ClangTidyCheckFactories::~ClangTidyCheckFactories() { 20 for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E; 21 ++I) { 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( 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)) 36 Checks.push_back(I->second->createCheck()); 37 } 38 } 39 40 } // namespace tidy 41 } // namespace clang 42