Skip to content

Commit 032d6bb

Browse files
committed
fix readability-container-size-empty
Signed-off-by: Matt Liberty <[email protected]>
1 parent ec02c77 commit 032d6bb

File tree

12 files changed

+24
-24
lines changed

12 files changed

+24
-24
lines changed

src/cut/src/blif.cpp

Lines changed: 6 additions & 6 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 "

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/grt/src/fastroute/src/FastRoute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,7 @@ void FastRouteCore::setSttInputFilename(const char* file_name)
21252125
}
21262126
bool FastRouteCore::hasSaveSttInput()
21272127
{
2128-
return (debug_->sttInputFileName != "");
2128+
return !debug_->sttInputFileName.empty();
21292129
}
21302130
std::string FastRouteCore::getSttInputFileName()
21312131
{

src/gui/src/gui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ bool Gui::filterSelectionProperties(const Descriptor::Properties& properties,
569569
if (auto props_selected_set
570570
= std::any_cast<SelectionSet>(&property.value)) {
571571
if (Descriptor::Property::toString(value) == "CONNECTED"
572-
&& (*props_selected_set).size() != 0) {
572+
&& !props_selected_set->empty()) {
573573
return true;
574574
}
575575
for (const auto& selected : *props_selected_set) {

src/mpl/src/clusterEngine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ void ClusteringEngine::breakCluster(Cluster* parent)
13361336
odb::dbModule* module = parent->getDbModules().front();
13371337
// Flat module that will be partitioned with TritonPart when updating
13381338
// the subtree later on.
1339-
if (module->getChildren().size() == 0) {
1339+
if (module->getChildren().empty()) {
13401340
if (parent == tree_->root.get()) {
13411341
createFlatCluster(module, parent);
13421342
} else {

src/odb/src/defout/defout_impl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ void DefOut::Impl::writeVias(dbBlock* block)
358358
{
359359
dbSet<dbVia> vias = block->getVias();
360360

361-
if (vias.size() == 0) {
361+
if (vias.empty()) {
362362
return;
363363
}
364364

@@ -694,7 +694,7 @@ void DefOut::Impl::writeBTerms(dbBlock* block)
694694
{
695695
dbSet<dbBTerm> bterms = block->getBTerms();
696696

697-
if (bterms.size() == 0) {
697+
if (bterms.empty()) {
698698
return;
699699
}
700700

@@ -914,7 +914,7 @@ void DefOut::Impl::writeBTerm(dbBTerm* bterm)
914914
if (net) {
915915
dbSet<dbBPin> bpins = bterm->getBPins();
916916

917-
if (bpins.size() != 0) {
917+
if (!bpins.empty()) {
918918
int cnt = 0;
919919

920920
for (dbBPin* bpin : bpins) {

src/odb/test/cpp/Test3DBloxChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ TEST_F(CheckerFixture, test_overlapping_chips)
7272
auto markers = overlapping_category->getMarkers();
7373
EXPECT_EQ(markers.size(), 1);
7474

75-
if (markers.size() > 0) {
75+
if (!markers.empty()) {
7676
auto marker = *markers.begin();
7777
auto sources = marker->getSources();
7878
EXPECT_EQ(sources.size(), 2);
@@ -127,7 +127,7 @@ TEST_F(CheckerFixture, test_floating_chips)
127127
auto markers = floating_category->getMarkers();
128128
EXPECT_EQ(markers.size(), 1);
129129

130-
if (markers.size() > 0) {
130+
if (!markers.empty()) {
131131
auto marker = *markers.begin();
132132
auto sources = marker->getSources();
133133
EXPECT_EQ(sources.size(), 1);

src/par/src/ArtNetSpec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ void PartitionMgr::getRents(float& Rratio, float& p, float& q, float& avgK)
337337
flag = partitionCluster(triton_part, modMgr, cv);
338338
}
339339

340-
if (block->getInsts().size() >= 1 && block->getBTerms().size() >= 1) {
340+
if (!block->getInsts().empty() && !block->getBTerms().empty()) {
341341
auto m = std::make_shared<Module>(modMgr.getNumModules());
342342
m->setAvgK(avgK);
343343
m->setAvgInsts(block->getInsts().size());

src/rcx/src/extSolverGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ bool extSolverGen::getMultipliers(const char* input, std::vector<double>& table)
650650
double v = atof(word.c_str());
651651
table.push_back(v);
652652
}
653-
return table.size() > 0;
653+
return !table.empty();
654654
}
655655
bool extSolverGen::setWidthSpaceMultipliers(const char* w_list,
656656
const char* s_list)

src/rmp/src/Restructure.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void Restructure::run(char* liberty_file_name,
127127

128128
getBlob(max_depth);
129129

130-
if (path_insts_.size()) {
130+
if (!path_insts_.empty()) {
131131
runABC();
132132

133133
postABC(worst_slack);
@@ -143,7 +143,7 @@ void Restructure::getBlob(unsigned max_depth)
143143
sta::PinSet ends(open_sta_->getDbNetwork());
144144

145145
getEndPoints(ends, is_area_mode_, max_depth);
146-
if (ends.size()) {
146+
if (!ends.empty()) {
147147
sta::PinSet boundary_points = !is_area_mode_
148148
? resizer_->findFanins(ends)
149149
: resizer_->findFaninFanouts(ends);
@@ -216,7 +216,7 @@ void Restructure::runABC()
216216

217217
const std::string abc_script_file
218218
= prefix + std::to_string(curr_mode_idx) + "ord_abc_script.tcl";
219-
if (logfile_ == "") {
219+
if (logfile_.empty()) {
220220
logfile_ = prefix + "abc.log";
221221
}
222222

@@ -395,7 +395,7 @@ int Restructure::countConsts(odb::dbBlock* top_block)
395395

396396
void Restructure::removeConstCells()
397397
{
398-
if (!hicell_.size() || !locell_.size()) {
398+
if (hicell_.empty() || locell_.empty()) {
399399
return;
400400
}
401401

@@ -699,7 +699,7 @@ bool Restructure::readAbcLog(std::string abc_file_name,
699699
if (level.size() > 1) {
700700
level_gain = level[0] - level[level.size() - 1];
701701
}
702-
if (delay.size() > 0) {
702+
if (!delay.empty()) {
703703
final_delay = delay[delay.size() - 1]; // last value in file
704704
}
705705
return status;

0 commit comments

Comments
 (0)