From b4dca4ea2ce8296f07b2905aeaff7d3aeaa73054 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 5 Feb 2021 14:06:43 +0100 Subject: [PATCH] Cleanup: Use raw string literal Resolves modernize-raw-string-literal Clang-Tidy warning The way warning works is it suggests to use raw literal when overhead of having escape characters is higher than the overhead of having raw literal syntax (talking about code size overhead). This means that the warning will not trigger for "foo\"bar". Differential Revision: https://developer.blender.org/D10322 --- .clang-tidy | 1 - source/blender/blenlib/intern/delaunay_2d.cc | 8 ++++---- source/blender/blenlib/intern/dot_export.cc | 8 ++++---- .../intern/debug/deg_debug_relations_graphviz.cc | 2 +- .../depsgraph/intern/debug/deg_debug_stats_gnuplot.cc | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 0192a8b41ef..b51555b55dd 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -39,7 +39,6 @@ Checks: > -modernize-use-nodiscard, -modernize-loop-convert, -modernize-pass-by-value, - -modernize-raw-string-literal, WarningsAsErrors: '*' CheckOptions: diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc index c9315dab456..1cf2046ce16 100644 --- a/source/blender/blenlib/intern/delaunay_2d.cc +++ b/source/blender/blenlib/intern/delaunay_2d.cc @@ -561,14 +561,14 @@ template void cdt_draw(const std::string &label, const CDTArrangemen const vec2 &uco = u->co.approx; const vec2 &vco = v->co.approx; int strokew = e->input_ids == nullptr ? thin_line : thick_line; - f << "\n"; f << " " << vertname(u) << vertname(v) << "\n"; f << "\n"; if (draw_edge_labels) { f << ""; + << R"(" font-size="small">)"; f << vertname(u) << vertname(v) << sename(&e->symedges[0]) << sename(&e->symedges[1]) << "\n"; } @@ -576,13 +576,13 @@ template void cdt_draw(const std::string &label, const CDTArrangemen int i = 0; for (const CDTVert *v : cdt.verts) { - f << "co.approx[0]) << "\" cy=\"" << SY(v->co.approx[1]) + f << R"(co.approx[0]) << "\" cy=\"" << SY(v->co.approx[1]) << "\" r=\"" << vert_radius << "\">\n"; f << " [" << i << "]" << v->co.approx << "\n"; f << "\n"; if (draw_vert_labels) { f << "co.approx[0]) + vert_radius << "\" y=\"" - << SY(v->co.approx[1]) - vert_radius << "\" font-size=\"small\">[" << i << "]\n"; + << SY(v->co.approx[1]) - vert_radius << R"(" font-size="small">[)" << i << "]\n"; } ++i; } diff --git a/source/blender/blenlib/intern/dot_export.cc b/source/blender/blenlib/intern/dot_export.cc index eb15a51366e..13a2341a9d5 100644 --- a/source/blender/blenlib/intern/dot_export.cc +++ b/source/blender/blenlib/intern/dot_export.cc @@ -275,10 +275,10 @@ NodeWithSocketsRef::NodeWithSocketsRef(Node &node, { std::stringstream ss; - ss << "<"; + ss << R"(<
)"; /* Header */ - ss << ""; @@ -291,7 +291,7 @@ NodeWithSocketsRef::NodeWithSocketsRef(Node &node, if (name.size() == 0) { name = "No Name"; } - ss << ""; } @@ -304,7 +304,7 @@ NodeWithSocketsRef::NodeWithSocketsRef(Node &node, if (name.size() == 0) { name = "No Name"; } - ss << ""; } diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index a0cbbbc163d..9afae0f2c22 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -184,7 +184,7 @@ static void deg_debug_graphviz_legend(DotExportContext &ctx) std::stringstream ss; ss << "<"; - ss << "
"; + ss << R"(
)"; ss << ((name.size() == 0) ? "No Name" : name); ss << "
"; + ss << R"("; ss << name; ss << ""; + ss << R"("; ss << name; ss << "
"; + ss << R"(
)"; ss << ""; #ifdef COLOR_SCHEME_NODE_CLASS diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc index 0cdd627dd44..df343a3eb28 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc @@ -87,7 +87,7 @@ string gnuplotify_name(const string &name) for (int i = 0; i < length; i++) { const char ch = name[i]; if (ch == '_') { - result += "\\\\\\"; + result += R"(\\\)"; } result += ch; }
Legend