Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SVF::DOTGraphTraits< SVF::CDG * > Struct Reference

#include <CDG.h>

Inheritance diagram for SVF::DOTGraphTraits< SVF::CDG * >:
SVF::DOTGraphTraits< SVF::PAG * > SVF::DefaultDOTGraphTraits

Public Types

typedef SVF::CDGNode NodeType
 

Public Member Functions

 DOTGraphTraits (bool isSimple=false)
 
std::string getNodeLabel (NodeType *node, SVF::CDG *graph)
 
- Public Member Functions inherited from SVF::DOTGraphTraits< SVF::PAG * >
 DOTGraphTraits (bool simple=false)
 
- Public Member Functions inherited from SVF::DefaultDOTGraphTraits
 DefaultDOTGraphTraits (bool simple=false)
 
template<typename GraphType >
std::string getNodeLabel (const void *, const GraphType &)
 

Static Public Member Functions

static std::string getGraphName (SVF::CDG *)
 Return name of the graph.
 
static std::string getSimpleNodeLabel (NodeType *node, SVF::CDG *)
 Return the label of an ICFG node.
 
static std::string getNodeAttributes (NodeType *node, SVF::CDG *)
 
template<class EdgeIter >
static std::string getEdgeAttributes (NodeType *, EdgeIter EI, SVF::CDG *)
 
template<class EdgeIter >
static std::string getEdgeSourceLabel (NodeType *, EdgeIter EI)
 
- Static Public Member Functions inherited from SVF::DefaultDOTGraphTraits
template<typename GraphType >
static std::string getGraphName (const GraphType &)
 
template<typename GraphType >
static std::string getGraphProperties (const GraphType &)
 
static bool renderGraphFromBottomUp ()
 
template<typename GraphType >
static bool isNodeHidden (const void *, const GraphType &)
 
template<typename GraphType >
static std::string getNodeIdentifierLabel (const void *, const GraphType &)
 
template<typename GraphType >
static std::string getNodeDescription (const void *, const GraphType &)
 
template<typename GraphType >
static std::string getNodeAttributes (const void *, const GraphType &)
 
template<typename EdgeIter , typename GraphType >
static std::string getEdgeAttributes (const void *, EdgeIter, const GraphType &)
 
template<typename EdgeIter >
static std::string getEdgeSourceLabel (const void *, EdgeIter)
 
template<typename EdgeIter >
static bool edgeTargetsEdgeSource (const void *, EdgeIter)
 
template<typename EdgeIter >
static EdgeIter getEdgeTarget (const void *, EdgeIter I)
 
static bool hasEdgeDestLabels ()
 
static unsigned numEdgeDestLabels (const void *)
 
static std::string getEdgeDestLabel (const void *, unsigned)
 
template<typename GraphType , typename GraphWriter >
static void addCustomGraphFeatures (const GraphType &, GraphWriter &)
 

Additional Inherited Members

- Protected Member Functions inherited from SVF::DefaultDOTGraphTraits
bool isSimple ()
 

Detailed Description

Definition at line 346 of file CDG.h.

Member Typedef Documentation

◆ NodeType

Definition at line 349 of file CDG.h.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

SVF::DOTGraphTraits< SVF::CDG * >::DOTGraphTraits ( bool  isSimple = false)
inline

Definition at line 351 of file CDG.h.

351 :
352 DOTGraphTraits<SVF::PAG *>(isSimple)
353 {
354 }

Member Function Documentation

◆ getEdgeAttributes()

template<class EdgeIter >
static std::string SVF::DOTGraphTraits< SVF::CDG * >::getEdgeAttributes ( NodeType ,
EdgeIter  EI,
SVF::CDG  
)
inlinestatic

Definition at line 462 of file CDG.h.

