14#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_SERIALIZATION_SERIALIZATIONFORMAT_H
15#define LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_SERIALIZATION_SERIALIZATIONFORMAT_H
25#include "llvm/ADT/STLFunctionalExtras.h"
26#include "llvm/ADT/StringRef.h"
27#include "llvm/Support/Error.h"
28#include "llvm/Support/Registry.h"
38using Artifact = std::variant<TUSummary, LUSummary, WPASuite>;
53 llvm::StringRef Path) = 0;
60 llvm::StringRef Path) = 0;
65 llvm::StringRef Path) = 0;
76 llvm::StringRef Path) = 0;
88 llvm::StringRef Path) = 0;
95 llvm::StringRef Path) = 0;
100 llvm::StringRef Path) = 0;
105 llvm::function_ref<
void(llvm::StringRef Name, llvm::StringRef Desc)>
118#define FIELD(CLASS, FIELD_NAME) \
119 static const auto &get##FIELD_NAME(const CLASS &X) { return X.FIELD_NAME; } \
120 static auto &get##FIELD_NAME(CLASS &X) { return X.FIELD_NAME; }
121#include "clang/ScalableStaticAnalysis/Core/Model/PrivateFieldNames.def"
141 template <
class FormatT,
class SerializerFn,
class DeserializerFn>
144 template <
class FormatT,
class SerRet,
class... SerArgs,
class DesRet,
147 FormatT,
llvm::function_ref<SerRet(const AnalysisResult &, SerArgs...)>,
148 llvm::function_ref<DesRet(DesArgs...)>> {
150 using DeserializerFn = DesRet (*)(DesArgs...);
168 template <
class AnalysisResultT>
struct Add {
180 static bool Registered =
false;
183 AnalysisResultT::analysisName());
205 struct ConcreteCodec final :
Codec {
207 DeserializerFn DesFn;
212 SerArgs... args)
const override {
213 return SerFn(
static_cast<const AnalysisResultT &
>(
Base), args...);
216 DesRet
deserialize(DesArgs... args)
const override {
217 return DesFn(args...);
223 static std::string NameStr =
224 AnalysisResultT::analysisName().str().str();
230 [[maybe_unused]]
static
232 RegisterUsingCtorSideEffect(NameStr,
"");
239 for (
const auto &E : llvm::Registry<Codec>::entries()) {
240 if (E.getName() == Name.
str()) {
241 return E.instantiate();
245 "no support registered for analysis: {0}",
Uniquely identifies a whole-program analysis and the AnalysisResult it produces.
llvm::StringRef str() const
Explicit conversion to the underlying string representation.
Base class for whole-program analysis results.
Lightweight opaque handle representing an entity in an EntityIdTable.
static ErrorBuilder create(std::error_code EC, const char *Fmt, Args &&...ArgVals)
Create an ErrorBuilder with an error code and formatted message.
static void fatal(const char *Fmt, Args &&...ArgVals)
Report a fatal error with formatted message and terminate execution.
llvm::Error build() const
Build and return the final error.
Represents a link unit summary in its serialized encoding.
Represents a link unit (LU) summary containing merged entity summaries.
Uniquely identifies an analysis summary.
Represents a translation unit summary in its serialized encoding.
Data extracted for a given translation unit and for a given set of analyses.
Bundles the EntityIdTable (moved from the LUSummary) and the analysis results produced by one Analysi...
std::variant< TUSummaryEncoding, LUSummaryEncoding > ArtifactEncoding
Lazily-deserialized counterpart of Artifact: the same on-disk artifacts but with their per-entity sum...
std::variant< TUSummary, LUSummary, WPASuite > Artifact
Sum type returned by SerializationFormat::readArtifact, used when the caller does not know up-front w...
Diagnostic wrappers for TextAPI types for error reporting.
DeserializerFn Deserialize
FormatInfoEntry(SummaryName ForSummary, SerializerFn Serialize, DeserializerFn Deserialize)
virtual ~FormatInfoEntry()=default