9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYMODULE_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYMODULE_H
13#include "llvm/ADT/StringMap.h"
14#include "llvm/ADT/StringRef.h"
29 using CheckFactory = std::function<std::unique_ptr<ClangTidyCheck>(
58 template <
typename CheckType>
void registerCheck(llvm::StringRef CheckName) {
61 return std::make_unique<CheckType>(Name, Context);
65 void eraseCheck(llvm::StringRef CheckName) { Factories.erase(CheckName); }
68 std::vector<std::unique_ptr<ClangTidyCheck>>
72 std::vector<std::unique_ptr<ClangTidyCheck>>
76 FactoryMap::const_iterator
begin()
const {
return Factories.begin(); }
77 FactoryMap::const_iterator
end()
const {
return Factories.end(); }
78 bool empty()
const {
return Factories.empty(); }
A collection of ClangTidyCheckFactory instances.
std::vector< std::unique_ptr< ClangTidyCheck > > createChecksForLanguage(ClangTidyContext *Context) const
Create instances of checks that are enabled for the current Language.
void registerCheckFactory(llvm::StringRef Name, CheckFactory Factory)
Registers check Factory with name Name.
FactoryMap::const_iterator begin() const
std::function< std::unique_ptr< ClangTidyCheck >( llvm::StringRef Name, ClangTidyContext *Context)> CheckFactory
llvm::StringMap< CheckFactory > FactoryMap
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
FactoryMap::const_iterator end() const
void eraseCheck(llvm::StringRef CheckName)
std::vector< std::unique_ptr< ClangTidyCheck > > createChecks(ClangTidyContext *Context) const
Create instances of checks that are enabled.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
virtual void addCheckFactories(ClangTidyCheckFactories &CheckFactories)=0
Implement this function in order to register all CheckFactories belonging to this module.
virtual ClangTidyOptions getModuleOptions()
Gets default options for checks defined in this module.
virtual ~ClangTidyModule()
Contains options for clang-tidy.