Static Value-Flow Analysis
Loading...
Searching...
No Matches
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.
 
template<typename T >
void readJson (const cJSON *obj, const T *&cptr)
 Read a const pointer.
 
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, BaseObjVar *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, 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 1030 of file SVFFileSystem.h.

Member Typedef Documentation

◆ GEdgeFlag

using SVF::SVFIRReader::GEdgeFlag = GenericEdge<void>::GEdgeFlag
private

Definition at line 1066 of file SVFFileSystem.h.

◆ GEdgeKind

using SVF::SVFIRReader::GEdgeKind = GenericEdge<void>::GEdgeKind
private

Definition at line 1067 of file SVFFileSystem.h.

◆ GNodeK

Definition at line 1065 of file SVFFileSystem.h.

Member Function Documentation

◆ applyEdgeMask()

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

Definition at line 1053 of file SVFFileSystem.h.

1054 {
1055 return edgeFlag & GenericEdge<void>::EdgeKindMask;
1056 }
static constexpr u64_t EdgeKindMask

◆ createCHEdge()

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

Definition at line 1605 of file SVFFileSystem.cpp.

1606{
1607 ABORT_IFNOT(kind == 0, "Unsupported CHEdge kind " << kind);
1608 return new CHEdge(nullptr, nullptr, {});
1609}
#define ABORT_IFNOT(condition, msg)

◆ createCHNode()

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

Definition at line 1599 of file SVFFileSystem.cpp.

1600{
1601 ABORT_IFNOT(kind == 0, "Impossible CHNode kind " << kind);
1602 return new CHNode("", id);
1603}

◆ createEdgeWithFlag()

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

Definition at line 1076 of file SVFFileSystem.h.

1077 {
1078 auto kind = SVFIRReader::applyEdgeMask(flag);
1079 auto edge = creator(kind);
1081 return edge;
1082 }
static s64_t applyEdgeMask(u64_t edgeFlag)
static void setEdgeFlag(GenericEdge< T > *edge, typename GenericEdge< T >::GEdgeFlag edgeFlag)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ createICFGEdge()

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

Definition at line 1581 of file SVFFileSystem.cpp.

1582{
1583 constexpr ICFGNode* src = nullptr;
1584 constexpr ICFGNode* dst = nullptr;
1585
1586 switch (kind)
1587 {
1588 default:
1589 ABORT_MSG(kind << " is an impossible ICFGEdgeKind in create()");
1590 case ICFGEdge::IntraCF:
1591 return new IntraCFGEdge(src, dst);
1592 case ICFGEdge::CallCF:
1593 return new CallCFGEdge(src, dst);
1594 case ICFGEdge::RetCF:
1595 return new RetCFGEdge(src, dst);
1596 }
1597}
#define ABORT_MSG(msg)

◆ createICFGNode()

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

Definition at line 1562 of file SVFFileSystem.cpp.

1563{
1564 switch (kind)
1565 {
1566 default:
1567 ABORT_MSG(kind << " is an impossible ICFGNodeKind in create()");
1568#define CASE(kind, constructor) \
1569 case ICFGNode::kind: \
1570 return new constructor(id);
1571 CASE(IntraBlock, IntraICFGNode);
1572 CASE(FunEntryBlock, FunEntryICFGNode);
1573 CASE(FunExitBlock, FunExitICFGNode);
1574 CASE(FunCallBlock, CallICFGNode);
1575 CASE(FunRetBlock, RetICFGNode);
1576 CASE(GlobalBlock, GlobalICFGNode);
1577#undef CASE
1578 }
1579}
#define CASE(Kind)

◆ createObjs()

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

Definition at line 1376 of file SVFFileSystem.cpp.

1377{
1378#define READ_CREATE_NODE_FWD(GType) \
1379 [](const cJSON*& nodeJson) { \
1380 JSON_DEF_READ_FWD(nodeJson, NodeID, id); \
1381 JSON_DEF_READ_FWD(nodeJson, GNodeK, nodeKind); \
1382 return std::make_pair(id, create##GType##Node(id, nodeKind)); \
1383 }
1384#define READ_CREATE_EDGE_FWD(GType) \
1385 [](const cJSON*& edgeJson) { \
1386 JSON_DEF_READ_FWD(edgeJson, GEdgeFlag, edgeFlag); \
1387 auto kind = applyEdgeMask(edgeFlag); \
1388 auto edge = create##GType##Edge(kind); \
1389 setEdgeFlag(edge, edgeFlag); \
1390 return edge; \
1391 }
1392
1393 ABORT_IFNOT(jsonIsObject(root), "Root should be an object");
1394
1395 const cJSON* const svfModule = root->child;
1396 CHECK_JSON_KEY(svfModule);
1398 svfModule,
1399 // SVFType Creator
1400 [](const cJSON*& svfTypeFldJson)
1401 {
1403 JSON_DEF_READ_FWD(svfTypeFldJson, bool, isSingleValTy);
1404 return createSVFType(kind, isSingleValTy);
1405 },
1406 // SVFType Filler
1407 [this](const cJSON*& svfVarFldJson, SVFType* type)
1408 {
1410 },
1411 // SVFValue Creator
1412 [this](const cJSON*& svfValueFldJson)
1413 {
1415 JSON_DEF_READ_FWD(svfValueFldJson, const SVFType*, type, {});
1416 JSON_DEF_READ_FWD(svfValueFldJson, std::string, name);
1417 return createSVFValue(kind, type, std::move(name));
1418 },
1419 // SVFValue Filler
1420 [this](const cJSON*& svfVarFldJson, SVFValue* value)
1421 {
1422 virtFill(svfVarFldJson, value);
1423 },
1424 // StInfo Creator (no filler needed)
1425 [this](const cJSON*& stInfoFldJson)
1426 {
1428 auto si = new StInfo(stride);
1430 ABORT_IFNOT(!stInfoFldJson, "StInfo has extra field");
1431 return si;
1432 });
1433
1434 const cJSON* const symInfo = svfModule->next;
1435 CHECK_JSON_KEY(symInfo);
1437 symInfo,
1438 // MemObj Creator (no filler needed)
1439 [this](const cJSON*& memObjFldJson)
1440 {
1442 JSON_DEF_READ_FWD(memObjFldJson, ObjTypeInfo*, typeInfo, {});
1443 JSON_DEF_READ_FWD(memObjFldJson, const SVFValue*, refVal, {});
1444 return std::make_pair(symId, new MemObj(symId, typeInfo, refVal));
1445 });
1446
1447 const cJSON* const icfg = symInfo->next;
1448 CHECK_JSON_KEY(icfg);
1451 [](auto)
1452 {
1453 return new SVFLoop({}, 0);
1454 });
1455
1456 const cJSON* const chgraph = icfg->next;
1457 CHECK_JSON_KEY(chgraph);
1460
1461 const cJSON* const irGraph = chgraph->next;
1465
1467 [this](const cJSON*& j, ICFGNode* node)
1468 {
1469 virtFill(j, node);
1470 },
1471 [this](const cJSON*& j, ICFGEdge* edge)
1472 {
1473 virtFill(j, edge);
1474 },
1475 [this](const cJSON*& j, SVFLoop* loop)
1476 {
1477 fill(j, loop);
1478 });
1480 [this](const cJSON*& j, CHNode* node)
1481 {
1482 virtFill(j, node);
1483 },
1484 [this](const cJSON*& j, CHEdge* edge)
1485 {
1486 virtFill(j, edge);
1487 });
1489 [this](const cJSON*& j, SVFVar* var)
1490 {
1491 virtFill(j, var);
1492 },
1493 [this](const cJSON*& j, SVFStmt* stmt)
1494 {
1495 virtFill(j, stmt);
1496 });
1497
1498 return irGraph->next;
1499
1500#undef READ_CREATE_EDGE_FWD
1501#undef READ_CREATE_NODE_FWD
1502}
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,...)
#define CHECK_JSON_KEY(obj)
newitem type
Definition cJSON.cpp:2739
const char *const name
Definition cJSON.h:264
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
void createObjs(const cJSON *symTabJson, MemObjCreator memObjCreator)
static SVFValue * createSVFValue(SVFValue::GNodeK kind, const SVFType *type, std::string &&name)
SVFIR PAG
Definition SVFIR.h:746
bool jsonIsObject(const cJSON *item)
unsigned SymID
Definition GeneralType.h:57
SVFType * createSVFType(SVFType::GNodeK kind, bool isSingleValTy)
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 1633 of file SVFFileSystem.cpp.

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

