14#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_SERIALIZATION_SERIALIZATIONFORMAT_H
15#define LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_SERIALIZATION_SERIALIZATIONFORMAT_H
28#include "llvm/ADT/STLFunctionalExtras.h"
29#include "llvm/ADT/StringRef.h"
30#include "llvm/Support/Error.h"
31#include "llvm/Support/Registry.h"
41using Artifact = std::variant<TUSummary, LUSummary, WPASuite>;
63 llvm::StringRef Path) = 0;
70 llvm::StringRef Path) = 0;
75 llvm::StringRef Path) = 0;
86 llvm::StringRef Path) = 0;
98 llvm::StringRef Path) = 0;
105 llvm::StringRef Path) = 0;
111 llvm::StringRef Path) = 0;
118 llvm::StringRef Path) = 0;
125 llvm::StringRef Path) = 0;
130 llvm::StringRef Path) = 0;
135 llvm::function_ref<
void(llvm::StringRef Name, llvm::StringRef Desc)>
148#define FIELD(CLASS, FIELD_NAME) \
149 static const auto &get##FIELD_NAME(const CLASS &X) { return X.FIELD_NAME; } \
150 static auto &get##FIELD_NAME(CLASS &X) { return X.FIELD_NAME; }
151#include "clang/ScalableStaticAnalysis/Core/Model/PrivateFieldNames.def"
171 template <
class FormatT,
class SerializerFn,
class DeserializerFn>
174 template <
class FormatT,
class SerRet,
class... SerArgs,
class DesRet,
177 FormatT,
llvm::function_ref<SerRet(const AnalysisResult &, SerArgs...)>,
178 llvm::function_ref<DesRet(DesArgs...)>> {
180 using DeserializerFn = DesRet (*)(DesArgs...);
198 template <
class AnalysisResultT>
struct Add {
210 static bool Registered =
false;
213 AnalysisResultT::analysisName());
235 struct ConcreteCodec final :
Codec {
237 DeserializerFn DesFn;
242 SerArgs... args)
const override {
243 return SerFn(
static_cast<const AnalysisResultT &
>(
Base), args...);
246 DesRet
deserialize(DesArgs... args)
const override {
247 return DesFn(args...);
253 static std::string NameStr =
254 AnalysisResultT::analysisName().str().str();
260 [[maybe_unused]]
static
262 RegisterUsingCtorSideEffect(NameStr,
"");
269 for (
const auto &E : llvm::Registry<Codec>::entries()) {
270 if (E.getName() == Name.
str()) {
271 return E.instantiate();
275 "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.
Represents a multi-architecture shared library.
Represents a multi-architecture static library.
Represents a static library of translation unit summary encodings.
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, StaticLibrary, MultiArchStaticLibrary, MultiArchSharedLibrary > 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