clang 23.0.0git
PointerFlowFormat.h
Go to the documentation of this file.
1//===- PointerFlowFormat.h --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// JSON serialization helpers for EdgeSet (PointerFlow edge maps).
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_POINTERFLOW_POINTERFLOWFORMAT_H
14#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_POINTERFLOW_POINTERFLOWFORMAT_H
15
18#include "llvm/ADT/iterator_range.h"
19
20namespace clang::ssaf {
21
22/// Serialize an EdgeSet
23/// {(src1, dest1), (src1, dest2), (src2, dest3), (src2, dest4), ...}
24/// to an array of arrays of EntityPointerLevels:
25/// [ [src1, dest1, dest2, ...], [src2, dest3, dest4, ...], ... ]
26llvm::json::Array
27edgeSetToJSON(llvm::iterator_range<EdgeSet::const_iterator> Edges,
29
30/// Deserialize an EdgeSet from the array format produced by `edgeSetToJSON`.
31llvm::Expected<EdgeSet>
32edgeSetFromJSON(const llvm::json::Array &EdgesData,
34
35} // namespace clang::ssaf
36
37#endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_POINTERFLOW_POINTERFLOWFORMAT_H
llvm::function_ref< llvm::Expected< EntityId >(const Object &)> EntityIdFromJSONFn
Definition JSONFormat.h:71
llvm::function_ref< Object(EntityId)> EntityIdToJSONFn
Definition JSONFormat.h:70
llvm::json::Array edgeSetToJSON(llvm::iterator_range< EdgeSet::const_iterator > Edges, JSONFormat::EntityIdToJSONFn IdToJSON)
Serialize an EdgeSet {(src1, dest1), (src1, dest2), (src2, dest3), (src2, dest4), ....
llvm::Expected< EdgeSet > edgeSetFromJSON(const llvm::json::Array &EdgesData, JSONFormat::EntityIdFromJSONFn IdFromJSON)
Deserialize an EdgeSet from the array format produced by edgeSetToJSON.