vhdlpp: Fixed a few memory leaks.
This commit is contained in:
parent
b3c1fa3e85
commit
b666b9c0bf
|
|
@ -129,12 +129,21 @@ ExpAggregate::ExpAggregate(std::list<element_t*>*el)
|
||||||
elements_[idx++] = el->front();
|
elements_[idx++] = el->front();
|
||||||
el->pop_front();
|
el->pop_front();
|
||||||
}
|
}
|
||||||
|
delete el;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpAggregate::~ExpAggregate()
|
ExpAggregate::~ExpAggregate()
|
||||||
{
|
{
|
||||||
for (size_t idx = 0 ; idx < elements_.size() ; idx += 1)
|
for(std::vector<element_t*>::iterator it = elements_.begin();
|
||||||
delete elements_[idx];
|
it != elements_.end(); ++it) {
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(std::vector<choice_element>::iterator it = aggregate_.begin();
|
||||||
|
it != aggregate_.end(); ++it) {
|
||||||
|
delete it->choice;
|
||||||
|
delete it->expr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression* ExpAggregate::clone() const
|
Expression* ExpAggregate::clone() const
|
||||||
|
|
@ -539,6 +548,7 @@ ExpName::ExpName(ExpName*prefix, perm_string nn, Expression*msb, Expression*lsb)
|
||||||
ExpName::~ExpName()
|
ExpName::~ExpName()
|
||||||
{
|
{
|
||||||
delete index_;
|
delete index_;
|
||||||
|
delete lsb_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExpName::symbolic_compare(const Expression*that) const
|
bool ExpName::symbolic_compare(const Expression*that) const
|
||||||
|
|
|
||||||
|
|
@ -678,6 +678,11 @@ class ExpName : public Expression {
|
||||||
public:
|
public:
|
||||||
index_t(Expression*idx, Expression*size, Expression*offset = NULL) :
|
index_t(Expression*idx, Expression*size, Expression*offset = NULL) :
|
||||||
idx_(idx), size_(size), offset_(offset) {}
|
idx_(idx), size_(size), offset_(offset) {}
|
||||||
|
~index_t() {
|
||||||
|
delete idx_;
|
||||||
|
delete size_;
|
||||||
|
delete offset_;
|
||||||
|
}
|
||||||
|
|
||||||
int emit(ostream&out, Entity*ent, ScopeBase*scope);
|
int emit(ostream&out, Entity*ent, ScopeBase*scope);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -673,6 +673,11 @@ int ExpName::emit(ostream&out, Entity*ent, ScopeBase*scope)
|
||||||
|
|
||||||
if(try_workarounds_(out, ent, scope, indices, field_size)) {
|
if(try_workarounds_(out, ent, scope, indices, field_size)) {
|
||||||
emit_workaround_(out, ent, scope, indices, field_size);
|
emit_workaround_(out, ent, scope, indices, field_size);
|
||||||
|
for(list<index_t*>::iterator it = indices.begin();
|
||||||
|
it != indices.end(); ++it)
|
||||||
|
{
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -753,7 +758,7 @@ bool ExpName::check_const_array_workaround_(const VTypeArray*arr,
|
||||||
data_size = element->get_width(scope);
|
data_size = element->get_width(scope);
|
||||||
if(data_size < 0)
|
if(data_size < 0)
|
||||||
return false;
|
return false;
|
||||||
indices.push_back(new index_t(index_, new ExpInteger(data_size)));
|
indices.push_back(new index_t(index_->clone(), new ExpInteger(data_size)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -830,11 +830,17 @@ else_when_waveform
|
||||||
concurrent_signal_assignment_statement /* IEEE 1076-2008 P11.6 */
|
concurrent_signal_assignment_statement /* IEEE 1076-2008 P11.6 */
|
||||||
: concurrent_simple_signal_assignment
|
: concurrent_simple_signal_assignment
|
||||||
|
|
||||||
| IDENTIFIER ':' concurrent_simple_signal_assignment { $$ = $3; }
|
| IDENTIFIER ':' concurrent_simple_signal_assignment
|
||||||
|
{ delete[] $1;
|
||||||
|
$$ = $3;
|
||||||
|
}
|
||||||
|
|
||||||
| concurrent_conditional_signal_assignment
|
| concurrent_conditional_signal_assignment
|
||||||
|
|
||||||
| IDENTIFIER ':' concurrent_conditional_signal_assignment { $$ = $3; }
|
| IDENTIFIER ':' concurrent_conditional_signal_assignment
|
||||||
|
{ delete[] $1;
|
||||||
|
$$ = $3;
|
||||||
|
}
|
||||||
|
|
||||||
| selected_signal_assignment
|
| selected_signal_assignment
|
||||||
|
|
||||||
|
|
@ -975,6 +981,7 @@ direction : K_to { $$ = false; } | K_downto { $$ = true; } ;
|
||||||
element_association
|
element_association
|
||||||
: choices ARROW expression
|
: choices ARROW expression
|
||||||
{ ExpAggregate::element_t*tmp = new ExpAggregate::element_t($1, $3);
|
{ ExpAggregate::element_t*tmp = new ExpAggregate::element_t($1, $3);
|
||||||
|
delete $1;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
| expression
|
| expression
|
||||||
|
|
@ -998,7 +1005,9 @@ element_association_list
|
||||||
|
|
||||||
element_declaration
|
element_declaration
|
||||||
: identifier_list ':' subtype_indication ';'
|
: identifier_list ':' subtype_indication ';'
|
||||||
{ $$ = record_elements($1, $3); }
|
{ $$ = record_elements($1, $3);
|
||||||
|
delete $1;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
element_declaration_list
|
element_declaration_list
|
||||||
|
|
@ -1879,6 +1888,7 @@ primary
|
||||||
VHDL syntax). */
|
VHDL syntax). */
|
||||||
| IDENTIFIER '(' association_list ')'
|
| IDENTIFIER '(' association_list ')'
|
||||||
{ sorrymsg(@1, "Function calls not supported\n");
|
{ sorrymsg(@1, "Function calls not supported\n");
|
||||||
|
delete[] $1;
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1901,12 +1911,14 @@ procedure_call
|
||||||
{
|
{
|
||||||
ProcedureCall* tmp = new ProcedureCall(lex_strings.make($1));
|
ProcedureCall* tmp = new ProcedureCall(lex_strings.make($1));
|
||||||
sorrymsg(@1, "Procedure calls are not supported.\n");
|
sorrymsg(@1, "Procedure calls are not supported.\n");
|
||||||
|
delete[] $1;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
| IDENTIFIER '(' association_list ')'
|
| IDENTIFIER '(' association_list ')'
|
||||||
{
|
{
|
||||||
ProcedureCall* tmp = new ProcedureCall(lex_strings.make($1), $3);
|
ProcedureCall* tmp = new ProcedureCall(lex_strings.make($1), $3);
|
||||||
sorrymsg(@1, "Procedure calls are not supported.\n");
|
sorrymsg(@1, "Procedure calls are not supported.\n");
|
||||||
|
delete[] $1;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
| IDENTIFIER '(' error ')'
|
| IDENTIFIER '(' error ')'
|
||||||
|
|
@ -1918,7 +1930,10 @@ procedure_call
|
||||||
;
|
;
|
||||||
|
|
||||||
procedure_call_statement
|
procedure_call_statement
|
||||||
: IDENTIFIER ':' procedure_call { $$ = $3; }
|
: IDENTIFIER ':' procedure_call
|
||||||
|
{ delete[] $1;
|
||||||
|
$$ = $3;
|
||||||
|
}
|
||||||
| procedure_call { $$ = $1; }
|
| procedure_call { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -2272,6 +2287,7 @@ severity
|
||||||
errormsg(@1, "Invalid severity level (possible values: NOTE, WARNING, ERROR, FAILURE).\n");
|
errormsg(@1, "Invalid severity level (possible values: NOTE, WARNING, ERROR, FAILURE).\n");
|
||||||
$$ = ReportStmt::UNSPECIFIED;
|
$$ = ReportStmt::UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
delete[] $2;
|
||||||
}
|
}
|
||||||
|
|
||||||
severity_opt
|
severity_opt
|
||||||
|
|
@ -2407,7 +2423,10 @@ signal_assignment
|
||||||
|
|
||||||
signal_assignment_statement
|
signal_assignment_statement
|
||||||
: signal_assignment
|
: signal_assignment
|
||||||
| IDENTIFIER ':' signal_assignment { $$ = $3; }
|
| IDENTIFIER ':' signal_assignment
|
||||||
|
{ delete[] $1;
|
||||||
|
$$ = $3;
|
||||||
|
}
|
||||||
|
|
||||||
subprogram_body_start
|
subprogram_body_start
|
||||||
: subprogram_specification K_is
|
: subprogram_specification K_is
|
||||||
|
|
@ -2496,6 +2515,7 @@ subprogram_statement_part
|
||||||
subtype_declaration
|
subtype_declaration
|
||||||
: K_subtype IDENTIFIER K_is subtype_indication ';'
|
: K_subtype IDENTIFIER K_is subtype_indication ';'
|
||||||
{ perm_string name = lex_strings.make($2);
|
{ perm_string name = lex_strings.make($2);
|
||||||
|
delete[] $2;
|
||||||
if ($4 == 0) {
|
if ($4 == 0) {
|
||||||
errormsg(@1, "Failed to declare type name %s.\n", name.str());
|
errormsg(@1, "Failed to declare type name %s.\n", name.str());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2645,7 +2665,10 @@ use_clauses_opt
|
||||||
|
|
||||||
variable_assignment_statement /* IEEE 1076-2008 P10.6.1 */
|
variable_assignment_statement /* IEEE 1076-2008 P10.6.1 */
|
||||||
: variable_assignment
|
: variable_assignment
|
||||||
| IDENTIFIER ':' variable_assignment { $$ = $3; }
|
| IDENTIFIER ':' variable_assignment
|
||||||
|
{ delete[] $1;
|
||||||
|
$$ = $3;
|
||||||
|
}
|
||||||
|
|
||||||
variable_assignment
|
variable_assignment
|
||||||
: name VASSIGN expression ';'
|
: name VASSIGN expression ';'
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,15 @@ SubprogramHeader::SubprogramHeader(perm_string nam, list<InterfacePort*>*ports,
|
||||||
SubprogramHeader::~SubprogramHeader()
|
SubprogramHeader::~SubprogramHeader()
|
||||||
{
|
{
|
||||||
delete body_;
|
delete body_;
|
||||||
|
|
||||||
|
if(ports_) {
|
||||||
|
for(list<InterfacePort*>::iterator it = ports_->begin();
|
||||||
|
it != ports_->end(); ++it)
|
||||||
|
{
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
delete ports_;
|
delete ports_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubprogramHeader::compare_specification(SubprogramHeader*that) const
|
bool SubprogramHeader::compare_specification(SubprogramHeader*that) const
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue