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"
51class AnalysisRegistry {
52 using RegistryT = llvm::Registry<AnalysisBase>;
54 AnalysisRegistry() =
delete;
64 template <
typename AnalysisT>
struct Add {
65 static_assert(std::is_base_of_v<SummaryAnalysisBase, AnalysisT> ||
66 std::is_base_of_v<DerivedAnalysisBase, AnalysisT>,
67 "AnalysisT must derive from SummaryAnalysis<...> or "
68 "DerivedAnalysis<...>");
70 explicit Add(llvm::StringRef Desc)
71 : Name(AnalysisT::ResultType::analysisName().str().str()),
73 if (
contains(AnalysisT::ResultType::analysisName())) {
76 getAnalysisNames().push_back(AnalysisT::ResultType::analysisName());
84 RegistryT::Add<AnalysisT> Node;
91 static const std::vector<AnalysisName> &
names();
104 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