31#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_WHOLEPROGRAMANALYSIS_ANALYSISREGISTRY_H
32#define LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_WHOLEPROGRAMANALYSIS_ANALYSISREGISTRY_H
39#include "llvm/Support/Error.h"
40#include "llvm/Support/Registry.h"
46 llvm::Registry<clang::ssaf::AnalysisBase>)
55class AnalysisRegistry {
56 using RegistryT = llvm::Registry<AnalysisBase>;
58 AnalysisRegistry() =
delete;
68 template <
typename AnalysisT>
struct Add {
69 static_assert(std::is_base_of_v<SummaryAnalysisBase, AnalysisT> ||
70 std::is_base_of_v<DerivedAnalysisBase, AnalysisT>,
71 "AnalysisT must derive from SummaryAnalysis<...> or "
72 "DerivedAnalysis<...>");
74 explicit Add(llvm::StringRef Desc)
75 : Name(AnalysisT::ResultType::analysisName().str().str()),
77 if (
contains(AnalysisT::ResultType::analysisName())) {
78 ErrorBuilder::fatal(
"duplicate analysis registration for '{0}'", Name);
80 getAnalysisNames().push_back(AnalysisT::ResultType::analysisName());
83 Add(
const Add &) =
delete;
84 Add &operator=(
const Add &) =
delete;
88 RegistryT::Add<AnalysisT> Node;
92 static bool contains(
const AnalysisName &Name);
95 static const std::vector<AnalysisName> &names();
99 static llvm::Expected<std::unique_ptr<AnalysisBase>>
100 instantiate(
const AnalysisName &Name);
108 static std::vector<AnalysisName> &getAnalysisNames();
static bool contains(const std::set< tok::TokenKind > &Terminators, const Token &Tok)
llvm::Registry< SummaryDataBuilderBase > RegistryT
bool Add(InterpState &S, CodePtr OpPC)