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

Member Typedef Documentation

◆ NodeType

Definition at line 847 of file SVFG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 848 of file SVFG.cpp.

848 :
850 {
851 }
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 947 of file SVFG.cpp.

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

◆ getEdgeAttributes()

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

Definition at line 1145 of file SVFG.cpp.

1146 {
1147 SVFGEdge* edge = *(EI.getCurrent());
1148 assert(edge && "No edge found!!");
1149 if (SVFUtil::isa<DirectSVFGEdge>(edge))
1150 {
1151 if (SVFUtil::isa<CallDirSVFGEdge>(edge))
1152 return "style=solid,color=red";
1153 else if (SVFUtil::isa<RetDirSVFGEdge>(edge))
1154 return "style=solid,color=blue";
1155 else
1156 return "style=solid";
1157 }
1158 else if (SVFUtil::isa<IndirectSVFGEdge>(edge))
1159 {
1160 if (SVFUtil::isa<CallIndSVFGEdge>(edge))
1161 return "style=dashed,color=red";
1162 else if (SVFUtil::isa<RetIndSVFGEdge>(edge))
1163 return "style=dashed,color=blue";
1164 else
1165 return "style=dashed";
1166 }
1167 return "";
1168 }

◆ getEdgeSourceLabel()

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

Definition at line 1171 of file SVFG.cpp.

1172 {
1173 SVFGEdge* edge = *(EI.getCurrent());
1174 assert(edge && "No edge found!!");
1175
1176 std::string str;
1177 std::stringstream rawstr(str);
1178 if (CallDirSVFGEdge* dirCall = SVFUtil::dyn_cast<CallDirSVFGEdge>(edge))
1179 rawstr << dirCall->getCallSiteId();
1180 else if (RetDirSVFGEdge* dirRet = SVFUtil::dyn_cast<RetDirSVFGEdge>(edge))
1181 rawstr << dirRet->getCallSiteId();
1182 else if (CallIndSVFGEdge* indCall = SVFUtil::dyn_cast<CallIndSVFGEdge>(edge))
1183 rawstr << indCall->getCallSiteId();
1184 else if (RetIndSVFGEdge* indRet = SVFUtil::dyn_cast<RetIndSVFGEdge>(edge))
1185 rawstr << indRet->getCallSiteId();
1186
1187 return rawstr.str();
1188 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 854 of file SVFG.cpp.

855 {
856 return "SVFG";
857 }

◆ getNodeAttributes()

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

dump slice information

Definition at line 1022 of file SVFG.cpp.

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

868 {
869 if (isSimple())
870 return getSimpleNodeLabel(node, graph);
871 else
872 return getCompleteNodeLabel(node, graph);
873 }
static std::string getSimpleNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node without MemSSA information.
Definition SVFG.cpp:876
static std::string getCompleteNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node with MemSSA information.
Definition SVFG.cpp:947

◆ getSimpleNodeLabel()

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

Return label of a VFG node without MemSSA information.

Definition at line 876 of file SVFG.cpp.

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

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

862 {
863 if (Options::ShowHiddenNode()) return false;
864 else return node->getInEdges().empty() && node->getOutEdges().empty();
865 }
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
static const Option< bool > ShowHiddenNode
Definition Options.h:225

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