summaryrefslogtreecommitdiff
path: root/Source/cmGraphVizWriter.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-26 13:18:24 +0000
committerKitware Robot <kwrobot@kitware.com>2020-03-26 09:19:31 -0400
commit4b266927c7556f74d11d6f499360d682117e0a60 (patch)
tree9ecc27596a3e852c833db5003697882e25b45bc4 /Source/cmGraphVizWriter.cxx
parent6a0c1726e0c6c3381c7def2a5eff2ec239ba3abd (diff)
parent8e3a65d96340f523e6ca8ac86b9360a94fe08fb9 (diff)
downloadcmake-4b266927c7556f74d11d6f499360d682117e0a60.tar.gz
Merge topic 'cleanup-endls-3'
8e3a65d963 Refactor: Avoid `std::endl` where it's not necessary (part 3) Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4517
Diffstat (limited to 'Source/cmGraphVizWriter.cxx')
-rw-r--r--Source/cmGraphVizWriter.cxx102
1 files changed, 47 insertions, 55 deletions
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 73d99963bf..0fcda4e3e3 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -298,13 +298,13 @@ void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& fs,
const std::string& name)
{
auto const escapedGraphName = EscapeForDotFile(name);
- fs << "digraph \"" << escapedGraphName << "\" {" << std::endl;
- fs << this->GraphHeader << std::endl;
+ fs << "digraph \"" << escapedGraphName << "\" {\n"
+ << this->GraphHeader << '\n';
}
void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& fs)
{
- fs << "}" << std::endl;
+ fs << "}\n";
}
void cmGraphVizWriter::WriteLegend(cmGeneratedFileStream& fs)
@@ -312,52 +312,46 @@ void cmGraphVizWriter::WriteLegend(cmGeneratedFileStream& fs)
// Note that the subgraph name must start with "cluster", as done here, to
// make Graphviz layout engines do the right thing and keep the nodes
// together.
- fs << "subgraph clusterLegend {" << std::endl;
- fs << " label = \"Legend\";" << std::endl;
- // Set the color of the box surrounding the legend.
- fs << " color = black;" << std::endl;
- // We use invisible edges just to enforce the layout.
- fs << " edge [ style = invis ];" << std::endl;
-
- // Nodes.
- fs << " legendNode0 [ label = \"Executable\", shape = "
- << GRAPHVIZ_NODE_SHAPE_EXECUTABLE << " ];" << std::endl;
-
- fs << " legendNode1 [ label = \"Static Library\", shape = "
- << GRAPHVIZ_NODE_SHAPE_LIBRARY_STATIC << " ];" << std::endl;
- fs << " legendNode2 [ label = \"Shared Library\", shape = "
- << GRAPHVIZ_NODE_SHAPE_LIBRARY_SHARED << " ];" << std::endl;
- fs << " legendNode3 [ label = \"Module Library\", shape = "
- << GRAPHVIZ_NODE_SHAPE_LIBRARY_MODULE << " ];" << std::endl;
-
- fs << " legendNode4 [ label = \"Interface Library\", shape = "
- << GRAPHVIZ_NODE_SHAPE_LIBRARY_INTERFACE << " ];" << std::endl;
- fs << " legendNode5 [ label = \"Object Library\", shape = "
- << GRAPHVIZ_NODE_SHAPE_LIBRARY_OBJECT << " ];" << std::endl;
- fs << " legendNode6 [ label = \"Unknown Library\", shape = "
- << GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN << " ];" << std::endl;
-
- fs << " legendNode7 [ label = \"Custom Target\", shape = "
- << GRAPHVIZ_NODE_SHAPE_UTILITY << " ];" << std::endl;
-
- // Edges.
- // Some of those are dummy (invisible) edges to enforce a layout.
- fs << " legendNode0 -> legendNode1 [ style = " << GRAPHVIZ_EDGE_STYLE_PUBLIC
- << " ];" << std::endl;
- fs << " legendNode0 -> legendNode2 [ style = " << GRAPHVIZ_EDGE_STYLE_PUBLIC
- << " ];" << std::endl;
- fs << " legendNode0 -> legendNode3;" << std::endl;
-
- fs << " legendNode1 -> legendNode4 [ label = \"Interface\", style = "
- << GRAPHVIZ_EDGE_STYLE_INTERFACE << " ];" << std::endl;
- fs << " legendNode2 -> legendNode5 [ label = \"Private\", style = "
- << GRAPHVIZ_EDGE_STYLE_PRIVATE << " ];" << std::endl;
- fs << " legendNode3 -> legendNode6 [ style = " << GRAPHVIZ_EDGE_STYLE_PUBLIC
- << " ];" << std::endl;
-
- fs << " legendNode0 -> legendNode7;" << std::endl;
-
- fs << "}" << std::endl;
+ /* clang-format off */
+ fs << "subgraph clusterLegend {\n"
+ " label = \"Legend\";\n"
+ // Set the color of the box surrounding the legend.
+ " color = black;\n"
+ // We use invisible edges just to enforce the layout.
+ " edge [ style = invis ];\n"
+ // Nodes.
+ " legendNode0 [ label = \"Executable\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_EXECUTABLE << " ];\n"
+ " legendNode1 [ label = \"Static Library\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_LIBRARY_STATIC << " ];\n"
+ " legendNode2 [ label = \"Shared Library\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_LIBRARY_SHARED << " ];\n"
+ " legendNode3 [ label = \"Module Library\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_LIBRARY_MODULE << " ];\n"
+ " legendNode4 [ label = \"Interface Library\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_LIBRARY_INTERFACE << " ];\n"
+ " legendNode5 [ label = \"Object Library\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_LIBRARY_OBJECT << " ];\n"
+ " legendNode6 [ label = \"Unknown Library\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN << " ];\n"
+ " legendNode7 [ label = \"Custom Target\", shape = "
+ << GRAPHVIZ_NODE_SHAPE_UTILITY << " ];\n"
+ // Edges.
+ // Some of those are dummy (invisible) edges to enforce a layout.
+ " legendNode0 -> legendNode1 [ style = "
+ << GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n"
+ " legendNode0 -> legendNode2 [ style = "
+ << GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n"
+ " legendNode0 -> legendNode3;\n"
+ " legendNode1 -> legendNode4 [ label = \"Interface\", style = "
+ << GRAPHVIZ_EDGE_STYLE_INTERFACE << " ];\n"
+ " legendNode2 -> legendNode5 [ label = \"Private\", style = "
+ << GRAPHVIZ_EDGE_STYLE_PRIVATE << " ];\n"
+ " legendNode3 -> legendNode6 [ style = "
+ << GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n"
+ " legendNode0 -> legendNode7;\n"
+ "}\n";
+ /* clang-format off */
}
void cmGraphVizWriter::WriteNode(cmGeneratedFileStream& fs,
@@ -370,7 +364,7 @@ void cmGraphVizWriter::WriteNode(cmGeneratedFileStream& fs,
auto const escapedLabel = EscapeForDotFile(itemNameWithAliases);
fs << " \"" << nodeName << "\" [ label = \"" << escapedLabel
- << "\", shape = " << getShapeForTarget(item) << " ];" << std::endl;
+ << "\", shape = " << getShapeForTarget(item) << " ];\n";
}
void cmGraphVizWriter::WriteConnection(cmGeneratedFileStream& fs,
@@ -382,11 +376,9 @@ void cmGraphVizWriter::WriteConnection(cmGeneratedFileStream& fs,
auto const& dependeeName = dependee.AsStr();
fs << " \"" << this->NodeNames[dependerName] << "\" -> \""
- << this->NodeNames[dependeeName] << "\" ";
-
- fs << edgeStyle;
-
- fs << " // " << dependerName << " -> " << dependeeName << std::endl;
+ << this->NodeNames[dependeeName] << "\" "
+ << edgeStyle
+ << " // " << dependerName << " -> " << dependeeName << '\n';
}
bool cmGraphVizWriter::ItemExcluded(cmLinkItem const& item)