◆ createPAGNode()

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

Definition at line 1611 of file SVFFileSystem.cpp.

1612{
1613 switch (kind)
1614 {
1615 default:
1616 ABORT_MSG(kind << " is an impossible SVFVarKind in create()");
1617#define CASE(kind, constructor) \
1618 case SVFVar::kind: \
1619 return new constructor(id);
1620 CASE(ValNode, ValVar);
1621 CASE(RetNode, RetPN);
1622 CASE(ObjNode, ObjVar);
1623 CASE(VarargNode, VarArgPN);
1624 CASE(GepValNode, GepValVar);
1625 CASE(GepObjNode, GepObjVar);
1626 CASE(BaseObjNode, BaseObjVar);
1627 CASE(DummyValNode, DummyValVar);
1628 CASE(DummyObjNode, DummyObjVar);
1629#undef CASE
1630 }
1631}

◆ fill() [1/67]

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

Definition at line 2020 of file SVFFileSystem.cpp.

2021{
2022 fill(fieldJson, static_cast<AssignStmt*>(stmt));
2023}

◆ fill() [2/67]

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

Definition at line 2015 of file SVFFileSystem.cpp.

2016{
2017 fill(fieldJson, static_cast<SVFStmt*>(stmt));
2018}

◆ fill() [3/67]

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

Definition at line 1949 of file SVFFileSystem.cpp.

1950{
1951 fill(fieldJson, static_cast<ObjVar*>(var));
1952}

◆ fill() [4/67]

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

Definition at line 2086 of file SVFFileSystem.cpp.

2087{
2088 fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2090}
#define JSON_READ_FIELD_FWD(json, objptr, field)

◆ fill() [5/67]

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

Definition at line 2098 of file SVFFileSystem.cpp.

2099{
2100 fill(fieldJson, static_cast<SVFStmt*>(stmt));
2101 JSON_READ_FIELD_FWD(fieldJson, stmt, successors);
2104}

◆ fill() [6/67]

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

Definition at line 2237 of file SVFFileSystem.cpp.

2238{
2239 fill(fieldJson, static_cast<ICFGEdge*>(edge));
2241}

◆ fill() [7/67]

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

Definition at line 2195 of file SVFFileSystem.cpp.

2196{
2197 fill(fieldJson, static_cast<ICFGNode*>(node));
2198 JSON_READ_FIELD_FWD(fieldJson, node, ret);
2199 JSON_READ_FIELD_FWD(fieldJson, node, APNodes);
2200}

◆ fill() [8/67]

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

Definition at line 2048 of file SVFFileSystem.cpp.

2049{
2050 fill(fieldJson, static_cast<AssignStmt*>(stmt));
2053}

◆ fill() [9/67]

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

Definition at line 2080 of file SVFFileSystem.cpp.

2081{
2082 fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2083 JSON_READ_FIELD_FWD(fieldJson, stmt, predicate);
2084}

◆ fill() [10/67]

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

Definition at line 2025 of file SVFFileSystem.cpp.

2026{
2027 fill(fieldJson, static_cast<AssignStmt*>(stmt));
2029}

◆ fill() [11/67]

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

Definition at line 1969 of file SVFFileSystem.cpp.

1970{
1971 fill(fieldJson, static_cast<ObjVar*>(var));
1972}

◆ fill() [12/67]

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

Definition at line 1964 of file SVFFileSystem.cpp.

1965{
1966 fill(fieldJson, static_cast<ValVar*>(var));
1967}

◆ fill() [13/67]

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

Definition at line 2183 of file SVFFileSystem.cpp.

2184{
2185 fill(fieldJson, static_cast<ICFGNode*>(node));
2186 JSON_READ_FIELD_FWD(fieldJson, node, FPNodes);
2187}

◆ fill() [14/67]

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

Definition at line 2189 of file SVFFileSystem.cpp.

2190{
2191 fill(fieldJson, static_cast<ICFGNode*>(node));
2192 JSON_READ_FIELD_FWD(fieldJson, node, formalRet);
2193}

◆ fill() [15/67]

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

