31#ifndef LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_WHOLEPROGRAMANALYSIS_ANALYSISREGISTRY_H
32#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_WHOLEPROGRAMANALYSIS_ANALYSISREGISTRY_H
38#include "llvm/Support/Error.h"
39#include "llvm/Support/Registry.h"
44LLVM_DECLARE_REGISTRY(llvm::Registry<clang::ssaf::AnalysisBase>)
53class AnalysisRegistry {
54 using RegistryT = llvm::Registry<AnalysisBase>;
56 AnalysisRegistry() =
delete;
66 template <
typename AnalysisT>
struct Add {
67 static_assert(std::is_base_of_v<SummaryAnalysisBase, AnalysisT> ||
68 std::is_base_of_v<DerivedAnalysisBase, AnalysisT>,
69 "AnalysisT must derive from SummaryAnalysis<...> or "
70 "DerivedAnalysis<...>");
72 explicit Add(llvm::StringRef Desc)
73 : Name(AnalysisT::ResultType::analysisName().str().str()),
75 if (
contains(AnalysisT::ResultType::analysisName())) {
78 getAnalysisNames().push_back(AnalysisT::ResultType::analysisName());
86 RegistryT::Add<AnalysisT> Node;
93 static const std::vector<AnalysisName> &
names();
106 static std::vector<AnalysisName> &getAnalysisNames();
Uniquely identifies a whole-program analysis and the AnalysisResult it produces.
static bool contains(const AnalysisName &Name)
Returns true if an analysis is registered under Name.
static const std::vector< AnalysisName > & names()
Returns the names of all registered analyses.
static llvm::Expected< std::unique_ptr< AnalysisBase > > instantiate(const AnalysisName &Name)
Instantiates the analysis registered under Name, or returns an error if no such analysis is registere...
static void fatal(const char *Fmt, Args &&...ArgVals)
Report a fatal error with formatted message and terminate execution.
Add(llvm::StringRef Desc)
Add & operator=(const Add &)=delete