2013-07-29 16:19:24 +08:00
|
|
|
//===--- tools/extra/clang-tidy/ClangTidyModule.cpp - Clang tidy tool -----===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file Implements classes required to build clang-tidy modules.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ClangTidyModule.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
|
2014-09-10 19:25:43 +08:00
|
|
|
void ClangTidyCheckFactories::registerCheckFactory(
|
|
|
|
StringRef Name, std::function<ClangTidyCheck *()> Factory) {
|
|
|
|
Factories[Name] = Factory;
|
2013-07-29 16:19:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ClangTidyCheckFactories::createChecks(
|
2014-08-06 19:49:10 +08:00
|
|
|
GlobList &Filter, std::vector<std::unique_ptr<ClangTidyCheck>> &Checks) {
|
2014-03-06 18:17:46 +08:00
|
|
|
for (const auto &Factory : Factories) {
|
2014-08-06 19:49:10 +08:00
|
|
|
if (Filter.contains(Factory.first)) {
|
2014-09-10 19:25:43 +08:00
|
|
|
ClangTidyCheck *Check = Factory.second();
|
2014-03-06 18:17:46 +08:00
|
|
|
Check->setName(Factory.first);
|
2014-06-05 21:31:45 +08:00
|
|
|
Checks.emplace_back(Check);
|
2014-01-13 18:50:51 +08:00
|
|
|
}
|
2013-07-29 16:19:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|