Definition at line 1320 of file SVFFileSystem.h.

1321 {
1322 // edgeFlag has already been read.
1325 }

◆ fill() [16/67]

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

Definition at line 1312 of file SVFFileSystem.h.

1313 {
1314 // id and nodeKind have already been read.
1315 JSON_READ_FIELD_FWD(fieldJson, node, InEdges);
1316 JSON_READ_FIELD_FWD(fieldJson, node, OutEdges);
1317 }

◆ fill() [17/67]

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

Definition at line 1942 of file SVFFileSystem.cpp.

1943{
1944 fill(fieldJson, static_cast<ObjVar*>(var));
1945 JSON_READ_FIELD_FWD(fieldJson, var, apOffset);
1947}

◆ fill() [18/67]

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

Definition at line 2041 of file SVFFileSystem.cpp.

2042{
2043 fill(fieldJson, static_cast<AssignStmt*>(stmt));
2045 JSON_READ_FIELD_FWD(fieldJson, stmt, variantField);
2046}

◆ fill() [19/67]

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

Definition at line 1935 of file SVFFileSystem.cpp.

1936{
1937 fill(fieldJson, static_cast<ValVar*>(var));
1939 JSON_READ_FIELD_FWD(fieldJson, var, gepValType);
1940}

◆ fill() [20/67]

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

Definition at line 2167 of file SVFFileSystem.cpp.

2168{
2169 fill(fieldJson, static_cast<ICFGNode*>(node));
2170}

◆ fill() [21/67]

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

Definition at line 2225 of file SVFFileSystem.cpp.

2226{
2227 fill(fieldJson, static_cast<GenericICFGEdgeTy*>(edge));
2228}
GenericEdge< ICFGNode > GenericICFGEdgeTy
Definition ICFGEdge.h:43

◆ fill() [22/67]

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

Definition at line 2158 of file SVFFileSystem.cpp.

2159{
2160 fill(fieldJson, static_cast<GenericICFGNodeTy*>(node));
2161 JSON_READ_FIELD_FWD(fieldJson, node, fun);
2162 JSON_READ_FIELD_FWD(fieldJson, node, bb);
2163 // Skip VFGNodes as it is empty
2164 JSON_READ_FIELD_FWD(fieldJson, node, pagEdges);
2165}
GenericNode< ICFGNode, ICFGEdge > GenericICFGNodeTy
Definition ICFGNode.h:52

◆ fill() [23/67]

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

Definition at line 2178 of file SVFFileSystem.cpp.

2179{
2180 fill(fieldJson, static_cast<ICFGNode*>(node));
2181}

◆ fill() [24/67]

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

Definition at line 2230 of file SVFFileSystem.cpp.

2231{
2232 fill(fieldJson, static_cast<ICFGEdge*>(edge));
2233 JSON_READ_FIELD_FWD(fieldJson, edge, conditionVar);
2234 JSON_READ_FIELD_FWD(fieldJson, edge, branchCondVal);
2235}

◆ fill() [25/67]

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

Definition at line 2172 of file SVFFileSystem.cpp.

2173{
2174 fill(fieldJson, static_cast<ICFGNode*>(node));
2175 JSON_READ_FIELD_FWD(fieldJson, node, isRet);
2176}

◆ fill() [26/67]

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

Definition at line 2036 of file SVFFileSystem.cpp.

2037{
2038 fill(fieldJson, static_cast<AssignStmt*>(stmt));
2039}

◆ fill() [27/67]

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

Definition at line 2116 of file SVFFileSystem.cpp.

2117{
2118 // symId has already been read
2121}

◆ fill() [28/67]

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

Definition at line 2062 of file SVFFileSystem.cpp.

2063{
2064 fill(fieldJson, static_cast<SVFStmt*>(stmt));
2066}

◆ fill() [29/67]

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

Definition at line 1929 of file SVFFileSystem.cpp.

1930{
1931 fill(fieldJson, static_cast<SVFVar*>(var));
1933}

◆ fill() [30/67]

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

Definition at line 2068 of file SVFFileSystem.cpp.

2069{
2070 fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2071 JSON_READ_FIELD_FWD(fieldJson, stmt, opICFGNodes);
2072}

◆ fill() [31/67]

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

Definition at line 2243 of file SVFFileSystem.cpp.

2244{
2245 fill(fieldJson, static_cast<ICFGEdge*>(edge));
2247}

◆ fill() [32/67]

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

Definition at line 2202 of file SVFFileSystem.cpp.

2203{
2204 fill(fieldJson, static_cast<ICFGNode*>(node));
2205 JSON_READ_FIELD_FWD(fieldJson, node, actualRet);
2206 JSON_READ_FIELD_FWD(fieldJson, node, callBlockNode);
2207}

◆ fill() [33/67]

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

Definition at line 2055 of file SVFFileSystem.cpp.

2056{
2057 fill(fieldJson, static_cast<AssignStmt*>(stmt));
2060}

◆ fill() [34/67]

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

Definition at line 1954 of file SVFFileSystem.cpp.

1955{
1956 fill(fieldJson, static_cast<ValVar*>(var));
1957}

◆ fill() [35/67]

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

Definition at line 2074 of file SVFFileSystem.cpp.

2075{
2076 fill(fieldJson, static_cast<MultiOpndStmt*>(stmt));
2077 JSON_READ_FIELD_FWD(fieldJson, stmt, condition);
2078}

◆ fill() [36/67]

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

Definition at line 2123 of file SVFFileSystem.cpp.

2124{
2125#define F(field) JSON_READ_FIELD_FWD(fieldJson, stInfo, field)
2126 // stride has already been read upon construction
2127 F(numOfFlattenElements);
2128 F(numOfFlattenFields);
2129 F(fldIdxVec);
2130 F(elemIdxVec);
2131 F(fldIdx2TypeMap);
2132 F(finfo);
2133 F(flattenElementTypes);
2134#undef F
2135}
#define F(f)

◆ fill() [37/67]

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

Definition at line 2031 of file SVFFileSystem.cpp.

2032{
2033 fill(fieldJson, static_cast<AssignStmt*>(stmt));
2034}

◆ fill() [38/67]

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

Definition at line 2378 of file SVFFileSystem.cpp.

