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

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

◆ getEdgeSourceLabel()

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

Definition at line 1157 of file SVFG.cpp.

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

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

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