clang  6.0.0svn
Classes | Public Types | Public Member Functions | List of all members
clang::ento::CheckerRegistry Class Reference

Manages a set of available checkers for running a static analysis. More...

#include "clang/StaticAnalyzer/Core/CheckerRegistry.h"

Classes

struct  CheckerInfo
 

Public Types

typedef void(* InitializationFunction) (CheckerManager &)
 Initialization functions perform any necessary setup for a checker. More...
 
typedef std::vector< CheckerInfoCheckerInfoList
 

Public Member Functions

void addChecker (InitializationFunction fn, StringRef fullName, StringRef desc)
 Adds a checker to the registry. More...
 
template<class T >
void addChecker (StringRef fullName, StringRef desc)
 Adds a checker to the registry. More...
 
void initializeManager (CheckerManager &mgr, SmallVectorImpl< CheckerOptInfo > &opts) const
 Initializes a CheckerManager by calling the initialization functions for all checkers specified by the given CheckerOptInfo list. More...
 
void validateCheckerOptions (const AnalyzerOptions &opts, DiagnosticsEngine &diags) const
 Check if every option corresponds to a specific checker or package. More...
 
void printHelp (raw_ostream &out, size_t maxNameChars=30) const
 Prints the name and description of all checkers in this registry. More...
 
void printList (raw_ostream &out, SmallVectorImpl< CheckerOptInfo > &opts) const
 

Detailed Description

Manages a set of available checkers for running a static analysis.

The checkers are organized into packages by full name, where including a package will recursively include all subpackages and checkers within it. For example, the checker "core.builtin.NoReturnFunctionChecker" will be included if initializeManager() is called with an option of "core", "core.builtin", or the full name "core.builtin.NoReturnFunctionChecker".

Definition at line 80 of file CheckerRegistry.h.

Member Typedef Documentation

◆ CheckerInfoList

Definition at line 94 of file CheckerRegistry.h.

◆ InitializationFunction

typedef void(* clang::ento::CheckerRegistry::InitializationFunction) (CheckerManager &)

Initialization functions perform any necessary setup for a checker.

They should include a call to CheckerManager::registerChecker.

Definition at line 84 of file CheckerRegistry.h.

Member Function Documentation

◆ addChecker() [1/2]

void CheckerRegistry::addChecker ( InitializationFunction  fn,
StringRef  fullName,
StringRef  desc 
)

Adds a checker to the registry.

Use this non-templated overload when your checker requires custom initialization.

Definition at line 84 of file CheckerRegistry.cpp.

References PackageSeparator.

Referenced by addChecker().

◆ addChecker() [2/2]

template<class T >
void clang::ento::CheckerRegistry::addChecker ( StringRef  fullName,
StringRef  desc 
)
inline

Adds a checker to the registry.

Use this templated overload when your checker does not require any custom initialization.

Definition at line 111 of file CheckerRegistry.h.

References addChecker(), printHelp(), printList(), and validateCheckerOptions().

◆ initializeManager()

void CheckerRegistry::initializeManager ( CheckerManager mgr,
SmallVectorImpl< CheckerOptInfo > &  opts 
) const

Initializes a CheckerManager by calling the initialization functions for all checkers specified by the given CheckerOptInfo list.

The order of this list is significant; later options can be used to reverse earlier ones. This can be used to exclude certain checkers in an included package.

Definition at line 97 of file CheckerRegistry.cpp.

References checkerNameLT(), collectCheckers(), and clang::ento::CheckerManager::setCurrentCheckName().

◆ printHelp()

void CheckerRegistry::printHelp ( raw_ostream &  out,
size_t  maxNameChars = 30 
) const

Prints the name and description of all checkers in this registry.

This output is not intended to be machine-parseable.

Definition at line 139 of file CheckerRegistry.cpp.

References checkerNameLT(), and max().

Referenced by addChecker().

◆ printList()

void CheckerRegistry::printList ( raw_ostream &  out,
SmallVectorImpl< CheckerOptInfo > &  opts 
) const

Definition at line 179 of file CheckerRegistry.cpp.

References checkerNameLT(), and collectCheckers().

Referenced by addChecker().

◆ validateCheckerOptions()

void CheckerRegistry::validateCheckerOptions ( const AnalyzerOptions opts,
DiagnosticsEngine diags 
) const

Check if every option corresponds to a specific checker or package.

Definition at line 117 of file CheckerRegistry.cpp.

References clang::AnalyzerOptions::Config, and clang::DiagnosticsEngine::Report().

Referenced by addChecker().


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