Static Value-Flow Analysis
Loading...
Searching...
No Matches
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.
 
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 741 of file ConsG.cpp.

Member Typedef Documentation

◆ NodeType

Definition at line 744 of file ConsG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

Definition at line 745 of file ConsG.cpp.

745 :
747 {
748 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ getEdgeAttributes()

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

Definition at line 836 of file ConsG.cpp.

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

◆ getEdgeSourceLabel()

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

Definition at line 869 of file ConsG.cpp.

870 {
871 return "";
872 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 751 of file ConsG.cpp.

752 {
753 return "ConstraintG";
754 }

◆ getNodeAttributes()

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

Definition at line 797 of file ConsG.cpp.

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

◆ 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 764 of file ConsG.cpp.

765 {
766 const SVFVar* node = SVFIR::getPAG()->getSVFVar(n->getId());
768 bool nameDisplay = true;
769 std::string str;
770 std::stringstream rawstr(str);
771
772 if (briefDisplay)
773 {
774 if (SVFUtil::isa<ValVar>(node))
775 {
776 if (nameDisplay)
777 rawstr << node->getId() << ":" << node->getName();
778 else
779 rawstr << node->getId();
780 }
781 else
782 rawstr << node->getId();
783 }
784 else
785 {
786 // print the whole value
787 if (!SVFUtil::isa<DummyValVar>(node) && !SVFUtil::isa<DummyObjVar>(node))
788 rawstr << node->toString();
789 else
790 rawstr << node->getId() << ":";
791
792 }
793
794 return rawstr.str();
795 }
static const Option< bool > BriefConsCGDotGraph
Definition Options.h:206
NodeID getId() const
Get ID.
Definition SVFValue.h:160
virtual const std::string & getName() const
Definition SVFValue.h:186
virtual const std::string toString() const
Get string representation.

◆ isNodeHidden()

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

Definition at line 756 of file ConsG.cpp.

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

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