Static Value-Flow Analysis
Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SVF::SVFIRReader Class Reference

#include <SVFFileSystem.h>

Static Public Member Functions

static SVFIRread (const std::string &path)
 
static void readJson (const cJSON *obj, bool &flag)
 
static void readJson (const cJSON *obj, unsigned &val)
 
static void readJson (const cJSON *obj, int &val)
 
static void readJson (const cJSON *obj, short &val)
 
static void readJson (const cJSON *obj, float &val)
 
static void readJson (const cJSON *obj, unsigned long &val)
 
static void readJson (const cJSON *obj, long long &val)
 
static void readJson (const cJSON *obj, unsigned long long &val)
 
static void readJson (const cJSON *obj, std::string &str)
 
static s64_t applyEdgeMask (u64_t edgeFlag)
 
template<typename T >
static void setEdgeFlag (GenericEdge< T > *edge, typename GenericEdge< T >::GEdgeFlag edgeFlag)
 

Private Types

using GNodeK = s32_t
 
using GEdgeFlag = GenericEdge< void >::GEdgeFlag
 
using GEdgeKind = GenericEdge< void >::GEdgeKind
 

Private Member Functions

SVFIRread (const cJSON *root)
 
const cJSONcreateObjs (const cJSON *root)
 
void readJson (const cJSON *obj, NodeIDAllocator *idAllocator)
 
void readJson (SymbolTableInfo *symTabInfo)
 
void readJson (IRGraph *graph)
 
void readJson (ICFG *icfg)
 
void readJson (CHGraph *graph)
 
void readJson (SVFModule *module)
 
void readJson (const cJSON *obj, SVFType *&type)
 
void readJson (const cJSON *obj, StInfo *&stInfo)
 
void readJson (const cJSON *obj, SVFValue *&value)
 
void readJson (const cJSON *obj, SVFVar *&var)
 
void readJson (const cJSON *obj, SVFStmt *&stmt)
 
void readJson (const cJSON *obj, ICFGNode *&node)
 
void readJson (const cJSON *obj, ICFGEdge *&edge)
 
void readJson (const cJSON *obj, CHNode *&node)
 
void readJson (const cJSON *obj, CHEdge *&edge)
 
void readJson (const cJSON *obj, AccessPath &ap)
 
void readJson (const cJSON *obj, SVFLoop *&loop)
 
void readJson (const cJSON *obj, MemObj *&memObj)
 
void readJson (const cJSON *obj, ObjTypeInfo *&objTypeInfo)
 
void readJson (const cJSON *obj, SVFLoopAndDomInfo *&ldInfo)
 
template<unsigned ElementSize>
void readJson (const cJSON *obj, SparseBitVector< ElementSize > &bv)
 
template<typename T >
SVFUtil::void_t< KindBaseT< T > > readJson (const cJSON *obj, T *&ptr)
 Read a pointer of some child class of SVFType/SVFValue/SVFVar/SVFStmt/ICFGNode/ICFGEdge/CHNode/CHEdge. More...
 
template<typename T >
void readJson (const cJSON *obj, const T *&cptr)
 Read a const pointer. More...
 
template<typename T1 , typename T2 >
void readJson (const cJSON *obj, std::pair< T1, T2 > &pair)
 
template<typename T , size_t N>
void readJson (const cJSON *obj, T(&array)[N])
 
template<typename C >
std::enable_if_t< SVFUtil::is_sequence_container_v< C > > readJson (const cJSON *obj, C &container)
 
template<typename C >
std::enable_if_t< SVFUtil::is_map_v< C > > readJson (const cJSON *obj, C &map)
 
template<typename C >
std::enable_if_t< SVFUtil::is_set_v< C > > readJson (const cJSON *obj, C &set)
 
void virtFill (const cJSON *&fieldJson, SVFVar *var)
 
void fill (const cJSON *&fieldJson, SVFVar *var)
 
void fill (const cJSON *&fieldJson, ValVar *var)
 
void fill (const cJSON *&fieldJson, ObjVar *var)
 
void fill (const cJSON *&fieldJson, GepValVar *var)
 
void fill (const cJSON *&fieldJson, GepObjVar *var)
 
void fill (const cJSON *&fieldJson, FIObjVar *var)
 
void fill (const cJSON *&fieldJson, RetPN *var)
 
void fill (const cJSON *&fieldJson, VarArgPN *var)
 
void fill (const cJSON *&fieldJson, DummyValVar *var)
 
void fill (const cJSON *&fieldJson, DummyObjVar *var)
 
void virtFill (const cJSON *&fieldJson, SVFStmt *stmt)
 
void fill (const cJSON *&fieldJson, SVFStmt *stmt)
 
void fill (const cJSON *&fieldJson, AssignStmt *stmt)
 
void fill (const cJSON *&fieldJson, AddrStmt *stmt)
 
void fill (const cJSON *&fieldJson, CopyStmt *stmt)
 
void fill (const cJSON *&fieldJson, StoreStmt *stmt)
 
void fill (const cJSON *&fieldJson, LoadStmt *stmt)
 
void fill (const cJSON *&fieldJson, GepStmt *stmt)
 
void fill (const cJSON *&fieldJson, CallPE *stmt)
 
void fill (const cJSON *&fieldJson, RetPE *stmt)
 
void fill (const cJSON *&fieldJson, MultiOpndStmt *stmt)
 
void fill (const cJSON *&fieldJson, PhiStmt *stmt)
 
void fill (const cJSON *&fieldJson, SelectStmt *stmt)
 
void fill (const cJSON *&fieldJson, CmpStmt *stmt)
 
void fill (const cJSON *&fieldJson, BinaryOPStmt *stmt)
 
void fill (const cJSON *&fieldJson, UnaryOPStmt *stmt)
 
void fill (const cJSON *&fieldJson, BranchStmt *stmt)
 
void fill (const cJSON *&fieldJson, TDForkPE *stmt)
 
void fill (const cJSON *&fieldJson, TDJoinPE *stmt)
 
void fill (const cJSON *&fieldJson, MemObj *memObj)
 
void fill (const cJSON *&fieldJson, StInfo *stInfo)
 
void virtFill (const cJSON *&fieldJson, ICFGNode *node)
 
void fill (const cJSON *&fieldJson, ICFGNode *node)
 
void fill (const cJSON *&fieldJson, GlobalICFGNode *node)
 
void fill (const cJSON *&fieldJson, IntraICFGNode *node)
 
void fill (const cJSON *&fieldJson, InterICFGNode *node)
 
void fill (const cJSON *&fieldJson, FunEntryICFGNode *node)
 
void fill (const cJSON *&fieldJson, FunExitICFGNode *node)
 
void fill (const cJSON *&fieldJson, CallICFGNode *node)
 
void fill (const cJSON *&fieldJson, RetICFGNode *node)
 
void virtFill (const cJSON *&fieldJson, ICFGEdge *node)
 
void fill (const cJSON *&fieldJson, ICFGEdge *edge)
 
void fill (const cJSON *&fieldJson, IntraCFGEdge *edge)
 
void fill (const cJSON *&fieldJson, CallCFGEdge *edge)
 
void fill (const cJSON *&fieldJson, RetCFGEdge *edge)
 
void fill (const cJSON *&fieldJson, SVFLoop *loop)
 
void virtFill (const cJSON *&fieldJson, CHNode *node)
 
void virtFill (const cJSON *&fieldJson, CHEdge *edge)
 
void virtFill (const cJSON *&fieldJson, SVFValue *value)
 
void fill (const cJSON *&fieldJson, SVFValue *value)
 
void fill (const cJSON *&fieldJson, SVFFunction *value)
 
void fill (const cJSON *&fieldJson, SVFBasicBlock *value)
 
void fill (const cJSON *&fieldJson, SVFInstruction *value)
 
void fill (const cJSON *&fieldJson, SVFCallInst *value)
 
void fill (const cJSON *&fieldJson, SVFVirtualCallInst *value)
 
void fill (const cJSON *&fieldJson, SVFConstant *value)
 
void fill (const cJSON *&fieldJson, SVFGlobalValue *value)
 
void fill (const cJSON *&fieldJson, SVFArgument *value)
 
void fill (const cJSON *&fieldJson, SVFConstantData *value)
 
void fill (const cJSON *&fieldJson, SVFConstantInt *value)
 
void fill (const cJSON *&fieldJson, SVFConstantFP *value)
 
void fill (const cJSON *&fieldJson, SVFConstantNullPtr *value)
 
void fill (const cJSON *&fieldJson, SVFBlackHoleValue *value)
 
void fill (const cJSON *&fieldJson, SVFOtherValue *value)
 
void fill (const cJSON *&fieldJson, SVFMetadataAsValue *value)
 
void virtFill (const cJSON *&fieldJson, SVFType *type)
 
void fill (const cJSON *&fieldJson, SVFType *type)
 
void fill (const cJSON *&fieldJson, SVFPointerType *type)
 
void fill (const cJSON *&fieldJson, SVFIntegerType *type)
 
void fill (const cJSON *&fieldJson, SVFFunctionType *type)
 
void fill (const cJSON *&fieldJson, SVFStructType *type)
 
void fill (const cJSON *&fieldJson, SVFArrayType *type)
 
void fill (const cJSON *&fieldJson, SVFOtherType *type)
 
template<typename NodeTy , typename EdgeTy >
void fill (const cJSON *&fieldJson, GenericNode< NodeTy, EdgeTy > *node)
 
template<typename NodeTy >
void fill (const cJSON *&fieldJson, GenericEdge< NodeTy > *edge)
 

Static Private Member Functions

static ICFGNodecreateICFGNode (NodeID id, GNodeK type)
 
static ICFGEdgecreateICFGEdge (GEdgeKind kind)
 
static CHNodecreateCHNode (NodeID id, GNodeK kind)
 
static CHEdgecreateCHEdge (GEdgeKind kind)
 
static SVFVarcreatePAGNode (NodeID id, GNodeK kind)
 
static SVFStmtcreatePAGEdge (GEdgeKind kind)
 
template<typename EdgeCreator >
static auto createEdgeWithFlag (GEdgeFlag flag, EdgeCreator creator)
 

