2013-07-29 16:19:24 +08:00
|
|
|
//===--- tools/extra/clang-tidy/ClangTidyModule.cpp - Clang tidy tool -----===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-07-29 16:19:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \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) {
|
2020-01-29 03:23:46 +08:00
|
|
|
Factories[std::string(Name)] = std::move(Factory);
|
2013-07-29 16:19:24 +08:00
|
|
|
}
|
|
|
|
|
2019-09-26 21:55:01 +08:00
|
|
|
std::vector<std::unique_ptr<ClangTidyCheck>>
|
|
|
|
ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) {
|
|
|
|
std::vector<std::unique_ptr<ClangTidyCheck>> Checks;
|
2014-03-06 18:17:46 +08:00
|
|
|
for (const auto &Factory : Factories) {
|
2017-05-17 22:39:47 +08:00
|
|
|
if (Context->isCheckEnabled(Factory.first))
|
2014-09-12 16:53:36 +08:00
|
|
|
Checks.emplace_back(Factory.second(Factory.first, Context));
|
2013-07-29 16:19:24 +08:00
|
|
|
}
|
2019-09-26 21:55:01 +08:00
|
|
|
return Checks;
|
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
|