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-12 16:53:36 +08:00
|
|
|
void ClangTidyCheckFactories::registerCheckFactory(StringRef Name,
|
|
|
|
CheckFactory Factory) {
|
2014-09-10 19:25:43 +08:00
|
|
|
Factories[Name] = Factory;
|
2013-07-29 16:19:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ClangTidyCheckFactories::createChecks(
|
2014-09-12 16:53:36 +08:00
|
|
|
ClangTidyContext *Context,
|
|
|
|
std::vector<std::unique_ptr<ClangTidyCheck>> &Checks) {
|
|
|
|
GlobList &Filter = Context->getChecksFilter();
|
2014-03-06 18:17:46 +08:00
|
|
|
for (const auto &Factory : Factories) {
|
2014-09-12 16:53:36 +08:00
|
|
|
if (Filter.contains(Factory.first))
|
|
|
|
Checks.emplace_back(Factory.second(Factory.first, Context));
|
2013-07-29 16:19:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-16 19:27:57 +08:00
|
|
|
ClangTidyOptions ClangTidyModule::getModuleOptions() {
|
|
|
|
return ClangTidyOptions();
|
|
|
|
}
|
|
|
|
|
2013-07-29 16:19:24 +08:00
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|