2379{
2380 fill(fieldJson, static_cast<SVFValue*>(value));
2381 JSON_READ_FIELD_FWD(fieldJson, value, fun);
2382 JSON_READ_FIELD_FWD(fieldJson, value, argNo);
2383 JSON_READ_FIELD_FWD(fieldJson, value, uncalled);
2384}

◆ fill() [39/67]

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

Definition at line 2477 of file SVFFileSystem.cpp.

2478{
2479 fill(fieldJson, static_cast<SVFType*>(type));
2480 JSON_READ_FIELD_FWD(fieldJson, type, numOfElement);
2481 JSON_READ_FIELD_FWD(fieldJson, type, typeOfElement);
2482}

◆ fill() [40/67]

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

Definition at line 2343 of file SVFFileSystem.cpp.

2344{
2345 fill(fieldJson, static_cast<SVFValue*>(value));
2346 JSON_READ_FIELD_FWD(fieldJson, value, succBBs);
2347 JSON_READ_FIELD_FWD(fieldJson, value, predBBs);
2348 JSON_READ_FIELD_FWD(fieldJson, value, fun);
2349}

◆ fill() [41/67]

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

Definition at line 2409 of file SVFFileSystem.cpp.

2410{
2411 fill(fieldJson, static_cast<SVFConstantData*>(value));
2412}

◆ fill() [42/67]

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

Definition at line 2359 of file SVFFileSystem.cpp.

2360{
2361 fill(fieldJson, static_cast<SVFInstruction*>(value));
2362 JSON_READ_FIELD_FWD(fieldJson, value, args);
2363 JSON_READ_FIELD_FWD(fieldJson, value, varArg);
2364 JSON_READ_FIELD_FWD(fieldJson, value, calledVal);
2365}

◆ fill() [43/67]

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

Definition at line 2367 of file SVFFileSystem.cpp.

2368{
2369 fill(fieldJson, static_cast<SVFValue*>(value));
2370}

◆ fill() [44/67]

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

Definition at line 2386 of file SVFFileSystem.cpp.

2387{
2388 fill(fieldJson, static_cast<SVFConstant*>(value));
2389}

◆ fill() [45/67]

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

Definition at line 2398 of file SVFFileSystem.cpp.

2399{
2400 fill(fieldJson, static_cast<SVFConstantData*>(value));
2401 JSON_READ_FIELD_FWD(fieldJson, value, dval);
2402}

◆ fill() [46/67]

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

Definition at line 2391 of file SVFFileSystem.cpp.

2392{
2393 fill(fieldJson, static_cast<SVFConstantData*>(value));
2394 JSON_READ_FIELD_FWD(fieldJson, value, zval);
2395 JSON_READ_FIELD_FWD(fieldJson, value, sval);
2396}

◆ fill() [47/67]

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

Definition at line 2404 of file SVFFileSystem.cpp.

2405{
2406 fill(fieldJson, static_cast<SVFConstantData*>(value));
2407}

◆ fill() [48/67]

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

Definition at line 2325 of file SVFFileSystem.cpp.

2326{
2327 fill(fieldJson, static_cast<SVFValue*>(value));
2328#define F(f) JSON_READ_FIELD_FWD(fieldJson, value, f)
2329 F(isDecl);
2330 F(intrinsic);
2331 F(addrTaken);
2332 F(isUncalled);
2333 F(isNotRet);
2334 F(varArg);
2335 F(funcType);
2336 F(loopAndDom);
2337 F(realDefFun);
2338 F(allBBs);
2339 F(allArgs);
2340#undef F
2341}

◆ fill() [49/67]

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

Definition at line 2465 of file SVFFileSystem.cpp.

2466{
2467 fill(fieldJson, static_cast<SVFType*>(type));
2469}

◆ fill() [50/67]

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

Definition at line 2372 of file SVFFileSystem.cpp.

2373{
2374 fill(fieldJson, static_cast<SVFConstant*>(value));
2375 JSON_READ_FIELD_FWD(fieldJson, value, realDefGlobal);
2376}

◆ fill() [51/67]

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

Definition at line 2351 of file SVFFileSystem.cpp.

2352{
2353 fill(fieldJson, static_cast<SVFValue*>(value));
2354 JSON_READ_FIELD_FWD(fieldJson, value, bb);
2355 JSON_READ_FIELD_FWD(fieldJson, value, terminator);
2356 JSON_READ_FIELD_FWD(fieldJson, value, ret);
2357}

◆ fill() [52/67]

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

Definition at line 2459 of file SVFFileSystem.cpp.

2460{
2461 fill(fieldJson, static_cast<SVFType*>(type));
2462 JSON_READ_FIELD_FWD(fieldJson, type, signAndWidth);
2463}

◆ fill() [53/67]

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

Definition at line 2249 of file SVFFileSystem.cpp.

2250{
2251#define F(field) JSON_READ_FIELD_FWD(fieldJson, loop, field)
2252 F(entryICFGEdges);
2253 F(backICFGEdges);
2254 F(inICFGEdges);
2255 F(outICFGEdges);
2256 F(icfgNodes);
2257 F(loopBound);
2258#undef F
2259}

◆ fill() [54/67]

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

Definition at line 2419 of file SVFFileSystem.cpp.

2420{
2421 fill(fieldJson, static_cast<SVFOtherValue*>(value));
2422}

◆ fill() [55/67]

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

Definition at line 2484 of file SVFFileSystem.cpp.

2485{
2486 fill(fieldJson, static_cast<SVFType*>(type));
2488}

◆ fill() [56/67]

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

Definition at line 2414 of file SVFFileSystem.cpp.

2415{
2416 fill(fieldJson, static_cast<SVFValue*>(value));
2417}

◆ fill() [57/67]

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

Definition at line 2454 of file SVFFileSystem.cpp.

2455{
2456 fill(fieldJson, static_cast<SVFType*>(type));
2457}

◆ fill() [58/67]

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

Definition at line 2006 of file SVFFileSystem.cpp.

2007{
2008 fill(fieldJson, static_cast<GenericPAGEdgeTy*>(stmt));
2010 JSON_READ_FIELD_FWD(fieldJson, stmt, basicBlock);
2013}
GenericEdge< SVFVar > GenericPAGEdgeTy

◆ fill() [59/67]

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

Definition at line 2471 of file SVFFileSystem.cpp.

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

