From b8b2f5302756d3df350d3d597565fb8019f76cb6 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 22 Jan 2015 11:32:28 +0100 Subject: [PATCH] vhdlpp: Added VType::get_generic_typename() method. --- vhdlpp/vtype.cc | 8 ++++++++ vhdlpp/vtype.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/vhdlpp/vtype.cc b/vhdlpp/vtype.cc index 652c9047e..ea3341ce7 100644 --- a/vhdlpp/vtype.cc +++ b/vhdlpp/vtype.cc @@ -19,6 +19,7 @@ # include "vtype.h" # include "parse_types.h" +# include "compiler.h" # include # include # include @@ -35,6 +36,13 @@ void VType::show(ostream&out) const 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) : type_(tt), packed_(packed) { diff --git a/vhdlpp/vtype.h b/vhdlpp/vtype.h index 9f761536a..5310e868a 100644 --- a/vhdlpp/vtype.h +++ b/vhdlpp/vtype.h @@ -88,6 +88,10 @@ class VType { // Returns true if the type has an undefined dimension. 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: friend struct decl_t; // This virtual method is called to emit the declaration. This