@@ -337,8 +337,8 @@ void Straps::makeStraps(int x_start,
337337 }
338338 }
339339
340- addShape (
341- new Shape ( layer_, net, strap_rect, odb::dbWireShapeType::STRIPE));
340+ addShape (std::make_unique<Shape>(
341+ layer_, net, strap_rect, odb::dbWireShapeType::STRIPE));
342342 }
343343 strap_count++;
344344 if (number_of_straps_ != 0 && strap_count == number_of_straps_) {
@@ -462,15 +462,15 @@ void FollowPins::makeShapes(const Shape::ShapeTreeMap& other_shapes)
462462 const int ground_y_bot
463463 = (power_on_top ? bbox.yMin () : bbox.yMax ()) - width / 2 ;
464464
465- auto * power_strap = new FollowPinShape (
465+ auto power_strap = std::make_unique< FollowPinShape> (
466466 layer, power, odb::Rect (x0, power_y_bot, x1, power_y_bot + width));
467467 power_strap->addRow (row);
468- addShape (power_strap);
468+ addShape (std::move ( power_strap) );
469469
470- auto * ground_strap = new FollowPinShape (
470+ auto ground_strap = std::make_unique< FollowPinShape> (
471471 layer, ground, odb::Rect (x0, ground_y_bot, x1, ground_y_bot + width));
472472 ground_strap->addRow (row);
473- addShape (ground_strap);
473+ addShape (std::move ( ground_strap) );
474474 }
475475}
476476
@@ -1072,14 +1072,17 @@ void PadDirectConnectionStraps::makeShapesFacingCore(
10721072 }
10731073 }
10741074
1075- auto * shape
1076- = new Shape ( layer, net, shape_rect, odb::dbWireShapeType::STRIPE);
1075+ auto shape = std::make_unique<Shape>(
1076+ layer, net, shape_rect, odb::dbWireShapeType::STRIPE);
10771077 // use intersection of pin_rect to ensure max width limitation is
10781078 // preserved
10791079 shape->addITermConnection (pin_rect.intersect (shape_rect));
1080- addShape (shape);
1080+ const auto added = addShape (std::move (shape));
1081+ if (added == nullptr ) {
1082+ continue ;
1083+ }
10811084
1082- target_shapes_[shape ] = closest_shape.get ();
1085+ target_shapes_[added. get () ] = closest_shape.get ();
10831086 }
10841087 }
10851088}
@@ -1210,15 +1213,19 @@ void PadDirectConnectionStraps::makeShapesOverPads(
12101213 return ;
12111214 }
12121215
1213- auto * shape = new Shape (
1216+ auto shape = std::make_unique< Shape> (
12141217 getLayer (), iterm_->getNet (), shape_rect, odb::dbWireShapeType::STRIPE);
12151218
12161219 if (getDirection () != getLayer ()->getDirection ()) {
12171220 shape->setAllowsNonPreferredDirectionChange ();
12181221 }
1219- addShape (shape);
1220- target_shapes_[shape] = closest_shape.get ();
1221- target_pin_shape_[shape] = org_pin_shape;
1222+ const auto added = addShape (std::move (shape));
1223+ if (added == nullptr ) {
1224+ return ;
1225+ }
1226+
1227+ target_shapes_[added.get ()] = closest_shape.get ();
1228+ target_pin_shape_[added.get ()] = org_pin_shape;
12221229}
12231230
12241231bool PadDirectConnectionStraps::snapRectToClosestShape (
@@ -1495,7 +1502,7 @@ bool PadDirectConnectionStraps::refineShape(
14951502 new_rect.set_xhi (check_loc + getWidth ());
14961503 }
14971504
1498- std::unique_ptr<Shape> new_shape ( shape->copy () );
1505+ std::unique_ptr<Shape> new_shape = shape->copy ();
14991506 new_shape->setRect (new_rect);
15001507
15011508 debugPrint (
@@ -1513,7 +1520,7 @@ bool PadDirectConnectionStraps::refineShape(
15131520 new_shape.get (), all_shapes, all_obstructions, true )) {
15141521 continue ;
15151522 }
1516- const ShapePtr& added_shape = addShape (new_shape. release ( ));
1523+ const ShapePtr& added_shape = addShape (std::move (new_shape ));
15171524 if (added_shape != nullptr ) {
15181525 added_shape->clearITermConnections ();
15191526 added_shape->addITermConnection (
0 commit comments