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 340 of file CDG.h.

Member Typedef Documentation

◆ NodeType

Definition at line 343 of file CDG.h.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 345 of file CDG.h.

345 :
346 DOTGraphTraits<SVF::PAG *>(isSimple)
347 {
348 }

Member Function Documentation

◆ getEdgeAttributes()

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

Definition at line 456 of file CDG.h.

457 {
458 assert(*(EI.getCurrent()) && "No edge found!!");
459 return "style=solid";
460 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ getEdgeSourceLabel()

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

Definition at line 463 of file CDG.h.

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

◆ getGraphName()

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

Return name of the graph.

Definition at line 351 of file CDG.h.

352 {
353 return "Control Dependence Graph";
354 }

◆ getNodeAttributes()

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

Definition at line 417 of file CDG.h.

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

◆ getNodeLabel()

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

Definition at line 356 of file CDG.h.

357 {
358 return getSimpleNodeLabel(node, graph);
359 }
static std::string getSimpleNodeLabel(NodeType *node, SVF::CDG *)
Return the label of an ICFG node.
Definition CDG.h:362

◆ getSimpleNodeLabel()

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

Return the label of an ICFG node.

Definition at line 362 of file CDG.h.

363 {
364 std::string str;
365 std::stringstream rawstr(str);
366 rawstr << "NodeID: " << node->getId() << "\n";
367 const SVF::ICFGNode *icfgNode = node->getICFGNode();
368 if (const SVF::IntraICFGNode *bNode = SVF::SVFUtil::dyn_cast<SVF::IntraICFGNode>(icfgNode))
369 {
370 rawstr << "IntraBlockNode ID: " << bNode->getId() << " \t";
372 if (edges.empty())
373 {
374 rawstr << (bNode)->toString() << " \t";
375 }
376 else
377 {
378 for (SVF::PAG::SVFStmtList::iterator it = edges.begin(), eit = edges.end(); it != eit; ++it)
379 {
380 const SVF::PAGEdge *edge = *it;
381 rawstr << edge->toString();
382 }
383 }
384 rawstr << " {fun: " << bNode->getFun()->getName() << "}";
385 }
386 else if (const SVF::FunEntryICFGNode *entry = SVF::SVFUtil::dyn_cast<SVF::FunEntryICFGNode>(icfgNode))
387 {
388 rawstr << entry->toString();
389 }
390 else if (const SVF::FunExitICFGNode *exit = SVF::SVFUtil::dyn_cast<SVF::FunExitICFGNode>(icfgNode))
391 {
392 rawstr << exit->toString();
393 }
394 else if (const SVF::CallICFGNode *call = SVF::SVFUtil::dyn_cast<SVF::CallICFGNode>(icfgNode))
395 {
396 rawstr << call->toString();
397 }
398 else if (const SVF::RetICFGNode *ret = SVF::SVFUtil::dyn_cast<SVF::RetICFGNode>(icfgNode))
399 {
400 rawstr << ret->toString();
401 }
402 else if (const SVF::GlobalICFGNode *glob = SVF::SVFUtil::dyn_cast<SVF::GlobalICFGNode>(icfgNode))
403 {
405 for (SVF::PAG::SVFStmtList::iterator it = edges.begin(), eit = edges.end(); it != eit; ++it)
406 {
407 const SVF::PAGEdge *edge = *it;
408 rawstr << edge->toString();
409 }
410 }
411 else
412 assert(false && "what else kinds of nodes do we have??");
413
414 return rawstr.str();
415 }
IDToNodeMapTy::iterator iterator
Node Iterators.
NodeID getId() const
Get ID.
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:227
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:116
virtual const std::string toString() const

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