From 5a7cfd8c0225867c6004db07530eefa3079b033d Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Tue, 10 Jun 2008 14:00:15 +0100 Subject: [PATCH] Clean up vhdl_comp_inst --- tgt-vhdl/vhdl_syntax.cc | 9 +++++++++ tgt-vhdl/vhdl_syntax.hh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tgt-vhdl/vhdl_syntax.cc b/tgt-vhdl/vhdl_syntax.cc index 844d8ba9f..ec545f3c9 100644 --- a/tgt-vhdl/vhdl_syntax.cc +++ b/tgt-vhdl/vhdl_syntax.cc @@ -255,6 +255,15 @@ vhdl_comp_inst::vhdl_comp_inst(const char *inst_name, const char *comp_name) } +vhdl_comp_inst::~vhdl_comp_inst() +{ + port_map_list_t::iterator it; + for (it = mapping_.begin(); it != mapping_.end(); ++it) { + delete (*it).expr; + } + mapping_.clear(); +} + void vhdl_comp_inst::map_port(const char *name, vhdl_expr *expr) { port_map_t pmap = { name, expr }; diff --git a/tgt-vhdl/vhdl_syntax.hh b/tgt-vhdl/vhdl_syntax.hh index 15cd12e03..eb89751b9 100644 --- a/tgt-vhdl/vhdl_syntax.hh +++ b/tgt-vhdl/vhdl_syntax.hh @@ -368,7 +368,7 @@ typedef std::list port_map_list_t; class vhdl_comp_inst : public vhdl_conc_stmt { public: vhdl_comp_inst(const char *inst_name, const char *comp_name); - virtual ~vhdl_comp_inst() {} + ~vhdl_comp_inst(); void emit(std::ofstream &of, int level) const; void map_port(const char *name, vhdl_expr *expr);