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

Member Typedef Documentation

◆ NodeType

Definition at line 747 of file ConsG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

Definition at line 748 of file ConsG.cpp.

748 :
750 {
751 }
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 839 of file ConsG.cpp.

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

◆ getEdgeSourceLabel()

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

Definition at line 872 of file ConsG.cpp.

873 {
874 return "";
875 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 754 of file ConsG.cpp.

755 {
756 return "ConstraintG";
757 }

◆ getNodeAttributes()

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

Definition at line 800 of file ConsG.cpp.

801 {
802 const SVFVar* node = SVFIR::getPAG()->getSVFVar(n->getId());
803 if (SVFUtil::isa<ValVar>(node))
804 {
805 if(SVFUtil::isa<GepValVar>(node))
806 return "shape=hexagon";
807 else if (SVFUtil::isa<DummyValVar>(node))
808 return "shape=diamond";
809 else
810 return "shape=box";
811 }
812 else if (SVFUtil::isa<ObjVar>(node))
813 {
814 if(SVFUtil::isa<GepObjVar>(node))
815 return "shape=doubleoctagon";
816 else if(SVFUtil::isa<BaseObjVar>(node))
817 return "shape=box3d";
818 else if (SVFUtil::isa<DummyObjVar>(node))
819 return "shape=tab";
820 else
821 return "shape=component";
822 }
823 else if (SVFUtil::isa<RetValPN>(node))
824 {
825 return "shape=Mrecord";
826 }
827 else if (SVFUtil::isa<VarArgValPN>(node))
828 {
829 return "shape=octagon";
830 }
831 else
832 {
833 assert(0 && "no such kind!!");
834 }
835 return "";
836 }
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 767 of file ConsG.cpp.

768 {
769 const SVFVar* node = SVFIR::getPAG()->getSVFVar(n->getId());
771 bool nameDisplay = true;
772 std::string str;
773 std::stringstream rawstr(str);
774
775 if (briefDisplay)
776 {
777 if (SVFUtil::isa<ValVar>(node))
778 {
779 if (nameDisplay)
780 rawstr << node->getId() << ":" << node->getName();
781 else
782 rawstr << node->getId();
783 }
784 else
785 rawstr << node->getId();
786 }
787 else
788 {
789 // print the whole value
790 if (!SVFUtil::isa<DummyValVar>(node) && !SVFUtil::isa<DummyObjVar>(node))
791 rawstr << node->toString();
792 else
793 rawstr << node->getId() << ":";
794
795 }
796
797 return rawstr.str();
798 }
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 759 of file ConsG.cpp.

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

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