Minor clean up of initialization

This commit is contained in:
Geza Lore 2022-07-13 18:24:48 +01:00
parent f4efcbde5c
commit 3bd830eacf
5 changed files with 10 additions and 12 deletions

View File

@ -27,9 +27,12 @@
#include "V3Stats.h" #include "V3Stats.h"
//###################################################################### //######################################################################
// V3 Class -- top level // V3Global
AstNetlist* V3Global::makeNetlist() { return new AstNetlist(); } void V3Global::boot() {
UASSERT(!m_rootp, "call once");
m_rootp = new AstNetlist();
}
void V3Global::clear() { void V3Global::clear() {
#ifdef VL_LEAK_CHECK #ifdef VL_LEAK_CHECK

View File

@ -119,11 +119,7 @@ public:
// CONSTRUCTORS // CONSTRUCTORS
V3Global() {} V3Global() {}
AstNetlist* makeNetlist(); void boot();
void boot() {
UASSERT(!m_rootp, "call once");
m_rootp = makeNetlist();
}
void clear(); void clear();
void shutdown(); // Release allocated resorces void shutdown(); // Release allocated resorces
// ACCESSORS (general) // ACCESSORS (general)

View File

@ -49,9 +49,8 @@ protected:
return level; return level;
} }
void boot(char** env) { void boot() {
// Create the implementation pointer // Create the implementation pointer
if (env) {}
if (!s_preprocp) { if (!s_preprocp) {
FileLine* const cmdfl = new FileLine(FileLine::commandLineFilename()); FileLine* const cmdfl = new FileLine(FileLine::commandLineFilename());
s_preprocp = V3PreProc::createPreProc(cmdfl); s_preprocp = V3PreProc::createPreProc(cmdfl);
@ -162,7 +161,7 @@ VInFilter* V3PreShellImp::s_filterp = nullptr;
//###################################################################### //######################################################################
// V3PreShell // V3PreShell
void V3PreShell::boot(char** env) { V3PreShellImp::s_preImp.boot(env); } void V3PreShell::boot() { V3PreShellImp::s_preImp.boot(); }
bool V3PreShell::preproc(FileLine* fl, const string& modname, VInFilter* filterp, bool V3PreShell::preproc(FileLine* fl, const string& modname, VInFilter* filterp,
V3ParseImp* parsep, const string& errmsg) { V3ParseImp* parsep, const string& errmsg) {
return V3PreShellImp::s_preImp.preproc(fl, modname, filterp, parsep, errmsg); return V3PreShellImp::s_preImp.preproc(fl, modname, filterp, parsep, errmsg);

View File

@ -32,7 +32,7 @@ class VSpellCheck;
class V3PreShell final { class V3PreShell final {
// Static class for calling preprocessor // Static class for calling preprocessor
public: public:
static void boot(char** env); static void boot();
static bool preproc(FileLine* fl, const string& modname, VInFilter* filterp, static bool preproc(FileLine* fl, const string& modname, VInFilter* filterp,
V3ParseImp* parsep, const string& errmsg); V3ParseImp* parsep, const string& errmsg);
static void preprocInclude(FileLine* fl, const string& modname); static void preprocInclude(FileLine* fl, const string& modname);

View File

@ -716,7 +716,7 @@ int main(int argc, char** argv, char** env) {
// Preprocessor // Preprocessor
// Before command parsing so we can handle -Ds on command line. // Before command parsing so we can handle -Ds on command line.
V3PreShell::boot(env); V3PreShell::boot();
// Command option parsing // Command option parsing
v3Global.opt.bin(argv[0]); v3Global.opt.bin(argv[0]);