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 NodeT , typename GraphType >
std::string getNodeLabel (NodeT, 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 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 746 of file ConsG.cpp.

Member Typedef Documentation

◆ NodeType

Definition at line 749 of file ConsG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

Definition at line 750 of file ConsG.cpp.

750 :
752 {
753 }
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 841 of file ConsG.cpp.

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

◆ getEdgeSourceLabel()

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

Definition at line 874 of file ConsG.cpp.

875 {
876 return "";
877 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 756 of file ConsG.cpp.

757 {
758 return "ConstraintG";
759 }

◆ getNodeAttributes()

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

Definition at line 802 of file ConsG.cpp.

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

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

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

◆ isNodeHidden()

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

Definition at line 761 of file ConsG.cpp.

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

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