Private Attributes

SVFModuleReader svfModuleReader
 
SymbolTableInfoReader symTableReader
 
ICFGReader icfgReader
 
CHGraphReader chGraphReader
 
IRGraphReader irGraphReader
 

Detailed Description

Definition at line 1032 of file SVFFileSystem.h.

Member Typedef Documentation

◆ GEdgeFlag

Definition at line 1068 of file SVFFileSystem.h.

◆ GEdgeKind

Definition at line 1069 of file SVFFileSystem.h.

◆ GNodeK

Definition at line 1067 of file SVFFileSystem.h.

Member Function Documentation

◆ applyEdgeMask()

static s64_t SVF::SVFIRReader::applyEdgeMask ( u64_t  edgeFlag)
inlinestatic

Definition at line 1055 of file SVFFileSystem.h.

1056  {
1057  return edgeFlag & GenericEdge<void>::EdgeKindMask;
1058  }
static constexpr u64_t EdgeKindMask
Definition: GenericGraph.h:133

◆ createCHEdge()

CHEdge * SVF::SVFIRReader::createCHEdge ( GEdgeKind  kind)
staticprivate

Definition at line 1613 of file SVFFileSystem.cpp.

1614 {
1615  ABORT_IFNOT(kind == 0, "Unsupported CHEdge kind " << kind);
1616  return new CHEdge(nullptr, nullptr, {});
1617 }
#define ABORT_IFNOT(condition, msg)

◆ createCHNode()

CHNode * SVF::SVFIRReader::createCHNode ( NodeID  id,
GNodeK  kind 
)
staticprivate

Definition at line 1607 of file SVFFileSystem.cpp.

1608 {
1609  ABORT_IFNOT(kind == 0, "Impossible CHNode kind " << kind);
1610  return new CHNode("", id);
1611 }

◆ createEdgeWithFlag()

template<typename EdgeCreator >
static auto SVF::SVFIRReader::createEdgeWithFlag ( GEdgeFlag  flag,
EdgeCreator  creator 
)
inlinestaticprivate

Definition at line 1078 of file SVFFileSystem.h.

1079  {
1080  auto kind = SVFIRReader::applyEdgeMask(flag);
1081  auto edge = creator(kind);
1082  setEdgeFlag(edge, flag);
1083  return edge;
1084  }
static s64_t applyEdgeMask(u64_t edgeFlag)
static void setEdgeFlag(GenericEdge< T > *edge, typename GenericEdge< T >::GEdgeFlag edgeFlag)

◆ createICFGEdge()

ICFGEdge * SVF::SVFIRReader::createICFGEdge ( GEdgeKind  kind)
staticprivate

Definition at line 1589 of file SVFFileSystem.cpp.

1590 {
1591  constexpr ICFGNode* src = nullptr;
1592  constexpr ICFGNode* dst = nullptr;
1593 
1594  switch (kind)
1595  {
1596  default:
1597  ABORT_MSG(kind << " is an impossible ICFGEdgeKind in create()");
1598  case ICFGEdge::IntraCF:
1599  return new IntraCFGEdge(src, dst);
1600  case ICFGEdge::CallCF:
1601  return new CallCFGEdge(src, dst);
1602  case ICFGEdge::RetCF:
1603  return new RetCFGEdge(src, dst);
1604  }
1605 }
#define ABORT_MSG(msg)

◆ createICFGNode()

ICFGNode * SVF::SVFIRReader::createICFGNode ( NodeID  id,
GNodeK  type 
)
staticprivate

Definition at line 1570 of file SVFFileSystem.cpp.

1571 {
1572  switch (kind)
1573  {
1574  default:
1575  ABORT_MSG(kind << " is an impossible ICFGNodeKind in create()");
1576 #define CASE(kind, constructor) \
1577  case ICFGNode::kind: \
1578  return new constructor(id);
1579  CASE(IntraBlock, IntraICFGNode);
1580  CASE(FunEntryBlock, FunEntryICFGNode);
1581  CASE(FunExitBlock, FunExitICFGNode);
1582  CASE(FunCallBlock, CallICFGNode);
1583  CASE(FunRetBlock, RetICFGNode);
1584  CASE(GlobalBlock, GlobalICFGNode);
1585 #undef CASE
1586  }
1587 }
#define CASE(Kind)

◆ createObjs()

const cJSON * SVF::SVFIRReader::createObjs ( const cJSON root)
private

Definition at line 1384 of file SVFFileSystem.cpp.

1385 {
1386 #define READ_CREATE_NODE_FWD(GType) \
1387  [](const cJSON*& nodeJson) { \
1388  JSON_DEF_READ_FWD(nodeJson, NodeID, id); \
1389  JSON_DEF_READ_FWD(nodeJson, GNodeK, nodeKind); \
1390  return std::make_pair(id, create##GType##Node(id, nodeKind)); \
1391  }
1392 #define READ_CREATE_EDGE_FWD(GType) \
1393  [](const cJSON*& edgeJson) { \
1394  JSON_DEF_READ_FWD(edgeJson, GEdgeFlag, edgeFlag); \
1395  auto kind = applyEdgeMask(edgeFlag); \
1396  auto edge = create##GType##Edge(kind); \
1397  setEdgeFlag(edge, edgeFlag); \
1398  return edge; \
1399  }
1400 
1401  ABORT_IFNOT(jsonIsObject(root), "Root should be an object");
1402 
1403  const cJSON* const svfModule = root->child;
1404  CHECK_JSON_KEY(svfModule);
1406  svfModule,
1407  // SVFType Creator
1408  [](const cJSON*& svfTypeFldJson)
1409  {
1410  JSON_DEF_READ_FWD(svfTypeFldJson, SVFType::GNodeK, kind);
1411  JSON_DEF_READ_FWD(svfTypeFldJson, bool, isSingleValTy);
1412  return createSVFType(kind, isSingleValTy);
1413  },
1414  // SVFType Filler
1415  [this](const cJSON*& svfVarFldJson, SVFType* type)
1416  {
1417  virtFill(svfVarFldJson, type);
1418  },
1419  // SVFValue Creator
1420  [this](const cJSON*& svfValueFldJson)
1421  {
1422  JSON_DEF_READ_FWD(svfValueFldJson, SVFValue::GNodeK, kind);
1423  JSON_DEF_READ_FWD(svfValueFldJson, const SVFType*, type, {});
1424  JSON_DEF_READ_FWD(svfValueFldJson, std::string, name);
1425  return createSVFValue(kind, type, std::move(name));
1426  },
1427  // SVFValue Filler
1428  [this](const cJSON*& svfVarFldJson, SVFValue* value)
1429  {
1430  virtFill(svfVarFldJson, value);
1431  },
1432  // StInfo Creator (no filler needed)
1433  [this](const cJSON*& stInfoFldJson)
1434  {
1435  JSON_DEF_READ_FWD(stInfoFldJson, u32_t, stride);
1436  auto si = new StInfo(stride);
1437  fill(stInfoFldJson, si);
1438  ABORT_IFNOT(!stInfoFldJson, "StInfo has extra field");
1439  return si;
1440  });
1441 
1442  const cJSON* const symInfo = svfModule->next;
1443  CHECK_JSON_KEY(symInfo);
1445  symInfo,
1446  // MemObj Creator (no filler needed)
1447  [this](const cJSON*& memObjFldJson)
1448  {
1449  JSON_DEF_READ_FWD(memObjFldJson, SymID, symId);
1450  JSON_DEF_READ_FWD(memObjFldJson, ObjTypeInfo*, typeInfo, {});
1451  JSON_DEF_READ_FWD(memObjFldJson, const SVFValue*, refVal, {});
1452  return std::make_pair(symId, new MemObj(symId, typeInfo, refVal));
1453  });
1454 
1455  const cJSON* const icfg = symInfo->next;
1456  CHECK_JSON_KEY(icfg);
1458  READ_CREATE_EDGE_FWD(ICFG),
1459  [](auto)
1460  {
1461  return new SVFLoop({}, 0);
1462  });
1463 
1464  const cJSON* const chgraph = icfg->next;
1465  CHECK_JSON_KEY(chgraph);
1467  READ_CREATE_EDGE_FWD(CH));
1468 
1469  const cJSON* const irGraph = chgraph->next;
1470  CHECK_JSON_KEY(irGraph);
1473 
1475  [this](const cJSON*& j, ICFGNode* node)
1476  {
1477  virtFill(j, node);
1478  },
1479  [this](const cJSON*& j, ICFGEdge* edge)
1480  {
1481  virtFill(j, edge);
1482  },
1483  [this](const cJSON*& j, SVFLoop* loop)
1484  {
1485  fill(j, loop);
1486  });
1488  [this](const cJSON*& j, CHNode* node)
1489  {
1490  virtFill(j, node);
1491  },
1492  [this](const cJSON*& j, CHEdge* edge)
1493  {
1494  virtFill(j, edge);
1495  });
1497  [this](const cJSON*& j, SVFVar* var)
1498  {
1499  virtFill(j, var);
1500  },
1501  [this](const cJSON*& j, SVFStmt* stmt)
1502  {
1503  virtFill(j, stmt);
1504  });
1505 
1506  return irGraph->next;
1507 
1508 #undef READ_CREATE_EDGE_FWD
1509 #undef READ_CREATE_NODE_FWD
1510 }
unsigned u32_t
Definition: CommandLine.h:18
#define READ_CREATE_EDGE_FWD(GType)
#define READ_CREATE_NODE_FWD(GType)
#define JSON_DEF_READ_FWD(json, type, obj,...)
Definition: SVFFileSystem.h:88
#define CHECK_JSON_KEY(obj)
Definition: SVFFileSystem.h:96
newitem type
Definition: cJSON.cpp:2739
const char *const name
Definition: cJSON.h:264
const char *const string
Definition: cJSON.h:172
void createObjs(const cJSON *graphJson, NodeCreator nodeCreator, EdgeCreator edgeCreator)
void fillObjs(NodeFiller nodeFiller, EdgeFiller edgeFiller)
void fillObjs(NodeFiller nodeFiller, EdgeFiller edgeFiller, LoopFiller loopFiller)
void createObjs(const cJSON *icfgJson, NodeCreator nodeCreator, EdgeCreator edgeCreator, SVFLoopCreator svfLoopCreator)
IRGraphReader irGraphReader
SVFModuleReader svfModuleReader
void fill(const cJSON *&fieldJson, SVFVar *var)
CHGraphReader chGraphReader
ICFGReader icfgReader
void virtFill(const cJSON *&fieldJson, SVFVar *var)
SymbolTableInfoReader symTableReader
void createObjs(const cJSON *svfModuleJson, SVFTypeCreator typeCreator, SVFTypeFiller typeFiller, SVFValueCreator valueCreator, SVFValueFiller valueFiller, StInfoCreator stInfoCreator)
s64_t GNodeK
Definition: SVFType.h:163
s64_t GNodeK
Definition: SVFValue.h:184
void createObjs(const cJSON *symTabJson, MemObjCreator memObjCreator)
constexpr std::remove_reference< T >::type && move(T &&t) noexcept
Definition: SVFUtil.h:447
static SVFValue * createSVFValue(SVFValue::GNodeK kind, const SVFType *type, std::string &&name)
SVFType * createSVFType(SVFType::GNodeK kind, bool isSingleValTy)
SVFIR PAG
Definition: SVFIR.h:700
bool jsonIsObject(const cJSON *item)
unsigned SymID
Definition: GeneralType.h:57
Definition: cJSON.h:104
struct cJSON * child
Definition: cJSON.h:109
struct cJSON * next
Definition: cJSON.h:106

