pass metadata: removed superfluous `stringf` calls
authorAki Van Ness <aki@yosyshq.com>
Fri, 3 Dec 2021 18:43:11 +0000 (13:43 -0500)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 26 May 2022 02:36:44 +0000 (19:36 -0700)
(cherry picked from commit 1876ed21e704a8c4c384981560659da1fc248d1b)

backends/metadata/metadata.cc

index 7b2faa181ef4f9d4f0e1712bff2c6dc08b82c4da..8f73e474feef7e241a6be1d6ed9b32b50a675222 100644 (file)
@@ -77,25 +77,25 @@ struct MetadataWriter
 
         design->sort();
 
-        f << stringf("{\n");
+        f << "{\n";
         f << stringf("  \"generator\": %s,\n", get_string(yosys_version_str).c_str());
         // XXX(aki): Replace this with a proper version info eventually:tm:
-        f << stringf("  \"version\": \"0.0.0\",\n");
-        f << stringf("  \"modules\": [\n");
+        f << "  \"version\": \"0.0.0\",\n";
+        f << "  \"modules\": [\n";
 
         bool first{true};
         for (auto mod : _use_selection ? design->selected_modules() : design->modules()) {
             if (!first)
-                f << stringf(",\n");
+                f << ",\n";
             write_module(mod);
 
-            f << stringf("\n");
+            f << "\n";
 
             first = false;
         }
 
-        f << stringf("  ]\n");
-        f << stringf("}\n");
+        f << "  ]\n";
+        f << "}\n";
     }
 
     void write_module(Module* mod)
@@ -104,26 +104,26 @@ struct MetadataWriter
 
         coalesce_cells(mod);
 
-        f << stringf("    {\n");
+        f << "    {\n";
         f << stringf("      \"name\": %s,\n", get_string(RTLIL::unescape_id(mod->name)).c_str());
-        f << stringf("      \"cell_sorts\": [\n");
+        f << "      \"cell_sorts\": [\n";
 
         bool first_sort{true};
         for (auto& sort : _cells) {
             if (!first_sort)
-                f << stringf(",\n");
+                f << ",\n";
 
             write_cell_sort(sort);
 
             first_sort = false;
         }
-        f << stringf("\n");
+        f << "\n";
 
-        f << stringf("      ],\n");
-        f << stringf("      \"connections\": [\n");
+        f << "      ],\n";
+        f << "      \"connections\": [\n";
 
-        f << stringf("      ]\n");
-        f << stringf("    }");
+        f << "      ]\n";
+        f << "    }";
     }
 
 
@@ -131,55 +131,56 @@ struct MetadataWriter
     {
         const auto port_cell = sort.second.front();
 
-        f << stringf("        {\n");
+        f << "        {\n";
         f << stringf("          \"type\": %s,\n", sort.first.c_str());
-        f << stringf("          \"ports\": [\n");
+        f << "          \"ports\": [\n";
 
         bool first_port{true};
         for (auto con : port_cell->connections()) {
             if (!first_port)
-                f << stringf(",\n");
+                f << ",\n";
 
-            f << stringf("          {\n");
+            f << "          {\n";
             f << stringf("            \"name\": %s,\n", get_string(RTLIL::unescape_id(con.first)).c_str());
-            f << stringf("            \"direction\": \"");
+            f << "            \"direction\": \"";
             if (port_cell->input(con.first))
-                f << stringf("i");
+                f << "i";
             if (port_cell->input(con.first))
-                f << stringf("o");
-            f << stringf("\",\n");
+                f << "o";
+            f << "\",\n";
             if (con.second.size() == 1)
-                f << stringf("            \"range\": [0, 0]\n");
+                f << "            \"range\": [0, 0]\n";
             else
                 f << stringf("            \"range\": [%d, %d]\n", con.second.size(), 0);
-            f << stringf("          }");
+            f << "          }";
 
             first_port = false;
         }
-        f << stringf("\n");
+        f << "\n";
 
-        f << stringf("          ],\n          \"cells\": [\n");
+        f << "          ],\n          \"cells\": [\n";
         bool first_cell{true};
         for (auto& cell : sort.second) {
             if (!first_cell)
-                f << stringf(",\n");
+                f << ",\n";
 
             write_cell(cell);
 
             first_cell = false;
         }
-        f << stringf("\n");
-        f << stringf("          ]\n");
-        f << stringf("        }");
+        f << "\n";
+        f << "          ]\n";
+        f << "        }";
+    }
     }
 
     void write_cell(Cell* cell)
     {
         log_assert(cell != nullptr);
 
-        f << stringf("            {\n");
+        f << "            {\n";
         f << stringf("              \"name\": %s,\n", get_string(RTLIL::unescape_id(cell->name)).c_str());
-        f << stringf("              \"attributes\": {\n");
+        f << "              \"attributes\": {\n";
 
         bool first_attr{true};
         for (auto& attr : cell->attributes) {
@@ -193,9 +194,10 @@ struct MetadataWriter
 
             first_attr = false;
         }
+        f << "\n";
 
-        f << stringf("              },\n");
-        f << stringf("              \"parameters\": {\n");
+        f << "              },\n";
+        f << "              \"parameters\": {\n";
 
         bool first_param{true};
         for (auto& param : cell->parameters) {
@@ -209,9 +211,10 @@ struct MetadataWriter
 
             first_param = false;
         }
+        f << "\n";
 
-        f << stringf("              },\n");
-        f << stringf("            }");
+        f << "              },\n";
+        f << "            }";
     }
 };