◆ fill() [60/67]

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

Definition at line 2448 of file SVFFileSystem.cpp.

2449{
2450 // kind has already been read
2452}

◆ fill() [61/67]

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

Definition at line 2317 of file SVFFileSystem.cpp.

2318{
2319 // kind, type, name have already been read.
2320 JSON_READ_FIELD_FWD(fieldJson, value, ptrInUncalledFun);
2321 JSON_READ_FIELD_FWD(fieldJson, value, constDataOrAggData);
2322 JSON_READ_FIELD_FWD(fieldJson, value, sourceLoc);
2323}

◆ fill() [62/67]

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

Definition at line 1915 of file SVFFileSystem.cpp.

1916{
1917 fill(fieldJson, static_cast<GenericPAGNodeTy*>(var));
1919 JSON_READ_FIELD_FWD(fieldJson, var, InEdgeKindToSetMap);
1920 JSON_READ_FIELD_FWD(fieldJson, var, OutEdgeKindToSetMap);
1922}
GenericNode< SVFVar, SVFStmt > GenericPAGNodeTy

◆ fill() [63/67]

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

Definition at line 2106 of file SVFFileSystem.cpp.

2107{
2108 fill(fieldJson, static_cast<CallPE*>(stmt));
2109}

◆ fill() [64/67]

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

Definition at line 2111 of file SVFFileSystem.cpp.

2112{
2113 fill(fieldJson, static_cast<RetPE*>(stmt));
2114}

◆ fill() [65/67]

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

Definition at line 2092 of file SVFFileSystem.cpp.

2093{
2094 fill(fieldJson, static_cast<SVFStmt*>(stmt));
2096}

◆ fill() [66/67]

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

Definition at line 1924 of file SVFFileSystem.cpp.

1925{
1926 fill(fieldJson, static_cast<SVFVar*>(var));
1927}

◆ fill() [67/67]

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

Definition at line 1959 of file SVFFileSystem.cpp.

1960{
1961 fill(fieldJson, static_cast<ValVar*>(var));
1962}

◆ read() [1/2]

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

Definition at line 1328 of file SVFFileSystem.cpp.

1329{
1330 const cJSON* svfirField = createObjs(root);
1331
1332 SVFIR* svfIR = SVFIR::getPAG(); // SVFIR constructor sets symInfo
1333 IRGraph* irGraph = svfIR;
1334
1335 auto svfModule = SVFModule::getSVFModule();
1336 auto icfg = new ICFG();
1337 auto chgraph = new CHGraph(svfModule);
1338 auto symInfo = SymbolTableInfo::SymbolInfo();
1339 symInfo->mod = svfModule;
1340
1341 svfIR->svfModule = svfModule;
1342 svfIR->icfg = icfg;
1343 svfIR->chgraph = chgraph;
1344
1345#define F(field) JSON_READ_FIELD_FWD(svfirField, svfIR, field)
1346 readJson(symInfo);
1348 readJson(icfg);
1349 readJson(chgraph);
1350 readJson(svfModule);
1351
1352 F(icfgNode2SVFStmtsMap);
1353 F(icfgNode2PTASVFStmtsMap);
1354 F(GepValObjMap);
1355 F(typeLocSetsMap);
1356 F(GepObjVarMap);
1357 F(memToFieldsMap);
1358 F(globSVFStmtSet);
1359 F(phiNodeMap);
1360 F(funArgsListMap);
1361 F(callSiteArgsListMap);
1362 F(callSiteRetMap);
1363 F(funRetMap);
1364 F(indCallSiteToFunPtrMap);
1365 F(funPtrToCallSitesMap);
1366 F(candidatePointers);
1367 F(callSiteSet);
1368#undef F
1369 assert(!NodeIDAllocator::allocator && "NodeIDAllocator should be NULL");
1372
1373 return svfIR;
1374}
#define JSON_READ_OBJ_FWD(json, obj)
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:116
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 2490 of file SVFFileSystem.cpp.

