clang  10.0.0svn
Macros | Typedefs | Functions | Variables
CheckerRegistry.cpp File Reference
#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/LLVM.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
Include dependency graph for CheckerRegistry.cpp:

Go to the source code of this file.

Macros

#define GET_CHECKERS
 
#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN)
 
#define GET_PACKAGES
 
#define PACKAGE(FULLNAME)   addPackage(FULLNAME);
 
#define GET_CHECKER_DEPENDENCIES
 
#define CHECKER_DEPENDENCY(FULLNAME, DEPENDENCY)   addDependency(FULLNAME, DEPENDENCY);
 
#define GET_CHECKER_OPTIONS
 
#define CHECKER_OPTION(TYPE, FULLNAME, CMDFLAG, DESC, DEFAULT_VAL, DEVELOPMENT_STATUS, IS_HIDDEN)   addCheckerOption(TYPE, FULLNAME, CMDFLAG, DEFAULT_VAL, DESC, DEVELOPMENT_STATUS, IS_HIDDEN);
 
#define GET_PACKAGE_OPTIONS
 
#define PACKAGE_OPTION(TYPE, FULLNAME, CMDFLAG, DESC, DEFAULT_VAL, DEVELOPMENT_STATUS, IS_HIDDEN)   addPackageOption(TYPE, FULLNAME, CMDFLAG, DEFAULT_VAL, DESC, DEVELOPMENT_STATUS, IS_HIDDEN);
 

Typedefs

using RegisterCheckersFn = void(*)(CheckerRegistry &)
 

Functions

static bool isCompatibleAPIVersion (const char *VersionString)
 
template<class CheckerOrPackageInfoList >
static std::conditional< std::is_const< CheckerOrPackageInfoList >::value, typename CheckerOrPackageInfoList::const_iterator, typename CheckerOrPackageInfoList::iterator >::type binaryFind (CheckerOrPackageInfoList &Collection, StringRef FullName)
 
static bool isInPackage (const CheckerRegistry::CheckerInfo &Checker, StringRef PackageName)
 
static bool collectDependenciesImpl (const CheckerRegistry::ConstCheckerInfoList &Deps, const LangOptions &LO, CheckerRegistry::CheckerInfoSet &Ret)
 Collects dependencies in ret, returns false on failure. More...
 
static LLVM_NODISCARD llvm::Optional< CheckerRegistry::CheckerInfoSet > collectDependencies (const CheckerRegistry::CheckerInfo &checker, const LangOptions &LO)
 Collects dependenies in enabledCheckers. Return None on failure. More...
 
static void insertAndValidate (StringRef FullName, const CheckerRegistry::CmdLineOption &Option, AnalyzerOptions &AnOpts, DiagnosticsEngine &Diags)
 Insert the checker/package option to AnalyzerOptions' config table, and validate it, if the user supplied it on the command line. More...
 
template<class T >
static void insertOptionToCollection (StringRef FullName, T &Collection, const CheckerRegistry::CmdLineOption &Option, AnalyzerOptions &AnOpts, DiagnosticsEngine &Diags)
 
static void isOptionContainedIn (const CheckerRegistry::CmdLineOptionList &OptionList, StringRef SuppliedChecker, StringRef SuppliedOption, const AnalyzerOptions &AnOpts, DiagnosticsEngine &Diags)
 

Variables

static constexpr char PackageSeparator = '.'
 

Macro Definition Documentation

◆ CHECKER

#define CHECKER (   FULLNAME,
  CLASS,
  HELPTEXT,
  DOC_URI,
  IS_HIDDEN 
)
Value:
addChecker(register##CLASS, shouldRegister##CLASS, FULLNAME, HELPTEXT, \
DOC_URI, IS_HIDDEN);

◆ CHECKER_DEPENDENCY

#define CHECKER_DEPENDENCY (   FULLNAME,
  DEPENDENCY 
)    addDependency(FULLNAME, DEPENDENCY);

◆ CHECKER_OPTION

#define CHECKER_OPTION (   TYPE,
  FULLNAME,
  CMDFLAG,
  DESC,
  DEFAULT_VAL,
  DEVELOPMENT_STATUS,
  IS_HIDDEN 
)    addCheckerOption(TYPE, FULLNAME, CMDFLAG, DEFAULT_VAL, DESC, DEVELOPMENT_STATUS, IS_HIDDEN);

