#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>
usingnamespaceclang;
usingnamespaceento;
usingnamespacechecker_registry;
DynamicLibrary;
static bool isCompatibleAPIVersion(const char *VersionString) { … }
static constexpr char PackageSeparator = …;
CheckerRegistry::CheckerRegistry(
CheckerRegistryData &Data, ArrayRef<std::string> Plugins,
DiagnosticsEngine &Diags, AnalyzerOptions &AnOpts,
ArrayRef<std::function<void(CheckerRegistry &)>> CheckerRegistrationFns)
: … { … }
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);
void CheckerRegistry::initializeRegistry(const CheckerManager &Mgr) { … }
template <typename IsEnabledFn>
static bool collectStrongDependencies(const ConstCheckerInfoList &Deps,
const CheckerManager &Mgr,
CheckerInfoSet &Ret,
IsEnabledFn IsEnabled) { … }
template <typename IsEnabledFn>
static void collectWeakDependencies(const ConstCheckerInfoList &WeakDeps,
const CheckerManager &Mgr,
CheckerInfoSet &Ret,
IsEnabledFn IsEnabled) { … }
template <bool IsWeak> void CheckerRegistry::resolveDependencies() { … }
void CheckerRegistry::addDependency(StringRef FullName, StringRef Dependency) { … }
void CheckerRegistry::addWeakDependency(StringRef FullName,
StringRef Dependency) { … }
static void insertAndValidate(StringRef FullName, const CmdLineOption &Option,
AnalyzerOptions &AnOpts,
DiagnosticsEngine &Diags) { … }
template <class T>
static void insertOptionToCollection(StringRef FullName, T &Collection,
const CmdLineOption &Option,
AnalyzerOptions &AnOpts,
DiagnosticsEngine &Diags) { … }
void CheckerRegistry::resolveCheckerAndPackageOptions() { … }
void CheckerRegistry::addPackage(StringRef FullName) { … }
void CheckerRegistry::addPackageOption(StringRef OptionType,
StringRef PackageFullName,
StringRef OptionName,
StringRef DefaultValStr,
StringRef Description,
StringRef DevelopmentStatus,
bool IsHidden) { … }
void CheckerRegistry::addChecker(RegisterCheckerFn Rfn,
ShouldRegisterFunction Sfn, StringRef Name,
StringRef Desc, StringRef DocsUri,
bool IsHidden) { … }
void CheckerRegistry::addCheckerOption(StringRef OptionType,
StringRef CheckerFullName,
StringRef OptionName,
StringRef DefaultValStr,
StringRef Description,
StringRef DevelopmentStatus,
bool IsHidden) { … }
void CheckerRegistry::initializeManager(CheckerManager &CheckerMgr) const { … }
static void isOptionContainedIn(const CmdLineOptionList &OptionList,
StringRef SuppliedChecker,
StringRef SuppliedOption,
const AnalyzerOptions &AnOpts,
DiagnosticsEngine &Diags) { … }
void CheckerRegistry::validateCheckerOptions() const { … }