2491{
2492 struct stat buf;
2493 int fd = open(path.c_str(), O_RDONLY);
2494 if (fd == -1)
2495 {
2496 std::string info = "open(\"" + path + "\")";
2497 perror(info.c_str());
2498 abort();
2499 }
2500 if (fstat(fd, &buf) == -1)
2501 {
2502 std::string info = "fstate(\"" + path + "\")";
2503 perror(info.c_str());
2504 abort();
2505 }
2506 auto addr =
2507 (char*)mmap(nullptr, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
2508 if (addr == MAP_FAILED)
2509 {
2510 std::string info = "mmap(content of \"" + path + "\")";
2511 perror(info.c_str());
2512 abort();
2513 }
2514
2515 auto root = cJSON_ParseWithLength(addr, buf.st_size);
2516
2517 if (munmap(addr, buf.st_size) == -1)
2518 perror("munmap()");
2519
2520 if (close(fd) < 0)
2521 perror("close()");
2522
2523 SVFIRReader reader;
2524 SVFIR* ir = reader.read(root);
2525
2526 cJSON_Delete(root);
2527 return ir;
2528}
cJSON_Delete(null)

◆ readJson() [1/37]

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

Definition at line 1736 of file SVFFileSystem.cpp.

1737{
1740#define F(field) JSON_READ_FIELD_FWD(obj, graph, field)
1741 F(classNum);
1742 F(vfID);
1743 F(classNameToNodeMap);
1744 F(classNameToDescendantsMap);
1745 F(classNameToAncestorsMap);
1746 F(classNameToInstAndDescsMap);
1747 F(templateNameToInstancesMap);
1748 F(callNodeToClassesMap);
1749 F(virtualFunctionToIDMap);
1750 F(callNodeToCHAVtblsMap);
1751 F(callNodeToCHAVFnsMap);
1752#undef F
1753}
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 1832 of file SVFFileSystem.cpp.

1833{
1834 ABORT_IFNOT(jsonIsObject(obj), "Expected obj for AccessPath");
1835 obj = obj->child;
1836 JSON_READ_FIELD_FWD(obj, &ap, fldIdx);
1837 JSON_READ_FIELD_FWD(obj, &ap, idxOperandPairs);
1838 ABORT_IFNOT(!obj, "Extra field " << JSON_KEY(obj) << " in AccessPath");
1839}
#define JSON_KEY(json)

◆ readJson() [3/37]

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

Definition at line 1504 of file SVFFileSystem.cpp.

1505{
1506 ABORT_IFNOT(jsonIsBool(obj, flag), "Expect bool for " << obj->string);
1507}
bool jsonIsBool(const cJSON *item)

◆ 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 1183 of file SVFFileSystem.h.

1185 {
1186 using T = typename C::value_type;
1187 assert(container.empty() && "container should be empty");
1188 ABORT_IFNOT(jsonIsArray(obj), "vector expects an array");
1190 {
1191 container.push_back(T{});
1192 readJson(elemJson, container.back());
1193 }
1194 }
#define jsonForEach(field, array)
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 1197 of file SVFFileSystem.h.

1198 {
1199 assert(map.empty() && "map should be empty");
1200 ABORT_IFNOT(jsonIsMap(obj), "expects an map (represented by array)");
1202 {
1204 typename C::key_type key{};
1205 readJson(jpair.first, key);
1206 auto it = map.emplace(std::move(key), typename C::mapped_type{});
1207 ABORT_IFNOT(it.second, "Duplicated map key");
1208 readJson(jpair.second, it.first->second);
1209 }
1210 }
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 1213 of file SVFFileSystem.h.

1214 {
1215 using T = typename C::value_type;
1216 assert(set.empty() && "set should be empty");
1217 ABORT_IFNOT(jsonIsArray(obj), "expects an array");
1219 {
1220 T elem{};
1222 auto inserted = set.insert(std::move(elem)).second;
1223 ABORT_IFNOT(inserted, "Duplicated set element");
1224 }
1225 }
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 1826 of file SVFFileSystem.cpp.

1827{
1828 assert(!edge && "CHEdge already read?");
1830}
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 1820 of file SVFFileSystem.cpp.

1821{
1822 assert(!node && "CHNode already read?");
1824}
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 1151 of file SVFFileSystem.h.

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

◆ readJson() [10/37]

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

Definition at line 1524 of file SVFFileSystem.cpp.

1525{
1527}
static void readSmallNumber(const cJSON *obj, SmallNumberType &val)

◆ readJson() [11/37]

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

Definition at line 1814 of file SVFFileSystem.cpp.

1815{
1816 assert(!edge && "ICFGEdge already read?");
1818}

◆ readJson() [12/37]

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

Definition at line 1807 of file SVFFileSystem.cpp.

1808{
1809 assert(!node && "ICFGNode already read?");
1810 NodeID id = jsonGetNumber(obj);
1811 node = icfgReader.getNodePtr(id);
1812}
u32_t NodeID
Definition GeneralType.h:55

◆ readJson() [13/37]

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

Definition at line 1514 of file SVFFileSystem.cpp.

1515{
1517}

◆ readJson() [14/37]

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

Definition at line 1538 of file SVFFileSystem.cpp.

1539{
1541 [](const char* s)
1542 {
1543 return std::strtoll(s, nullptr, 10);
1544 });
1545}
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 1848 of file SVFFileSystem.cpp.

1849{
1850 assert(!memObj && "MemObj already read?");
1852}
MemObj * getMemObjPtr(unsigned id) const

◆ readJson() [16/37]

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

Definition at line 1661 of file SVFFileSystem.cpp.

1662{
1663 assert(idAllocator && "idAllocator should be nonempty");
1664
1665 ABORT_IFNOT(jsonIsObject(obj), "Expect object for " << JSON_KEY(obj));
1666 obj = obj->child;
1667
1668 JSON_DEF_READ_FWD(obj, int, strategy);
1669 static_assert(sizeof(idAllocator->strategy) == sizeof(strategy),
1670 "idAllocator->strategy should be represented by int");
1671 idAllocator->strategy = static_cast<NodeIDAllocator::Strategy>(strategy);
1672 JSON_READ_FIELD_FWD(obj, idAllocator, numObjects);
1673 JSON_READ_FIELD_FWD(obj, idAllocator, numValues);
1674 JSON_READ_FIELD_FWD(obj, idAllocator, numSymbols);
1676
1677 ABORT_IFNOT(!obj, "Extra field " << JSON_KEY(obj) << " in NodeIDAllocator");
1678}
Strategy
Allocation strategy to use.

◆ readJson() [17/37]

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

Definition at line 1854 of file SVFFileSystem.cpp.

1855{
1856 assert(!objTypeInfo && "ObjTypeInfo already read?");
1857 ABORT_IFNOT(jsonIsObject(obj), "Expected object for objTypeInfo");
1858 cJSON* field = obj->child;
1859
1860 JSON_DEF_READ_FWD(field, SVFType*, type, {});
1861 JSON_DEF_READ_FWD(field, u32_t, flags);
1862 JSON_DEF_READ_FWD(field, u32_t, maxOffsetLimit);
1863 JSON_DEF_READ_FWD(field, u32_t, elemNum);
1864
1865 ABORT_IFNOT(!field, "Extra field in objTypeInfo: " << JSON_KEY(field));
1866 objTypeInfo = new ObjTypeInfo(type, maxOffsetLimit);
1867 objTypeInfo->flags = flags;
1868 objTypeInfo->elemNum = elemNum;
1869}

◆ readJson() [18/37]

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

Definition at line 1519 of file SVFFileSystem.cpp.

1520{
1522}

◆ readJson() [19/37]

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

Definition at line 1114 of file SVFFileSystem.h.

1115 {
1116 ABORT_IFNOT(jsonIsArray(obj), "SparseBitVector should be an array");
1118 {
1119 unsigned n;
1120 readJson(nObj, n);
1121 bv.set(n);
1122 }
1123 }
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 1160 of file SVFFileSystem.h.

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

◆ readJson() [21/37]

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

Definition at line 1556 of file SVFFileSystem.cpp.

1557{
1558 ABORT_IFNOT(jsonIsString(obj), "Expect string for " << obj->string);
1559 str = obj->valuestring;
1560}
bool jsonIsString(const cJSON *item)

◆ readJson() [22/37]

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

Definition at line 1780 of file SVFFileSystem.cpp.

1781{
1782 assert(!stInfo && "StInfo already read?");
1784}
StInfo * getStInfoPtr(size_t id) const

◆ readJson() [23/37]

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

Definition at line 1841 of file SVFFileSystem.cpp.

