Move log_header to separate function Signed-off-by: Ryszard Różak <rrozak@antmicro.com>
diff --git a/uhdm-plugin/uhdmastfrontend.cc b/uhdm-plugin/uhdmastfrontend.cc index 739ef64..9a22339 100644 --- a/uhdm-plugin/uhdmastfrontend.cc +++ b/uhdm-plugin/uhdmastfrontend.cc
@@ -30,7 +30,7 @@ YOSYS_NAMESPACE_BEGIN struct UhdmAstFrontend : public UhdmCommonFrontend { - UhdmAstFrontend() : UhdmCommonFrontend("uhdm", "read UHDM file") { this->log_header_message = "Executing UHDM frontend.\n"; } + UhdmAstFrontend() : UhdmCommonFrontend("uhdm", "read UHDM file") {} void help() override { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| @@ -59,6 +59,7 @@ vpi_release_handle(design); return current_ast; } + void call_log_header(RTLIL::Design *design) override { log_header(design, "Executing UHDM frontend.\n"); } } UhdmAstFrontend; YOSYS_NAMESPACE_END
diff --git a/uhdm-plugin/uhdmcommonfrontend.cc b/uhdm-plugin/uhdmcommonfrontend.cc index 3cf755d..b340797 100644 --- a/uhdm-plugin/uhdmcommonfrontend.cc +++ b/uhdm-plugin/uhdmcommonfrontend.cc
@@ -49,8 +49,7 @@ void UhdmCommonFrontend::execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) { - log_header(design, this->log_header_message); - + this->call_log_header(design); this->args = args; bool defer = false;
diff --git a/uhdm-plugin/uhdmcommonfrontend.h b/uhdm-plugin/uhdmcommonfrontend.h index 253cf18..f2d12a8 100644 --- a/uhdm-plugin/uhdmcommonfrontend.h +++ b/uhdm-plugin/uhdmcommonfrontend.h
@@ -30,12 +30,12 @@ struct UhdmCommonFrontend : public Frontend { UhdmAstShared shared; std::string report_directory; - const char *log_header_message; std::vector<std::string> args; UhdmCommonFrontend(std::string name, std::string short_help) : Frontend(name, short_help) {} virtual void print_read_options(); virtual void help() = 0; virtual AST::AstNode *parse(std::string filename) = 0; + virtual void call_log_header(RTLIL::Design *design) = 0; void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design); };
diff --git a/uhdm-plugin/uhdmsurelogastfrontend.cc b/uhdm-plugin/uhdmsurelogastfrontend.cc index b52bb1c..ce79772 100644 --- a/uhdm-plugin/uhdmsurelogastfrontend.cc +++ b/uhdm-plugin/uhdmsurelogastfrontend.cc
@@ -78,10 +78,7 @@ } struct UhdmSurelogAstFrontend : public UhdmCommonFrontend { - UhdmSurelogAstFrontend() : UhdmCommonFrontend("verilog_with_uhdm", "generate/read UHDM file") - { - this->log_header_message = "Executing Verilog with UHDM frontend.\n"; - } + UhdmSurelogAstFrontend() : UhdmCommonFrontend("verilog_with_uhdm", "generate/read UHDM file") {} void print_read_options() override { log(" -process\n"); @@ -129,6 +126,7 @@ return current_ast; } + void call_log_header(RTLIL::Design *design) override { log_header(design, "Executing Verilog with UHDM frontend.\n"); } } UhdmSurelogAstFrontend; YOSYS_NAMESPACE_END