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

Public Types

typedef VFGNode NodeType
 

Public Member Functions

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

Member Typedef Documentation

◆ NodeType

Definition at line 1087 of file VFG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 1088 of file VFG.cpp.

1088 :
1090 {
1091 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

Member Function Documentation

◆ getCompleteNodeLabel()

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

Return label of a VFG node with MemSSA information.

Definition at line 1163 of file VFG.cpp.

1164 {
1165
1166 std::string str;
1167 std::stringstream rawstr(str);
1168 if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1169 {
1170 rawstr << stmtNode->toString();
1171 }
1172 else if(BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
1173 {
1174 rawstr << bop->toString();
1175 }
1176 else if(UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
1177 {
1178 rawstr << uop->toString();
1179 }
1180 else if(CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
1181 {
1182 rawstr << cmp->toString();
1183 }
1184 else if(PHIVFGNode* phi = SVFUtil::dyn_cast<PHIVFGNode>(node))
1185 {
1186 rawstr << phi->toString();
1187 }
1188 else if(FormalParmVFGNode* fp = SVFUtil::dyn_cast<FormalParmVFGNode>(node))
1189 {
1190 rawstr << fp->toString();
1191 }
1192 else if(ActualParmVFGNode* ap = SVFUtil::dyn_cast<ActualParmVFGNode>(node))
1193 {
1194 rawstr << ap->toString();
1195 }
1196 else if(NullPtrVFGNode* nptr = SVFUtil::dyn_cast<NullPtrVFGNode>(node))
1197 {
1198 rawstr << nptr->toString();
1199 }
1200 else if (ActualRetVFGNode* ar = SVFUtil::dyn_cast<ActualRetVFGNode>(node))
1201 {
1202 rawstr << ar->toString();
1203 }
1204 else if (FormalRetVFGNode* fr = SVFUtil::dyn_cast<FormalRetVFGNode>(node))
1205 {
1206 rawstr << fr->toString();
1207 }
1208 else if (MRSVFGNode* mr = SVFUtil::dyn_cast<MRSVFGNode>(node))
1209 {
1210 rawstr << mr->toString();
1211 }
1212 else if (BranchVFGNode* branchNode = SVFUtil::dyn_cast<BranchVFGNode>(node))
1213 {
1214 rawstr << branchNode->toString();
1215 }
1216 else
1217 assert(false && "what else kinds of nodes do we have??");
1218
1219 return rawstr.str();
1220 }

◆ getEdgeAttributes()

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

Definition at line 1313 of file VFG.cpp.

1314 {
1315 VFGEdge* edge = *(EI.getCurrent());
1316 assert(edge && "No edge found!!");
1317 if (SVFUtil::isa<DirectSVFGEdge>(edge))
1318 {
1319 if (SVFUtil::isa<CallDirSVFGEdge>(edge))
1320 return "style=solid,color=red";
1321 else if (SVFUtil::isa<RetDirSVFGEdge>(edge))
1322 return "style=solid,color=blue";
1323 else
1324 return "style=solid";
1325 }
1326 else if (SVFUtil::isa<IndirectSVFGEdge>(edge))
1327 {
1328 if (SVFUtil::isa<CallIndSVFGEdge>(edge))
1329 return "style=dashed,color=red";
1330 else if (SVFUtil::isa<RetIndSVFGEdge>(edge))
1331 return "style=dashed,color=blue";
1332 else
1333 return "style=dashed";
1334 }
1335 else
1336 {
1337 assert(false && "what else edge we have?");
1338 }
1339 return "";
1340 }

◆ getEdgeSourceLabel()

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

Definition at line 1343 of file VFG.cpp.

1344 {
1345 VFGEdge* edge = *(EI.getCurrent());
1346 assert(edge && "No edge found!!");
1347
1348 std::string str;
1349 std::stringstream rawstr(str);
1350 if (CallDirSVFGEdge* dirCall = SVFUtil::dyn_cast<CallDirSVFGEdge>(edge))
1351 rawstr << dirCall->getCallSiteId();
1352 else if (RetDirSVFGEdge* dirRet = SVFUtil::dyn_cast<RetDirSVFGEdge>(edge))
1353 rawstr << dirRet->getCallSiteId();
1354
1355 return rawstr.str();
1356 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 1094 of file VFG.cpp.

1095 {
1096 return "VFG";
1097 }

◆ getNodeAttributes()

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

Definition at line 1222 of file VFG.cpp.

1223 {
1224 std::string str;
1225 std::stringstream rawstr(str);
1226
1227 if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1228 {
1229 const SVFStmt* edge = stmtNode->getSVFStmt();
1230 if (SVFUtil::isa<AddrStmt>(edge))
1231 {
1232 rawstr << "color=green";
1233 }
1234 else if (SVFUtil::isa<CopyStmt>(edge))
1235 {
1236 rawstr << "color=black";
1237 }
1238 else if (SVFUtil::isa<RetPE>(edge))
1239 {
1240 rawstr << "color=black,style=dotted";
1241 }
1242 else if (SVFUtil::isa<GepStmt>(edge))
1243 {
1244 rawstr << "color=purple";
1245 }
1246 else if (SVFUtil::isa<StoreStmt>(edge))
1247 {
1248 rawstr << "color=blue";
1249 }
1250 else if (SVFUtil::isa<LoadStmt>(edge))
1251 {
1252 rawstr << "color=red";
1253 }
1254 else
1255 {
1256 assert(0 && "No such kind edge!!");
1257 }
1258 rawstr << "";
1259 }
1260 else if (SVFUtil::isa<CmpVFGNode>(node))
1261 {
1262 rawstr << "color=grey";
1263 }
1264 else if (SVFUtil::isa<BinaryOPVFGNode>(node))
1265 {
1266 rawstr << "color=grey";
1267 }
1268 else if (SVFUtil::isa<UnaryOPVFGNode>(node))
1269 {
1270 rawstr << "color=grey";
1271 }
1272 else if(SVFUtil::isa<PHIVFGNode>(node))
1273 {
1274 rawstr << "color=black";
1275 }
1276 else if(SVFUtil::isa<NullPtrVFGNode>(node))
1277 {
1278 rawstr << "color=grey";
1279 }
1280 else if(SVFUtil::isa<FormalParmVFGNode>(node))
1281 {
1282 rawstr << "color=yellow,penwidth=2";
1283 }
1284 else if(SVFUtil::isa<ActualParmVFGNode>(node))
1285 {
1286 rawstr << "color=yellow,penwidth=2";
1287 }
1288 else if (SVFUtil::isa<ActualRetVFGNode>(node))
1289 {
1290 rawstr << "color=yellow,penwidth=2";
1291 }
1292 else if (SVFUtil::isa<FormalRetVFGNode>(node))
1293 {
1294 rawstr << "color=yellow,penwidth=2";
1295 }
1296 else if (SVFUtil::isa<MRSVFGNode>(node))
1297 {
1298 rawstr << "color=orange,penwidth=2";
1299 }
1300 else if (SVFUtil::isa<BranchVFGNode>(node))
1301 {
1302 rawstr << "color=gold,penwidth=2";
1303 }
1304 else
1305 assert(false && "no such kind of node!!");
1306
1307 rawstr << "";
1308
1309 return rawstr.str();
1310 }

◆ getNodeLabel()

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

Definition at line 1099 of file VFG.cpp.

1100 {
1101 if (isSimple())
1102 return getSimpleNodeLabel(node, graph);
1103 else
1104 return getCompleteNodeLabel(node, graph);
1105 }
static std::string getCompleteNodeLabel(NodeType *node, VFG *)
Return label of a VFG node with MemSSA information.
Definition VFG.cpp:1163
static std::string getSimpleNodeLabel(NodeType *node, VFG *)
Return label of a VFG node without MemSSA information.
Definition VFG.cpp:1108

◆ getSimpleNodeLabel()

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

Return label of a VFG node without MemSSA information.

Definition at line 1108 of file VFG.cpp.

1109 {
1110 std::string str;
1111 std::stringstream rawstr(str);
1112 if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1113 {
1114 rawstr << stmtNode->toString();
1115 }
1116 else if(PHIVFGNode* tphi = SVFUtil::dyn_cast<PHIVFGNode>(node))
1117 {
1118 rawstr << tphi->toString();
1119 }
1120 else if(FormalParmVFGNode* fp = SVFUtil::dyn_cast<FormalParmVFGNode>(node))
1121 {
1122 rawstr << fp->toString();
1123 }
1124 else if(ActualParmVFGNode* ap = SVFUtil::dyn_cast<ActualParmVFGNode>(node))
1125 {
1126 rawstr << ap->toString();
1127 }
1128 else if (ActualRetVFGNode* ar = SVFUtil::dyn_cast<ActualRetVFGNode>(node))
1129 {
1130 rawstr << ar->toString();
1131 }
1132 else if (FormalRetVFGNode* fr = SVFUtil::dyn_cast<FormalRetVFGNode>(node))
1133 {
1134 rawstr << fr->toString();
1135 }
1136 else if(SVFUtil::isa<NullPtrVFGNode>(node))
1137 {
1138 rawstr << "NullPtr";
1139 }
1140 else if(BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
1141 {
1142 rawstr << bop->toString();
1143 }
1144 else if(UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
1145 {
1146 rawstr << uop->toString();
1147 }
1148 else if(CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
1149 {
1150 rawstr << cmp->toString();;
1151 }
1152 else if (BranchVFGNode* branchNode = SVFUtil::dyn_cast<BranchVFGNode>(node))
1153 {
1154 rawstr << branchNode->toString();
1155 }
1156 else
1157 assert(false && "what else kinds of nodes do we have??");
1158
1159 return rawstr.str();
1160 }

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