vhdlpp: Added VType::get_generic_typename() method.

This commit is contained in:
Maciej Suminski
2015-02-04 16:57:43 +01:00
parent 9b3bd039bb
commit b8b2f53027
2 changed files with 12 additions and 0 deletions
+8
View File
@@ -19,6 +19,7 @@
# include "vtype.h" # include "vtype.h"
# include "parse_types.h" # include "parse_types.h"
# include "compiler.h"
# include <map> # include <map>
# include <typeinfo> # include <typeinfo>
# include <cassert> # include <cassert>
@@ -35,6 +36,13 @@ void VType::show(ostream&out) const
write_to_stream(out); write_to_stream(out);
} }
perm_string VType::get_generic_typename() const
{
char buf[16] = {0,};
snprintf(buf, 16, "type_%p", this);
return lex_strings.make(buf);
}
VTypePrimitive::VTypePrimitive(VTypePrimitive::type_t tt, bool packed) VTypePrimitive::VTypePrimitive(VTypePrimitive::type_t tt, bool packed)
: type_(tt), packed_(packed) : type_(tt), packed_(packed)
{ {
+4
View File
@@ -88,6 +88,10 @@ class VType {
// Returns true if the type has an undefined dimension. // Returns true if the type has an undefined dimension.
virtual bool is_unbounded() const { return false; } virtual bool is_unbounded() const { return false; }
// Returns a perm_string that can be used in automatically created
// typedefs (i.e. not ones defined by the user).
perm_string get_generic_typename() const;
private: private:
friend struct decl_t; friend struct decl_t;
// This virtual method is called to emit the declaration. This // This virtual method is called to emit the declaration. This