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 830 of file SVFG.cpp.

Member Typedef Documentation

◆ NodeType

Definition at line 833 of file SVFG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 834 of file SVFG.cpp.

834 :
836 {
837 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

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 933 of file SVFG.cpp.

934 {
935
936 std::string str;
937 std::stringstream rawstr(str);
938 if(StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
939 {
940 rawstr << stmtNode->toString();
941 }
942 else if(BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
943 {
944 rawstr << bop->toString();
945 }
946 else if(UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
947 {
948 rawstr << uop->toString();
949 }
950 else if(CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
951 {
952 rawstr << cmp->toString();
953 }
954 else if(MSSAPHISVFGNode* mphi = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
955 {
956 rawstr << mphi->toString();
957 }
958 else if(PHISVFGNode* tphi = SVFUtil::dyn_cast<PHISVFGNode>(node))
959 {
960 rawstr << tphi->toString();
961 }
962 else if(FormalINSVFGNode* fi = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
963 {
964 rawstr << fi->toString();
965 }
966 else if(FormalOUTSVFGNode* fo = SVFUtil::dyn_cast<FormalOUTSVFGNode>(node))
967 {
968 rawstr << fo->toString();
969 }
970 else if(FormalParmSVFGNode* fp = SVFUtil::dyn_cast<FormalParmSVFGNode>(node))
971 {
972 rawstr << fp->toString();
973 }
974 else if(ActualINSVFGNode* ai = SVFUtil::dyn_cast<ActualINSVFGNode>(node))
975 {
976 rawstr << ai->toString();
977 }
978 else if(ActualOUTSVFGNode* ao = SVFUtil::dyn_cast<ActualOUTSVFGNode>(node))
979 {
980 rawstr << ao->toString();
981 }
982 else if(ActualParmSVFGNode* ap = SVFUtil::dyn_cast<ActualParmSVFGNode>(node))
983 {
984 rawstr << ap->toString();
985 }
986 else if(NullPtrSVFGNode* nptr = SVFUtil::dyn_cast<NullPtrSVFGNode>(node))
987 {
988 rawstr << nptr->toString();
989 }
990 else if (ActualRetSVFGNode* ar = SVFUtil::dyn_cast<ActualRetSVFGNode>(node))
991 {
992 rawstr << ar->toString();
993 }
994 else if (FormalRetSVFGNode* fr = SVFUtil::dyn_cast<FormalRetSVFGNode>(node))
995 {
996 rawstr << fr->toString();
997 }
998 else if (BranchVFGNode* br = SVFUtil::dyn_cast<BranchVFGNode>(node))
999 {
1000 rawstr << br->toString();
1001 }
1002 else
1003 assert(false && "what else kinds of nodes do we have??");
1004
1005 return rawstr.str();
1006 }

◆ getEdgeAttributes()

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

Definition at line 1130 of file SVFG.cpp.

1131 {
1132 SVFGEdge* edge = *(EI.getCurrent());
1133 assert(edge && "No edge found!!");
1134 if (SVFUtil::isa<DirectSVFGEdge>(edge))
1135 {
1136 if (SVFUtil::isa<CallDirSVFGEdge>(edge))
1137 return "style=solid,color=red";
1138 else if (SVFUtil::isa<RetDirSVFGEdge>(edge))
1139 return "style=solid,color=blue";
1140 else
1141 return "style=solid";
1142 }
1143 else if (SVFUtil::isa<IndirectSVFGEdge>(edge))
1144 {
1145 if (SVFUtil::isa<CallIndSVFGEdge>(edge))
1146 return "style=dashed,color=red";
1147 else if (SVFUtil::isa<RetIndSVFGEdge>(edge))
1148 return "style=dashed,color=blue";
1149 else
1150 return "style=dashed";
1151 }
1152 return "";
1153 }

◆ getEdgeSourceLabel()

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

Definition at line 1156 of file SVFG.cpp.

1157 {
1158 SVFGEdge* edge = *(EI.getCurrent());
1159 assert(edge && "No edge found!!");
1160
1161 std::string str;
1162 std::stringstream rawstr(str);
1163 if (CallDirSVFGEdge* dirCall = SVFUtil::dyn_cast<CallDirSVFGEdge>(edge))
1164 rawstr << dirCall->getCallSiteId();
1165 else if (RetDirSVFGEdge* dirRet = SVFUtil::dyn_cast<RetDirSVFGEdge>(edge))
1166 rawstr << dirRet->getCallSiteId();
1167 else if (CallIndSVFGEdge* indCall = SVFUtil::dyn_cast<CallIndSVFGEdge>(edge))
1168 rawstr << indCall->getCallSiteId();
1169 else if (RetIndSVFGEdge* indRet = SVFUtil::dyn_cast<RetIndSVFGEdge>(edge))
1170 rawstr << indRet->getCallSiteId();
1171
1172 return rawstr.str();
1173 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 840 of file SVFG.cpp.

841 {
842 return "SVFG";
843 }

◆ getNodeAttributes()

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

dump slice information

Definition at line 1008 of file SVFG.cpp.

1009 {
1010 std::string str;
1011 std::stringstream rawstr(str);
1012
1013 rawstr << "shape=record";
1014
1015 if(StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
1016 {
1017 const SVFStmt* edge = stmtNode->getSVFStmt();
1018 if (SVFUtil::isa<AddrStmt>(edge))
1019 {
1020 rawstr << ",color=green";
1021 }
1022 else if (SVFUtil::isa<CopyStmt>(edge))
1023 {
1024 rawstr << ",color=black";
1025 }
1026 else if (SVFUtil::isa<RetPE>(edge))
1027 {
1028 rawstr << ",color=black,style=dotted";
1029 }
1030 else if (SVFUtil::isa<GepStmt>(edge))
1031 {
1032 rawstr << ",color=purple";
1033 }
1034 else if (SVFUtil::isa<StoreStmt>(edge))
1035 {
1036 rawstr << ",color=blue";
1037 }
1038 else if (SVFUtil::isa<LoadStmt>(edge))
1039 {
1040 rawstr << ",color=red";
1041 }
1042 else
1043 {
1044 assert(0 && "No such kind edge!!");
1045 }
1046 }
1047 else if(SVFUtil::isa<MSSAPHISVFGNode>(node))
1048 {
1049 rawstr << ",color=black";
1050 }
1051 else if(SVFUtil::isa<PHISVFGNode>(node))
1052 {
1053 rawstr << ",color=black";
1054 }
1055 else if(SVFUtil::isa<NullPtrSVFGNode>(node))
1056 {
1057 rawstr << ",color=grey";
1058 }
1059 else if(SVFUtil::isa<FormalINSVFGNode>(node))
1060 {
1061 rawstr << ",color=yellow,penwidth=2";
1062 }
1063 else if(SVFUtil::isa<FormalOUTSVFGNode>(node))
1064 {
1065 rawstr << ",color=yellow,penwidth=2";
1066 }
1067 else if(SVFUtil::isa<FormalParmSVFGNode>(node))
1068 {
1069 rawstr << ",color=yellow,penwidth=2";
1070 }
1071 else if(SVFUtil::isa<ActualINSVFGNode>(node))
1072 {
1073 rawstr << ",color=yellow,penwidth=2";
1074 }
1075 else if(SVFUtil::isa<ActualOUTSVFGNode>(node))
1076 {
1077 rawstr << ",color=yellow,penwidth=2";
1078 }
1079 else if(SVFUtil::isa<ActualParmSVFGNode>(node))
1080 {
1081 rawstr << ",color=yellow,penwidth=2";
1082 }
1083 else if (SVFUtil::isa<ActualRetSVFGNode>(node))
1084 {
1085 rawstr << ",color=yellow,penwidth=2";
1086 }
1087 else if (SVFUtil::isa<FormalRetSVFGNode>(node))
1088 {
1089 rawstr << ",color=yellow,penwidth=2";
1090 }
1091 else if (SVFUtil::isa<BinaryOPVFGNode>(node))
1092 {
1093 rawstr << ",color=black,penwidth=2";
1094 }
1095 else if (SVFUtil::isa<CmpVFGNode>(node))
1096 {
1097 rawstr << ",color=black,penwidth=2";
1098 }
1099 else if (SVFUtil::isa<UnaryOPVFGNode>(node))
1100 {
1101 rawstr << ",color=black,penwidth=2";
1102 }
1103 else if (SVFUtil::isa<BranchVFGNode>(node))
1104 {
1105 rawstr << ",color=gold,penwidth=2";
1106 }
1107 else
1108 assert(false && "no such kind of node!!");
1109
1111 if(graph->getStat()->isSource(node))
1112 {
1113 rawstr << ",style=filled, fillcolor=red";
1114 }
1115 else if(graph->getStat()->isSink(node))
1116 {
1117 rawstr << ",style=filled, fillcolor=blue";
1118 }
1119 else if(graph->getStat()->inBackwardSlice(node))
1120 {
1121 rawstr << ",style=filled, fillcolor=yellow";
1122 }
1123 else if(graph->getStat()->inForwardSlice(node))
1124 rawstr << ",style=filled, fillcolor=gray";
1125
1126 return rawstr.str();
1127 }
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 853 of file SVFG.cpp.

854 {
855 if (isSimple())
856 return getSimpleNodeLabel(node, graph);
857 else
858 return getCompleteNodeLabel(node, graph);
859 }
static std::string getSimpleNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node without MemSSA information.
Definition SVFG.cpp:862
static std::string getCompleteNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node with MemSSA information.
Definition SVFG.cpp:933

◆ getSimpleNodeLabel()

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

Return label of a VFG node without MemSSA information.

Definition at line 862 of file SVFG.cpp.

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

◆ 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 847 of file SVFG.cpp.

848 {
849 if (Options::ShowHiddenNode()) return false;
850 else return node->getInEdges().empty() && node->getOutEdges().empty();
851 }
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
static const Option< bool > ShowHiddenNode
Definition Options.h:221

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