clang 20.0.0git
Macros | 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/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"

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_WEAK_DEPENDENCIES
 
#define CHECKER_WEAK_DEPENDENCY(FULLNAME, DEPENDENCY)    addWeakDependency(FULLNAME, DEPENDENCY);
 
#define GET_CHECKER_OPTIONS
 
#define CHECKER_OPTION(TYPE, FULLNAME, CMDFLAG, DESC, DEFAULT_VAL, DEVELOPMENT_STATUS, IS_HIDDEN)
 
#define GET_PACKAGE_OPTIONS
 
#define PACKAGE_OPTION(TYPE, FULLNAME, CMDFLAG, DESC, DEFAULT_VAL, DEVELOPMENT_STATUS, IS_HIDDEN)
 

Functions

static bool isCompatibleAPIVersion (const char *VersionString)
 
template<typename IsEnabledFn >
static bool collectStrongDependencies (const ConstCheckerInfoList &Deps, const CheckerManager &Mgr, CheckerInfoSet &Ret, IsEnabledFn IsEnabled)
 
template<typename IsEnabledFn >
static void collectWeakDependencies (const ConstCheckerInfoList &Deps, const CheckerManager &Mgr, CheckerInfoSet &Ret, IsEnabledFn IsEnabled)
 Collects weak dependencies in enabledData.Checkers.
 
static void insertAndValidate (StringRef FullName, const 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.
 
template<class T >
static void insertOptionToCollection (StringRef FullName, T &Collection, const CmdLineOption &Option, AnalyzerOptions &AnOpts, DiagnosticsEngine &Diags)
 
static void isOptionContainedIn (const 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 
)
Value:
addCheckerOption(TYPE, FULLNAME, CMDFLAG, DEFAULT_VAL, DESC, \
DEVELOPMENT_STATUS, IS_HIDDEN);
#define TYPE(DERIVED, BASE)
Definition: ASTFwd.h:26

◆ CHECKER_WEAK_DEPENDENCY

#define CHECKER_WEAK_DEPENDENCY (   FULLNAME,
  DEPENDENCY 
)     addWeakDependency(FULLNAME, DEPENDENCY);

◆ GET_CHECKER_DEPENDENCIES

#define GET_CHECKER_DEPENDENCIES

◆ GET_CHECKER_OPTIONS

#define GET_CHECKER_OPTIONS

◆ GET_CHECKER_WEAK_DEPENDENCIES

#define GET_CHECKER_WEAK_DEPENDENCIES

◆ 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 
)
Value:
addPackageOption(TYPE, FULLNAME, CMDFLAG, DEFAULT_VAL, DESC, \
DEVELOPMENT_STATUS, IS_HIDDEN);

Function Documentation

◆ collectStrongDependencies()

template<typename IsEnabledFn >
static bool collectStrongDependencies ( const ConstCheckerInfoList Deps,
const CheckerManager Mgr,
CheckerInfoSet Ret,
IsEnabledFn  IsEnabled 
)
static

◆ collectWeakDependencies()

template<typename IsEnabledFn >
static void collectWeakDependencies ( const ConstCheckerInfoList Deps,
const CheckerManager Mgr,
CheckerInfoSet Ret,
IsEnabledFn  IsEnabled 
)
static

Collects weak dependencies in enabledData.Checkers.

Definition at line 280 of file CheckerRegistry.cpp.

References collectStrongDependencies(), and collectWeakDependencies().

Referenced by collectWeakDependencies(), and clang::ento::CheckerRegistry::initializeRegistry().

◆ insertAndValidate()

static void insertAndValidate ( StringRef  FullName,
const 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 341 of file CheckerRegistry.cpp.

References clang::AnalyzerOptions::Config, clang::ento::CmdLineOption::DefaultValStr, FullName, clang::ento::CmdLineOption::OptionName, clang::ento::CmdLineOption::OptionType, clang::DiagnosticsEngine::Report(), and clang::AnalyzerOptions::ShouldEmitErrorsOnInvalidConfigValue.

Referenced by insertOptionToCollection().

◆ insertOptionToCollection()

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

◆ isCompatibleAPIVersion()

static bool isCompatibleAPIVersion ( const char *  VersionString)
static

◆ isOptionContainedIn()

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

Variable Documentation

◆ PackageSeparator

constexpr char PackageSeparator = '.'
staticconstexpr

Definition at line 44 of file CheckerRegistry.cpp.