MCPcopy Create free account
hub / github.com/Kitware/CMake / WritePerTargetConnections

Method WritePerTargetConnections

Source/cmGraphVizWriter.cxx:347–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345
346template <typename DirFunc>
347void 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
386void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& fs,
387 std::string const& name)

Callers

nothing calls this directly

Calls 7

FindAllConnectionsMethod · 0.95
ItemExcludedMethod · 0.95
CreateTargetFileMethod · 0.95
WriteNodeMethod · 0.95
WriteConnectionMethod · 0.95
WriteFooterMethod · 0.95
emplaceMethod · 0.80

Tested by

no test coverage detected