tap/psm: geom boost - #11267
Conversation
Signed-off-by: Peter Gadfort <gadfort@zeroasic.com>
Signed-off-by: Peter Gadfort <gadfort@zeroasic.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the geometry types in the psm and tap modules to use odb::geom::BoostPolygon90 and odb::geom::BoostPolygon90WithHoles instead of direct boost::polygon aliases. It also optimizes row subtraction in Tapcell::getBoundaryAreas and simplifies Tapcell::getBoundaryEdges. A review comment points out a potential undefined behavior in Tapcell::getBoundaryEdges if the input polygon is empty, suggesting an early return guard.
| std::vector<Edge> edges; | ||
|
|
||
| Polygon90::point_type prev_pt = *area.begin(); | ||
| const odb::Point first_pt((*area.begin()).x(), (*area.begin()).y()); |
There was a problem hiding this comment.
If area is empty, calling area.begin() and dereferencing it with *area.begin() will result in undefined behavior (dereferencing an end iterator). A guard should be added to check if the polygon is empty before accessing its vertices.
std::vector<Edge> edges;
if (area.begin() == area.end()) {
return edges;
}
const odb::Point first_pt((*area.begin()).x(), (*area.begin()).y());
Summary
Switch PSM and TAP to use the geom_boost converters instead of their own.
Type of Change
Impact
Should be a no-op
Verification
./etc/Build.sh).