1842{
1843 assert(!loop && "SVFLoop already read?");
1844 unsigned id = jsonGetNumber(obj);
1846}
SVFLoop * getSVFLoopPtr(size_t id) const

◆ readJson() [24/37]

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

Definition at line 1871 of file SVFFileSystem.cpp.

1872{
1873 assert(!ldInfo && "SVFLoopAndDomInfo already read?");
1874 ABORT_IFNOT(jsonIsObject(obj), "Expected object for SVFLoopAndDomInfo");
1875 cJSON* field = obj->child;
1876
1877 ldInfo = new SVFLoopAndDomInfo();
1878
1879 JSON_READ_FIELD_FWD(field, ldInfo, reachableBBs);
1880 JSON_READ_FIELD_FWD(field, ldInfo, dtBBsMap);
1881 JSON_READ_FIELD_FWD(field, ldInfo, pdtBBsMap);
1882 JSON_READ_FIELD_FWD(field, ldInfo, dfBBsMap);
1883 JSON_READ_FIELD_FWD(field, ldInfo, bb2LoopMap);
1884 JSON_READ_FIELD_FWD(field, ldInfo, bb2PdomLevel);
1885 JSON_READ_FIELD_FWD(field, ldInfo, bb2PIdom);
1886
1888 "Extra field in SVFLoopAndDomInfo: " << JSON_KEY(field));
1889}

◆ readJson() [25/37]

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

Definition at line 1801 of file SVFFileSystem.cpp.

1802{
1803 assert(!stmt && "SVFStmt already read?");
1805}

◆ readJson() [26/37]

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

Definition at line 1774 of file SVFFileSystem.cpp.

1775{
1776 assert(!type && "SVFType already read?");
1778}
SVFType * getSVFTypePtr(size_t id) const

◆ readJson() [27/37]

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

Definition at line 1786 of file SVFFileSystem.cpp.

1787{
1788 assert(!value && "SVFValue already read?");
1790}
SVFValue * getSVFValuePtr(size_t id) const

◆ readJson() [28/37]

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

Definition at line 1792 of file SVFFileSystem.cpp.

1793{
1794 assert(!var && "SVFVar already read?");
1795 if (jsonIsNullId(obj))
1796 var = nullptr;
1797 else
1799}
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 1138 of file SVFFileSystem.h.

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

◆ readJson() [30/37]

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

Definition at line 1168 of file SVFFileSystem.h.

1169 {
1170 static_assert(N > 0, "array size should be greater than 0");
1171 ABORT_IFNOT(jsonIsArray(obj), "array expects an array");
1172 size_t i = 0;
1174 {
1176 if (++i >= N)
1177 break;
1178 }
1179 ABORT_IFNOT(i == N, "expect array of size " << N);
1180 }

◆ readJson() [31/37]

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

Definition at line 1509 of file SVFFileSystem.cpp.

1510{
1512}

◆ readJson() [32/37]

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

Definition at line 1529 of file SVFFileSystem.cpp.

1530{
1532 [](const char* s)
1533 {
1534 return std::strtoul(s, nullptr, 10);
1535 });
1536}

◆ readJson() [33/37]

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

Definition at line 1547 of file SVFFileSystem.cpp.

1548{
1550 [](const char* s)
1551 {
1552 return std::strtoull(s, nullptr, 10);
1553 });
1554}

◆ readJson() [34/37]

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

Definition at line 1723 of file SVFFileSystem.cpp.

1724{
1726 const cJSON* obj = icfgReader.getFieldJson();
1727#define F(field) JSON_READ_FIELD_FWD(obj, icfg, field)
1728 F(totalICFGNode);
1729 F(FunToFunEntryNodeMap);
1730 F(FunToFunExitNodeMap);
1731 F(globalBlockNode);
1732 F(icfgNodeToSVFLoopVec);
1733#undef F
1734}

◆ readJson() [35/37]

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

Definition at line 1698 of file SVFFileSystem.cpp.

1699{
1700 assert(SymbolTableInfo::symInfo && "SymbolTableInfo should be nonempty");
1701 assert(graph->symInfo == SymbolTableInfo::SymbolInfo() && "symInfo differ");
1702
1703 auto& valToEdgeMap = graph->valueToEdgeMap;
1704 valToEdgeMap.clear();
1705
1708#define F(field) JSON_READ_FIELD_FWD(obj, graph, field)
1709 // base and symInfo have already been read
1710 F(KindToSVFStmtSetMap);
1711 F(KindToPTASVFStmtSetMap);
1712 F(fromFile);
1713 F(nodeNumAfterPAGBuild);
1714 F(totalPTAPAGEdge);
1715 F(valueToEdgeMap);
1716#undef F
1717
1718 auto nullit = valToEdgeMap.find(nullptr);
1719 ABORT_IFNOT(nullit != valToEdgeMap.end(), "valueToEdgeMap should has key NULL");
1720 ABORT_IFNOT(nullit->second.empty(), "valueToEdgeMap[NULL] should be empty");
1721}
static SymbolTableInfo * symInfo

◆ readJson() [36/37]

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

Definition at line 1755 of file SVFFileSystem.cpp.

1756{
1758 auto symInfo = SymbolTableInfo::symInfo;
1759 assert(symInfo && "SymbolTableInfo should be non-NULL");
1760 svfModuleReader.svfTypePool.saveToSet(symInfo->svfTypes);
1761 svfModuleReader.stInfoPool.saveToSet(symInfo->stInfos);
1762
1763#define F(field) JSON_READ_FIELD_FWD(obj, module, field)
1764 F(pagReadFromTxt);
1765 F(moduleIdentifier);
1766 F(FunctionSet);
1767 F(GlobalSet);
1768 F(AliasSet);
1769 F(ConstantSet);
1770 F(OtherValueSet);
1771#undef F
1772}
const cJSON * getFieldJson() const
ReaderPtrPool< StInfo > stInfoPool
ReaderPtrPool< SVFType > svfTypePool

◆ readJson() [37/37]

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

Definition at line 1680 of file SVFFileSystem.cpp.