◆ createPAGEdge()

SVFStmt * SVF::SVFIRReader::createPAGEdge ( GEdgeKind  kind)
staticprivate

Definition at line 1641 of file SVFFileSystem.cpp.

1642 {
1643  switch (kind)
1644  {
1645  default:
1646  ABORT_MSG(kind << " is an impossible SVFStmtKind in create()");
1647 #define CASE(kind, constructor) \
1648  case SVFStmt::kind: \
1649  return new constructor;
1650  CASE(Addr, AddrStmt);
1651  CASE(Copy, CopyStmt);
1652  CASE(Store, StoreStmt);
1653  CASE(Load, LoadStmt);
1654  CASE(Call, CallPE);
1655  CASE(Ret, RetPE);
1656  CASE(Gep, GepStmt);
1657  CASE(Phi, PhiStmt);
1658  CASE(Select, SelectStmt);
1659  CASE(Cmp, CmpStmt);
1660  CASE(BinaryOp, BinaryOPStmt);
1661  CASE(UnaryOp, UnaryOPStmt);
1662  CASE(Branch, BranchStmt);
1663  CASE(ThreadFork, TDForkPE);
1664  CASE(ThreadJoin, TDJoinPE);
1665 #undef CASE
1666  }
1667 }

◆ createPAGNode()

SVFVar * SVF::SVFIRReader::createPAGNode ( NodeID  id,
GNodeK  kind 
)
staticprivate

Definition at line 1619 of file SVFFileSystem.cpp.

1620 {
1621  switch (kind)
1622  {
1623  default:
1624  ABORT_MSG(kind << " is an impossible SVFVarKind in create()");
1625 #define CASE(kind, constructor) \
1626  case SVFVar::kind: \
1627  return new constructor(id);
1628  CASE(ValNode, ValVar);
1629  CASE(RetNode, RetPN);
1630  CASE(ObjNode, ObjVar);
1631  CASE(VarargNode, VarArgPN);
1632  CASE(GepValNode, GepValVar);
1633  CASE(GepObjNode, GepObjVar);
1634  CASE(FIObjNode, FIObjVar);
1635  CASE(DummyValNode, DummyValVar);
1636  CASE(DummyObjNode, DummyObjVar);
1637 #undef CASE
1638  }
1639 }

◆ fill() [1/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
AddrStmt stmt 
)
private

Definition at line 2028 of file SVFFileSystem.cpp.

2029 {
2030  fill(fieldJson, static_cast<AssignStmt*>(stmt));
2031 }

◆ fill() [2/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
AssignStmt stmt 
)
private

Definition at line 2023 of file SVFFileSystem.cpp.

2024 {
2025  fill(fieldJson, static_cast<SVFStmt*>(stmt));
2026 }

◆ fill() [3/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
BinaryOPStmt stmt 
)
private

Definition at line 2094 of file SVFFileSystem.cpp.

2095 {
2096  fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2097  JSON_READ_FIELD_FWD(fieldJson, stmt, opcode);
2098 }
#define JSON_READ_FIELD_FWD(json, objptr, field)
Definition: SVFFileSystem.h:91

◆ fill() [4/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
BranchStmt stmt 
)
private

Definition at line 2106 of file SVFFileSystem.cpp.

2107 {
2108  fill(fieldJson, static_cast<SVFStmt*>(stmt));
2109  JSON_READ_FIELD_FWD(fieldJson, stmt, successors);
2110  JSON_READ_FIELD_FWD(fieldJson, stmt, cond);
2111  JSON_READ_FIELD_FWD(fieldJson, stmt, brInst);
2112 }

◆ fill() [5/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
CallCFGEdge edge 
)
private

Definition at line 2245 of file SVFFileSystem.cpp.

2246 {
2247  fill(fieldJson, static_cast<ICFGEdge*>(edge));
2248  JSON_READ_FIELD_FWD(fieldJson, edge, callPEs);
2249 }

◆ fill() [6/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
CallICFGNode node 
)
private

Definition at line 2203 of file SVFFileSystem.cpp.

2204 {
2205  fill(fieldJson, static_cast<ICFGNode*>(node));
2206  JSON_READ_FIELD_FWD(fieldJson, node, ret);
2207  JSON_READ_FIELD_FWD(fieldJson, node, APNodes);
2208 }

◆ fill() [7/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
CallPE stmt 
)
private

Definition at line 2056 of file SVFFileSystem.cpp.

2057 {
2058  fill(fieldJson, static_cast<AssignStmt*>(stmt));
2059  JSON_READ_FIELD_FWD(fieldJson, stmt, call);
2060  JSON_READ_FIELD_FWD(fieldJson, stmt, entry);
2061 }

◆ fill() [8/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
CmpStmt stmt 
)
private

Definition at line 2088 of file SVFFileSystem.cpp.

2089 {
2090  fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2091  JSON_READ_FIELD_FWD(fieldJson, stmt, predicate);
2092 }

◆ fill() [9/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
CopyStmt stmt 
)
private

Definition at line 2033 of file SVFFileSystem.cpp.

2034 {
2035  fill(fieldJson, static_cast<AssignStmt*>(stmt));
2036  JSON_READ_FIELD_FWD(fieldJson, stmt, copyKind);
2037 }

◆ fill() [10/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
DummyObjVar var 
)
private

Definition at line 1977 of file SVFFileSystem.cpp.

1978 {
1979  fill(fieldJson, static_cast<ObjVar*>(var));
1980 }

◆ fill() [11/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
DummyValVar var 
)
private

Definition at line 1972 of file SVFFileSystem.cpp.

1973 {
1974  fill(fieldJson, static_cast<ValVar*>(var));
1975 }

◆ fill() [12/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
FIObjVar var 
)
private

Definition at line 1957 of file SVFFileSystem.cpp.

1958 {
1959  fill(fieldJson, static_cast<ObjVar*>(var));
1960 }

◆ fill() [13/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
FunEntryICFGNode node 
)
private

Definition at line 2191 of file SVFFileSystem.cpp.

2192 {
2193  fill(fieldJson, static_cast<ICFGNode*>(node));
2194  JSON_READ_FIELD_FWD(fieldJson, node, FPNodes);
2195 }

◆ fill() [14/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
FunExitICFGNode node 
)
private

Definition at line 2197 of file SVFFileSystem.cpp.

2198 {
2199  fill(fieldJson, static_cast<ICFGNode*>(node));
2200  JSON_READ_FIELD_FWD(fieldJson, node, formalRet);
2201 }

◆ fill() [15/68]

template<typename NodeTy >
void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
GenericEdge< NodeTy > *  edge 
)
inlineprivate

Definition at line 1323 of file SVFFileSystem.h.

1324  {
1325  // edgeFlag has already been read.
1326  JSON_READ_FIELD_FWD(fieldJson, edge, src);
1327  JSON_READ_FIELD_FWD(fieldJson, edge, dst);
1328  }

◆ fill() [16/68]

template<typename NodeTy , typename EdgeTy >
void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
GenericNode< NodeTy, EdgeTy > *  node 
)
inlineprivate

Definition at line 1315 of file SVFFileSystem.h.

1316  {
1317  // id and nodeKind have already been read.
1318  JSON_READ_FIELD_FWD(fieldJson, node, InEdges);
1319  JSON_READ_FIELD_FWD(fieldJson, node, OutEdges);
1320  }

◆ fill() [17/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
GepObjVar var 
)
private

Definition at line 1950 of file SVFFileSystem.cpp.

1951 {
1952  fill(fieldJson, static_cast<ObjVar*>(var));
1953  JSON_READ_FIELD_FWD(fieldJson, var, apOffset);
1954  JSON_READ_FIELD_FWD(fieldJson, var, base);
1955 }

◆ fill() [18/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
GepStmt stmt 
)
private

Definition at line 2049 of file SVFFileSystem.cpp.

2050 {
2051  fill(fieldJson, static_cast<AssignStmt*>(stmt));
2052  JSON_READ_FIELD_FWD(fieldJson, stmt, ap);
2053  JSON_READ_FIELD_FWD(fieldJson, stmt, variantField);
2054 }

◆ fill() [19/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
GepValVar var 
)
private

Definition at line 1943 of file SVFFileSystem.cpp.

1944 {
1945  fill(fieldJson, static_cast<ValVar*>(var));
1946  JSON_READ_FIELD_FWD(fieldJson, var, ap);
1947  JSON_READ_FIELD_FWD(fieldJson, var, gepValType);
1948 }

◆ fill() [20/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
GlobalICFGNode node 
)
private

Definition at line 2175 of file SVFFileSystem.cpp.

2176 {
2177  fill(fieldJson, static_cast<ICFGNode*>(node));
2178 }

