From ef89a760d67a40c5463b54623ad371311509f459 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Tue, 1 Jul 2008 10:44:20 +0100 Subject: [PATCH] Add vhdl_element::print method for debugging --- tgt-vhdl/scope.cc | 8 ++++++-- tgt-vhdl/vhdl_element.cc | 6 ++++++ tgt-vhdl/vhdl_element.hh | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tgt-vhdl/scope.cc b/tgt-vhdl/scope.cc index 03b4e8fa7..c4b9b9eb8 100644 --- a/tgt-vhdl/scope.cc +++ b/tgt-vhdl/scope.cc @@ -64,8 +64,12 @@ static vhdl_expr *nexus_to_expr(vhdl_scope *arch_scope, ivl_nexus_t nexus) } vhdl_var_ref *nexus_to_var_ref(vhdl_scope *arch_scope, ivl_nexus_t nexus) -{ - vhdl_var_ref *ref = dynamic_cast(nexus_to_expr(arch_scope, nexus)); +{ + vhdl_expr *e = nexus_to_expr(arch_scope, nexus); + + e->print(); + + vhdl_var_ref *ref = dynamic_cast(e); assert(ref); return ref; } diff --git a/tgt-vhdl/vhdl_element.cc b/tgt-vhdl/vhdl_element.cc index cdbd1fcff..e631319fc 100644 --- a/tgt-vhdl/vhdl_element.cc +++ b/tgt-vhdl/vhdl_element.cc @@ -72,3 +72,9 @@ void vhdl_element::emit_comment(std::ostream &of, int level, newline(of, level); } } + +void vhdl_element::print() const +{ + emit(std::cout, 0); + std::cout << std::endl; +} diff --git a/tgt-vhdl/vhdl_element.hh b/tgt-vhdl/vhdl_element.hh index 4bd6b3c05..abccdfdb2 100644 --- a/tgt-vhdl/vhdl_element.hh +++ b/tgt-vhdl/vhdl_element.hh @@ -35,6 +35,7 @@ public: virtual ~vhdl_element() {} virtual void emit(std::ostream &of, int level=0) const = 0; + void print() const; void set_comment(std::string comment); protected: