Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SVF::DOTGraphTraits< ConstraintGraph * > Struct Reference
Inheritance diagram for SVF::DOTGraphTraits< ConstraintGraph * >:
SVF::DOTGraphTraits< SVFIR * > SVF::DefaultDOTGraphTraits

Public Types

typedef ConstraintNode NodeType
 

Public Member Functions

 DOTGraphTraits (bool isSimple=false)
 
- Public Member Functions inherited from SVF::DOTGraphTraits< SVFIR * >
 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 (ConstraintGraph *)
 Return name of the graph. More...
 
static bool isNodeHidden (NodeType *n, ConstraintGraph *)
 
static std::string getNodeLabel (NodeType *n, ConstraintGraph *)
 
static std::string getNodeAttributes (NodeType *n, ConstraintGraph *)
 
template<class EdgeIter >
static std::string getEdgeAttributes (NodeType *, EdgeIter EI, ConstraintGraph *)
 
template<class EdgeIter >
static std::string getEdgeSourceLabel (NodeType *, EdgeIter)
 
- 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 742 of file ConsG.cpp.

Member Typedef Documentation

◆ NodeType

Definition at line 745 of file ConsG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 746 of file ConsG.cpp.

Member Function Documentation

◆ getEdgeAttributes()

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

Definition at line 837 of file ConsG.cpp.

838  {
839  ConstraintEdge* edge = *(EI.getCurrent());
840  assert(edge && "No edge found!!");
841  if (edge->getEdgeKind() == ConstraintEdge::Addr)
842  {
843  return "color=green";
844  }
845  else if (edge->getEdgeKind() == ConstraintEdge::Copy)
846  {
847  return "color=black";
848  }
849  else if (edge->getEdgeKind() == ConstraintEdge::NormalGep
851  {
852  return "color=purple";
853  }
854  else if (edge->getEdgeKind() == ConstraintEdge::Store)
855  {
856  return "color=blue";
857  }
858  else if (edge->getEdgeKind() == ConstraintEdge::Load)
859  {
860  return "color=red";
861  }
862  else
863  {
864  assert(0 && "No such kind edge!!");
865  }
866  return "";
867  }
GEdgeKind getEdgeKind() const
Definition: GenericGraph.h:89

◆ getEdgeSourceLabel()

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

Definition at line 870 of file ConsG.cpp.

871  {
872  return "";
873  }

◆ getGraphName()

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

Return name of the graph.

Definition at line 752 of file ConsG.cpp.

753  {
754  return "ConstraintG";
755  }

◆ getNodeAttributes()

static std::string SVF::DOTGraphTraits< ConstraintGraph * >::getNodeAttributes ( NodeType n,
ConstraintGraph  
)
inlinestatic

Definition at line 798 of file ConsG.cpp.

799  {
800  PAGNode* node = SVFIR::getPAG()->getGNode(n->getId());
801  if (SVFUtil::isa<ValVar>(node))
802  {
803  if(SVFUtil::isa<GepValVar>(node))
804  return "shape=hexagon";
805  else if (SVFUtil::isa<DummyValVar>(node))
806  return "shape=diamond";
807  else
808  return "shape=box";
809  }
810  else if (SVFUtil::isa<ObjVar>(node))
811  {
812  if(SVFUtil::isa<GepObjVar>(node))
813  return "shape=doubleoctagon";
814  else if(SVFUtil::isa<FIObjVar>(node))
815  return "shape=box3d";
816  else if (SVFUtil::isa<DummyObjVar>(node))
817  return "shape=tab";
818  else
819  return "shape=component";
820  }
821  else if (SVFUtil::isa<RetPN>(node))
822  {
823  return "shape=Mrecord";
824  }
825  else if (SVFUtil::isa<VarArgPN>(node))
826  {
827  return "shape=octagon";
828  }
829  else
830  {
831  assert(0 && "no such kind!!");
832  }
833  return "";
834  }
cJSON * n
Definition: cJSON.cpp:2558
NodeType * getGNode(NodeID id) const
Get a node.
Definition: GenericGraph.h:653
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition: SVFIR.h:115

◆ getNodeLabel()

static std::string SVF::DOTGraphTraits< ConstraintGraph * >::getNodeLabel ( NodeType n,
ConstraintGraph  
)
inlinestatic

Return label of a VFG node with two display mode Either you can choose to display the name of the value or the whole instruction

Definition at line 765 of file ConsG.cpp.

766  {
767  PAGNode* node = SVFIR::getPAG()->getGNode(n->getId());
768  bool briefDisplay = Options::BriefConsCGDotGraph();
769  bool nameDisplay = true;
770  std::string str;
771  std::stringstream rawstr(str);
772 
773  if (briefDisplay)
774  {
775  if (SVFUtil::isa<ValVar>(node))
776  {
777  if (nameDisplay)
778  rawstr << node->getId() << ":" << node->getValueName();
779  else
780  rawstr << node->getId();
781  }
782  else
783  rawstr << node->getId();
784  }
785  else
786  {
787  // print the whole value
788  if (!SVFUtil::isa<DummyValVar>(node) && !SVFUtil::isa<DummyObjVar>(node))
789  rawstr << node->getId() << ":" << node->getValue()->toString();
790  else
791  rawstr << node->getId() << ":";
792 
793  }
794 
795  return rawstr.str();
796  }
const char *const string
Definition: cJSON.h:172
static const Option< bool > BriefConsCGDotGraph
Definition: Options.h:209
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
std::string toString() const
Needs to be implemented by a SVF front end.
Definition: LLVMUtil.cpp:663
virtual const std::string getValueName() const =0
Get name of the LLVM value.
const SVFValue * getValue() const
Get/has methods of the components.
Definition: SVFVariables.h:83

◆ isNodeHidden()

static bool SVF::DOTGraphTraits< ConstraintGraph * >::isNodeHidden ( NodeType n,
ConstraintGraph  
)
inlinestatic

Definition at line 757 of file ConsG.cpp.

758  {
759  if (Options::ShowHiddenNode()) return false;
760  else return (n->getInEdges().empty() && n->getOutEdges().empty());
761  }
static const Option< bool > ShowHiddenNode
Definition: Options.h:228

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