15#include "llvm/Support/Error.h"
16#include "llvm/Support/JSON.h"
27ssaf::buildUnsafeBufferUsageEntitySummary(EntityPointerLevelSet UnsafeBuffers) {
31llvm::iterator_range<EntityPointerLevelSet::const_iterator>
33 return llvm::make_range(S.UnsafeBuffers.begin(), S.UnsafeBuffers.end());
39 Array UnsafeBuffersData;
41 for (
const auto &EPL : getUnsafeBuffers(SS))
48 const Array *UnsafeBuffersData =
51 if (!UnsafeBuffersData)
55 EntityPointerLevelSet EPLs;
57 for (
const auto &EltData : *UnsafeBuffersData) {
62 return EPL.takeError();
65 return std::make_unique<UnsafeBufferUsageEntitySummary>(
66 buildUnsafeBufferUsageEntitySummary(std::move(EPLs)));
81static llvm::Registry<JSONFormat::FormatInfo>::Add<
85 "JSON Format info for UnsafeBufferUsageEntitySummary");
98 return Object({{
"@", IdToIntFn(Id)}});
102 const auto *Int = O.get(
"@");
104 if (Int && Int->getAsUINT64())
105 return IdFromIntFn(*Int->getAsUINT64());
106 return llvm::createStringError(
"failed to get EntityId from Object");
volatile int UnsafeBufferUsageSSAFJSONFormatAnchorSource
static llvm::Expected< std::unique_ptr< EntitySummary > > deserialize(const Object &Data, EntityIdTable &, JSONFormat::EntityIdFromJSONFn Fn)
static llvm::Expected< std::unique_ptr< EntitySummary > > deserializeImpl(const Object &Data, JSONFormat::EntityIdFromJSONFn Fn)
static llvm::Registry< JSONFormat::FormatInfo >::Add< UnsafeBufferUsageJSONFormatInfo > RegisterUnsafeBufferUsageJSONFormatInfo(UnsafeBufferUsageEntitySummary::Name, "JSON Format info for UnsafeBufferUsageEntitySummary")
llvm::json::Object Object
static Object serialize(const EntitySummary &S, JSONFormat::EntityIdToJSONFn Fn)
static constexpr llvm::StringLiteral SummarySerializationKey
Manages entity name interning and provides efficient EntityId handles.
Lightweight opaque handle representing an entity in an EntityIdTable.
Base class for analysis-specific summary data.
An UnsafeBufferUsageEntitySummary contains a set of EntityPointerLevels extracted from unsafe buffer ...
static constexpr llvm::StringLiteral Name
llvm::json::Value entityPointerLevelToJSON(const EntityPointerLevel &EPL, JSONFormat::EntityIdToJSONFn EntityId2JSON)
llvm::Expected< std::unique_ptr< EntitySummary > > serializeDeserializeRoundTrip(const UnsafeBufferUsageEntitySummary &S, std::function< uint64_t(EntityId)> IdToIntFn, std::function< llvm::Expected< EntityId >(uint64_t)> IdFromIntFn)
Expected< EntityPointerLevel > entityPointerLevelFromJSON(const llvm::json::Value &EPLData, JSONFormat::EntityIdFromJSONFn EntityIdFromJSON)
llvm::json::Object Object
llvm::Error makeSawButExpectedError(const llvm::json::Value &Saw, llvm::StringRef Expected, const Ts &...ExpectedArgs)
The JSON file list parser is used to communicate input to InstallAPI.
int const char * function