From 03c5d061070050d4ed499f0b3bef3877e45a992b Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 1 Oct 2009 22:33:11 -0400 Subject: [PATCH] Visitors that just accept netlists should say so. No functional change --- src/V3Active.cpp | 2 +- src/V3Clean.cpp | 8 +++----- src/V3Clock.cpp | 11 ++++------- src/V3Const.cpp | 2 +- src/V3Delayed.cpp | 2 +- src/V3Depth.cpp | 2 +- src/V3DepthBlock.cpp | 2 +- src/V3Expand.cpp | 9 +++------ src/V3LinkCells.cpp | 9 +++------ src/V3Name.cpp | 2 +- src/V3Premit.cpp | 9 +++------ src/V3Scope.cpp | 4 ++-- src/V3Split.cpp | 2 +- src/V3Unknown.cpp | 2 +- src/V3Width.cpp | 2 +- src/V3Width.h | 2 +- 16 files changed, 28 insertions(+), 42 deletions(-) diff --git a/src/V3Active.cpp b/src/V3Active.cpp index 63c0b67f5..7c66c5a05 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -364,7 +364,7 @@ private: } public: // CONSTUCTORS - ActiveVisitor(AstNode* nodep) { + ActiveVisitor(AstNetlist* nodep) { m_scopeFinalp = NULL; m_alwaysp = NULL; m_itemCombo = false; diff --git a/src/V3Clean.cpp b/src/V3Clean.cpp index 1ba5b6266..d04a94fb4 100644 --- a/src/V3Clean.cpp +++ b/src/V3Clean.cpp @@ -262,11 +262,10 @@ private: public: // CONSTUCTORS - CleanVisitor() {} - virtual ~CleanVisitor() {} - void main(AstNetlist* nodep) { + CleanVisitor(AstNetlist* nodep) { nodep->accept(*this); } + virtual ~CleanVisitor() {} }; //###################################################################### @@ -274,6 +273,5 @@ public: void V3Clean::cleanAll(AstNetlist* nodep) { UINFO(2,__FUNCTION__<<": "<fileline(), nodep->typeName()); nodep->replaceWith(cmtp); - AstNode* stmtsp = nodep->bodysp(); - if (stmtsp) { + if (AstNode* stmtsp = nodep->bodysp()) { stmtsp->unlinkFrBackWithNext(); cmtp->addNextHere(stmtsp); } @@ -290,8 +289,7 @@ private: virtual void visit(AstAlwaysPost* nodep, AstNUser*) { AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName()); nodep->replaceWith(cmtp); - AstNode* stmtsp = nodep->bodysp(); - if (stmtsp) { + if (AstNode* stmtsp = nodep->bodysp()) { stmtsp->unlinkFrBackWithNext(); cmtp->addNextHere(stmtsp); } @@ -320,8 +318,7 @@ private: virtual void visit(AstInitial* nodep, AstNUser*) { AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName()); nodep->replaceWith(cmtp); - AstNode* stmtsp = nodep->bodysp(); - if (stmtsp) { + if (AstNode* stmtsp = nodep->bodysp()) { stmtsp->unlinkFrBackWithNext(); cmtp->addNextHere(stmtsp); } @@ -534,7 +531,7 @@ private: public: // CONSTUCTORS - ClockVisitor(AstNode* nodep) { + ClockVisitor(AstNetlist* nodep) { m_modp=NULL; m_activep=NULL; m_evalFuncp = NULL; m_topScopep=NULL; diff --git a/src/V3Const.cpp b/src/V3Const.cpp index a3c16f85d..10c92933a 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -59,7 +59,7 @@ public: // CONSTUCTORS ConstVarMarkVisitor(AstNode* nodep) { AstNode::user4ClearTree(); // Check marked InUse before we're called - nodep->iterateAndNext(*this, NULL); + nodep->accept(*this); } virtual ~ConstVarMarkVisitor() {} }; diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index 7ffc80ffa..50171800c 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -441,7 +441,7 @@ private: public: // CONSTUCTORS - DelayedVisitor(AstNode* nodep) { + DelayedVisitor(AstNetlist* nodep) { m_inDly = false; m_activep=NULL; m_cfuncp=NULL; diff --git a/src/V3Depth.cpp b/src/V3Depth.cpp index b5f505fe9..0d64a19cf 100644 --- a/src/V3Depth.cpp +++ b/src/V3Depth.cpp @@ -156,7 +156,7 @@ private: public: // CONSTUCTORS - DepthVisitor(AstNode* nodep) { + DepthVisitor(AstNetlist* nodep) { m_modp=NULL; m_funcp=NULL; m_stmtp=NULL; diff --git a/src/V3DepthBlock.cpp b/src/V3DepthBlock.cpp index 43ae756ee..132a0a993 100644 --- a/src/V3DepthBlock.cpp +++ b/src/V3DepthBlock.cpp @@ -126,7 +126,7 @@ private: public: // CONSTUCTORS - DepthBlockVisitor(AstNode* nodep) { + DepthBlockVisitor(AstNetlist* nodep) { m_modp=NULL; m_depth=0; // diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index 8fe952bc9..b40641b9b 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -905,13 +905,11 @@ private: public: // CONSTUCTORS - ExpandVisitor() { + ExpandVisitor(AstNetlist* nodep) { m_stmtp=NULL; - } - virtual ~ExpandVisitor() {} - void main(AstNode* nodep) { nodep->accept(*this); } + virtual ~ExpandVisitor() {} }; //---------------------------------------------------------------------- @@ -922,6 +920,5 @@ public: void V3Expand::expandAll(AstNetlist* nodep) { UINFO(2,__FUNCTION__<<": "<accept(*this); } + virtual ~LinkCellsVisitor() {} }; //###################################################################### @@ -274,6 +272,5 @@ public: void V3LinkCells::link(AstNetlist* rootp) { UINFO(4,__FUNCTION__<<": "<accept(*this); } virtual ~NameVisitor() {} diff --git a/src/V3Premit.cpp b/src/V3Premit.cpp index f63b9cd1e..4a456924c 100644 --- a/src/V3Premit.cpp +++ b/src/V3Premit.cpp @@ -306,17 +306,15 @@ private: public: // CONSTUCTORS - PremitVisitor() { + PremitVisitor(AstNetlist* nodep) { m_modp = NULL; m_funcp = NULL; m_stmtp = NULL; m_inWhilep = NULL; m_inTracep = NULL; - } - virtual ~PremitVisitor() {} - void main(AstNode* nodep) { nodep->accept(*this); } + virtual ~PremitVisitor() {} }; //---------------------------------------------------------------------- @@ -327,6 +325,5 @@ public: void V3Premit::premitAll(AstNetlist* nodep) { UINFO(2,__FUNCTION__<<": "<accept(*this); } diff --git a/src/V3Split.cpp b/src/V3Split.cpp index 34d843bda..051e3c9f1 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -548,7 +548,7 @@ private: public: // CONSTUCTORS - SplitVisitor(AstNode* nodep, bool reorder) + SplitVisitor(AstNetlist* nodep, bool reorder) : m_reorder(reorder) { scoreboardClear(); nodep->accept(*this); diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 134a58caf..bba47e6b9 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -377,7 +377,7 @@ private: public: // CONSTUCTORS - UnknownVisitor(AstNode* nodep) { + UnknownVisitor(AstNetlist* nodep) { nodep->accept(*this); } virtual ~UnknownVisitor() { diff --git a/src/V3Width.cpp b/src/V3Width.cpp index ef73378b1..ea838b614 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1197,7 +1197,7 @@ void V3Width::widthSignedIfNotAlready(AstNode* nodep) { } } -void V3Width::widthCommit(AstNode* nodep) { +void V3Width::widthCommit(AstNetlist* nodep) { UINFO(2,__FUNCTION__<<": "<