◆ fill() [21/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
ICFGEdge edge 
)
private

Definition at line 2233 of file SVFFileSystem.cpp.

2234 {
2235  fill(fieldJson, static_cast<GenericICFGEdgeTy*>(edge));
2236 }
GenericEdge< ICFGNode > GenericICFGEdgeTy
Definition: ICFGEdge.h:38

◆ fill() [22/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
ICFGNode node 
)
private

Definition at line 2166 of file SVFFileSystem.cpp.

2167 {
2168  fill(fieldJson, static_cast<GenericICFGNodeTy*>(node));
2169  JSON_READ_FIELD_FWD(fieldJson, node, fun);
2170  JSON_READ_FIELD_FWD(fieldJson, node, bb);
2171  // Skip VFGNodes as it is empty
2172  JSON_READ_FIELD_FWD(fieldJson, node, pagEdges);
2173 }
GenericNode< ICFGNode, ICFGEdge > GenericICFGNodeTy
Definition: ICFGNode.h:46

◆ fill() [23/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
InterICFGNode node 
)
private

Definition at line 2186 of file SVFFileSystem.cpp.

2187 {
2188  fill(fieldJson, static_cast<ICFGNode*>(node));
2189 }

◆ fill() [24/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
IntraCFGEdge edge 
)
private

Definition at line 2238 of file SVFFileSystem.cpp.

2239 {
2240  fill(fieldJson, static_cast<ICFGEdge*>(edge));
2241  JSON_READ_FIELD_FWD(fieldJson, edge, conditionVar);
2242  JSON_READ_FIELD_FWD(fieldJson, edge, branchCondVal);
2243 }

◆ fill() [25/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
IntraICFGNode node 
)
private

Definition at line 2180 of file SVFFileSystem.cpp.

2181 {
2182  fill(fieldJson, static_cast<ICFGNode*>(node));
2183  JSON_READ_FIELD_FWD(fieldJson, node, isRet);
2184 }

◆ fill() [26/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
LoadStmt stmt 
)
private

Definition at line 2044 of file SVFFileSystem.cpp.

2045 {
2046  fill(fieldJson, static_cast<AssignStmt*>(stmt));
2047 }

◆ fill() [27/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
MemObj memObj 
)
private

Definition at line 2124 of file SVFFileSystem.cpp.

2125 {
2126  // symId has already been read
2127  JSON_READ_FIELD_FWD(fieldJson, memObj, typeInfo);
2128  JSON_READ_FIELD_FWD(fieldJson, memObj, refVal);
2129 }

◆ fill() [28/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
MultiOpndStmt stmt 
)
private

Definition at line 2070 of file SVFFileSystem.cpp.

2071 {
2072  fill(fieldJson, static_cast<SVFStmt*>(stmt));
2073  JSON_READ_FIELD_FWD(fieldJson, stmt, opVars);
2074 }

◆ fill() [29/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
ObjVar var 
)
private

Definition at line 1937 of file SVFFileSystem.cpp.

1938 {
1939  fill(fieldJson, static_cast<SVFVar*>(var));
1940  JSON_READ_FIELD_FWD(fieldJson, var, mem);
1941 }

◆ fill() [30/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
PhiStmt stmt 
)
private

Definition at line 2076 of file SVFFileSystem.cpp.

2077 {
2078  fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2079  JSON_READ_FIELD_FWD(fieldJson, stmt, opICFGNodes);
2080 }

◆ fill() [31/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
RetCFGEdge edge 
)
private

Definition at line 2251 of file SVFFileSystem.cpp.

2252 {
2253  fill(fieldJson, static_cast<ICFGEdge*>(edge));
2254  JSON_READ_FIELD_FWD(fieldJson, edge, retPE);
2255 }

◆ fill() [32/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
RetICFGNode node 
)
private

Definition at line 2210 of file SVFFileSystem.cpp.

2211 {
2212  fill(fieldJson, static_cast<ICFGNode*>(node));
2213  JSON_READ_FIELD_FWD(fieldJson, node, actualRet);
2214  JSON_READ_FIELD_FWD(fieldJson, node, callBlockNode);
2215 }

◆ fill() [33/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
RetPE stmt 
)
private

Definition at line 2063 of file SVFFileSystem.cpp.

2064 {
2065  fill(fieldJson, static_cast<AssignStmt*>(stmt));
2066  JSON_READ_FIELD_FWD(fieldJson, stmt, call);
2067  JSON_READ_FIELD_FWD(fieldJson, stmt, exit);
2068 }

◆ fill() [34/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
RetPN var 
)
private

Definition at line 1962 of file SVFFileSystem.cpp.

1963 {
1964  fill(fieldJson, static_cast<ValVar*>(var));
1965 }

◆ fill() [35/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SelectStmt stmt 
)
private

Definition at line 2082 of file SVFFileSystem.cpp.

2083 {
2084  fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2085  JSON_READ_FIELD_FWD(fieldJson, stmt, condition);
2086 }

◆ fill() [36/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
StInfo stInfo 
)
private

Definition at line 2131 of file SVFFileSystem.cpp.

2132 {
2133 #define F(field) JSON_READ_FIELD_FWD(fieldJson, stInfo, field)
2134  // stride has already been read upon construction
2135  F(numOfFlattenElements);
2136  F(numOfFlattenFields);
2137  F(fldIdxVec);
2138  F(elemIdxVec);
2139  F(fldIdx2TypeMap);
2140  F(finfo);
2141  F(flattenElementTypes);
2142 #undef F
2143 }
#define F(f)

◆ fill() [37/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
StoreStmt stmt 
)
private

Definition at line 2039 of file SVFFileSystem.cpp.

2040 {
2041  fill(fieldJson, static_cast<AssignStmt*>(stmt));
2042 }

◆ fill() [38/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFArgument value 
)
private

Definition at line 2395 of file SVFFileSystem.cpp.

2396 {
2397  fill(fieldJson, static_cast<SVFValue*>(value));
2398  JSON_READ_FIELD_FWD(fieldJson, value, fun);
2399  JSON_READ_FIELD_FWD(fieldJson, value, argNo);
2400  JSON_READ_FIELD_FWD(fieldJson, value, uncalled);
2401 }

◆ fill() [39/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFArrayType type 
)
private

Definition at line 2494 of file SVFFileSystem.cpp.

2495 {
2496  fill(fieldJson, static_cast<SVFType*>(type));
2497  JSON_READ_FIELD_FWD(fieldJson, type, numOfElement);
2498  JSON_READ_FIELD_FWD(fieldJson, type, typeOfElement);
2499 }

◆ fill() [40/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFBasicBlock value 
)
private

Definition at line 2352 of file SVFFileSystem.cpp.

2353 {
2354  fill(fieldJson, static_cast<SVFValue*>(value));
2355  JSON_READ_FIELD_FWD(fieldJson, value, succBBs);
2356  JSON_READ_FIELD_FWD(fieldJson, value, predBBs);
2357  JSON_READ_FIELD_FWD(fieldJson, value, fun);
2358 }

◆ fill() [41/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFBlackHoleValue value 
)
private

Definition at line 2426 of file SVFFileSystem.cpp.

2427 {
2428  fill(fieldJson, static_cast<SVFConstantData*>(value));
2429 }

◆ fill() [42/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFCallInst value 
)
private

Definition at line 2368 of file SVFFileSystem.cpp.

2369 {
2370  fill(fieldJson, static_cast<SVFInstruction*>(value));
2371  JSON_READ_FIELD_FWD(fieldJson, value, args);
2372  JSON_READ_FIELD_FWD(fieldJson, value, varArg);
2373  JSON_READ_FIELD_FWD(fieldJson, value, calledVal);
2374 }

◆ fill() [43/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFConstant value 
)
private

Definition at line 2384 of file SVFFileSystem.cpp.

2385 {
2386  fill(fieldJson, static_cast<SVFValue*>(value));
2387 }

◆ fill() [44/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFConstantData value 
)
private

Definition at line 2403 of file SVFFileSystem.cpp.

2404 {
2405  fill(fieldJson, static_cast<SVFConstant*>(value));
2406 }

◆ fill() [45/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFConstantFP value 
)
private

Definition at line 2415 of file SVFFileSystem.cpp.

2416 {
2417  fill(fieldJson, static_cast<SVFConstantData*>(value));
2418  JSON_READ_FIELD_FWD(fieldJson, value, dval);
2419 }

◆ fill() [46/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFConstantInt value 
)
private

Definition at line 2408 of file SVFFileSystem.cpp.

2409 {
2410  fill(fieldJson, static_cast<SVFConstantData*>(value));
2411  JSON_READ_FIELD_FWD(fieldJson, value, zval);
2412  JSON_READ_FIELD_FWD(fieldJson, value, sval);
2413 }

◆ fill() [47/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFConstantNullPtr value 
)
private

Definition at line 2421 of file SVFFileSystem.cpp.

2422 {
2423  fill(fieldJson, static_cast<SVFConstantData*>(value));
2424 }

◆ fill() [48/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFFunction value 
)
private

Definition at line 2334 of file SVFFileSystem.cpp.

2335 {
2336  fill(fieldJson, static_cast<SVFValue*>(value));
2337 #define F(f) JSON_READ_FIELD_FWD(fieldJson, value, f)
2338  F(isDecl);
2339  F(intrinsic);
2340  F(addrTaken);
2341  F(isUncalled);
2342  F(isNotRet);
2343  F(varArg);
2344  F(funcType);
2345  F(loopAndDom);
2346  F(realDefFun);
2347  F(allBBs);
2348  F(allArgs);
2349 #undef F
2350 }

◆ fill() [49/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFFunctionType type 
)
private

Definition at line 2482 of file SVFFileSystem.cpp.

2483 {
2484  fill(fieldJson, static_cast<SVFType*>(type));
2485  JSON_READ_FIELD_FWD(fieldJson, type, retTy);
2486 }

◆ fill() [50/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFGlobalValue value 
)
private

Definition at line 2389 of file SVFFileSystem.cpp.

2390 {
2391  fill(fieldJson, static_cast<SVFConstant*>(value));
2392  JSON_READ_FIELD_FWD(fieldJson, value, realDefGlobal);
2393 }

