clang-tools  10.0.0svn
Public Types | Public Member Functions | List of all members
clang::tidy::ClangTidyCheckFactories Class Reference

A collection of ClangTidyCheckFactory instances. More...

#include <ClangTidyModule.h>

Public Types

using CheckFactory = std::function< std::unique_ptr< ClangTidyCheck >(StringRef Name, ClangTidyContext *Context)>
 
typedef std::map< std::string, CheckFactoryFactoryMap
 

Public Member Functions

void registerCheckFactory (StringRef Name, CheckFactory Factory)
 Registers check Factory with name Name. More...
 
template<typename CheckType >
void registerCheck (StringRef CheckName)
 Registers the CheckType with the name Name. More...
 
std::vector< std::unique_ptr< ClangTidyCheck > > createChecks (ClangTidyContext *Context)
 Create instances of checks that are enabled. More...
 
FactoryMap::const_iterator begin () const
 
FactoryMap::const_iterator end () const
 
bool empty () const
 

Detailed Description

A collection of ClangTidyCheckFactory instances.

All clang-tidy modules register their check factories with an instance of this object.

Definition at line 27 of file ClangTidyModule.h.

Member Typedef Documentation

◆ CheckFactory

using clang::tidy::ClangTidyCheckFactories::CheckFactory = std::function<std::unique_ptr<ClangTidyCheck>( StringRef Name, ClangTidyContext *Context)>

Definition at line 30 of file ClangTidyModule.h.

◆ FactoryMap

Definition at line 69 of file ClangTidyModule.h.

Member Function Documentation

◆ begin()

FactoryMap::const_iterator clang::tidy::ClangTidyCheckFactories::begin ( ) const
inline

Definition at line 70 of file ClangTidyModule.h.

◆ createChecks()

std::vector< std::unique_ptr< ClangTidyCheck > > clang::tidy::ClangTidyCheckFactories::createChecks ( ClangTidyContext Context)

Create instances of checks that are enabled.

Definition at line 24 of file ClangTidyModule.cpp.

◆ empty()

bool clang::tidy::ClangTidyCheckFactories::empty ( ) const
inline

Definition at line 72 of file ClangTidyModule.h.

◆ end()

FactoryMap::const_iterator clang::tidy::ClangTidyCheckFactories::end ( ) const
inline

Definition at line 71 of file ClangTidyModule.h.

◆ registerCheck()

template<typename CheckType >
void clang::tidy::ClangTidyCheckFactories::registerCheck ( StringRef  CheckName)
inline

Registers the CheckType with the name Name.

This method should be used for all ClangTidyChecks that don't require constructor parameters.

For example, if have a clang-tidy check like:

class MyTidyCheck : public ClangTidyCheck {
void registerMatchers(ast_matchers::MatchFinder *Finder) override {
..
}
};

you can register it with:

class MyModule : public ClangTidyModule {
void addCheckFactories(ClangTidyCheckFactories &Factories) override {
Factories.registerCheck<MyTidyCheck>("myproject-my-check");
}
};

Definition at line 58 of file ClangTidyModule.h.

References registerCheckFactory().

Referenced by clang::tidy::portability::PortabilityModule::addCheckFactories(), clang::tidy::boost::BoostModule::addCheckFactories(), clang::tidy::linuxkernel::LinuxKernelModule::addCheckFactories(), clang::tidy::darwin::DarwinModule::addCheckFactories(), clang::tidy::mpi::MPIModule::addCheckFactories(), clang::tidy::openmp::OpenMPModule::addCheckFactories(), clang::tidy::zircon::ZirconModule::addCheckFactories(), clang::tidy::llvm_check::LLVMModule::addCheckFactories(), clang::tidy::objc::ObjCModule::addCheckFactories(), clang::tidy::performance::PerformanceModule::addCheckFactories(), clang::tidy::fuchsia::FuchsiaModule::addCheckFactories(), clang::tidy::misc::MiscModule::addCheckFactories(), clang::tidy::abseil::AbseilModule::addCheckFactories(), clang::tidy::android::AndroidModule::addCheckFactories(), clang::tidy::cert::CERTModule::addCheckFactories(), clang::tidy::google::GoogleModule::addCheckFactories(), clang::tidy::cppcoreguidelines::CppCoreGuidelinesModule::addCheckFactories(), clang::tidy::hicpp::HICPPModule::addCheckFactories(), clang::tidy::modernize::ModernizeModule::addCheckFactories(), clang::tidy::readability::ReadabilityModule::addCheckFactories(), and clang::tidy::bugprone::BugproneModule::addCheckFactories().

◆ registerCheckFactory()

void clang::tidy::ClangTidyCheckFactories::registerCheckFactory ( StringRef  Name,
CheckFactory  Factory 
)

Registers check Factory with name Name.

For all checks that have default constructors, use registerCheck.

Definition at line 18 of file ClangTidyModule.cpp.

References Name.

Referenced by registerCheck().


The documentation for this class was generated from the following files: