Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::DOTGraphTraits< SparseObjGraph * > Struct Reference
Inheritance diagram for SVF::DOTGraphTraits< SparseObjGraph * >:
SVF::DefaultDOTGraphTraits SVF::DefaultDOTGraphTraits

Public Member Functions

 DOTGraphTraits (bool simple=false)
Public Member Functions inherited from SVF::DefaultDOTGraphTraits
 DefaultDOTGraphTraits (bool simple=false)
template<typename NodeT, typename GraphType>
std::string getNodeLabel (NodeT, const GraphType &)

Static Public Member Functions

static std::string getGraphName (SparseObjGraph *)
static std::string getNodeLabel (SparseObjNode *node, SparseObjGraph *)
static std::string getNodeAttributes (SparseObjNode *node, SparseObjGraph *)
template<class EdgeIter>
static std::string getEdgeAttributes (SparseObjNode *node, EdgeIter it, SparseObjGraph *graph)
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 NodeT>
static const void * getNodeIdentifier (NodeT N)
template<typename NodeT, typename GraphType>
static bool isNodeHidden (NodeT, const GraphType &)
template<typename NodeT, typename GraphType>
static std::string getNodeIdentifierLabel (NodeT, const GraphType &)
template<typename NodeT, typename GraphType>
static std::string getNodeDescription (NodeT, const GraphType &)
template<typename NodeT, typename GraphType>
static std::string getNodeAttributes (NodeT, const GraphType &)
template<typename NodeT, typename EdgeIter, typename GraphType>
static std::string getEdgeAttributes (NodeT, EdgeIter, const GraphType &)
template<typename NodeT, typename EdgeIter>
static std::string getEdgeSourceLabel (NodeT, EdgeIter)
template<typename NodeT, typename EdgeIter>
static bool edgeTargetsEdgeSource (NodeT, EdgeIter)
template<typename NodeT, typename EdgeIter>
static EdgeIter getEdgeTarget (NodeT, EdgeIter I)
static bool hasEdgeDestLabels ()
template<typename NodeT>
static unsigned numEdgeDestLabels (NodeT)
template<typename NodeT>
static std::string getEdgeDestLabel (NodeT, 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 469 of file SparseObjGraph.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

SVF::DOTGraphTraits< SparseObjGraph * >::DOTGraphTraits ( bool simple = false)
inline

Definition at line 471 of file SparseObjGraph.cpp.

Member Function Documentation

◆ getEdgeAttributes()

template<class EdgeIter>
std::string SVF::DOTGraphTraits< SparseObjGraph * >::getEdgeAttributes ( SparseObjNode * node,
EdgeIter it,
SparseObjGraph * graph )
inlinestatic

Definition at line 527 of file SparseObjGraph.cpp.

529 {
530 const SparseObjEdge* edge = *(it.getCurrent());
531 std::string label = labelText(graph->getPAG(), edge->getBases());
532 std::string attr = "label=\"{" + label + "}\"";
533 const SparseObjNode* target = edge->getDstNode();
534 if (node->location->getFun() != target->location->getFun())
535 attr += ",color=blue,style=dashed,fontcolor=blue";
536 else if (node->branch || target->branch)
537 attr += ",color=\"#c2410c\",fontcolor=\"#c2410c\"";
538 return attr;
539 }

◆ getGraphName()

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

Definition at line 473 of file SparseObjGraph.cpp.

474 {
475 return "Sparse object routes";
476 }

◆ getNodeAttributes()

std::string SVF::DOTGraphTraits< SparseObjGraph * >::getNodeAttributes ( SparseObjNode * node,
SparseObjGraph *  )
inlinestatic

Definition at line 520 of file SparseObjGraph.cpp.

521 {
522 return node->branch ? "shape=diamond,style=filled,fillcolor=\"#ffedd5\""
523 : "shape=box,style=filled,fillcolor=\"#dbeafe\"";
524 }

◆ getNodeLabel()

std::string SVF::DOTGraphTraits< SparseObjGraph * >::getNodeLabel ( SparseObjNode * node,
SparseObjGraph *  )
inlinestatic

Definition at line 478 of file SparseObjGraph.cpp.

479 {
481 const ICFGNode* loc = node->location;
482 if (node->branch)
483 {
484 out << "branch ICFG" << loc->getId() << " -> ICFG"
485 << node->branch->getDstNode()->getId() << " ["
486 << (node->branch->getSuccessorCondValue() ? "true" : "false") << "]";
487 return out.str();
488 }
489 out << "ICFG" << loc->getId();
490 if (loc->getFun())
491 out << " @" << loc->getFun()->getName();
492 if (SVFUtil::isa<FunEntryICFGNode>(loc)) out << " (entry)";
493 else if (SVFUtil::isa<FunExitICFGNode>(loc)) out << " (exit)";
494 else if (SVFUtil::isa<CallICFGNode>(loc)) out << " (call)";
495 else if (SVFUtil::isa<RetICFGNode>(loc)) out << " (ret)";
496 else if (SVFUtil::isa<GlobalICFGNode>(loc)) out << " (global)";
498 for (const SVFStmt* stmt : loc->getSVFStmts())
499 {
500 const char* k = SVFUtil::isa<StoreStmt>(stmt) ? "store"
501 : SVFUtil::isa<LoadStmt>(stmt) ? "load"
502 : SVFUtil::isa<BranchStmt>(stmt) ? "branch" : nullptr;
503 if (k && kinds.find(k) == std::string::npos)
504 kinds += std::string(kinds.empty() ? "" : "+") + k;
505 }
507 {
508 const std::string src = loc->getSourceLoc();
509 const size_t ln = src.find("\"ln\": ");
510 if (ln != std::string::npos)
511 line = src.substr(ln + 6, src.find_first_of(",}", ln + 6) - ln - 6);
512 }
513 if (!line.empty() && line != "0")
514 out << " line " << line;
515 if (!kinds.empty())
516 out << "\n" << kinds;
517 return out.str();
518 }
LLVM_NODISCARD bool isa(const Y &Val)
Definition Casting.h:241

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