◆ fill() [51/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFInstruction value 
)
private

Definition at line 2360 of file SVFFileSystem.cpp.

2361 {
2362  fill(fieldJson, static_cast<SVFValue*>(value));
2363  JSON_READ_FIELD_FWD(fieldJson, value, bb);
2364  JSON_READ_FIELD_FWD(fieldJson, value, terminator);
2365  JSON_READ_FIELD_FWD(fieldJson, value, ret);
2366 }

◆ fill() [52/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFIntegerType type 
)
private

Definition at line 2476 of file SVFFileSystem.cpp.

2477 {
2478  fill(fieldJson, static_cast<SVFType*>(type));
2479  JSON_READ_FIELD_FWD(fieldJson, type, signAndWidth);
2480 }

◆ fill() [53/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFLoop loop 
)
private

Definition at line 2257 of file SVFFileSystem.cpp.

2258 {
2259 #define F(field) JSON_READ_FIELD_FWD(fieldJson, loop, field)
2260  F(entryICFGEdges);
2261  F(backICFGEdges);
2262  F(inICFGEdges);
2263  F(outICFGEdges);
2264  F(icfgNodes);
2265  F(loopBound);
2266 #undef F
2267 }

◆ fill() [54/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFMetadataAsValue value 
)
private

Definition at line 2436 of file SVFFileSystem.cpp.

2437 {
2438  fill(fieldJson, static_cast<SVFOtherValue*>(value));
2439 }

◆ fill() [55/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFOtherType type 
)
private

Definition at line 2501 of file SVFFileSystem.cpp.

2502 {
2503  fill(fieldJson, static_cast<SVFType*>(type));
2504  JSON_READ_FIELD_FWD(fieldJson, type, repr);
2505 }

◆ fill() [56/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFOtherValue value 
)
private

Definition at line 2431 of file SVFFileSystem.cpp.

2432 {
2433  fill(fieldJson, static_cast<SVFValue*>(value));
2434 }

◆ fill() [57/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFPointerType type 
)
private

Definition at line 2471 of file SVFFileSystem.cpp.

2472 {
2473  fill(fieldJson, static_cast<SVFType*>(type));
2474 }

◆ fill() [58/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFStmt stmt 
)
private

Definition at line 2014 of file SVFFileSystem.cpp.

2015 {
2016  fill(fieldJson, static_cast<GenericPAGEdgeTy*>(stmt));
2017  JSON_READ_FIELD_FWD(fieldJson, stmt, value);
2018  JSON_READ_FIELD_FWD(fieldJson, stmt, basicBlock);
2019  JSON_READ_FIELD_FWD(fieldJson, stmt, icfgNode);
2020  JSON_READ_FIELD_FWD(fieldJson, stmt, edgeId);
2021 }
GenericEdge< SVFVar > GenericPAGEdgeTy
Definition: SVFStatements.h:45

◆ fill() [59/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFStructType type 
)
private

Definition at line 2488 of file SVFFileSystem.cpp.

2489 {
2490  fill(fieldJson, static_cast<SVFType*>(type));
2491  JSON_READ_FIELD_FWD(fieldJson, type, name);
2492 }

◆ fill() [60/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFType type 
)
private

Definition at line 2465 of file SVFFileSystem.cpp.

2466 {
2467  // kind has already been read
2468  JSON_READ_FIELD_FWD(fieldJson, type, typeinfo);
2469 }

◆ fill() [61/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFValue value 
)
private

Definition at line 2326 of file SVFFileSystem.cpp.

2327 {
2328  // kind, type, name have already been read.
2329  JSON_READ_FIELD_FWD(fieldJson, value, ptrInUncalledFun);
2330  JSON_READ_FIELD_FWD(fieldJson, value, constDataOrAggData);
2331  JSON_READ_FIELD_FWD(fieldJson, value, sourceLoc);
2332 }

◆ fill() [62/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFVar var 
)
private

Definition at line 1923 of file SVFFileSystem.cpp.

1924 {
1925  fill(fieldJson, static_cast<GenericPAGNodeTy*>(var));
1926  JSON_READ_FIELD_FWD(fieldJson, var, value);
1927  JSON_READ_FIELD_FWD(fieldJson, var, InEdgeKindToSetMap);
1928  JSON_READ_FIELD_FWD(fieldJson, var, OutEdgeKindToSetMap);
1929  JSON_READ_FIELD_FWD(fieldJson, var, isPtr);
1930 }
GenericNode< SVFVar, SVFStmt > GenericPAGNodeTy
Definition: SVFVariables.h:40

◆ fill() [63/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
SVFVirtualCallInst value 
)
private

Definition at line 2376 of file SVFFileSystem.cpp.

2377 {
2378  fill(fieldJson, static_cast<SVFCallInst*>(value));
2379  JSON_READ_FIELD_FWD(fieldJson, value, vCallVtblPtr);
2380  JSON_READ_FIELD_FWD(fieldJson, value, virtualFunIdx);
2381  JSON_READ_FIELD_FWD(fieldJson, value, funNameOfVcall);
2382 }

◆ fill() [64/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
TDForkPE stmt 
)
private

Definition at line 2114 of file SVFFileSystem.cpp.

2115 {
2116  fill(fieldJson, static_cast<CallPE*>(stmt));
2117 }

◆ fill() [65/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
TDJoinPE stmt 
)
private

Definition at line 2119 of file SVFFileSystem.cpp.

2120 {
2121  fill(fieldJson, static_cast<RetPE*>(stmt));
2122 }

◆ fill() [66/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
UnaryOPStmt stmt 
)
private

Definition at line 2100 of file SVFFileSystem.cpp.

2101 {
2102  fill(fieldJson, static_cast<SVFStmt*>(stmt));
2103  JSON_READ_FIELD_FWD(fieldJson, stmt, opcode);
2104 }

◆ fill() [67/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
ValVar var 
)
private

Definition at line 1932 of file SVFFileSystem.cpp.

1933 {
1934  fill(fieldJson, static_cast<SVFVar*>(var));
1935 }

◆ fill() [68/68]

void SVF::SVFIRReader::fill ( const cJSON *&  fieldJson,
VarArgPN var 
)
private

Definition at line 1967 of file SVFFileSystem.cpp.

1968 {
1969  fill(fieldJson, static_cast<ValVar*>(var));
1970 }

◆ read() [1/2]

SVFIR * SVF::SVFIRReader::read ( const cJSON root)
private

Definition at line 1336 of file SVFFileSystem.cpp.

1337 {
1338  const cJSON* svfirField = createObjs(root);
1339 
1340  SVFIR* svfIR = SVFIR::getPAG(); // SVFIR constructor sets symInfo
1341  IRGraph* irGraph = svfIR;
1342 
1343  auto svfModule = SVFModule::getSVFModule();
1344  auto icfg = new ICFG();
1345  auto chgraph = new CHGraph(svfModule);
1346  auto symInfo = SymbolTableInfo::SymbolInfo();
1347  symInfo->mod = svfModule;
1348 
1349  svfIR->svfModule = svfModule;
1350  svfIR->icfg = icfg;
1351  svfIR->chgraph = chgraph;
1352 
1353 #define F(field) JSON_READ_FIELD_FWD(svfirField, svfIR, field)
1354  readJson(symInfo);
1355  readJson(irGraph);
1356  readJson(icfg);
1357  readJson(chgraph);
1358  readJson(svfModule);
1359 
1360  F(icfgNode2SVFStmtsMap);
1361  F(icfgNode2PTASVFStmtsMap);
1362  F(GepValObjMap);
1363  F(typeLocSetsMap);
1364  F(GepObjVarMap);
1365  F(memToFieldsMap);
1366  F(globSVFStmtSet);
1367  F(phiNodeMap);
1368  F(funArgsListMap);
1369  F(callSiteArgsListMap);
1370  F(callSiteRetMap);
1371  F(funRetMap);
1372  F(indCallSiteToFunPtrMap);
1373  F(funPtrToCallSitesMap);
1374  F(candidatePointers);
1375  F(callSiteSet);
1376 #undef F
1377  assert(!NodeIDAllocator::allocator && "NodeIDAllocator should be NULL");
1378  auto nodeIDAllocator = NodeIDAllocator::get();
1379  JSON_READ_OBJ_FWD(svfirField, nodeIDAllocator);
1380 
1381  return svfIR;
1382 }
#define JSON_READ_OBJ_FWD(json, obj)
Definition: SVFFileSystem.h:86
static NodeIDAllocator * get(void)
Return (singleton) allocator.
static NodeIDAllocator * allocator
Single allocator.
static void readJson(const cJSON *obj, bool &flag)
const cJSON * createObjs(const cJSON *root)
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition: SVFIR.h:115
static SVFModule * getSVFModule()
Definition: SVFModule.cpp:60
static SymbolTableInfo * SymbolInfo()
Singleton design here to make sure we only have one instance during any analysis.

◆ read() [2/2]

SVFIR * SVF::SVFIRReader::read ( const std::string path)
static

Definition at line 2507 of file SVFFileSystem.cpp.

