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 1107 of file VFG.cpp.

Member Typedef Documentation

◆ NodeType

Definition at line 1110 of file VFG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 1111 of file VFG.cpp.

1111 :
1113 {
1114 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

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 1186 of file VFG.cpp.

1187 {
1188
1189 std::string str;
1190 std::stringstream rawstr(str);
1191 if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1192 {
1193 rawstr << stmtNode->toString();
1194 }
1195 else if(BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
1196 {
1197 rawstr << bop->toString();
1198 }
1199 else if(UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
1200 {
1201 rawstr << uop->toString();
1202 }
1203 else if(CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
1204 {
1205 rawstr << cmp->toString();
1206 }
1207 else if(PHIVFGNode* phi = SVFUtil::dyn_cast<PHIVFGNode>(node))
1208 {
1209 rawstr << phi->toString();
1210 }
1211 else if(FormalParmVFGNode* fp = SVFUtil::dyn_cast<FormalParmVFGNode>(node))
1212 {
1213 rawstr << fp->toString();
1214 }
1215 else if(ActualParmVFGNode* ap = SVFUtil::dyn_cast<ActualParmVFGNode>(node))
1216 {
1217 rawstr << ap->toString();
1218 }
1219 else if(NullPtrVFGNode* nptr = SVFUtil::dyn_cast<NullPtrVFGNode>(node))
1220 {
1221 rawstr << nptr->toString();
1222 }
1223 else if (ActualRetVFGNode* ar = SVFUtil::dyn_cast<ActualRetVFGNode>(node))
1224 {
1225 rawstr << ar->toString();
1226 }
1227 else if (FormalRetVFGNode* fr = SVFUtil::dyn_cast<FormalRetVFGNode>(node))
1228 {
1229 rawstr << fr->toString();
1230 }
1231 else if (MRSVFGNode* mr = SVFUtil::dyn_cast<MRSVFGNode>(node))
1232 {
1233 rawstr << mr->toString();
1234 }
1235 else if (BranchVFGNode* branchNode = SVFUtil::dyn_cast<BranchVFGNode>(node))
1236 {
1237 rawstr << branchNode->toString();
1238 }
1239 else
1240 assert(false && "what else kinds of nodes do we have??");
1241
1242 return rawstr.str();
1243 }

◆ getEdgeAttributes()

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

Definition at line 1336 of file VFG.cpp.

1337 {
1338 VFGEdge* edge = *(EI.getCurrent());
1339 assert(edge && "No edge found!!");
1340 if (SVFUtil::isa<DirectSVFGEdge>(edge))
1341 {
1342 if (SVFUtil::isa<CallDirSVFGEdge>(edge))
1343 return "style=solid,color=red";
1344 else if (SVFUtil::isa<RetDirSVFGEdge>(edge))
1345 return "style=solid,color=blue";
1346 else
1347 return "style=solid";
1348 }
1349 else if (SVFUtil::isa<IndirectSVFGEdge>(edge))
1350 {
1351 if (SVFUtil::isa<CallIndSVFGEdge>(edge))
1352 return "style=dashed,color=red";
1353 else if (SVFUtil::isa<RetIndSVFGEdge>(edge))
1354 return "style=dashed,color=blue";
1355 else
1356 return "style=dashed";
1357 }
1358 else
1359 {
1360 assert(false && "what else edge we have?");
1361 }
1362 return "";
1363 }

◆ getEdgeSourceLabel()

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

Definition at line 1366 of file VFG.cpp.

1367 {
1368 VFGEdge* edge = *(EI.getCurrent());
1369 assert(edge && "No edge found!!");
1370
1371 std::string str;
1372 std::stringstream rawstr(str);
1373 if (CallDirSVFGEdge* dirCall = SVFUtil::dyn_cast<CallDirSVFGEdge>(edge))
1374 rawstr << dirCall->getCallSiteId();
1375 else if (RetDirSVFGEdge* dirRet = SVFUtil::dyn_cast<RetDirSVFGEdge>(edge))
1376 rawstr << dirRet->getCallSiteId();
1377
1378 return rawstr.str();
1379 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 1117 of file VFG.cpp.

1118 {
1119 return "VFG";
1120 }

◆ getNodeAttributes()

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

Definition at line 1245 of file VFG.cpp.

1246 {
1247 std::string str;
1248 std::stringstream rawstr(str);
1249
1250 if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1251 {
1252 const PAGEdge* edge = stmtNode->getPAGEdge();
1253 if (SVFUtil::isa<AddrStmt>(edge))
1254 {
1255 rawstr << "color=green";
1256 }
1257 else if (SVFUtil::isa<CopyStmt>(edge))
1258 {
1259 rawstr << "color=black";
1260 }
1261 else if (SVFUtil::isa<RetPE>(edge))
1262 {
1263 rawstr << "color=black,style=dotted";
1264 }
1265 else if (SVFUtil::isa<GepStmt>(edge))
1266 {
1267 rawstr << "color=purple";
1268 }
1269 else if (SVFUtil::isa<StoreStmt>(edge))
1270 {
1271 rawstr << "color=blue";
1272 }
1273 else if (SVFUtil::isa<LoadStmt>(edge))
1274 {
1275 rawstr << "color=red";
1276 }
1277 else
1278 {
1279 assert(0 && "No such kind edge!!");
1280 }
1281 rawstr << "";
1282 }
1283 else if (SVFUtil::isa<CmpVFGNode>(node))
1284 {
1285 rawstr << "color=grey";
1286 }
1287 else if (SVFUtil::isa<BinaryOPVFGNode>(node))
1288 {
1289 rawstr << "color=grey";
1290 }
1291 else if (SVFUtil::isa<UnaryOPVFGNode>(node))
1292 {
1293 rawstr << "color=grey";
1294 }
1295 else if(SVFUtil::isa<PHIVFGNode>(node))
1296 {
1297 rawstr << "color=black";
1298 }
1299 else if(SVFUtil::isa<NullPtrVFGNode>(node))
1300 {
1301 rawstr << "color=grey";
1302 }
1303 else if(SVFUtil::isa<FormalParmVFGNode>(node))
1304 {
1305 rawstr << "color=yellow,penwidth=2";
1306 }
1307 else if(SVFUtil::isa<ActualParmVFGNode>(node))
1308 {
1309 rawstr << "color=yellow,penwidth=2";
1310 }
1311 else if (SVFUtil::isa<ActualRetVFGNode>(node))
1312 {
1313 rawstr << "color=yellow,penwidth=2";
1314 }
1315 else if (SVFUtil::isa<FormalRetVFGNode>(node))
1316 {
1317 rawstr << "color=yellow,penwidth=2";
1318 }
1319 else if (SVFUtil::isa<MRSVFGNode>(node))
1320 {
1321 rawstr << "color=orange,penwidth=2";
1322 }
1323 else if (SVFUtil::isa<BranchVFGNode>(node))
1324 {
1325 rawstr << "color=gold,penwidth=2";
1326 }
1327 else
1328 assert(false && "no such kind of node!!");
1329
1330 rawstr << "";
1331
1332 return rawstr.str();
1333 }

◆ getNodeLabel()

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

Definition at line 1122 of file VFG.cpp.

1123 {
1124 if (isSimple())
1125 return getSimpleNodeLabel(node, graph);
1126 else
1127 return getCompleteNodeLabel(node, graph);
1128 }
static std::string getCompleteNodeLabel(NodeType *node, VFG *)
Return label of a VFG node with MemSSA information.
Definition VFG.cpp:1186
static std::string getSimpleNodeLabel(NodeType *node, VFG *)
Return label of a VFG node without MemSSA information.
Definition VFG.cpp:1131

◆ getSimpleNodeLabel()

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

Return label of a VFG node without MemSSA information.

Definition at line 1131 of file VFG.cpp.

1132 {
1133 std::string str;
1134 std::stringstream rawstr(str);
1135 if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1136 {
1137 rawstr << stmtNode->toString();
1138 }
1139 else if(PHIVFGNode* tphi = SVFUtil::dyn_cast<PHIVFGNode>(node))
1140 {
1141 rawstr << tphi->toString();
1142 }
1143 else if(FormalParmVFGNode* fp = SVFUtil::dyn_cast<FormalParmVFGNode>(node))
1144 {
1145 rawstr << fp->toString();
1146 }
1147 else if(ActualParmVFGNode* ap = SVFUtil::dyn_cast<ActualParmVFGNode>(node))
1148 {
1149 rawstr << ap->toString();
1150 }
1151 else if (ActualRetVFGNode* ar = SVFUtil::dyn_cast<ActualRetVFGNode>(node))
1152 {
1153 rawstr << ar->toString();
1154 }
1155 else if (FormalRetVFGNode* fr = SVFUtil::dyn_cast<FormalRetVFGNode>(node))
1156 {
1157 rawstr << fr->toString();
1158 }
1159 else if(SVFUtil::isa<NullPtrVFGNode>(node))
1160 {
1161 rawstr << "NullPtr";
1162 }
1163 else if(BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
1164 {
1165 rawstr << bop->toString();
1166 }
1167 else if(UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
1168 {
1169 rawstr << uop->toString();
1170 }
1171 else if(CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
1172 {
1173 rawstr << cmp->toString();;
1174 }
1175 else if (BranchVFGNode* branchNode = SVFUtil::dyn_cast<BranchVFGNode>(node))
1176 {
1177 rawstr << branchNode->toString();
1178 }
1179 else
1180 assert(false && "what else kinds of nodes do we have??");
1181
1182 return rawstr.str();
1183 }

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