vhdlpp: Specify lifetime for variables.
This commit is contained in:
parent
b7d263462c
commit
163a913559
|
|
@ -67,6 +67,8 @@ class ScopeBase {
|
||||||
// type is returned, otherwise NULL.
|
// type is returned, otherwise NULL.
|
||||||
const VTypeEnum* is_enum_name(perm_string name) const;
|
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
|
// Moves signals, variables and components from another scope to
|
||||||
// this one. After the transfer new_* maps are cleared in the source scope.
|
// 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 };
|
enum transfer_type_t { SIGNALS = 1, VARIABLES = 2, COMPONENTS = 4, ALL = 0xffff };
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ class SubprogramBody : public LineInfo, public ScopeBase {
|
||||||
void dump(std::ostream&fd) const;
|
void dump(std::ostream&fd) const;
|
||||||
|
|
||||||
const SubprogramHeader*header() const { return header_; }
|
const SubprogramHeader*header() const { return header_; }
|
||||||
|
bool is_subprogram() const { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<SequentialStmt*>*statements_;
|
std::list<SequentialStmt*>*statements_;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
# include "vsignal.h"
|
# include "vsignal.h"
|
||||||
# include "expression.h"
|
# include "expression.h"
|
||||||
|
# include "scope.h"
|
||||||
# include "vtype.h"
|
# include "vtype.h"
|
||||||
# include "std_types.h"
|
# include "std_types.h"
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
|
|
@ -79,6 +80,8 @@ int Variable::emit(ostream&out, Entity*ent, ScopeBase*scope, bool initialize)
|
||||||
{
|
{
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
|
out << (!scope->is_subprogram() ? "static " : "automatic ");
|
||||||
|
|
||||||
VType::decl_t decl;
|
VType::decl_t decl;
|
||||||
type_elaborate_(decl);
|
type_elaborate_(decl);
|
||||||
decl.reg_flag = true;
|
decl.reg_flag = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue