mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-27 22:47:56 +00:00
Move source_location to register.h
Revert `PrettyHelp::get_current()` for no args since we can use `Pass::location` instead.
This commit is contained in:
parent
929c437b26
commit
6fdefee35b
4 changed files with 30 additions and 28 deletions
|
@ -23,12 +23,27 @@
|
|||
#include "kernel/yosys_common.h"
|
||||
#include "kernel/yosys.h"
|
||||
|
||||
#ifdef YOSYS_ENABLE_SOURCE_LOCATION
|
||||
#include <experimental/source_location>
|
||||
using std::experimental::source_location;
|
||||
#else
|
||||
struct source_location { // dummy placeholder
|
||||
int line() const { return 0; }
|
||||
int column() const { return 0; }
|
||||
const char* file_name() const { return "unknown"; }
|
||||
const char* function_name() const { return "unknown"; }
|
||||
static const source_location current(...) { return source_location(); }
|
||||
};
|
||||
#endif
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
struct Pass
|
||||
{
|
||||
std::string pass_name, short_help;
|
||||
Pass(std::string name, std::string short_help = "** document me **");
|
||||
source_location location;
|
||||
Pass(std::string name, std::string short_help = "** document me **",
|
||||
source_location location = source_location::current());
|
||||
// Prefer overriding 'Pass::on_shutdown()' if possible
|
||||
virtual ~Pass();
|
||||
|
||||
|
@ -82,7 +97,8 @@ struct ScriptPass : Pass
|
|||
RTLIL::Design *active_design;
|
||||
std::string active_run_from, active_run_to;
|
||||
|
||||
ScriptPass(std::string name, std::string short_help = "** document me **") : Pass(name, short_help) { }
|
||||
ScriptPass(std::string name, std::string short_help = "** document me **", source_location location = source_location::current()) :
|
||||
Pass(name, short_help, location) { }
|
||||
|
||||
virtual void script() = 0;
|
||||
|
||||
|
@ -100,7 +116,8 @@ struct Frontend : Pass
|
|||
static std::string last_here_document;
|
||||
|
||||
std::string frontend_name;
|
||||
Frontend(std::string name, std::string short_help = "** document me **");
|
||||
Frontend(std::string name, std::string short_help = "** document me **",
|
||||
source_location location = source_location::current());
|
||||
void run_register() override;
|
||||
~Frontend() override;
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override final;
|
||||
|
@ -116,7 +133,8 @@ struct Frontend : Pass
|
|||
struct Backend : Pass
|
||||
{
|
||||
std::string backend_name;
|
||||
Backend(std::string name, std::string short_help = "** document me **");
|
||||
Backend(std::string name, std::string short_help = "** document me **",
|
||||
source_location location = source_location::current());
|
||||
void run_register() override;
|
||||
~Backend() override;
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override final;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue