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 NodeT , typename GraphType >
std::string getNodeLabel (NodeT, 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 NodeT >
static const void * getNodeIdentifier (NodeT N)
 
template<typename NodeT , typename GraphType >
static bool isNodeHidden (NodeT, const GraphType &)
 
template<typename NodeT , typename GraphType >
static std::string getNodeIdentifierLabel (NodeT, const GraphType &)
 
template<typename NodeT , typename GraphType >
static std::string getNodeDescription (NodeT, const GraphType &)
 
template<typename NodeT , typename GraphType >
static std::string getNodeAttributes (NodeT, const GraphType &)
 
template<typename NodeT , typename EdgeIter , typename GraphType >
static std::string getEdgeAttributes (NodeT, EdgeIter, const GraphType &)
 
template<typename NodeT , typename EdgeIter >
static std::string getEdgeSourceLabel (NodeT, EdgeIter)
 
template<typename NodeT , typename EdgeIter >
static bool edgeTargetsEdgeSource (NodeT, EdgeIter)
 
template<typename NodeT , typename EdgeIter >
static EdgeIter getEdgeTarget (NodeT, EdgeIter I)
 
static bool hasEdgeDestLabels ()
 
template<typename NodeT >
static unsigned numEdgeDestLabels (NodeT)
 
template<typename NodeT >
static std::string getEdgeDestLabel (NodeT, 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 1087 of file VFG.cpp.

Member Typedef Documentation

◆ NodeType

Definition at line 1090 of file VFG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 1091 of file VFG.cpp.

1091 :
1093 {
1094 }
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 1166 of file VFG.cpp.

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

◆ getEdgeAttributes()

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

Definition at line 1316 of file VFG.cpp.

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

◆ getEdgeSourceLabel()

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

Definition at line 1346 of file VFG.cpp.

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

◆ getGraphName()

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

Return name of the graph.

Definition at line 1097 of file VFG.cpp.

1098 {
1099 return "VFG";
1100 }

◆ getNodeAttributes()

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

Definition at line 1225 of file VFG.cpp.

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

◆ getNodeLabel()

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

Definition at line 1102 of file VFG.cpp.

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

◆ getSimpleNodeLabel()

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

Return label of a VFG node without MemSSA information.

Definition at line 1111 of file VFG.cpp.

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

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