clang
8.0.0
|
Manages a set of available checkers for running a static analysis. More...
#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
Classes | |
struct | CheckerInfo |
Public Types | |
using | InitializationFunction = void(*)(CheckerManager &) |
Initialization functions perform any necessary setup for a checker. More... | |
using | CheckerInfoList = std::vector< CheckerInfo > |
using | CheckerInfoSet = llvm::SetVector< const CheckerRegistry::CheckerInfo * > |
Public Member Functions | |
CheckerRegistry (ArrayRef< std::string > plugins, DiagnosticsEngine &diags) | |
void | addChecker (InitializationFunction Fn, StringRef FullName, StringRef Desc, StringRef DocsUri) |
Adds a checker to the registry. More... | |
template<class T > | |
void | addChecker (StringRef FullName, StringRef Desc, StringRef DocsUri) |
Adds a checker to the registry. More... | |
void | initializeManager (CheckerManager &mgr, const AnalyzerOptions &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) 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, const AnalyzerOptions &opts) const |
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 82 of file CheckerRegistry.h.
using clang::ento::CheckerRegistry::CheckerInfoList = std::vector<CheckerInfo> |
Definition at line 102 of file CheckerRegistry.h.
using clang::ento::CheckerRegistry::CheckerInfoSet = llvm::SetVector<const CheckerRegistry::CheckerInfo *> |
Definition at line 103 of file CheckerRegistry.h.
using clang::ento::CheckerRegistry::InitializationFunction = void (*)(CheckerManager &) |
Initialization functions perform any necessary setup for a checker.
They should include a call to CheckerManager::registerChecker.
Definition at line 88 of file CheckerRegistry.h.
CheckerRegistry::CheckerRegistry | ( | ArrayRef< std::string > | plugins, |
DiagnosticsEngine & | diags | ||
) |
Definition at line 42 of file CheckerRegistry.cpp.
References CLANG_ANALYZER_API_VERSION_STRING, isCompatibleAPIVersion(), and clang::DiagnosticsEngine::Report().
void clang::ento::CheckerRegistry::addChecker | ( | InitializationFunction | Fn, |
StringRef | FullName, | ||
StringRef | Desc, | ||
StringRef | DocsUri | ||
) |
Adds a checker to the registry.
Use this non-templated overload when your checker requires custom initialization.
Referenced by addChecker(), and isInPackage().
|
inline |
Adds a checker to the registry.
Use this templated overload when your checker does not require any custom initialization.
Definition at line 120 of file CheckerRegistry.h.
References addChecker(), printHelp(), printList(), and validateCheckerOptions().
void clang::ento::CheckerRegistry::initializeManager | ( | CheckerManager & | mgr, |
const AnalyzerOptions & | 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.
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 199 of file CheckerRegistry.cpp.
References checkerNameLT(), and max().
Referenced by addChecker(), and clang::ento::printCheckerHelp().
void CheckerRegistry::printList | ( | raw_ostream & | out, |
const AnalyzerOptions & | opts | ||
) | const |
Definition at line 237 of file CheckerRegistry.cpp.
References checkerNameLT().
Referenced by addChecker(), and clang::ento::printEnabledCheckerList().
void CheckerRegistry::validateCheckerOptions | ( | const AnalyzerOptions & | opts | ) | const |
Check if every option corresponds to a specific checker or package.
Definition at line 178 of file CheckerRegistry.cpp.
References clang::AnalyzerOptions::Config, and clang::DiagnosticsEngine::Report().
Referenced by addChecker().