Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SVF::DOTGraphTraits< SVFG * > Struct Reference
Inheritance diagram for SVF::DOTGraphTraits< SVFG * >:
SVF::DOTGraphTraits< SVFIR * > SVF::DefaultDOTGraphTraits

Public Types

typedef SVFGNode NodeType
 

Public Member Functions

 DOTGraphTraits (bool isSimple=false)
 
std::string getNodeLabel (NodeType *node, SVFG *graph)
 
- 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 (SVFG *)
 Return name of the graph.
 
static bool isNodeHidden (SVFGNode *node, SVFG *)
 
static std::string getSimpleNodeLabel (NodeType *node, SVFG *)
 Return label of a VFG node without MemSSA information.
 
static std::string getCompleteNodeLabel (NodeType *node, SVFG *)
 Return label of a VFG node with MemSSA information.
 
static std::string getNodeAttributes (NodeType *node, SVFG *graph)
 
template<class EdgeIter >
static std::string getEdgeAttributes (NodeType *, EdgeIter EI, SVFG *)
 
template<class EdgeIter >
static std::string getEdgeSourceLabel (NodeType *, EdgeIter EI)
 
- 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 769 of file SVFG.cpp.

Member Typedef Documentation

◆ NodeType

Definition at line 772 of file SVFG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 773 of file SVFG.cpp.

773 :
775 {
776 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ getCompleteNodeLabel()

static std::string SVF::DOTGraphTraits< SVFG * >::getCompleteNodeLabel ( NodeType node,
SVFG  
)
inlinestatic

Return label of a VFG node with MemSSA information.

Definition at line 872 of file SVFG.cpp.

873 {
874
875 std::string str;
876 std::stringstream rawstr(str);
877 if(StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
878 {
879 rawstr << stmtNode->toString();
880 }
881 else if(BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
882 {
883 rawstr << bop->toString();
884 }
885 else if(UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
886 {
887 rawstr << uop->toString();
888 }
889 else if(CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
890 {
891 rawstr << cmp->toString();
892 }
893 else if(MSSAPHISVFGNode* mphi = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
894 {
895 rawstr << mphi->toString();
896 }
897 else if(PHISVFGNode* tphi = SVFUtil::dyn_cast<PHISVFGNode>(node))
898 {
899 rawstr << tphi->toString();
900 }
901 else if(FormalINSVFGNode* fi = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
902 {
903 rawstr << fi->toString();
904 }
905 else if(FormalOUTSVFGNode* fo = SVFUtil::dyn_cast<FormalOUTSVFGNode>(node))
906 {
907 rawstr << fo->toString();
908 }
909 else if(FormalParmSVFGNode* fp = SVFUtil::dyn_cast<FormalParmSVFGNode>(node))
910 {
911 rawstr << fp->toString();
912 }
913 else if(ActualINSVFGNode* ai = SVFUtil::dyn_cast<ActualINSVFGNode>(node))
914 {
915 rawstr << ai->toString();
916 }
917 else if(ActualOUTSVFGNode* ao = SVFUtil::dyn_cast<ActualOUTSVFGNode>(node))
918 {
919 rawstr << ao->toString();
920 }
921 else if(ActualParmSVFGNode* ap = SVFUtil::dyn_cast<ActualParmSVFGNode>(node))
922 {
923 rawstr << ap->toString();
924 }
925 else if(NullPtrSVFGNode* nptr = SVFUtil::dyn_cast<NullPtrSVFGNode>(node))
926 {
927 rawstr << nptr->toString();
928 }
929 else if (ActualRetSVFGNode* ar = SVFUtil::dyn_cast<ActualRetSVFGNode>(node))
930 {
931 rawstr << ar->toString();
932 }
933 else if (FormalRetSVFGNode* fr = SVFUtil::dyn_cast<FormalRetSVFGNode>(node))
934 {
935 rawstr << fr->toString();
936 }
937 else if (BranchVFGNode* br = SVFUtil::dyn_cast<BranchVFGNode>(node))
938 {
939 rawstr << br->toString();
940 }
941 else
942 assert(false && "what else kinds of nodes do we have??");
943
944 return rawstr.str();
945 }

◆ getEdgeAttributes()

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

Definition at line 1070 of file SVFG.cpp.

1071 {
1072 SVFGEdge* edge = *(EI.getCurrent());
1073 assert(edge && "No edge found!!");
1074 if (SVFUtil::isa<DirectSVFGEdge>(edge))
1075 {
1076 if (SVFUtil::isa<CallDirSVFGEdge>(edge))
1077 return "style=solid,color=red";
1078 else if (SVFUtil::isa<RetDirSVFGEdge>(edge))
1079 return "style=solid,color=blue";
1080 else
1081 return "style=solid";
1082 }
1083 else if (SVFUtil::isa<IndirectSVFGEdge>(edge))
1084 {
1085 if (SVFUtil::isa<CallIndSVFGEdge>(edge))
1086 return "style=dashed,color=red";
1087 else if (SVFUtil::isa<RetIndSVFGEdge>(edge))
1088 return "style=dashed,color=blue";
1089 else
1090 return "style=dashed";
1091 }
1092 return "";
1093 }

◆ getEdgeSourceLabel()

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

Definition at line 1096 of file SVFG.cpp.

1097 {
1098 SVFGEdge* edge = *(EI.getCurrent());
1099 assert(edge && "No edge found!!");
1100
1101 std::string str;
1102 std::stringstream rawstr(str);
1103 if (CallDirSVFGEdge* dirCall = SVFUtil::dyn_cast<CallDirSVFGEdge>(edge))
1104 rawstr << dirCall->getCallSiteId();
1105 else if (RetDirSVFGEdge* dirRet = SVFUtil::dyn_cast<RetDirSVFGEdge>(edge))
1106 rawstr << dirRet->getCallSiteId();
1107 else if (CallIndSVFGEdge* indCall = SVFUtil::dyn_cast<CallIndSVFGEdge>(edge))
1108 rawstr << indCall->getCallSiteId();
1109 else if (RetIndSVFGEdge* indRet = SVFUtil::dyn_cast<RetIndSVFGEdge>(edge))
1110 rawstr << indRet->getCallSiteId();
1111
1112 return rawstr.str();
1113 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 779 of file SVFG.cpp.

780 {
781 return "SVFG";
782 }

◆ getNodeAttributes()

static std::string SVF::DOTGraphTraits< SVFG * >::getNodeAttributes ( NodeType node,
SVFG graph 
)
inlinestatic

dump slice information

Definition at line 947 of file SVFG.cpp.

948 {
949 std::string str;
950 std::stringstream rawstr(str);
951
952 if(StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
953 {
954 const PAGEdge* edge = stmtNode->getPAGEdge();
955 if (SVFUtil::isa<AddrStmt>(edge))
956 {
957 rawstr << "color=green";
958 }
959 else if (SVFUtil::isa<CopyStmt>(edge))
960 {
961 rawstr << "color=black";
962 }
963 else if (SVFUtil::isa<RetPE>(edge))
964 {
965 rawstr << "color=black,style=dotted";
966 }
967 else if (SVFUtil::isa<GepStmt>(edge))
968 {
969 rawstr << "color=purple";
970 }
971 else if (SVFUtil::isa<StoreStmt>(edge))
972 {
973 rawstr << "color=blue";
974 }
975 else if (SVFUtil::isa<LoadStmt>(edge))
976 {
977 rawstr << "color=red";
978 }
979 else
980 {
981 assert(0 && "No such kind edge!!");
982 }
983 rawstr << "";
984 }
985 else if(SVFUtil::isa<MSSAPHISVFGNode>(node))
986 {
987 rawstr << "color=black";
988 }
989 else if(SVFUtil::isa<PHISVFGNode>(node))
990 {
991 rawstr << "color=black";
992 }
993 else if(SVFUtil::isa<NullPtrSVFGNode>(node))
994 {
995 rawstr << "color=grey";
996 }
997 else if(SVFUtil::isa<FormalINSVFGNode>(node))
998 {
999 rawstr << "color=yellow,penwidth=2";
1000 }
1001 else if(SVFUtil::isa<FormalOUTSVFGNode>(node))
1002 {
1003 rawstr << "color=yellow,penwidth=2";
1004 }
1005 else if(SVFUtil::isa<FormalParmSVFGNode>(node))
1006 {
1007 rawstr << "color=yellow,penwidth=2";
1008 }
1009 else if(SVFUtil::isa<ActualINSVFGNode>(node))
1010 {
1011 rawstr << "color=yellow,penwidth=2";
1012 }
1013 else if(SVFUtil::isa<ActualOUTSVFGNode>(node))
1014 {
1015 rawstr << "color=yellow,penwidth=2";
1016 }
1017 else if(SVFUtil::isa<ActualParmSVFGNode>(node))
1018 {
1019 rawstr << "color=yellow,penwidth=2";
1020 }
1021 else if (SVFUtil::isa<ActualRetSVFGNode>(node))
1022 {
1023 rawstr << "color=yellow,penwidth=2";
1024 }
1025 else if (SVFUtil::isa<FormalRetSVFGNode>(node))
1026 {
1027 rawstr << "color=yellow,penwidth=2";
1028 }
1029 else if (SVFUtil::isa<BinaryOPVFGNode>(node))
1030 {
1031 rawstr << "color=black,penwidth=2";
1032 }
1033 else if (SVFUtil::isa<CmpVFGNode>(node))
1034 {
1035 rawstr << "color=black,penwidth=2";
1036 }
1037 else if (SVFUtil::isa<UnaryOPVFGNode>(node))
1038 {
1039 rawstr << "color=black,penwidth=2";
1040 }
1041 else if (SVFUtil::isa<BranchVFGNode>(node))
1042 {
1043 rawstr << "color=gold,penwidth=2";
1044 }
1045 else
1046 assert(false && "no such kind of node!!");
1047
1049 if(graph->getStat()->isSource(node))
1050 {
1051 rawstr << ",style=filled, fillcolor=red";
1052 }
1053 else if(graph->getStat()->isSink(node))
1054 {
1055 rawstr << ",style=filled, fillcolor=blue";
1056 }
1057 else if(graph->getStat()->inBackwardSlice(node))
1058 {
1059 rawstr << ",style=filled, fillcolor=yellow";
1060 }
1061 else if(graph->getStat()->inForwardSlice(node))
1062 rawstr << ",style=filled, fillcolor=gray";
1063
1064 rawstr << "";
1065
1066 return rawstr.str();
1067 }
bool inBackwardSlice(const SVFGNode *node) const
Definition SVFGStat.h:257
bool isSource(const SVFGNode *node) const
Definition SVFGStat.h:261
bool inForwardSlice(const SVFGNode *node) const
Definition SVFGStat.h:253
bool isSink(const SVFGNode *node) const
Definition SVFGStat.h:265
SVFGStat * getStat() const
Return statistics.
Definition SVFG.h:126

◆ getNodeLabel()

std::string SVF::DOTGraphTraits< SVFG * >::getNodeLabel ( NodeType node,
SVFG graph 
)
inline

Definition at line 792 of file SVFG.cpp.

793 {
794 if (isSimple())
795 return getSimpleNodeLabel(node, graph);
796 else
797 return getCompleteNodeLabel(node, graph);
798 }
static std::string getSimpleNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node without MemSSA information.
Definition SVFG.cpp:801
static std::string getCompleteNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node with MemSSA information.
Definition SVFG.cpp:872

◆ getSimpleNodeLabel()

static std::string SVF::DOTGraphTraits< SVFG * >::getSimpleNodeLabel ( NodeType node,
SVFG  
)
inlinestatic

Return label of a VFG node without MemSSA information.

Definition at line 801 of file SVFG.cpp.

802 {
803 std::string str;
804 std::stringstream rawstr(str);
805 if(StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
806 {
807 rawstr << stmtNode->toString();
808 }
809 else if(PHISVFGNode* tphi = SVFUtil::dyn_cast<PHISVFGNode>(node))
810 {
811 rawstr << tphi->toString();
812 }
813 else if(FormalParmSVFGNode* fp = SVFUtil::dyn_cast<FormalParmSVFGNode>(node))
814 {
815 rawstr << fp->toString();
816 }
817 else if(ActualParmSVFGNode* ap = SVFUtil::dyn_cast<ActualParmSVFGNode>(node))
818 {
819 rawstr << ap->toString();
820 }
821 else if (ActualRetSVFGNode* ar = SVFUtil::dyn_cast<ActualRetSVFGNode>(node))
822 {
823 rawstr << ar->toString();
824 }
825 else if (FormalRetSVFGNode* fr = SVFUtil::dyn_cast<FormalRetSVFGNode>(node))
826 {
827 rawstr << fr->toString();
828 }
829 else if(FormalINSVFGNode* fi = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
830 {
831 rawstr << fi->toString();
832 }
833 else if(FormalOUTSVFGNode* fo = SVFUtil::dyn_cast<FormalOUTSVFGNode>(node))
834 {
835 rawstr << fo->toString();
836 }
837 else if(ActualINSVFGNode* ai = SVFUtil::dyn_cast<ActualINSVFGNode>(node))
838 {
839 rawstr << ai->toString();
840 }
841 else if(ActualOUTSVFGNode* ao = SVFUtil::dyn_cast<ActualOUTSVFGNode>(node))
842 {
843 rawstr << ao->toString();
844 }
845 else if(MSSAPHISVFGNode* mphi = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
846 {
847 rawstr << mphi->toString();
848 }
849 else if(SVFUtil::isa<NullPtrSVFGNode>(node))
850 {
851 rawstr << "NullPtr";
852 }
853 else if(BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
854 {
855 rawstr << bop->toString();
856 }
857 else if(UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
858 {
859 rawstr << uop->toString();
860 }
861 else if(CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
862 {
863 rawstr << cmp->toString();
864 }
865 else
866 assert(false && "what else kinds of nodes do we have??");
867
868 return rawstr.str();
869 }

◆ isNodeHidden()

static bool SVF::DOTGraphTraits< SVFG * >::isNodeHidden ( SVFGNode node,
SVFG  
)
inlinestatic

isNodeHidden - If the function returns true, the given node is not displayed in the graph

Definition at line 786 of file SVFG.cpp.

787 {
788 if (Options::ShowHiddenNode()) return false;
789 else return node->getInEdges().empty() && node->getOutEdges().empty();
790 }
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
static const Option< bool > ShowHiddenNode
Definition Options.h:228

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