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

Member Typedef Documentation

◆ NodeType

Definition at line 746 of file ConsG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

Definition at line 747 of file ConsG.cpp.

747 :
749 {
750 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

Member Function Documentation

◆ getEdgeAttributes()

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

Definition at line 838 of file ConsG.cpp.

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

◆ getEdgeSourceLabel()

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

Definition at line 871 of file ConsG.cpp.

872 {
873 return "";
874 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 753 of file ConsG.cpp.

754 {
755 return "ConstraintG";
756 }

◆ getNodeAttributes()

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

Definition at line 799 of file ConsG.cpp.

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

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

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

◆ isNodeHidden()

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

Definition at line 758 of file ConsG.cpp.

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

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