Add additional deletion in VHDL classes' destructors

Delete dynamically allocated objects in ScopeBase,
Architecture, ComponentInstatiation, Entity and Package.
This commit is contained in:
Pawel Szostek 2011-07-20 18:16:08 +02:00 committed by Stephen Williams
parent a8fae6bbf7
commit eb98ed9ce2
3 changed files with 12 additions and 0 deletions

View File

@ -32,6 +32,8 @@ Architecture::Architecture(perm_string name, const ScopeBase&ref,
Architecture::~Architecture() Architecture::~Architecture()
{ {
delete_all(statements_);
ScopeBase::cleanup();
} }
Architecture::Statement::Statement() Architecture::Statement::Statement()
@ -75,6 +77,9 @@ ComponentInstantiation::ComponentInstantiation(perm_string i, perm_string c,
ComponentInstantiation::~ComponentInstantiation() ComponentInstantiation::~ComponentInstantiation()
{ {
for(map<perm_string, Expression*>::iterator it = port_map_.begin()
; it != port_map_.end(); ++it)
delete it->second;
} }
ProcessStatement::ProcessStatement(perm_string iname, ProcessStatement::ProcessStatement(perm_string iname,

View File

@ -33,6 +33,9 @@ ComponentBase::ComponentBase(perm_string name)
ComponentBase::~ComponentBase() ComponentBase::~ComponentBase()
{ {
for(std::vector<InterfacePort*>::iterator it = ports_.begin()
; it != ports_.end(); ++it)
delete *it;
} }
void ComponentBase::set_interface(std::list<InterfacePort*>*ports) void ComponentBase::set_interface(std::list<InterfacePort*>*ports)
@ -60,6 +63,9 @@ Entity::Entity(perm_string name)
Entity::~Entity() Entity::~Entity()
{ {
for(map<perm_string,Architecture*>::reverse_iterator it = arch_.rbegin()
; it != arch_.rend(); ++it)
delete it->second;
} }
Architecture* Entity::add_architecture(Architecture*that) Architecture* Entity::add_architecture(Architecture*that)

View File

@ -26,4 +26,5 @@ Package::Package(perm_string n, const ScopeBase&ref)
Package::~Package() Package::~Package()
{ {
ScopeBase::cleanup();
} }