Do not allow converting children of proxy cells to static

Proxies and their tree below should not be manipulated,
hence this operation is not allowed.
This commit is contained in:
Matthias Koefferlein 2026-04-04 00:20:37 +02:00
parent 21ecd80253
commit b866ac63d3
1 changed files with 23 additions and 0 deletions

View File

@ -601,6 +601,27 @@ LayoutViewFunctions::cm_cell_convert_to_static ()
db::Layout &layout = view ()->cellview (cv_index)->layout ();
// check that all (unselected) parents are static cells - must not convert children
// of proxy cells.
std::set<db::cell_index_type> to_convert;
for (std::vector<lay::LayoutViewBase::cell_path_type>::iterator p = paths.begin (); p != paths.end (); ++p) {
if (! p->empty () && layout.is_valid_cell_index (p->back ())) {
to_convert.insert (p->back ());
}
}
for (auto c = to_convert.begin (); c != to_convert.end (); ++c) {
std::set<db::cell_index_type> callers;
layout.cell (*c).collect_caller_cells (callers);
for (auto cc = callers.begin (); cc != callers.end (); ++cc) {
if (layout.cell (*cc).is_proxy () && to_convert.find (*cc) == to_convert.end ()) {
throw tl::Exception (tl::sprintf (tl::to_string (tr ("Cannot convert cells to static cells if they have library or PCell parents - here: %s as child of %s")),
layout.cell (*c).get_display_name (), layout.cell (*cc).get_display_name ()));
}
}
}
// remember the current path
lay::LayoutViewBase::cell_path_type cell_path (view ()->cellview (cv_index).combined_unspecific_path ());
@ -610,6 +631,8 @@ LayoutViewFunctions::cm_cell_convert_to_static ()
std::map<db::cell_index_type, db::cell_index_type> cell_map;
// perform the conversion
for (std::vector<lay::LayoutViewBase::cell_path_type>::iterator p = paths.begin (); p != paths.end (); ++p) {
if (! p->empty () && layout.is_valid_cell_index (p->back ())) {
db::cell_index_type new_cell = layout.convert_cell_to_static (p->back ());