From e12bf35996e086a15dcadd4ef9c5daddba831930 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 29 May 2012 22:59:17 -0400 Subject: [PATCH] Fix leak check compile and run, bug521. --- src/V3Error.cpp | 2 +- src/V3Global.h | 3 ++- src/Verilator.cpp | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/V3Error.cpp b/src/V3Error.cpp index dd28f5eaa..841b314ce 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -308,7 +308,7 @@ void FileLine::deleteAllRemaining() { // Eventually the list will be empty and terminate the loop. } fileLineLeakChecks.clear(); - FileLineSingleton::clear(); + singleton().clear(); #endif } diff --git a/src/V3Global.h b/src/V3Global.h index 4414a8bb2..5c57cf41f 100644 --- a/src/V3Global.h +++ b/src/V3Global.h @@ -61,9 +61,10 @@ public: m_needHInlines = false; m_needHeavy = false; m_dpi = false; - m_rootp = makeNetlist(); + m_rootp = NULL; // created by makeInitNetlist() so static constructors run first } AstNetlist* makeNetlist(); + void boot() { UASSERT(!m_rootp,"call once"); m_rootp = makeNetlist(); } void clear(); // ACCESSORS (general) AstNetlist* rootp() const { return m_rootp; } diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 953d6122b..337e4c3a9 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -616,6 +616,9 @@ int main(int argc, char** argv, char** env) { time(&randseed); srand( (int) randseed); + // Post-constructor initialization of netlists + v3Global.boot(); + // Preprocessor // Before command parsing so we can handle -Ds on command line. V3PreShell::boot(env);