aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtlil.cc
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-06-17 12:54:24 -0700
committerEddie Hung <eddie@fpgeh.com>2019-06-17 12:54:24 -0700
commitb45d06d7a334c4b18e44793b33aaffcaf1f04b21 (patch)
treeea80de203f95ea9e745306d255d1ed7ae481e6df /kernel/rtlil.cc
parentc15ee827f4a171abe3108dba8f9ad0d7078eb306 (diff)
downloadyosys-b45d06d7a334c4b18e44793b33aaffcaf1f04b21.tar.gz
yosys-b45d06d7a334c4b18e44793b33aaffcaf1f04b21.tar.bz2
yosys-b45d06d7a334c4b18e44793b33aaffcaf1f04b21.zip
Fix leak removing cells during ABC integration; also preserve attr
Diffstat (limited to 'kernel/rtlil.cc')
-rw-r--r--kernel/rtlil.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index 790ba52a3..f732b56b0 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -1565,13 +1565,21 @@ void RTLIL::Module::remove(const pool<RTLIL::Wire*> &wires)
void RTLIL::Module::remove(RTLIL::Cell *cell)
{
+ auto it = cells_.find(cell->name);
+ log_assert(it != cells_.end());
+ remove(it);
+}
+
+dict<RTLIL::IdString, RTLIL::Cell*>::iterator RTLIL::Module::remove(dict<RTLIL::IdString, RTLIL::Cell*>::iterator it)
+{
+ RTLIL::Cell *cell = it->second;
while (!cell->connections_.empty())
cell->unsetPort(cell->connections_.begin()->first);
- log_assert(cells_.count(cell->name) != 0);
log_assert(refcount_cells_ == 0);
- cells_.erase(cell->name);
+ it = cells_.erase(it);
delete cell;
+ return it;
}
void RTLIL::Module::rename(RTLIL::Wire *wire, RTLIL::IdString new_name)