Skip to content

Commit f68042b

Browse files
authored
Merge pull request #8848 from gadfort/pdn-lambdaref
pdn: ensure lambdas pass by ref to avoid copying
2 parents 795facf + e1f35ef commit f68042b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/pdn/src/straps.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -681,25 +681,25 @@ std::vector<odb::dbBox*> PadDirectConnectionStraps::getPinsFacingCore()
681681
// remove all pins that do not face the core
682682
std::function<bool(odb::dbBox*)> remove_func;
683683
if (is_north) {
684-
remove_func = [inst_rect, transform](odb::dbBox* box) {
684+
remove_func = [&inst_rect, &transform](odb::dbBox* box) {
685685
odb::Rect box_rect = box->getBox();
686686
transform.apply(box_rect);
687687
return inst_rect.yMin() < box_rect.yMin();
688688
};
689689
} else if (is_south) {
690-
remove_func = [inst_rect, transform](odb::dbBox* box) {
690+
remove_func = [&inst_rect, &transform](odb::dbBox* box) {
691691
odb::Rect box_rect = box->getBox();
692692
transform.apply(box_rect);
693693
return inst_rect.yMax() > box_rect.yMax();
694694
};
695695
} else if (is_west) {
696-
remove_func = [inst_rect, transform](odb::dbBox* box) {
696+
remove_func = [&inst_rect, &transform](odb::dbBox* box) {
697697
odb::Rect box_rect = box->getBox();
698698
transform.apply(box_rect);
699699
return inst_rect.xMax() > box_rect.xMax();
700700
};
701701
} else {
702-
remove_func = [inst_rect, transform](odb::dbBox* box) {
702+
remove_func = [&inst_rect, &transform](odb::dbBox* box) {
703703
odb::Rect box_rect = box->getBox();
704704
transform.apply(box_rect);
705705
return inst_rect.xMin() < box_rect.xMin();
@@ -767,7 +767,7 @@ std::vector<odb::dbBox*> PadDirectConnectionStraps::getPinsFormingRing()
767767

768768
// remove pins that do not form a complete ring
769769
auto* master = iterm_->getInst()->getMaster();
770-
auto remove_filter = [master](odb::dbBox* box) {
770+
auto remove_filter = [&master](odb::dbBox* box) {
771771
const odb::Rect rect = box->getBox();
772772
const bool matches_x
773773
= rect.dx() == master->getWidth() || rect.dx() == master->getHeight();
@@ -1437,8 +1437,9 @@ bool PadDirectConnectionStraps::refineShapes(
14371437

14381438
// remove shape from all_shapes and all_obstructions
14391439
auto* layer = shape->getLayer();
1440-
auto find_shape
1441-
= [&](const ShapePtr& other) { return other.get() == refine_shape; };
1440+
auto find_shape = [&refine_shape](const ShapePtr& other) {
1441+
return other.get() == refine_shape;
1442+
};
14421443
// remove from all_shapes
14431444
auto& layer_shapes = all_shapes[layer];
14441445
auto find_all_shapes_itr = layer_shapes.qbegin(bgi::satisfies(find_shape));
@@ -1706,7 +1707,7 @@ void RepairChannelStraps::determineParameters(
17061707
area_width = available_area_.dx();
17071708
}
17081709

1709-
auto check = [&]() -> bool {
1710+
auto check = [this, &area_width, &obstructions]() -> bool {
17101711
const int group_width = getStrapGroupWidth();
17111712
if (group_width > area_width) {
17121713
debugPrint(

src/pdn/src/via.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ DbVia::ViaLayerShape DbTechVia::generate(
407407
odb::Point new_via_center;
408408
ViaLayerShape via_shapes;
409409

410-
auto add_via = [&via_shapes, this](odb::dbSBox* via,
410+
auto add_via = [this, &via_shapes](odb::dbSBox* via,
411411
const odb::Point& center) {
412412
ViaLayerShape new_via_shapes = getLayerShapes(via);
413413

@@ -2941,7 +2941,7 @@ void Via::writeToDb(odb::dbSWire* wire,
29412941
}
29422942

29432943
auto check_shapes
2944-
= [this, obstructions](
2944+
= [this, &obstructions](
29452945
const ShapePtr& shape,
29462946
const std::set<DbVia::ViaLayerShape::RectBoxPair>& via_shapes)
29472947
-> std::set<odb::dbSBox*> {

0 commit comments

Comments
 (0)