◆ GET_CHECKER_DEPENDENCIES

#define GET_CHECKER_DEPENDENCIES

◆ GET_CHECKER_OPTIONS

#define GET_CHECKER_OPTIONS

◆ GET_CHECKERS

#define GET_CHECKERS

◆ GET_PACKAGE_OPTIONS

#define GET_PACKAGE_OPTIONS

◆ GET_PACKAGES

#define GET_PACKAGES

◆ PACKAGE

#define PACKAGE (   FULLNAME)    addPackage(FULLNAME);

◆ PACKAGE_OPTION

#define PACKAGE_OPTION (   TYPE,
  FULLNAME,
  CMDFLAG,
  DESC,
  DEFAULT_VAL,
  DEVELOPMENT_STATUS,
  IS_HIDDEN 
)    addPackageOption(TYPE, FULLNAME, CMDFLAG, DEFAULT_VAL, DESC, DEVELOPMENT_STATUS, IS_HIDDEN);

Typedef Documentation

◆ RegisterCheckersFn

using RegisterCheckersFn = void (*)(CheckerRegistry &)

Definition at line 30 of file CheckerRegistry.cpp.

Function Documentation

◆ binaryFind()

template<class CheckerOrPackageInfoList >
static std::conditional<std::is_const<CheckerOrPackageInfoList>::value, typename CheckerOrPackageInfoList::const_iterator, typename CheckerOrPackageInfoList::iterator>::type binaryFind ( CheckerOrPackageInfoList &  Collection,
StringRef  FullName 
)
static

◆ collectDependencies()

static LLVM_NODISCARD llvm::Optional<CheckerRegistry::CheckerInfoSet> collectDependencies ( const CheckerRegistry::CheckerInfo &  checker,
const LangOptions LO 
)
static

Collects dependenies in enabledCheckers. Return None on failure.

Definition at line 228 of file CheckerRegistry.cpp.

References collectDependenciesImpl().

Referenced by collectDependenciesImpl().

◆ collectDependenciesImpl()

static bool collectDependenciesImpl ( const CheckerRegistry::ConstCheckerInfoList &  Deps,
const LangOptions LO,
CheckerRegistry::CheckerInfoSet &  Ret 
)
static

Collects dependencies in ret, returns false on failure.

Definition at line 241 of file CheckerRegistry.cpp.

References binaryFind(), and collectDependencies().

Referenced by clang::ento::CheckerRegistry::CheckerRegistry(), and collectDependencies().

◆ insertAndValidate()

static void insertAndValidate ( StringRef  FullName,
const CheckerRegistry::CmdLineOption &  Option,
AnalyzerOptions AnOpts,
DiagnosticsEngine Diags 
)
static

Insert the checker/package option to AnalyzerOptions' config table, and validate it, if the user supplied it on the command line.

Definition at line 312 of file CheckerRegistry.cpp.

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

Referenced by insertOptionToCollection().

◆ insertOptionToCollection()

template<class T >
static void insertOptionToCollection ( StringRef  FullName,
T &  Collection,
const CheckerRegistry::CmdLineOption &  Option,
AnalyzerOptions AnOpts,
DiagnosticsEngine Diags 
)
static

Definition at line 362 of file CheckerRegistry.cpp.

References binaryFind(), and insertAndValidate().

◆ isCompatibleAPIVersion()

static bool isCompatibleAPIVersion ( const char *  VersionString)
static

◆ isInPackage()

static bool isInPackage ( const CheckerRegistry::CheckerInfo &  Checker,
StringRef  PackageName 
)
static

Definition at line 74 of file CheckerRegistry.cpp.

References binaryFind(), and PackageSeparator.

◆ isOptionContainedIn()

static void isOptionContainedIn ( const CheckerRegistry::CmdLineOptionList &  OptionList,
StringRef  SuppliedChecker,
StringRef  SuppliedOption,
const AnalyzerOptions AnOpts,
DiagnosticsEngine Diags 
)
static

Variable Documentation

◆ PackageSeparator

constexpr char PackageSeparator = '.'
static

Definition at line 72 of file CheckerRegistry.cpp.

Referenced by isInPackage().