14#ifndef LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_SERIALIZATION_SERIALIZATIONFORMAT_H
15#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_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"
40 llvm::StringRef Path) = 0;
47 llvm::StringRef Path) = 0;
52 llvm::StringRef Path) = 0;
59 llvm::StringRef Path) = 0;
64 llvm::StringRef Path) = 0;
69 llvm::function_ref<
void(llvm::StringRef Name, llvm::StringRef Desc)>
82#define FIELD(CLASS, FIELD_NAME) \
83 static const auto &get##FIELD_NAME(const CLASS &X) { return X.FIELD_NAME; } \
84 static auto &get##FIELD_NAME(CLASS &X) { return X.FIELD_NAME; }
85#include "clang/ScalableStaticAnalysisFramework/Core/Model/PrivateFieldNames.def"
105 template <
class FormatT,
class SerializerFn,
class DeserializerFn>
108 template <
class FormatT,
class SerRet,
class... SerArgs,
class DesRet,
111 FormatT,
llvm::function_ref<SerRet(const AnalysisResult &, SerArgs...)>,
112 llvm::function_ref<DesRet(DesArgs...)>> {
114 using DeserializerFn = llvm::function_ref<DesRet(DesArgs...)>;
132 template <
class AnalysisResultT>
struct Add {
134 llvm::function_ref<SerRet(
const AnalysisResultT &, SerArgs...)>;
142 static bool Registered =
false;
145 AnalysisResultT::analysisName());
158 static DeserializerFn SavedDeserialize = Deserialize;
163 struct ConcreteCodec final :
Codec {
165 DeserializerFn DesFn;
167 ConcreteCodec() : SerFn(SavedSerialize), DesFn(SavedDeserialize) {}
170 SerArgs... args)
const override {
171 return SerFn(
static_cast<const AnalysisResultT &
>(
Base), args...);
174 DesRet
deserialize(DesArgs... args)
const override {
175 return DesFn(args...);
181 static std::string NameStr =
182 AnalysisResultT::analysisName().str().str();
188 [[maybe_unused]]
static
190 RegisterUsingCtorSideEffect(NameStr,
"");
197 for (
const auto &E : llvm::Registry<Codec>::entries()) {
198 if (E.getName() == Name.
str()) {
199 return E.instantiate();
203 "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...
Diagnostic wrappers for TextAPI types for error reporting.
DeserializerFn Deserialize
FormatInfoEntry(SummaryName ForSummary, SerializerFn Serialize, DeserializerFn Deserialize)
virtual ~FormatInfoEntry()=default