Skip to content

Commit 52f1e73

Browse files
committed
fix modernize-use-emplace
Signed-off-by: Matt Liberty <[email protected]>
1 parent a9e24ed commit 52f1e73

29 files changed

+123
-126
lines changed

src/cut/src/blifParser.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ void BlifParser::addClock(const std::string& clock)
134134
void BlifParser::addNewInstanceType(const std::string& type)
135135
{
136136
if (currentInstanceType_ != GateType::None) {
137-
gates_.push_back(
138-
Gate(currentInstanceType_, currentGate_, currentConnections_));
137+
gates_.emplace_back(currentInstanceType_, currentGate_, currentConnections_);
139138
}
140139
currentInstanceType_ = GateType::Mlatch;
141140
if (type != "mlatch") {
@@ -159,8 +158,7 @@ void BlifParser::addConnection(const std::string& connection)
159158
void BlifParser::endParser()
160159
{
161160
if (currentInstanceType_ != GateType::None) {
162-
gates_.push_back(
163-
Gate(currentInstanceType_, currentGate_, currentConnections_));
161+
gates_.emplace_back(currentInstanceType_, currentGate_, currentConnections_);
164162
}
165163
}
166164

src/drt/src/dr/FlexDR_init.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,7 @@ void FlexDRWorker::route_queue_init_queue(
23082308
// sort nets
23092309
mazeIterInit_sortRerouteNets(0, ripupNets);
23102310
for (auto& net : ripupNets) {
2311-
routes.push_back({net, 0, true, nullptr});
2311+
routes.emplace_back(net, 0, true, nullptr);
23122312
// reserve via because all nets are ripped up
23132313
initMazeCost_via_helper(net, true);
23142314
// no need to clear the net because route objs are not pushed to the net
@@ -2337,7 +2337,7 @@ void FlexDRWorker::route_queue_init_queue(
23372337
// sort nets
23382338
mazeIterInit_sortRerouteNets(0, ripupNets);
23392339
for (auto& net : ripupNets) {
2340-
routes.push_back({net, 0, true, nullptr});
2340+
routes.emplace_back(net, 0, true, nullptr);
23412341
initMazeCost_via_helper(net, true);
23422342
}
23432343
} else if (getRipupMode() == RipUpMode::INCR) {
@@ -2351,7 +2351,7 @@ void FlexDRWorker::route_queue_init_queue(
23512351
// sort nets
23522352
mazeIterInit_sortRerouteNets(0, ripupNets);
23532353
for (auto& net : ripupNets) {
2354-
routes.push_back({net, 0, true, nullptr});
2354+
routes.emplace_back(net, 0, true, nullptr);
23552355
// reserve via because all nets are ripped up
23562356
initMazeCost_via_helper(net, true);
23572357
// no need to clear the net because route objs are not pushed to the net
@@ -2563,7 +2563,7 @@ void FlexDRWorker::route_queue_update_from_marker(
25632563
allowAvoidRipup = true;
25642564
dNet->setNRipupAvoids(0);
25652565
}
2566-
routes.push_back({dNet, dNet->getNumReroutes(), true, checkingObj});
2566+
routes.emplace_back(dNet, dNet->getNumReroutes(), true, checkingObj);
25672567
}
25682568
}
25692569
}
@@ -2572,14 +2572,14 @@ void FlexDRWorker::route_queue_update_from_marker(
25722572
for (drNet* dNet : avoidRipupCandidates) {
25732573
if (dNet->getPins().size() <= 1 || allowAvoidRipup) {
25742574
dNet->incNRipupAvoids();
2575-
checks.push_back({dNet, -1, false, checkingObj});
2575+
checks.emplace_back(dNet, -1, false, checkingObj);
25762576
} else {
25772577
dNet->setNRipupAvoids(0);
2578-
routes.push_back({dNet, dNet->getNumReroutes(), true, checkingObj});
2578+
routes.emplace_back(dNet, dNet->getNumReroutes(), true, checkingObj);
25792579
}
25802580
}
25812581
for (auto& victimOwner : uniqueVictimOwners) {
2582-
checks.push_back({victimOwner, -1, false, checkingObj});
2582+
checks.emplace_back(victimOwner, -1, false, checkingObj);
25832583
}
25842584
}
25852585

src/drt/src/dr/FlexDR_maze.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ void FlexDRWorker::route_queue_main(std::queue<RouteQueueEntry>& rerouteQueue)
20372037
net->setModified(true);
20382038
writeGCPatchesToDRWorker();
20392039
} else {
2040-
rerouteQueue.push({net, numReroute + 1, false, net});
2040+
rerouteQueue.emplace(net, numReroute + 1, false, net);
20412041
}
20422042
gcWorker_->clearPWires();
20432043
}

src/drt/src/dr/FlexDR_rq.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void FlexDRWorkerRegionQuery::Impl::add(
105105
|| connFig->typeId() == drcPatchWire) {
106106
auto obj = static_cast<drShape*>(connFig);
107107
odb::Rect frb = obj->getBBox();
108-
allShapes.at(obj->getLayerNum()).push_back(std::make_pair(frb, obj));
108+
allShapes.at(obj->getLayerNum()).emplace_back(frb, obj);
109109
} else if (connFig->typeId() == drcVia) {
110110
auto via = static_cast<drVia*>(connFig);
111111
odb::dbTransform xform = via->getTransform();
@@ -115,7 +115,7 @@ void FlexDRWorkerRegionQuery::Impl::add(
115115
odb::Rect frb = shape->getBBox();
116116
xform.apply(frb);
117117
allShapes.at(via->getViaDef()->getLayer1Num())
118-
.push_back(std::make_pair(frb, via));
118+
.emplace_back(frb, via);
119119
} else {
120120
std::cout << "Error: unsupported region query add" << std::endl;
121121
}
@@ -126,7 +126,7 @@ void FlexDRWorkerRegionQuery::Impl::add(
126126
odb::Rect frb = shape->getBBox();
127127
xform.apply(frb);
128128
allShapes.at(via->getViaDef()->getLayer2Num())
129-
.push_back(std::make_pair(frb, via));
129+
.emplace_back(frb, via);
130130
} else {
131131
std::cout << "Error: unsupported region query add" << std::endl;
132132
}
@@ -137,7 +137,7 @@ void FlexDRWorkerRegionQuery::Impl::add(
137137
odb::Rect frb = shape->getBBox();
138138
xform.apply(frb);
139139
allShapes.at(via->getViaDef()->getCutLayerNum())
140-
.push_back(std::make_pair(frb, via));
140+
.emplace_back(frb, via);
141141
} else {
142142
std::cout << "Error: unsupported region query add" << std::endl;
143143
}

src/drt/src/frRegionQuery.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void frRegionQuery::Impl::add(frShape* shape,
105105
{
106106
if (shape->typeId() == frcPathSeg || shape->typeId() == frcRect) {
107107
odb::Rect frb = shape->getBBox();
108-
allShapes.at(shape->getLayerNum()).push_back(std::make_pair(frb, shape));
108+
allShapes.at(shape->getLayerNum()).emplace_back(frb, shape);
109109
} else {
110110
logger->error(DRT, 5, "Unsupported region query add.");
111111
}
@@ -134,7 +134,7 @@ void frRegionQuery::Impl::addDRObj(frShape* shape,
134134
if (shape->typeId() == frcPathSeg || shape->typeId() == frcRect
135135
|| shape->typeId() == frcPatchWire) {
136136
odb::Rect frb = shape->getBBox();
137-
allShapes.at(shape->getLayerNum()).push_back(std::make_pair(frb, shape));
137+
allShapes.at(shape->getLayerNum()).emplace_back(frb, shape);
138138
} else {
139139
logger->error(DRT, 7, "Unsupported region query add.");
140140
}
@@ -332,7 +332,7 @@ void frRegionQuery::Impl::addGRObj(grVia* via,
332332
{
333333
odb::Rect frb = via->getBBox();
334334
allShapes.at(via->getViaDef()->getCutLayerNum())
335-
.push_back(std::make_pair(frb, via));
335+
.emplace_back(frb, via);
336336
}
337337

338338
void frRegionQuery::removeGRObj(grVia* via)
@@ -347,7 +347,7 @@ void frRegionQuery::Impl::addGRObj(grShape* shape,
347347
{
348348
if (shape->typeId() == grcPathSeg) {
349349
odb::Rect frb = shape->getBBox();
350-
allShapes.at(shape->getLayerNum()).push_back(std::make_pair(frb, shape));
350+
allShapes.at(shape->getLayerNum()).emplace_back(frb, shape);
351351
} else {
352352
logger->error(DRT, 9, "Unsupported region query add.");
353353
}
@@ -379,7 +379,7 @@ void frRegionQuery::Impl::add(frVia* via,
379379
odb::Rect frb = shape->getBBox();
380380
xform.apply(frb);
381381
allShapes.at(via->getViaDef()->getLayer1Num())
382-
.push_back(std::make_pair(frb, via));
382+
.emplace_back(frb, via);
383383
} else {
384384
logger->error(DRT, 11, "Unsupported region query add.");
385385
}
@@ -390,7 +390,7 @@ void frRegionQuery::Impl::add(frVia* via,
390390
odb::Rect frb = shape->getBBox();
391391
xform.apply(frb);
392392
allShapes.at(via->getViaDef()->getLayer2Num())
393-
.push_back(std::make_pair(frb, via));
393+
.emplace_back(frb, via);
394394
} else {
395395
logger->error(DRT, 12, "Unsupported region query add.");
396396
}
@@ -401,7 +401,7 @@ void frRegionQuery::Impl::add(frVia* via,
401401
odb::Rect frb = shape->getBBox();
402402
xform.apply(frb);
403403
allShapes.at(via->getViaDef()->getCutLayerNum())
404-
.push_back(std::make_pair(frb, via));
404+
.emplace_back(frb, via);
405405
} else {
406406
logger->error(DRT, 13, "Unsupported region query add.");
407407
}
@@ -420,7 +420,7 @@ void frRegionQuery::Impl::addDRObj(frVia* via,
420420
{
421421
odb::Rect frb = via->getBBox();
422422
allShapes.at(via->getViaDef()->getCutLayerNum())
423-
.push_back(std::make_pair(frb, via));
423+
.emplace_back(frb, via);
424424
}
425425

426426
void frRegionQuery::removeDRObj(frVia* via)
@@ -449,7 +449,7 @@ void frRegionQuery::Impl::add(frInstTerm* instTerm,
449449
odb::Rect frb = shape->getBBox();
450450
xform.apply(frb);
451451
allShapes.at(static_cast<frShape*>(shape)->getLayerNum())
452-
.push_back(std::make_pair(frb, instTerm));
452+
.emplace_back(frb, instTerm);
453453
} else {
454454
logger->error(DRT, 14, "Unsupported region query add.");
455455
}
@@ -466,7 +466,7 @@ void frRegionQuery::Impl::add(frBTerm* term,
466466
if (shape->typeId() == frcPathSeg || shape->typeId() == frcRect) {
467467
odb::Rect frb = shape->getBBox();
468468
allShapes.at(static_cast<frShape*>(shape)->getLayerNum())
469-
.push_back(std::make_pair(frb, term));
469+
.emplace_back(frb, term);
470470
} else {
471471
logger->error(DRT, 15, "Unsupported region query add.");
472472
}
@@ -486,7 +486,7 @@ void frRegionQuery::Impl::add(frInstBlockage* instBlk,
486486
odb::Rect frb = shape->getBBox();
487487
xform.apply(frb);
488488
allShapes.at(static_cast<frShape*>(shape)->getLayerNum())
489-
.push_back(std::make_pair(frb, instBlk));
489+
.emplace_back(frb, instBlk);
490490
} else if (shape->typeId() == frcPolygon) {
491491
// Decompose the polygon to rectangles and store those
492492
// Convert the frPolygon to a Boost polygon
@@ -510,7 +510,7 @@ void frRegionQuery::Impl::add(frInstBlockage* instBlk,
510510
for (auto& rect : rects) {
511511
odb::Rect box(xl(rect), yl(rect), xh(rect), yh(rect));
512512
allShapes.at(static_cast<frShape*>(shape)->getLayerNum())
513-
.push_back(std::make_pair(box, instBlk));
513+
.emplace_back(box, instBlk);
514514
}
515515
} else {
516516
logger->error(DRT,
@@ -530,7 +530,7 @@ void frRegionQuery::Impl::add(frBlockage* blk,
530530
if (shape->typeId() == frcPathSeg || shape->typeId() == frcRect) {
531531
odb::Rect frb = shape->getBBox();
532532
allShapes.at(static_cast<frShape*>(shape)->getLayerNum())
533-
.push_back(std::make_pair(frb, blk));
533+
.emplace_back(frb, blk);
534534
} else {
535535
logger->error(DRT, 17, "Unsupported region query add.");
536536
}
@@ -542,7 +542,7 @@ void frRegionQuery::Impl::addGuide(frGuide* guide,
542542
{
543543
odb::Rect frb = guide->getBBox();
544544
for (int i = guide->getBeginLayerNum(); i <= guide->getEndLayerNum(); i++) {
545-
allShapes.at(i).push_back(std::make_pair(frb, guide));
545+
allShapes.at(i).emplace_back(frb, guide);
546546
}
547547
}
548548

@@ -551,15 +551,15 @@ void frRegionQuery::Impl::addRPin(frRPin* rpin,
551551
{
552552
frLayerNum layerNum = rpin->getLayerNum();
553553
odb::Rect frb = rpin->getBBox();
554-
allRPins.at(layerNum).push_back(std::make_pair(frb, rpin));
554+
allRPins.at(layerNum).emplace_back(frb, rpin);
555555
}
556556

557557
void frRegionQuery::Impl::addOrigGuide(frNet* net,
558558
const frRect& rect,
559559
ObjectsByLayer<frNet>& allShapes)
560560
{
561561
odb::Rect frb = rect.getBBox();
562-
allShapes.at(rect.getLayerNum()).push_back(std::make_pair(frb, net));
562+
allShapes.at(rect.getLayerNum()).emplace_back(frb, net);
563563
}
564564

565565
void frRegionQuery::query(const box_t& boostb,
@@ -896,7 +896,7 @@ void frRegionQuery::Impl::initGRPin(
896896
Objects<frBlockObject> allGRPins;
897897
for (auto& [obj, pt] : in) {
898898
odb::Rect frb(pt.x(), pt.y(), pt.x(), pt.y());
899-
allGRPins.push_back(std::make_pair(frb, obj));
899+
allGRPins.emplace_back(frb, obj);
900900
}
901901
in.clear();
902902
in.shrink_to_fit();

src/drt/src/gc/FlexGC_rq.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void FlexGCWorkerRegionQuery::Impl::addPolygonEdge(
6565
{
6666
segment_t boosts(point_t(edge->low().x(), edge->low().y()),
6767
point_t(edge->high().x(), edge->high().y()));
68-
allShapes[edge->getLayerNum()].push_back(std::make_pair(boosts, edge));
68+
allShapes[edge->getLayerNum()].emplace_back(boosts, edge);
6969
}
7070

7171
void FlexGCWorkerRegionQuery::addMaxRectangle(gcRect* rect)
@@ -86,15 +86,15 @@ void FlexGCWorkerRegionQuery::Impl::addMaxRectangle(
8686
{
8787
odb::Rect boostr(
8888
gtl::xl(*rect), gtl::yl(*rect), gtl::xh(*rect), gtl::yh(*rect));
89-
allShapes[rect->getLayerNum()].push_back(std::make_pair(boostr, rect));
89+
allShapes[rect->getLayerNum()].emplace_back(boostr, rect);
9090
}
9191

9292
void FlexGCWorkerRegionQuery::Impl::addSpcRectangle(
9393
gcRect* rect,
9494
std::vector<std::vector<rq_box_value_t<gcRect>>>& allShapes)
9595
{
9696
odb::Rect box(gtl::xl(*rect), gtl::yl(*rect), gtl::xh(*rect), gtl::yh(*rect));
97-
allShapes[rect->getLayerNum()].push_back(std::make_pair(box, *rect));
97+
allShapes[rect->getLayerNum()].emplace_back(box, *rect);
9898
}
9999

100100
void FlexGCWorkerRegionQuery::removePolygonEdge(gcSegment* edge)

src/drt/src/gr/FlexGR_rq.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void FlexGRWorkerRegionQuery::add(
7777
if (connFig->typeId() == grcPathSeg) {
7878
auto obj = static_cast<grShape*>(connFig);
7979
odb::Rect frb = obj->getBBox();
80-
allShapes.at(obj->getLayerNum()).push_back(std::make_pair(frb, obj));
80+
allShapes.at(obj->getLayerNum()).emplace_back(frb, obj);
8181
} else if (connFig->typeId() == grcVia) {
8282
auto via = static_cast<grVia*>(connFig);
8383
odb::dbTransform xform = via->getTransform();
@@ -87,7 +87,7 @@ void FlexGRWorkerRegionQuery::add(
8787
odb::Rect frb = shape->getBBox();
8888
xform.apply(frb);
8989
allShapes.at(via->getViaDef()->getLayer1Num())
90-
.push_back(std::make_pair(frb, via));
90+
.emplace_back(frb, via);
9191
} else {
9292
std::cout << "Error: unsupported region query add" << std::endl;
9393
}
@@ -98,7 +98,7 @@ void FlexGRWorkerRegionQuery::add(
9898
odb::Rect frb = shape->getBBox();
9999
xform.apply(frb);
100100
allShapes.at(via->getViaDef()->getLayer2Num())
101-
.push_back(std::make_pair(frb, via));
101+
.emplace_back(frb, via);
102102
} else {
103103
std::cout << "Error: unsupported region query add" << std::endl;
104104
}
@@ -109,7 +109,7 @@ void FlexGRWorkerRegionQuery::add(
109109
odb::Rect frb = shape->getBBox();
110110
xform.apply(frb);
111111
allShapes.at(via->getViaDef()->getCutLayerNum())
112-
.push_back(std::make_pair(frb, via));
112+
.emplace_back(frb, via);
113113
} else {
114114
std::cout << "Error: unsupported region query add" << std::endl;
115115
}

src/drt/src/io/io.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ void io::Parser::addRoutingLayer(odb::dbTechLayer* layer)
23232323
frUInt4 width, within, spacing;
23242324
rule->getV55InfluenceEntry(width, within, spacing);
23252325
widthTbl.push_back(width);
2326-
valTbl.push_back({within, spacing});
2326+
valTbl.emplace_back(within, spacing);
23272327
}
23282328
fr1DLookupTbl<frCoord, std::pair<frCoord, frCoord>> tbl(
23292329
"WIDTH", widthTbl, valTbl);
@@ -2383,7 +2383,7 @@ void io::Parser::addRoutingLayer(odb::dbTechLayer* layer)
23832383
for (uint32_t j = 0; j < layer->getTwoWidthsSpacingTableNumWidths(); ++j) {
23842384
frCoord width = layer->getTwoWidthsSpacingTableWidth(j);
23852385
frCoord prl = layer->getTwoWidthsSpacingTablePRL(j);
2386-
rowVals.push_back(frSpacingTableTwRowType(width, prl));
2386+
rowVals.emplace_back(width, prl);
23872387
}
23882388

23892389
std::unique_ptr<frConstraint> uCon
@@ -3282,9 +3282,9 @@ void io::Writer::mergeSplitConnFigs(
32823282
frCoord beginCoord = isH ? begin.x() : begin.y();
32833283
frCoord endCoord = isH ? end.x() : end.y();
32843284
pathSegMergeMap[std::make_tuple(layerNum, isH, trackLoc)][beginCoord]
3285-
.push_back(std::make_tuple(pathSeg, true));
3285+
.emplace_back(pathSeg, true);
32863286
pathSegMergeMap[std::make_tuple(layerNum, isH, trackLoc)][endCoord]
3287-
.push_back(std::make_tuple(pathSeg, false));
3287+
.emplace_back(pathSeg, false);
32883288

32893289
} else if (connFig->typeId() == frcVia) {
32903290
auto via = std::dynamic_pointer_cast<frVia>(connFig);

0 commit comments

Comments
 (0)