1681{
1683#define F(field) JSON_READ_FIELD_FWD(obj, symTabInfo, field)
1684 // `allMemObj` was consumed during create & fill phase.
1685 F(valSymMap);
1686 F(objSymMap);
1687 F(returnSymMap);
1688 F(varargSymMap);
1689 symTableReader.memObjMap.saveToIDToObjMap(symTabInfo->objMap); // objMap
1690 F(modelConstants);
1691 F(totalSymNum);
1692 F(maxStruct);
1693 F(maxStSize);
1694#undef F
1695 ABORT_IFNOT(!obj, "Extra field " << JSON_KEY(obj) << " in SymbolTableInfo");
1696}
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 1058 of file SVFFileSystem.h.

1060 {
1061 edge->edgeFlag = edgeFlag;
1062 }

◆ virtFill() [1/8]

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

Definition at line 2271 of file SVFFileSystem.cpp.

2272{
2273 assert(edge->getEdgeKind() == 0 && "Unknown CHEdge kind");
2274 fill(fieldJson, static_cast<GenericCHEdgeTy*>(edge));
2275 // edgeType is a enum
2276 JSON_DEF_READ_FWD(fieldJson, unsigned, edgeType);
2277 if (edgeType == CHEdge::INHERITANCE)
2278 edge->edgeType = CHEdge::INHERITANCE;
2279 else if (edgeType == CHEdge::INSTANTCE)
2280 edge->edgeType = CHEdge::INSTANTCE;
2281 else
2282 ABORT_MSG("Unknown CHEdge type " << edgeType);
2283}
@ 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 2261 of file SVFFileSystem.cpp.

2262{
2263 assert(node->getNodeKind() == 0 && "Unknown CHNode kind");
2264 fill(fieldJson, static_cast<GenericCHNodeTy*>(node));
2265 JSON_READ_FIELD_FWD(fieldJson, node, vtable);
2266 JSON_READ_FIELD_FWD(fieldJson, node, className);
2267 JSON_READ_FIELD_FWD(fieldJson, node, flags);
2268 JSON_READ_FIELD_FWD(fieldJson, node, virtualFunctionVectors);
2269}
GenericNode< CHNode, CHEdge > GenericCHNodeTy
Definition CHG.h:107

◆ virtFill() [3/8]

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

Definition at line 2209 of file SVFFileSystem.cpp.

2210{
2211 auto kind = edge->getEdgeKind();
2212 switch (kind)
2213 {
2214 default:
2215 ABORT_MSG("Unknown ICFGEdge kind " << kind);
2216 case ICFGEdge::IntraCF:
2217 return fill(fieldJson, static_cast<IntraCFGEdge*>(edge));
2218 case ICFGEdge::CallCF:
2219 return fill(fieldJson, static_cast<CallCFGEdge*>(edge));
2220 case ICFGEdge::RetCF:
2221 return fill(fieldJson, static_cast<RetCFGEdge*>(edge));
2222 }
2223}

◆ virtFill() [4/8]

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

Definition at line 2137 of file SVFFileSystem.cpp.

2138{
2139 switch (node->getNodeKind())
2140 {
2141 default:
2142 ABORT_MSG("Unknown ICFGNode kind " << node->getNodeKind());
2143
2144#define CASE(NodeKind, NodeType) \
2145 case ICFGNode::NodeKind: \
2146 return fill(fieldJson, static_cast<NodeType*>(node))
2147
2148 CASE(IntraBlock, IntraICFGNode);
2149 CASE(FunEntryBlock, FunEntryICFGNode);
2150 CASE(FunExitBlock, FunExitICFGNode);
2151 CASE(FunCallBlock, CallICFGNode);
2152 CASE(FunRetBlock, RetICFGNode);
2153 CASE(GlobalBlock, GlobalICFGNode);
2154#undef CASE
2155 }
2156}

◆ virtFill() [5/8]

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

Definition at line 1974 of file SVFFileSystem.cpp.

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

◆ virtFill() [6/8]

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

Definition at line 2424 of file SVFFileSystem.cpp.

2425{
2426 auto kind = type->getKind();
2427
2428 switch (kind)
2429 {
2430 default:
2431 assert(false && "Impossible SVFType kind");
2432
2433#define CASE(Kind) \
2434 case SVFType::Kind: \
2435 return fill(fieldJson, SVFUtil::dyn_cast<Kind##pe>(type))
2436
2437 CASE(SVFTy);
2438 CASE(SVFPointerTy);
2439 CASE(SVFIntegerTy);
2440 CASE(SVFFunctionTy);
2441 CASE(SVFStructTy);
2442 CASE(SVFArrayTy);
2443 CASE(SVFOtherTy);
2444#undef CASE
2445 }
2446}

◆ virtFill() [7/8]

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

Definition at line 2285 of file SVFFileSystem.cpp.

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

◆ virtFill() [8/8]

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

Definition at line 1891 of file SVFFileSystem.cpp.

1892{
1893 switch (var->getNodeKind())
1894 {
1895 default:
1896 assert(false && "Unknown SVFVar kind");
1897
1898#define CASE(VarKind, VarType) \
1899 case SVFVar::VarKind: \
1900 return fill(fieldJson, static_cast<VarType*>(var))
1901
1902 CASE(ValNode, ValVar);
1903 CASE(ObjNode, ObjVar);
1904 CASE(RetNode, RetPN);
1905 CASE(VarargNode, VarArgPN);
1906 CASE(GepValNode, GepValVar);
1907 CASE(GepObjNode, GepObjVar);
1908 CASE(BaseObjNode, BaseObjVar);
1909 CASE(DummyValNode, DummyValVar);
1910 CASE(DummyObjNode, DummyObjVar);
1911#undef CASE
1912 }
1913}

Member Data Documentation

◆ chGraphReader

CHGraphReader SVF::SVFIRReader::chGraphReader
private

Definition at line 1036 of file SVFFileSystem.h.

◆ icfgReader

ICFGReader SVF::SVFIRReader::icfgReader
private

Definition at line 1035 of file SVFFileSystem.h.

◆ irGraphReader

IRGraphReader SVF::SVFIRReader::irGraphReader
private

Definition at line 1037 of file SVFFileSystem.h.

◆ svfModuleReader

SVFModuleReader SVF::SVFIRReader::svfModuleReader
private

Definition at line 1033 of file SVFFileSystem.h.

◆ symTableReader

SymbolTableInfoReader SVF::SVFIRReader::symTableReader
private

Definition at line 1034 of file SVFFileSystem.h.


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