vhdlpp: Specify lifetime for variables.

This commit is contained in:
Maciej Suminski 2016-03-22 15:50:09 +01:00
parent b7d263462c
commit 163a913559
3 changed files with 6 additions and 0 deletions

View File

@ -67,6 +67,8 @@ class ScopeBase {
// type is returned, otherwise NULL.
const VTypeEnum* is_enum_name(perm_string name) const;
virtual bool is_subprogram() const { return false; }
// Moves signals, variables and components from another scope to
// this one. After the transfer new_* maps are cleared in the source scope.
enum transfer_type_t { SIGNALS = 1, VARIABLES = 2, COMPONENTS = 4, ALL = 0xffff };

View File

@ -55,6 +55,7 @@ class SubprogramBody : public LineInfo, public ScopeBase {
void dump(std::ostream&fd) const;
const SubprogramHeader*header() const { return header_; }
bool is_subprogram() const { return true; }
private:
std::list<SequentialStmt*>*statements_;

View File

@ -21,6 +21,7 @@
# include "vsignal.h"
# include "expression.h"
# include "scope.h"
# include "vtype.h"
# include "std_types.h"
# include <iostream>
@ -79,6 +80,8 @@ int Variable::emit(ostream&out, Entity*ent, ScopeBase*scope, bool initialize)
{
int errors = 0;
out << (!scope->is_subprogram() ? "static " : "automatic ");
VType::decl_t decl;
type_elaborate_(decl);
decl.reg_flag = true;