Skip to content

Commit f7d193d

Browse files
authored
Merge pull request #9196 from The-OpenROAD-Project-staging/tidy3
Tidy3
2 parents 754d7c6 + 1d81fbc commit f7d193d

File tree

82 files changed

+616
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+616
-568
lines changed

src/ant/src/AntennaChecker.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,7 @@ int AntennaChecker::Impl::checkAntennas(odb::dbNet* net,
12121212
}
12131213
omp_set_num_threads(num_threads);
12141214
#pragma omp parallel for schedule(dynamic)
1215-
for (int i = 0; i < nets_.size(); i++) {
1216-
odb::dbNet* net = nets_[i];
1215+
for (auto net : nets_) {
12171216
Violations antenna_violations;
12181217
int pin_viol_count
12191218
= checkNet(net, verbose, true, nullptr, 0, antenna_violations);

src/ant/src/Polygon.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
namespace ant {
1717

18-
using gtl::operators::operator+=;
19-
using gtl::operators::operator-=;
20-
using gtl::operators::operator&;
21-
2218
Polygon rectToPolygon(const odb::Rect& rect)
2319
{
2420
std::vector<Point> points{{gtl::construct<Point>(rect.xMin(), rect.yMin()),
@@ -34,6 +30,9 @@ Polygon rectToPolygon(const odb::Rect& rect)
3430
std::vector<int> findNodesWithIntersection(const GraphNodes& graph_nodes,
3531
const Polygon& pol)
3632
{
33+
using gtl::operators::operator+=;
34+
using gtl::operators::operator&;
35+
3736
// expand object by 1
3837
PolygonSet obj;
3938
obj += pol;
@@ -53,6 +52,8 @@ std::vector<int> findNodesWithIntersection(const GraphNodes& graph_nodes,
5352
void wiresToPolygonSetMap(odb::dbWire* wires,
5453
std::map<odb::dbTechLayer*, PolygonSet>& set_by_layer)
5554
{
55+
using gtl::operators::operator+=;
56+
5657
odb::dbShape shape;
5758
odb::dbWireShapeItr shapes_it;
5859
std::vector<odb::dbShape> via_boxes;
@@ -85,6 +86,8 @@ void wiresToPolygonSetMap(odb::dbWire* wires,
8586
void avoidPinIntersection(odb::dbNet* db_net,
8687
std::map<odb::dbTechLayer*, PolygonSet>& set_by_layer)
8788
{
89+
using gtl::operators::operator-=;
90+
8891
// iterate all instance pin
8992
for (odb::dbITerm* iterm : db_net->getITerms()) {
9093
odb::dbMTerm* mterm = iterm->getMTerm();

src/cts/src/HTreeBuilder.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ void HTreeBuilder::initSinkRegion()
323323
logger_->info(CTS, 26, " Height: {:.4f}.", sinkRegion_.getHeight());
324324
}
325325

326-
void plotBlockage(std::ofstream& file, odb::dbDatabase* db_, int scalingFactor)
326+
static void plotBlockage(std::ofstream& file,
327+
odb::dbDatabase* db_,
328+
int scalingFactor)
327329
{
328330
unsigned i = 0;
329331
for (odb::dbBlockage* blockage : db_->getChip()->getBlock()->getBlockages()) {
@@ -351,7 +353,8 @@ double HTreeBuilder::weightedDistance(const Point<double>& newLoc,
351353
return dist;
352354
}
353355

354-
void plotSinks(std::ofstream& file, const std::vector<Point<double>>& sinks)
356+
static void plotSinks(std::ofstream& file,
357+
const std::vector<Point<double>>& sinks)
355358
{
356359
unsigned cnt = 0;
357360
for (const Point<double>& pt : sinks) {
@@ -407,9 +410,9 @@ void HTreeBuilder::scalePosition(Point<double>& loc,
407410
loc.setY(y);
408411
}
409412

410-
void setSiblingPosition(const Point<double>& a,
411-
Point<double>& b,
412-
const Point<double>& parLoc)
413+
static void setSiblingPosition(const Point<double>& a,
414+
Point<double>& b,
415+
const Point<double>& parLoc)
413416
{
414417
double px = parLoc.getX();
415418
double py = parLoc.getY();

src/cts/src/TritonCTS.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -685,13 +685,6 @@ void TritonCTS::setBufferList(const char* buffers)
685685
options_->setBufferList(bufferList);
686686
}
687687

688-
std::string toLowerCase(std::string str)
689-
{
690-
std::ranges::transform(
691-
str, str.begin(), [](unsigned char c) { return std::tolower(c); });
692-
return str;
693-
}
694-
695688
std::string TritonCTS::getRootBufferToString()
696689
{
697690
std::ostringstream buffer_names;
@@ -2235,7 +2228,7 @@ double TritonCTS::computeInsertionDelay(const std::string& name,
22352228
return insDelayPerMicron;
22362229
}
22372230

2238-
float getInputCap(const sta::LibertyCell* cell)
2231+
static float getInputCap(const sta::LibertyCell* cell)
22392232
{
22402233
sta::LibertyPort *in, *out;
22412234
cell->bufferPorts(in, out);
@@ -2245,7 +2238,7 @@ float getInputCap(const sta::LibertyCell* cell)
22452238
return 0.0;
22462239
}
22472240

2248-
sta::LibertyCell* findBestDummyCell(
2241+
static sta::LibertyCell* findBestDummyCell(
22492242
const std::vector<sta::LibertyCell*>& dummyCandidates,
22502243
float deltaCap)
22512244
{

src/dbSta/src/SpefWriter.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SpefWriter::SpefWriter(Logger* logger,
3838
writePorts();
3939
}
4040

41-
std::string escapeSpecial(const std::string& name)
41+
static std::string escapeSpecial(const std::string& name)
4242
{
4343
std::string result = name;
4444
size_t pos = 0;
@@ -49,7 +49,7 @@ std::string escapeSpecial(const std::string& name)
4949
return result;
5050
}
5151

52-
std::string escapeSpecial(const char* name)
52+
static std::string escapeSpecial(const char* name)
5353
{
5454
if (!name) {
5555
return "";
@@ -60,7 +60,7 @@ std::string escapeSpecial(const char* name)
6060
// Quick fix for wrong pin delimiter.
6161
// TODO: save the parasitics data to odb and use the existing write_spef
6262
// mechanism to produce the spef files from estimate_parasitics.
63-
std::string fixPinDelimiter(const std::string& name)
63+
static std::string fixPinDelimiter(const std::string& name)
6464
{
6565
const char delimiter = '/';
6666
std::string result = name;
@@ -104,7 +104,7 @@ void SpefWriter::writeHeader()
104104
}
105105
}
106106

107-
char getIoDirectionText(const odb::dbIoType& io_type)
107+
static char getIoDirectionText(const odb::dbIoType& io_type)
108108
{
109109
if (io_type == odb::dbIoType::INPUT) {
110110
return 'I';

src/dbSta/src/dbSta.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ void dbSta::countPhysicalOnlyInstancesByType(InstTypeMap& inst_type_stats,
571571
}
572572
}
573573

574-
std::string toLowerCase(std::string str)
574+
static std::string toLowerCase(std::string str)
575575
{
576576
std::ranges::transform(
577577
str, str.begin(), [](unsigned char c) { return std::tolower(c); });

src/dbSta/test/cpp/TestHconn.cpp

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@
3434
namespace odb {
3535

3636
static const std::string prefix("_main/src/dbSta/test/");
37+
static constexpr bool kDebugMsgs = false;
3738

3839
/*
3940
Extract the hierarchical information in human readable format.
4041
Shows the dbNet and dbModNet view of the database.
4142
*/
4243

43-
void DbStrDebugHierarchy(dbBlock* block, std::stringstream& str_db)
44+
static void DbStrDebugHierarchy(dbBlock* block, std::stringstream& str_db)
4445
{
4546
str_db << fmt::format("Debug: Data base tables for block at {}:\n",
4647
block->getName());
@@ -527,9 +528,11 @@ class TestHconn : public ::tst::Fixture
527528
inv4_3_op_->connect(op2_net_);
528529
inv4_4_op_->connect(op3_net_);
529530

530-
// std::stringstream str_str;
531-
// DbStrDebugHierarchy(block_, str_str);
532-
// printf("The Flat design created %s\n", str_str.str().c_str());
531+
if (kDebugMsgs) {
532+
std::stringstream str_str;
533+
DbStrDebugHierarchy(block_, str_str);
534+
printf("The Flat design created %s\n", str_str.str().c_str());
535+
}
533536

534537
// Now build the hierarchical "overlay"
535538
// What we are doing here is adding the modnets which hook up
@@ -645,11 +648,12 @@ class TestHconn : public ::tst::Fixture
645648
inv4_mod_level2_inst_o3_miterm_->connect(inv4_mod_level2_inst_o3_mnet_);
646649
inv4_mod_level1_master_o3_port_->connect(inv4_mod_level2_inst_o3_mnet_);
647650

648-
// Uncomment this to see the full design
649-
// std::stringstream full_design;
650-
// DbStrDebugHierarchy(block_, full_design);
651-
// printf("The design created (flat and hierarchical) %s\n",
652-
// full_design.str().c_str());
651+
if (kDebugMsgs) {
652+
std::stringstream full_design;
653+
DbStrDebugHierarchy(block_, full_design);
654+
printf("The design created (flat and hierarchical) %s\n",
655+
full_design.str().c_str());
656+
}
653657
}
654658

655659
sta::LibertyLibrary* library_;
@@ -788,9 +792,11 @@ class TestHconn : public ::tst::Fixture
788792

789793
TEST_F(TestHconn, ConnectionMade)
790794
{
791-
// std::stringstream str_str_initial;
792-
// DbStrDebugHierarchy(block_, str_str_initial);
793-
// printf("The initial design: %s\n", str_str_initial.str().c_str());
795+
if (kDebugMsgs) {
796+
std::stringstream str_str_initial;
797+
DbStrDebugHierarchy(block_, str_str_initial);
798+
printf("The initial design: %s\n", str_str_initial.str().c_str());
799+
}
794800

795801
// ECO test: get initial state before we start modifying
796802
// the design. Then at end we undo everything and
@@ -896,10 +902,11 @@ TEST_F(TestHconn, ConnectionMade)
896902
db_network_->hierarchicalConnect(
897903
inv1_2_inst_op0, inv4_4_ip_, hier_net_name.c_str());
898904

899-
// Uncomment this to see the final design
900-
// std::stringstream str_str_final;
901-
// DbStrDebugHierarchy(block_, str_str_final);
902-
// printf("The final design: %s\n", str_str_final.str().c_str());
905+
if (kDebugMsgs) {
906+
std::stringstream str_str_final;
907+
DbStrDebugHierarchy(block_, str_str_final);
908+
printf("The final design: %s\n", str_str_final.str().c_str());
909+
}
903910

904911
// Example of how to turn on the call backs for all the bterms/iterms
905912
// used by the sta

src/dpl/src/CheckPlacement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using std::vector;
2222

2323
using utl::DPL;
2424

25-
using utl::format_as;
25+
using utl::format_as; // NOLINT(misc-unused-using-decls)
2626

2727
void Opendp::checkPlacement(const bool verbose,
2828
const std::string& report_file_name)

src/dpl/src/FillerPlacement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using utl::DPL;
2222
using odb::dbMaster;
2323
using odb::dbPlacementStatus;
2424

25-
using utl::format_as;
25+
using utl::format_as; // NOLINT(misc-unused-using-decls)
2626

2727
static odb::dbTechLayer* getImplant(dbMaster* master)
2828
{

src/dpl/src/OptMirror.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace dpl {
1919

2020
using utl::DPL;
2121

22-
using std::sort;
2322
using std::unordered_set;
2423

2524
using odb::dbITerm;

0 commit comments

Comments
 (0)