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

Member Typedef Documentation

◆ NodeType

Definition at line 1088 of file VFG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 1089 of file VFG.cpp.

1089 :
1091 {
1092 }
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 1164 of file VFG.cpp.

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

◆ getEdgeAttributes()

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

Definition at line 1314 of file VFG.cpp.

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

◆ getEdgeSourceLabel()

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

Definition at line 1344 of file VFG.cpp.

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

◆ getGraphName()

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

Return name of the graph.

Definition at line 1095 of file VFG.cpp.

1096 {
1097 return "VFG";
1098 }

◆ getNodeAttributes()

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

Definition at line 1223 of file VFG.cpp.

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

◆ getNodeLabel()

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

Definition at line 1100 of file VFG.cpp.

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

◆ getSimpleNodeLabel()

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

Return label of a VFG node without MemSSA information.

Definition at line 1109 of file VFG.cpp.

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

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