2508 {
2509  struct stat buf;
2510  int fd = open(path.c_str(), O_RDONLY);
2511  if (fd == -1)
2512  {
2513  std::string info = "open(\"" + path + "\")";
2514  perror(info.c_str());
2515  abort();
2516  }
2517  if (fstat(fd, &buf) == -1)
2518  {
2519  std::string info = "fstate(\"" + path + "\")";
2520  perror(info.c_str());
2521  abort();
2522  }
2523  auto addr =
2524  (char*)mmap(nullptr, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
2525  if (addr == MAP_FAILED)
2526  {
2527  std::string info = "mmap(content of \"" + path + "\")";
2528  perror(info.c_str());
2529  abort();
2530  }
2531 
2532  auto root = cJSON_ParseWithLength(addr, buf.st_size);
2533 
2534  if (munmap(addr, buf.st_size) == -1)
2535  perror("munmap()");
2536 
2537  if (close(fd) < 0)
2538  perror("close()");
2539 
2540  SVFIRReader reader;
2541  SVFIR* ir = reader.read(root);
2542 
2543  cJSON_Delete(root);
2544  return ir;
2545 }
cJSON_Delete(null)

◆ readJson() [1/37]

void SVF::SVFIRReader::readJson ( CHGraph graph)
private

Definition at line 1744 of file SVFFileSystem.cpp.

1745 {
1747  const cJSON* obj = chGraphReader.getFieldJson();
1748 #define F(field) JSON_READ_FIELD_FWD(obj, graph, field)
1749  F(classNum);
1750  F(vfID);
1751  F(classNameToNodeMap);
1752  F(classNameToDescendantsMap);
1753  F(classNameToAncestorsMap);
1754  F(classNameToInstAndDescsMap);
1755  F(templateNameToInstancesMap);
1756  F(callNodeToClassesMap);
1757  F(virtualFunctionToIDMap);
1758  F(callNodeToCHAVtblsMap);
1759  F(callNodeToCHAVFnsMap);
1760 #undef F
1761 }
void saveToGenericGraph(GenericGraph< NodeTy, EdgeTy > *graph) const
const cJSON * getFieldJson() const

◆ readJson() [2/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
AccessPath ap 
)
private

Definition at line 1840 of file SVFFileSystem.cpp.

1841 {
1842  ABORT_IFNOT(jsonIsObject(obj), "Expected obj for AccessPath");
1843  obj = obj->child;
1844  JSON_READ_FIELD_FWD(obj, &ap, fldIdx);
1845  JSON_READ_FIELD_FWD(obj, &ap, idxOperandPairs);
1846  ABORT_IFNOT(!obj, "Extra field " << JSON_KEY(obj) << " in AccessPath");
1847 }
#define JSON_KEY(json)
Definition: SVFFileSystem.h:64

◆ readJson() [3/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
bool &  flag 
)
static

Definition at line 1512 of file SVFFileSystem.cpp.

1513 {
1514  ABORT_IFNOT(jsonIsBool(obj, flag), "Expect bool for " << obj->string);
1515 }
bool jsonIsBool(const cJSON *item)
char * string
Definition: cJSON.h:122

◆ readJson() [4/37]

template<typename C >
std::enable_if_t<SVFUtil::is_sequence_container_v<C> > SVF::SVFIRReader::readJson ( const cJSON obj,
C &  container 
)
inlineprivate

Definition at line 1185 of file SVFFileSystem.h.

1187  {
1188  using T = typename C::value_type;
1189  assert(container.empty() && "container should be empty");
1190  ABORT_IFNOT(jsonIsArray(obj), "vector expects an array");
1191  jsonForEach(elemJson, obj)
1192  {
1193  container.push_back(T{});
1194  readJson(elemJson, container.back());
1195  }
1196  }
#define jsonForEach(field, array)
#define ABORT_IFNOT(condition, reason)
Definition: SVFFileSystem.h:39
bool jsonIsArray(const cJSON *item)

◆ readJson() [5/37]

template<typename C >
std::enable_if_t<SVFUtil::is_map_v<C> > SVF::SVFIRReader::readJson ( const cJSON obj,
C &  map 
)
inlineprivate

Definition at line 1199 of file SVFFileSystem.h.

1200  {
1201  assert(map.empty() && "map should be empty");
1202  ABORT_IFNOT(jsonIsMap(obj), "expects an map (represented by array)");
1203  jsonForEach(elemJson, obj)
1204  {
1205  auto jpair = jsonUnpackPair(elemJson);
1206  typename C::key_type key{};
1207  readJson(jpair.first, key);
1208  auto it = map.emplace(std::move(key), typename C::mapped_type{});
1209  ABORT_IFNOT(it.second, "Duplicated map key");
1210  readJson(jpair.second, it.first->second);
1211  }
1212  }
bool jsonIsMap(const cJSON *item)
std::pair< const cJSON *, const cJSON * > jsonUnpackPair(const cJSON *item)

◆ readJson() [6/37]

template<typename C >
std::enable_if_t<SVFUtil::is_set_v<C> > SVF::SVFIRReader::readJson ( const cJSON obj,
C &  set 
)
inlineprivate

Definition at line 1215 of file SVFFileSystem.h.

1216  {
1217  using T = typename C::value_type;
1218  assert(set.empty() && "set should be empty");
1219  ABORT_IFNOT(jsonIsArray(obj), "expects an array");
1220  jsonForEach(elemJson, obj)
1221  {
1222  T elem{};
1223  readJson(elemJson, elem);
1224  auto inserted = set.insert(std::move(elem)).second;
1225  ABORT_IFNOT(inserted, "Duplicated set element");
1226  }
1227  }
set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) add_llvm_executable(wpa wpa.cpp) target_link_libraries(wpa PUBLIC $
Definition: CMakeLists.txt:1

◆ readJson() [7/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
CHEdge *&  edge 
)
private

Definition at line 1834 of file SVFFileSystem.cpp.

1835 {
1836  assert(!edge && "CHEdge already read?");
1837  edge = chGraphReader.getEdgePtr(jsonGetNumber(obj));
1838 }
EdgeTy * getEdgePtr(unsigned id) const
double jsonGetNumber(const cJSON *item)

◆ readJson() [8/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
CHNode *&  node 
)
private

Definition at line 1828 of file SVFFileSystem.cpp.

1829 {
1830  assert(!node && "CHNode already read?");
1831  node = chGraphReader.getNodePtr(jsonGetNumber(obj));
1832 }
NodeTy * getNodePtr(unsigned id) const

◆ readJson() [9/37]

template<typename T >
void SVF::SVFIRReader::readJson ( const cJSON obj,
const T *&  cptr 
)
inlineprivate

Read a const pointer.

Definition at line 1153 of file SVFFileSystem.h.

1154  {
1155  assert(!cptr && "const pointer should be NULL");
1156  T* ptr{};
1157  readJson(obj, ptr);
1158  cptr = ptr;
1159  }

◆ readJson() [10/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
float &  val 
)
static

Definition at line 1532 of file SVFFileSystem.cpp.

1533 {
1534  readSmallNumber(obj, val);
1535 }
static void readSmallNumber(const cJSON *obj, SmallNumberType &val)

◆ readJson() [11/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
ICFGEdge *&  edge 
)
private

Definition at line 1822 of file SVFFileSystem.cpp.

1823 {
1824  assert(!edge && "ICFGEdge already read?");
1825  edge = icfgReader.getEdgePtr(jsonGetNumber(obj));
1826 }

◆ readJson() [12/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
ICFGNode *&  node 
)
private

Definition at line 1815 of file SVFFileSystem.cpp.

1816 {
1817  assert(!node && "ICFGNode already read?");
1818  NodeID id = jsonGetNumber(obj);
1819  node = icfgReader.getNodePtr(id);
1820 }
u32_t NodeID
Definition: GeneralType.h:55

◆ readJson() [13/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
int &  val 
)
static

Definition at line 1522 of file SVFFileSystem.cpp.

1523 {
1524  readSmallNumber(obj, val);
1525 }

◆ readJson() [14/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
long long &  val 
)
static

Definition at line 1546 of file SVFFileSystem.cpp.

1547 {
1548  readBigNumber(obj, val,
1549  [](const char* s)
1550  {
1551  return std::strtoll(s, nullptr, 10);
1552  });
1553 }
long long strtoll(const char *str, char **endptr, int base)
Definition: extapi.c:971
static void readBigNumber(const cJSON *obj, BigNumberType &val, CStrToVal conv)

◆ readJson() [15/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
MemObj *&  memObj 
)
private

Definition at line 1856 of file SVFFileSystem.cpp.

1857 {
1858  assert(!memObj && "MemObj already read?");
1859  memObj = symTableReader.getMemObjPtr(jsonGetNumber(obj));
1860 }
MemObj * getMemObjPtr(unsigned id) const

◆ readJson() [16/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
NodeIDAllocator idAllocator 
)
private

Definition at line 1669 of file SVFFileSystem.cpp.

1670 {
1671  assert(idAllocator && "idAllocator should be nonempty");
1672 
1673  ABORT_IFNOT(jsonIsObject(obj), "Expect object for " << JSON_KEY(obj));
1674  obj = obj->child;
1675 
1676  JSON_DEF_READ_FWD(obj, int, strategy);
1677  static_assert(sizeof(idAllocator->strategy) == sizeof(strategy),
1678  "idAllocator->strategy should be represented by int");
1679  idAllocator->strategy = static_cast<NodeIDAllocator::Strategy>(strategy);
1680  JSON_READ_FIELD_FWD(obj, idAllocator, numObjects);
1681  JSON_READ_FIELD_FWD(obj, idAllocator, numValues);
1682  JSON_READ_FIELD_FWD(obj, idAllocator, numSymbols);
1683  JSON_READ_FIELD_FWD(obj, idAllocator, numNodes);
1684 
1685  ABORT_IFNOT(!obj, "Extra field " << JSON_KEY(obj) << " in NodeIDAllocator");
1686 }
Strategy
Allocation strategy to use.

◆ readJson() [17/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
ObjTypeInfo *&  objTypeInfo 
)
private

Definition at line 1862 of file SVFFileSystem.cpp.

1863 {
1864  assert(!objTypeInfo && "ObjTypeInfo already read?");
1865  ABORT_IFNOT(jsonIsObject(obj), "Expected object for objTypeInfo");
1866  cJSON* field = obj->child;
1867 
1868  JSON_DEF_READ_FWD(field, SVFType*, type, {});
1869  JSON_DEF_READ_FWD(field, u32_t, flags);
1870  JSON_DEF_READ_FWD(field, u32_t, maxOffsetLimit);
1871  JSON_DEF_READ_FWD(field, u32_t, elemNum);
1872 
1873  ABORT_IFNOT(!field, "Extra field in objTypeInfo: " << JSON_KEY(field));
1874  objTypeInfo = new ObjTypeInfo(type, maxOffsetLimit);
1875  objTypeInfo->flags = flags;
1876  objTypeInfo->elemNum = elemNum;
1877 }

◆ readJson() [18/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
short &  val 
)
static

Definition at line 1527 of file SVFFileSystem.cpp.

1528 {
1529  readSmallNumber(obj, val);
1530 }

◆ readJson() [19/37]

template<unsigned ElementSize>
void SVF::SVFIRReader::readJson ( const cJSON obj,
SparseBitVector< ElementSize > &  bv 
)
inlineprivate

Definition at line 1116 of file SVFFileSystem.h.

1117  {
1118  ABORT_IFNOT(jsonIsArray(obj), "SparseBitVector should be an array");
1119  jsonForEach(nObj, obj)
1120  {
1121  unsigned n;
1122  readJson(nObj, n);
1123  bv.set(n);
1124  }
1125  }
cJSON * n
Definition: cJSON.cpp:2558
void set(unsigned Idx)

◆ readJson() [20/37]

template<typename T1 , typename T2 >
void SVF::SVFIRReader::readJson ( const cJSON obj,
std::pair< T1, T2 > &  pair 
)
inlineprivate

Definition at line 1162 of file SVFFileSystem.h.

1163  {
1164  auto jpair = jsonUnpackPair(obj);
1165  readJson(jpair.first, pair.first);
1166  readJson(jpair.second, pair.second);
1167  }

◆ readJson() [21/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
std::string str 
)
static

Definition at line 1564 of file SVFFileSystem.cpp.

1565 {
1566  ABORT_IFNOT(jsonIsString(obj), "Expect string for " << obj->string);
1567  str = obj->valuestring;
1568 }
bool jsonIsString(const cJSON *item)
char * valuestring
Definition: cJSON.h:115

◆ readJson() [22/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
StInfo *&  stInfo 
)
private

Definition at line 1788 of file SVFFileSystem.cpp.

1789 {
1790  assert(!stInfo && "StInfo already read?");
1792 }
StInfo * getStInfoPtr(size_t id) const

◆ readJson() [23/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
SVFLoop *&  loop 
)
private

Definition at line 1849 of file SVFFileSystem.cpp.

1850 {
1851  assert(!loop && "SVFLoop already read?");
1852  unsigned id = jsonGetNumber(obj);
1853  loop = icfgReader.getSVFLoopPtr(id);
1854 }
SVFLoop * getSVFLoopPtr(size_t id) const

◆ readJson() [24/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
SVFLoopAndDomInfo *&  ldInfo 
)
private

Definition at line 1879 of file SVFFileSystem.cpp.

1880 {
1881  assert(!ldInfo && "SVFLoopAndDomInfo already read?");
1882  ABORT_IFNOT(jsonIsObject(obj), "Expected object for SVFLoopAndDomInfo");
1883  cJSON* field = obj->child;
1884 
1885  ldInfo = new SVFLoopAndDomInfo();
1886 
1887  JSON_READ_FIELD_FWD(field, ldInfo, reachableBBs);
1888  JSON_READ_FIELD_FWD(field, ldInfo, dtBBsMap);
1889  JSON_READ_FIELD_FWD(field, ldInfo, pdtBBsMap);
1890  JSON_READ_FIELD_FWD(field, ldInfo, dfBBsMap);
1891  JSON_READ_FIELD_FWD(field, ldInfo, bb2LoopMap);
1892  JSON_READ_FIELD_FWD(field, ldInfo, bb2PdomLevel);
1893  JSON_READ_FIELD_FWD(field, ldInfo, bb2PIdom);
1894 
1895  ABORT_IFNOT(!field,
1896  "Extra field in SVFLoopAndDomInfo: " << JSON_KEY(field));
1897 }

◆ readJson() [25/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
SVFStmt *&  stmt 
)
private

Definition at line 1809 of file SVFFileSystem.cpp.

1810 {
1811  assert(!stmt && "SVFStmt already read?");
1812  stmt = irGraphReader.getEdgePtr(jsonGetNumber(obj));
1813 }

◆ readJson() [26/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
SVFType *&  type 
)
private

Definition at line 1782 of file SVFFileSystem.cpp.

1783 {
1784  assert(!type && "SVFType already read?");
1786 }
SVFType * getSVFTypePtr(size_t id) const

◆ readJson() [27/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
SVFValue *&  value 
)
private

Definition at line 1794 of file SVFFileSystem.cpp.

1795 {
1796  assert(!value && "SVFValue already read?");
1798 }
SVFValue * getSVFValuePtr(size_t id) const

◆ readJson() [28/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
SVFVar *&  var 
)
private

Definition at line 1800 of file SVFFileSystem.cpp.

1801 {
1802  assert(!var && "SVFVar already read?");
1803  if (jsonIsNullId(obj))
1804  var = nullptr;
1805  else
1807 }
bool jsonIsNullId(const cJSON *item)

◆ readJson() [29/37]

template<typename T >
SVFUtil::void_t<KindBaseT<T> > SVF::SVFIRReader::readJson ( const cJSON obj,
T *&  ptr 
)
inlineprivate

Read a pointer of some child class of SVFType/SVFValue/SVFVar/SVFStmt/ICFGNode/ICFGEdge/CHNode/CHEdge.

Definition at line 1140 of file SVFFileSystem.h.

1141  {
1142  // TODO: Can be optimized?
1143  KindBaseT<T>* basePtr = ptr;
1144  readJson(obj, basePtr);
1145  if (!basePtr)
1146  return; // ptr is nullptr when read
1147  ptr = SVFUtil::dyn_cast<T>(basePtr);
1148  ABORT_IFNOT(ptr, "Cast: " << obj->string << " shouldn't have kind "
1149  << KindBaseHelper<T>::getKind(ptr));
1150  }

◆ readJson() [30/37]

template<typename T , size_t N>
void SVF::SVFIRReader::readJson ( const cJSON obj,
T(&)  array[N] 
)
inlineprivate

Definition at line 1170 of file SVFFileSystem.h.

1171  {
1172  static_assert(N > 0, "array size should be greater than 0");
1173  ABORT_IFNOT(jsonIsArray(obj), "array expects an array");
1174  size_t i = 0;
1175  jsonForEach(elemJson, obj)
1176  {
1177  readJson(elemJson, array[i]);
1178  if (++i >= N)
1179  break;
1180  }
1181  ABORT_IFNOT(i == N, "expect array of size " << N);
1182  }

◆ readJson() [31/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
unsigned &  val 
)
static

Definition at line 1517 of file SVFFileSystem.cpp.

1518 {
1519  readSmallNumber(obj, val);
1520 }

◆ readJson() [32/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
unsigned long &  val 
)
static

Definition at line 1537 of file SVFFileSystem.cpp.

1538 {
1539  readBigNumber(obj, val,
1540  [](const char* s)
1541  {
1542  return std::strtoul(s, nullptr, 10);
1543  });
1544 }
unsigned long int strtoul(const char *str, char **endptr, int base)
Definition: extapi.c:983

◆ readJson() [33/37]

void SVF::SVFIRReader::readJson ( const cJSON obj,
unsigned long long &  val 
)
static

Definition at line 1555 of file SVFFileSystem.cpp.

1556 {
1557  readBigNumber(obj, val,
1558  [](const char* s)
1559  {
1560  return std::strtoull(s, nullptr, 10);
1561  });
1562 }
unsigned long long strtoull(const char *str, char **endptr, int base)
Definition: extapi.c:989

◆ readJson() [34/37]

void SVF::SVFIRReader::readJson ( ICFG icfg)
private

Definition at line 1731 of file SVFFileSystem.cpp.

1732 {
1734  const cJSON* obj = icfgReader.getFieldJson();
1735 #define F(field) JSON_READ_FIELD_FWD(obj, icfg, field)
1736  F(totalICFGNode);
1737  F(FunToFunEntryNodeMap);
1738  F(FunToFunExitNodeMap);
1739  F(globalBlockNode);
1740  F(icfgNodeToSVFLoopVec);
1741 #undef F
1742 }

◆ readJson() [35/37]

void SVF::SVFIRReader::readJson ( IRGraph graph)
private

Definition at line 1706 of file SVFFileSystem.cpp.

1707 {
1708  assert(SymbolTableInfo::symInfo && "SymbolTableInfo should be nonempty");
1709  assert(graph->symInfo == SymbolTableInfo::SymbolInfo() && "symInfo differ");
1710 
1711  auto& valToEdgeMap = graph->valueToEdgeMap;
1712  valToEdgeMap.clear();
1713 
1715  const cJSON* obj = irGraphReader.getFieldJson();
1716 #define F(field) JSON_READ_FIELD_FWD(obj, graph, field)
1717  // base and symInfo have already been read
1718  F(KindToSVFStmtSetMap);
1719  F(KindToPTASVFStmtSetMap);
1720  F(fromFile);
1721  F(nodeNumAfterPAGBuild);
1722  F(totalPTAPAGEdge);
1723  F(valueToEdgeMap);
1724 #undef F
1725 
1726  auto nullit = valToEdgeMap.find(nullptr);
1727  ABORT_IFNOT(nullit != valToEdgeMap.end(), "valueToEdgeMap should has key NULL");
1728  ABORT_IFNOT(nullit->second.empty(), "valueToEdgeMap[NULL] should be empty");
1729 }
static SymbolTableInfo * symInfo

◆ readJson() [36/37]

void SVF::SVFIRReader::readJson ( SVFModule module)
private

Definition at line 1763 of file SVFFileSystem.cpp.

1764 {
1765  const cJSON* obj = svfModuleReader.getFieldJson();
1766  auto symInfo = SymbolTableInfo::symInfo;
1767  assert(symInfo && "SymbolTableInfo should be non-NULL");
1768  svfModuleReader.svfTypePool.saveToSet(symInfo->svfTypes);
1769  svfModuleReader.stInfoPool.saveToSet(symInfo->stInfos);
1770 
1771 #define F(field) JSON_READ_FIELD_FWD(obj, module, field)
1772  F(pagReadFromTxt);
1773  F(moduleIdentifier);
1774  F(FunctionSet);
1775  F(GlobalSet);
1776  F(AliasSet);
1777  F(ConstantSet);
1778  F(OtherValueSet);
1779 #undef F
1780 }
ReaderPtrPool< StInfo > stInfoPool
ReaderPtrPool< SVFType > svfTypePool
const cJSON * getFieldJson() const

◆ readJson() [37/37]

void SVF::SVFIRReader::readJson ( SymbolTableInfo symTabInfo)
private

Definition at line 1688 of file SVFFileSystem.cpp.

1689 {
1690  const cJSON* obj = symTableReader.getFieldJson();
1691 #define F(field) JSON_READ_FIELD_FWD(obj, symTabInfo, field)
1692  // `allMemObj` was consumed during create & fill phase.
1693  F(valSymMap);
1694  F(objSymMap);
1695  F(returnSymMap);
1696  F(varargSymMap);
1697  symTableReader.memObjMap.saveToIDToObjMap(symTabInfo->objMap); // objMap
1698  F(modelConstants);
1699  F(totalSymNum);
1700  F(maxStruct);
1701  F(maxStSize);
1702 #undef F
1703  ABORT_IFNOT(!obj, "Extra field " << JSON_KEY(obj) << " in SymbolTableInfo");
1704 }
ReaderIDToObjMap< MemObj > memObjMap
const cJSON * getFieldJson() const

◆ setEdgeFlag()

template<typename T >
static void SVF::SVFIRReader::setEdgeFlag ( GenericEdge< T > *  edge,
typename GenericEdge< T >::GEdgeFlag  edgeFlag 
)
inlinestatic

Definition at line 1060 of file SVFFileSystem.h.

1062  {
1063  edge->edgeFlag = edgeFlag;
1064  }

◆ virtFill() [1/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
CHEdge edge 
)
private

Definition at line 2279 of file SVFFileSystem.cpp.

2280 {
2281  assert(edge->getEdgeKind() == 0 && "Unknown CHEdge kind");
2282  fill(fieldJson, static_cast<GenericCHEdgeTy*>(edge));
2283  // edgeType is a enum
2284  JSON_DEF_READ_FWD(fieldJson, unsigned, edgeType);
2285  if (edgeType == CHEdge::INHERITANCE)
2286  edge->edgeType = CHEdge::INHERITANCE;
2287  else if (edgeType == CHEdge::INSTANTCE)
2288  edge->edgeType = CHEdge::INSTANTCE;
2289  else
2290  ABORT_MSG("Unknown CHEdge type " << edgeType);
2291 }
@ INHERITANCE
Definition: CHG.h:86
@ INSTANTCE
Definition: CHG.h:87
GenericEdge< CHNode > GenericCHEdgeTy
Definition: CHG.h:77

◆ virtFill() [2/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
CHNode node 
)
private

Definition at line 2269 of file SVFFileSystem.cpp.

2270 {
2271  assert(node->getNodeKind() == 0 && "Unknown CHNode kind");
2272  fill(fieldJson, static_cast<GenericCHNodeTy*>(node));
2273  JSON_READ_FIELD_FWD(fieldJson, node, vtable);
2274  JSON_READ_FIELD_FWD(fieldJson, node, className);
2275  JSON_READ_FIELD_FWD(fieldJson, node, flags);
2276  JSON_READ_FIELD_FWD(fieldJson, node, virtualFunctionVectors);
2277 }
GenericNode< CHNode, CHEdge > GenericCHNodeTy
Definition: CHG.h:107

◆ virtFill() [3/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
ICFGEdge node 
)
private

Definition at line 2217 of file SVFFileSystem.cpp.

2218 {
2219  auto kind = edge->getEdgeKind();
2220  switch (kind)
2221  {
2222  default:
2223  ABORT_MSG("Unknown ICFGEdge kind " << kind);
2224  case ICFGEdge::IntraCF:
2225  return fill(fieldJson, static_cast<IntraCFGEdge*>(edge));
2226  case ICFGEdge::CallCF:
2227  return fill(fieldJson, static_cast<CallCFGEdge*>(edge));
2228  case ICFGEdge::RetCF:
2229  return fill(fieldJson, static_cast<RetCFGEdge*>(edge));
2230  }
2231 }

◆ virtFill() [4/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
ICFGNode node 
)
private

Definition at line 2145 of file SVFFileSystem.cpp.

2146 {
2147  switch (node->getNodeKind())
2148  {
2149  default:
2150  ABORT_MSG("Unknown ICFGNode kind " << node->getNodeKind());
2151 
2152 #define CASE(NodeKind, NodeType) \
2153  case ICFGNode::NodeKind: \
2154  return fill(fieldJson, static_cast<NodeType*>(node))
2155 
2156  CASE(IntraBlock, IntraICFGNode);
2157  CASE(FunEntryBlock, FunEntryICFGNode);
2158  CASE(FunExitBlock, FunExitICFGNode);
2159  CASE(FunCallBlock, CallICFGNode);
2160  CASE(FunRetBlock, RetICFGNode);
2161  CASE(GlobalBlock, GlobalICFGNode);
2162 #undef CASE
2163  }
2164 }

◆ virtFill() [5/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
SVFStmt stmt 
)
private

Definition at line 1982 of file SVFFileSystem.cpp.

1983 {
1984  auto kind = stmt->getEdgeKind();
1985 
1986  switch (kind)
1987  {
1988  default:
1989  ABORT_MSG("Unknown SVFStmt kind " << kind);
1990 
1991 #define CASE(EdgeKind, EdgeType) \
1992  case SVFStmt::EdgeKind: \
1993  return fill(fieldJson, static_cast<EdgeType*>(stmt))
1994 
1995  CASE(Addr, AddrStmt);
1996  CASE(Copy, CopyStmt);
1997  CASE(Store, StoreStmt);
1998  CASE(Load, LoadStmt);
1999  CASE(Call, CallPE);
2000  CASE(Ret, RetPE);
2001  CASE(Gep, GepStmt);
2002  CASE(Phi, PhiStmt);
2003  CASE(Select, SelectStmt);
2004  CASE(Cmp, CmpStmt);
2005  CASE(BinaryOp, BinaryOPStmt);
2006  CASE(UnaryOp, UnaryOPStmt);
2007  CASE(Branch, BranchStmt);
2008  CASE(ThreadFork, TDForkPE);
2009  CASE(ThreadJoin, TDJoinPE);
2010 #undef CASE
2011  }
2012 }

◆ virtFill() [6/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
SVFType type 
)
private

Definition at line 2441 of file SVFFileSystem.cpp.

2442 {
2443  auto kind = type->getKind();
2444 
2445  switch (kind)
2446  {
2447  default:
2448  assert(false && "Impossible SVFType kind");
2449 
2450 #define CASE(Kind) \
2451  case SVFType::Kind: \
2452  return fill(fieldJson, SVFUtil::dyn_cast<Kind##pe>(type))
2453 
2454  CASE(SVFTy);
2455  CASE(SVFPointerTy);
2456  CASE(SVFIntegerTy);
2457  CASE(SVFFunctionTy);
2458  CASE(SVFStructTy);
2459  CASE(SVFArrayTy);
2460  CASE(SVFOtherTy);
2461 #undef CASE
2462  }
2463 }

◆ virtFill() [7/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
SVFValue value 
)
private

Definition at line 2293 of file SVFFileSystem.cpp.

2294 {
2295  auto kind = value->getKind();
2296 
2297  switch (kind)
2298  {
2299  default:
2300  ABORT_MSG("Impossible SVFValue kind " << kind);
2301 
2302 #define CASE(ValueKind, Type) \
2303  case SVFValue::ValueKind: \
2304  return fill(fieldJson, static_cast<Type*>(value))
2305 
2306  CASE(SVFVal, SVFValue);
2307  CASE(SVFFunc, SVFFunction);
2308  CASE(SVFBB, SVFBasicBlock);
2309  CASE(SVFInst, SVFInstruction);
2310  CASE(SVFCall, SVFCallInst);
2311  CASE(SVFVCall, SVFVirtualCallInst);
2312  CASE(SVFGlob, SVFGlobalValue);
2313  CASE(SVFArg, SVFArgument);
2314  CASE(SVFConst, SVFConstant);
2315  CASE(SVFConstData, SVFConstantData);
2316  CASE(SVFConstInt, SVFConstantInt);
2317  CASE(SVFConstFP, SVFConstantFP);
2318  CASE(SVFNullPtr, SVFConstantNullPtr);
2319  CASE(SVFBlackHole, SVFBlackHoleValue);
2320  CASE(SVFMetaAsValue, SVFMetadataAsValue);
2321  CASE(SVFOther, SVFOtherValue);
2322 #undef CASE
2323  }
2324 }

◆ virtFill() [8/8]

void SVF::SVFIRReader::virtFill ( const cJSON *&  fieldJson,
SVFVar var 
)
private

Definition at line 1899 of file SVFFileSystem.cpp.

1900 {
1901  switch (var->getNodeKind())
1902  {
1903  default:
1904  assert(false && "Unknown SVFVar kind");
1905 
1906 #define CASE(VarKind, VarType) \
1907  case SVFVar::VarKind: \
1908  return fill(fieldJson, static_cast<VarType*>(var))
1909 
1910  CASE(ValNode, ValVar);
1911  CASE(ObjNode, ObjVar);
1912  CASE(RetNode, RetPN);
1913  CASE(VarargNode, VarArgPN);
1914  CASE(GepValNode, GepValVar);
1915  CASE(GepObjNode, GepObjVar);
1916  CASE(FIObjNode, FIObjVar);
1917  CASE(DummyValNode, DummyValVar);
1918  CASE(DummyObjNode, DummyObjVar);
1919 #undef CASE
1920  }
1921 }

Member Data Documentation

◆ chGraphReader

CHGraphReader SVF::SVFIRReader::chGraphReader
private

Definition at line 1038 of file SVFFileSystem.h.

◆ icfgReader

ICFGReader SVF::SVFIRReader::icfgReader
private

Definition at line 1037 of file SVFFileSystem.h.

◆ irGraphReader

IRGraphReader SVF::SVFIRReader::irGraphReader
private

Definition at line 1039 of file SVFFileSystem.h.

◆ svfModuleReader

SVFModuleReader SVF::SVFIRReader::svfModuleReader
private

Definition at line 1035 of file SVFFileSystem.h.

◆ symTableReader

SymbolTableInfoReader SVF::SVFIRReader::symTableReader
private

Definition at line 1036 of file SVFFileSystem.h.


The documentation for this class was generated from the following files: