Clean up generated objects

This commit is contained in:
Nick Gasson 2008-05-31 16:08:57 +01:00
parent 7c9d154461
commit 5cbd587833
3 changed files with 30 additions and 4 deletions

View File

@ -91,6 +91,11 @@ extern "C" int target_design(ivl_design_t des)
(*it)->emit(outfile);
outfile.close();
// Clean up
for (it = g_entities.begin(); it != g_entities.end(); ++it)
delete (*it);
g_entities.clear();
return g_errors;
}

View File

@ -91,6 +91,11 @@ vhdl_entity::vhdl_entity(const char *name, vhdl_arch *arch)
}
vhdl_entity::~vhdl_entity()
{
delete arch_;
}
void vhdl_entity::emit(std::ofstream &of, int level) const
{
emit_comment(of, level);
@ -112,6 +117,14 @@ vhdl_arch::vhdl_arch(const char *entity, const char *name)
}
vhdl_arch::~vhdl_arch()
{
conc_stmt_list_t::iterator it;
for (it = stmts_.begin(); it != stmts_.end(); ++it)
delete (*it);
stmts_.clear();
}
void vhdl_arch::add_stmt(vhdl_conc_stmt* stmt)
{
stmts_.push_back(stmt);
@ -140,6 +153,14 @@ vhdl_process::vhdl_process(const char *name)
}
vhdl_process::~vhdl_process()
{
seq_stmt_list_t::iterator it;
for (it = stmts_.begin(); it != stmts_.end(); ++it)
delete (*it);
stmts_.clear();
}
void vhdl_process::add_stmt(vhdl_seq_stmt* stmt)
{
stmts_.push_back(stmt);

View File

@ -59,7 +59,7 @@ typedef std::list<vhdl_seq_stmt*> seq_stmt_list_t;
class vhdl_process : public vhdl_conc_stmt {
public:
vhdl_process(const char *name = NULL);
virtual ~vhdl_process() {}
virtual ~vhdl_process();
void emit(std::ofstream &of, int level) const;
void add_stmt(vhdl_seq_stmt* stmt);
@ -71,7 +71,7 @@ private:
class vhdl_arch : public vhdl_element {
public:
vhdl_arch(const char *entity, const char *name="Behavioural");
virtual ~vhdl_arch() {}
virtual ~vhdl_arch();
void emit(std::ofstream &of, int level=0) const;
void add_stmt(vhdl_conc_stmt* stmt);
@ -83,7 +83,7 @@ private:
class vhdl_entity : public vhdl_element {
public:
vhdl_entity(const char *name, vhdl_arch *arch);
virtual ~vhdl_entity() {}
virtual ~vhdl_entity();
void emit(std::ofstream &of, int level=0) const;
vhdl_arch *get_arch() const { return arch_; }