Skip to content

Commit 668f6e7

Browse files
authored
Merge pull request #9154 from The-OpenROAD-Project-staging/tidy
Fix many categories of clang-tidy
2 parents 0502342 + a00df6d commit 668f6e7

File tree

231 files changed

+1870
-2186
lines changed

Some content is hidden

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

231 files changed

+1870
-2186
lines changed

src/OpenRoad.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ extern int Ord_Init(Tcl_Interp* interp);
102102

103103
namespace ord {
104104

105-
using odb::dbBlock;
106105
using odb::dbChip;
107106
using odb::dbDatabase;
108-
using odb::dbLib;
109107
using odb::dbTech;
110108

111109
using utl::ORD;

src/cts/src/HTreeBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SegmentBuilder
3232
Clock& clock,
3333
ClockSubNet& drivingSubNet,
3434
const TechChar& techChar,
35-
const unsigned techCharDistUnit,
35+
unsigned techCharDistUnit,
3636
TreeBuilder* tree);
3737

3838
void build(const std::string& forceBuffer = "");

src/cts/src/SinkClustering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ bool SinkClustering::findBestMatching(const unsigned groupSize)
212212
"Stree",
213213
1,
214214
"Clustering with max cap limit of {:.3e}",
215-
options_->getSinkBufferInputCap() * max_cap__factor_);
215+
options_->getSinkBufferInputCap() * kMaxCapFactor);
216216
}
217217
// Iterates over the theta vector.
218218
for (unsigned i = 0; i < thetaIndexVector_.size(); ++i) {
@@ -416,7 +416,7 @@ bool SinkClustering::isLimitExceeded(const unsigned size,
416416
const unsigned sizeLimit)
417417
{
418418
if (useMaxCapLimit_) {
419-
return (capCost > options_->getSinkBufferInputCap() * max_cap__factor_);
419+
return (capCost > options_->getSinkBufferInputCap() * kMaxCapFactor);
420420
}
421421

422422
return (size >= sizeLimit || cost > maxInternalDiameter_);

src/cts/src/SinkClustering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class SinkClustering
9292
float capPerUnit_;
9393
bool useMaxCapLimit_;
9494
int scaleFactor_;
95-
static constexpr double max_cap__factor_ = 10;
95+
static constexpr double kMaxCapFactor = 10;
9696
HTreeBuilder* HTree_;
9797
bool firstRun_ = true;
9898
double xSpan_ = 0.0;

src/cts/src/TritonCTS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void TritonCTS::checkCharacterization()
249249
techChar_->forEachWireSegment([&](unsigned idx, const WireSegment& wireSeg) {
250250
for (int buf = 0; buf < wireSeg.getNumBuffers(); ++buf) {
251251
const std::string& master = wireSeg.getBufferMaster(buf);
252-
if (visitedMasters.count(master) == 0) {
252+
if (!visitedMasters.contains(master)) {
253253
if (masterExists(master)) {
254254
visitedMasters.insert(master);
255255
} else {

src/cut/include/cut/blif.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class Blif
4141
bool inspectBlif(const char* file_name, int& num_instances);
4242
float getRequiredTime(sta::Pin* term, bool is_rise);
4343
float getArrivalTime(sta::Pin* term, bool is_rise);
44-
void addArrival(sta::Pin* pin, std::string netName);
45-
void addRequired(sta::Pin* pin, std::string netName);
44+
void addArrival(sta::Pin* pin, const std::string& netName);
45+
void addRequired(sta::Pin* pin, const std::string& netName);
4646

4747
private:
4848
std::set<odb::dbInst*> instances_to_optimize_;

src/cut/src/blif.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ bool Blif::writeBlif(const char* file_name, bool write_arrival_requireds)
172172
&& (expr->op() == sta::FuncExpr::op_zero
173173
|| expr->op() == sta::FuncExpr::op_one)) {
174174
if (expr->op() == sta::FuncExpr::op_zero) {
175-
if (!const0.size()) {
175+
if (const0.empty()) {
176176
const0_cell_ = port_->libertyCell()->name();
177177
const0_cell_port_ = port_->name();
178178
}
179179
const0.insert(netName);
180180
} else {
181-
if (!const1.size()) {
181+
if (const1.empty()) {
182182
const1_cell_ = port_->libertyCell()->name();
183183
const1_cell_port_ = port_->name();
184184
}
@@ -291,7 +291,7 @@ bool Blif::writeBlif(const char* file_name, bool write_arrival_requireds)
291291
}
292292
f << "\n";
293293

294-
if (clocks.size() > 0) {
294+
if (!clocks.empty()) {
295295
f << ".clock";
296296
for (auto& clock : clocks) {
297297
f << " " << clock;
@@ -420,7 +420,7 @@ bool Blif::readBlif(const char* file_name, odb::dbBlock* block)
420420
for (auto iterm : iterms) {
421421
auto net = iterm->getNet();
422422
iterm->disconnect();
423-
if (net && net->getITerms().size() == 0 && net->getBTerms().size() == 0) {
423+
if (net && net->getITerms().empty() && net->getBTerms().empty()) {
424424
odb::dbNet::destroy(net);
425425
}
426426
}
@@ -447,7 +447,7 @@ bool Blif::readBlif(const char* file_name, odb::dbBlock* block)
447447

448448
if (master == nullptr
449449
&& (masterName == "_const0_" || masterName == "_const1_")) {
450-
if (connections.size() < 1) {
450+
if (connections.empty()) {
451451
logger_->info(CUT,
452452
9,
453453
"Const driver {} doesn't have any connected nets.",
@@ -566,7 +566,7 @@ bool Blif::readBlif(const char* file_name, odb::dbBlock* block)
566566
}
567567
}
568568

569-
if (mtermName == "") {
569+
if (mtermName.empty()) {
570570
logger_->info(CUT,
571571
13,
572572
"Could not connect instance of cell type {} to {} net "
@@ -613,15 +613,15 @@ float Blif::getArrivalTime(sta::Pin* term, bool is_rise)
613613
return arr;
614614
}
615615

616-
void Blif::addArrival(sta::Pin* pin, std::string netName)
616+
void Blif::addArrival(sta::Pin* pin, const std::string& netName)
617617
{
618618
if (arrivals_.find(netName) == arrivals_.end()) {
619619
arrivals_[netName] = std::pair<float, float>(
620620
getArrivalTime(pin, true) * 1e12, getArrivalTime(pin, false) * 1e12);
621621
}
622622
}
623623

624-
void Blif::addRequired(sta::Pin* pin, std::string netName)
624+
void Blif::addRequired(sta::Pin* pin, const std::string& netName)
625625
{
626626
if (requireds_.find(netName) == requireds_.end()) {
627627
requireds_[netName] = std::pair<float, float>(

src/cut/src/blifParser.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace blif_parser {
2828
namespace qi = boost::spirit::qi;
2929
namespace ascii = boost::spirit::ascii;
3030

31-
using namespace boost::placeholders;
31+
using boost::placeholders::_1;
3232

3333
using boost::spirit::ascii::space_type;
3434
using boost::spirit::ascii::string;
@@ -38,43 +38,43 @@ using qi::lexeme;
3838
using ascii::char_;
3939
using ascii::space;
4040

41-
void setNewInput(std::string input, cut::BlifParser* parser)
41+
void setNewInput(const std::string& input, cut::BlifParser* parser)
4242
{
4343
if (input != "\\") {
4444
parser->addInput(input);
4545
}
4646
}
4747

48-
void setNewOutput(std::string output, cut::BlifParser* parser)
48+
void setNewOutput(const std::string& output, cut::BlifParser* parser)
4949
{
5050
if (output != "\\") {
5151
parser->addOutput(output);
5252
}
5353
}
5454

55-
void setNewClock(std::string clock, cut::BlifParser* parser)
55+
void setNewClock(const std::string& clock, cut::BlifParser* parser)
5656
{
5757
if (clock != "\\") {
5858
parser->addClock(clock);
5959
}
6060
}
6161

62-
void setNewInstanceType(std::string type, cut::BlifParser* parser)
62+
void setNewInstanceType(const std::string& type, cut::BlifParser* parser)
6363
{
6464
parser->addNewInstanceType(type);
6565
}
6666

67-
void setNewGate(std::string gate, cut::BlifParser* parser)
67+
void setNewGate(const std::string& gate, cut::BlifParser* parser)
6868
{
6969
parser->addNewGate(gate);
7070
}
7171

72-
void setGateNets(std::string net, cut::BlifParser* parser)
72+
void setGateNets(const std::string& net, cut::BlifParser* parser)
7373
{
7474
parser->addConnection(net);
7575
}
7676

77-
void endParser(std::string end, cut::BlifParser* parser)
77+
void endParser(const std::string& end, cut::BlifParser* parser)
7878
{
7979
parser->endParser();
8080
}

src/dbSta/src/dbNetwork.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4215,7 +4215,7 @@ dbModNet* dbNetwork::findModNetForPin(const Pin* drvr_pin)
42154215

42164216
bool dbNetwork::hasHierarchicalElements() const
42174217
{
4218-
if (block()->getModNets().size() != 0) {
4218+
if (!block()->getModNets().empty()) {
42194219
return true;
42204220
}
42214221
return false;

src/dbSta/src/dbSta.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class dbStaReport : public sta::ReportTcl
146146
class dbStaCbk : public dbBlockCallBackObj
147147
{
148148
public:
149-
dbStaCbk(dbSta* sta, Logger* logger);
149+
dbStaCbk(dbSta* sta);
150150
void setNetwork(dbNetwork* network);
151151
void inDbInstCreate(dbInst* inst) override;
152152
void inDbInstDestroy(dbInst* inst) override;
@@ -175,7 +175,6 @@ class dbStaCbk : public dbBlockCallBackObj
175175

176176
dbSta* sta_;
177177
dbNetwork* network_ = nullptr;
178-
Logger* logger_;
179178
};
180179

181180
////////////////////////////////////////////////////////////////
@@ -229,7 +228,7 @@ void dbSta::initVars(Tcl_Interp* tcl_interp,
229228
}
230229
db_report_->setLogger(logger);
231230
db_network_->init(db, logger);
232-
db_cbk_ = std::make_unique<dbStaCbk>(this, logger);
231+
db_cbk_ = std::make_unique<dbStaCbk>(this);
233232
buffer_use_analyser_ = std::make_unique<BufferUseAnalyser>();
234233
}
235234

@@ -930,7 +929,7 @@ const char* dbStaReport::redirectStringEnd()
930929
//
931930
////////////////////////////////////////////////////////////////
932931

933-
dbStaCbk::dbStaCbk(dbSta* sta, Logger* logger) : sta_(sta), logger_(logger)
932+
dbStaCbk::dbStaCbk(dbSta* sta) : sta_(sta)
934933
{
935934
}
936935

0 commit comments

Comments
 (0)