463 {
464 assert(*(EI.getCurrent()) && "No edge found!!");
465 return "style=solid";
466 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ getEdgeSourceLabel()

template<class EdgeIter >
static std::string SVF::DOTGraphTraits< SVF::CDG * >::getEdgeSourceLabel ( NodeType ,
EdgeIter  EI 
)
inlinestatic

Definition at line 469 of file CDG.h.

470 {
471 SVF::CDGEdge *edge = *(EI.getCurrent());
472 assert(edge && "No edge found!!");
473
474 std::string str;
475 std::stringstream rawstr(str);
476 for (const auto &cond: edge->getBranchConditions())
477 {
478 rawstr << std::to_string(cond.second) << "|";
479 }
480 std::string lb = rawstr.str();
481 lb.pop_back();
482
483 return lb;
484 }

◆ getGraphName()

static std::string SVF::DOTGraphTraits< SVF::CDG * >::getGraphName ( SVF::CDG )
inlinestatic

Return name of the graph.

Definition at line 357 of file CDG.h.

358 {
359 return "Control Dependence Graph";
360 }

◆ getNodeAttributes()

static std::string SVF::DOTGraphTraits< SVF::CDG * >::getNodeAttributes ( NodeType node,
SVF::CDG  
)
inlinestatic

Definition at line 423 of file CDG.h.

424 {
425 std::string str;
426 std::stringstream rawstr(str);
427 const SVF::ICFGNode *icfgNode = node->getICFGNode();
428
429 rawstr << "shape=record";
430
431 if (SVF::SVFUtil::isa<SVF::IntraICFGNode>(icfgNode))
432 {
433 rawstr << ",color=black";
434 }
435 else if (SVF::SVFUtil::isa<SVF::FunEntryICFGNode>(icfgNode))
436 {
437 rawstr << ",color=yellow";
438 }
439 else if (SVF::SVFUtil::isa<SVF::FunExitICFGNode>(icfgNode))
440 {
441 rawstr << ",color=green";
442 }
443 else if (SVF::SVFUtil::isa<SVF::CallICFGNode>(icfgNode))
444 {
445 rawstr << ",color=red";
446 }
447 else if (SVF::SVFUtil::isa<SVF::RetICFGNode>(icfgNode))
448 {
449 rawstr << ",color=blue";
450 }
451 else if (SVF::SVFUtil::isa<SVF::GlobalICFGNode>(icfgNode))
452 {
453 rawstr << ",color=purple";
454 }
455 else
456 assert(false && "no such kind of node!!");
457
458 return rawstr.str();
459 }

◆ getNodeLabel()

std::string SVF::DOTGraphTraits< SVF::CDG * >::getNodeLabel ( NodeType node,
SVF::CDG graph 
)
inline

Definition at line 362 of file CDG.h.

363 {
364 return getSimpleNodeLabel(node, graph);
365 }
static std::string getSimpleNodeLabel(NodeType *node, SVF::CDG *)
Return the label of an ICFG node.
Definition CDG.h:368

◆ getSimpleNodeLabel()

static std::string SVF::DOTGraphTraits< SVF::CDG * >::getSimpleNodeLabel ( NodeType node,
SVF::CDG  
)
inlinestatic

Return the label of an ICFG node.

Definition at line 368 of file CDG.h.

369 {
370 std::string str;
371 std::stringstream rawstr(str);
372 rawstr << "NodeID: " << node->getId() << "\n";
373 const SVF::ICFGNode *icfgNode = node->getICFGNode();
374 if (const SVF::IntraICFGNode *bNode = SVF::SVFUtil::dyn_cast<SVF::IntraICFGNode>(icfgNode))
375 {
376 rawstr << "IntraBlockNode ID: " << bNode->getId() << " \t";
378 if (edges.empty())
379 {
380 rawstr << (bNode)->toString() << " \t";
381 }
382 else
383 {
384 for (SVF::PAG::SVFStmtList::iterator it = edges.begin(), eit = edges.end(); it != eit; ++it)
385 {
386 const SVF::PAGEdge *edge = *it;
387 rawstr << edge->toString();
388 }
389 }
390 rawstr << " {fun: " << bNode->getFun()->getName() << "}";
391 }
392 else if (const SVF::FunEntryICFGNode *entry = SVF::SVFUtil::dyn_cast<SVF::FunEntryICFGNode>(icfgNode))
393 {
394 rawstr << entry->toString();
395 }
396 else if (const SVF::FunExitICFGNode *exit = SVF::SVFUtil::dyn_cast<SVF::FunExitICFGNode>(icfgNode))
397 {
398 rawstr << exit->toString();
399 }
400 else if (const SVF::CallICFGNode *call = SVF::SVFUtil::dyn_cast<SVF::CallICFGNode>(icfgNode))
401 {
402 rawstr << call->toString();
403 }
404 else if (const SVF::RetICFGNode *ret = SVF::SVFUtil::dyn_cast<SVF::RetICFGNode>(icfgNode))
405 {
406 rawstr << ret->toString();
407 }
408 else if (const SVF::GlobalICFGNode *glob = SVF::SVFUtil::dyn_cast<SVF::GlobalICFGNode>(icfgNode))
409 {
411 for (SVF::PAG::SVFStmtList::iterator it = edges.begin(), eit = edges.end(); it != eit; ++it)
412 {
413 const SVF::PAGEdge *edge = *it;
414 rawstr << edge->toString();
415 }
416 }
417 else
418 assert(false && "what else kinds of nodes do we have??");
419
420 return rawstr.str();
421 }
IDToNodeMapTy::iterator iterator
Node Iterators.
std::vector< const SVFStmt * > SVFStmtList
Definition SVFIR.h:59
SVFStmtList & getPTASVFStmtList(const ICFGNode *inst)
Given an instruction, get all its PTA PAGEdges.
Definition SVFIR.h:323
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:120
virtual const std::string toString() const
NodeID getId() const
Get ID.
Definition SVFValue.h:160

The documentation for this struct was generated from the following file: