| 345 | |
| 346 | template <typename DirFunc> |
| 347 | void cmGraphVizWriter::WritePerTargetConnections( |
| 348 | ConnectionsMap const& connections, std::string const& fileNameSuffix) |
| 349 | { |
| 350 | // the per target connections must be extended by indirect dependencies |
| 351 | ConnectionsMap extendedConnections; |
| 352 | for (auto const& conPerTarget : connections) { |
| 353 | cmLinkItem const& rootItem = conPerTarget.first; |
| 354 | Connections& extendedCons = extendedConnections[conPerTarget.first]; |
| 355 | this->FindAllConnections(connections, rootItem, extendedCons); |
| 356 | } |
| 357 | |
| 358 | for (auto const& conPerTarget : extendedConnections) { |
| 359 | cmLinkItem const& rootItem = conPerTarget.first; |
| 360 | |
| 361 | // some of the nodes are excluded completely and are not written |
| 362 | if (this->ItemExcluded(rootItem)) { |
| 363 | continue; |
| 364 | } |
| 365 | |
| 366 | Connections const& cons = conPerTarget.second; |
| 367 | |
| 368 | std::unique_ptr<cmGeneratedFileStream> fileStream = |
| 369 | this->CreateTargetFile(rootItem, fileNameSuffix); |
| 370 | |
| 371 | // avoid write same node multiple times |
| 372 | std::unordered_set<std::string> writtenNodes = { rootItem.AsStr() }; |
| 373 | for (Connection const& con : cons) { |
| 374 | cmLinkItem const& src = DirFunc::src(con); |
| 375 | cmLinkItem const& dst = DirFunc::dst(con); |
| 376 | if (writtenNodes.emplace(con.dst.AsStr()).second) { |
| 377 | this->WriteNode(*fileStream, con.dst); |
| 378 | } |
| 379 | this->WriteConnection(*fileStream, src, dst, con.scopeType); |
| 380 | } |
| 381 | |
| 382 | this->WriteFooter(*fileStream); |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& fs, |
| 387 | std::string const& name) |
nothing calls this directly
no test coverage detected