diff --git a/src/V3Ast.h b/src/V3Ast.h index 6a286bde8..8dc154695 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1915,8 +1915,6 @@ public: // Iterate and insert - assumes tree format virtual void addNextStmt(AstNode* newp, AstNode* belowp); // When calling, "this" is second argument - virtual void addBeforeStmt(AstNode* newp, - AstNode* belowp); // When calling, "this" is second argument // METHODS - Iterate on a tree // Clone or return nullptr if nullptr diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 960f10d09..1070c83f9 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -308,8 +308,6 @@ public: // METHODS void addNextStmt(AstNode* newp, AstNode* belowp) override; // Stop statement searchback here - void addBeforeStmt(AstNode* newp, - AstNode* belowp) override; // Stop statement searchback here void dump(std::ostream& str = std::cout) const override; }; class AstNodeAssign VL_NOT_FINAL : public AstNodeStmt { @@ -3246,8 +3244,6 @@ public: int instrCount() const override { return INSTR_COUNT_BRANCH; } bool same(const AstNode* /*samep*/) const override { return true; } // Stop statement searchback here - void addBeforeStmt(AstNode* newp, AstNode* belowp) override; - // Stop statement searchback here void addNextStmt(AstNode* newp, AstNode* belowp) override; bool isFirstInMyListOfStatements(AstNode* n) const override { return n == stmtsp(); } }; diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 0f3fa80a4..eccb2d504 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1271,44 +1271,17 @@ AstVarScope* AstConstPool::findConst(AstConst* initp, bool mergeDType) { //====================================================================== // Special walking tree inserters -void AstNode::addBeforeStmt(AstNode* newp, AstNode*) { - UASSERT_OBJ(backp(), newp, "Can't find current statement to addBeforeStmt"); - // Look up; virtual call will find where to put it - this->backp()->addBeforeStmt(newp, this); -} void AstNode::addNextStmt(AstNode* newp, AstNode*) { UASSERT_OBJ(backp(), newp, "Can't find current statement to addNextStmt"); // Look up; virtual call will find where to put it this->backp()->addNextStmt(newp, this); } -void AstNodeStmt::addBeforeStmt(AstNode* newp, AstNode*) { - // Insert newp before current node - this->addHereThisAsNext(newp); -} void AstNodeStmt::addNextStmt(AstNode* newp, AstNode*) { // Insert newp after current node this->addNextHere(newp); } -void AstWhile::addBeforeStmt(AstNode* newp, AstNode* belowp) { - // Special, as statements need to be put in different places - // Belowp is how we came to recurse up to this point - // Preconditions insert first just before themselves (the normal rule - // for other statement types) - if (belowp == precondsp()) { - // Must have been first statement in precondsp list, so newp is new first statement - belowp->addHereThisAsNext(newp); - } else if (belowp == condp()) { - // Goes before condition, IE in preconditions - addPrecondsp(newp); - } else if (belowp == stmtsp()) { - // Was first statement in body, so new front - belowp->addHereThisAsNext(newp); - } else { - belowp->v3fatalSrc("Doesn't look like this was really under the while"); - } -} void AstWhile::addNextStmt(AstNode* newp, AstNode* belowp) { // Special, as statements need to be put in different places // Belowp is how we came to recurse up to this point diff --git a/src/V3LinkInc.cpp b/src/V3LinkInc.cpp index 8c71d6bb2..904fd423f 100644 --- a/src/V3LinkInc.cpp +++ b/src/V3LinkInc.cpp @@ -69,7 +69,6 @@ private: // METHODS void insertBeforeStmt(AstNode* nodep, AstNode* newp) { // Return node that must be visited, if any - // See also AstNode::addBeforeStmt; this predates that function if (debug() >= 9) newp->dumpTree("- newstmt: "); UASSERT_OBJ(m_insStmtp, nodep, "Function not underneath a statement"); if (m_insMode == IM_BEFORE) { diff --git a/src/V3Task.cpp b/src/V3Task.cpp index e7ef1e0f7..9bc068a19 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -1335,7 +1335,6 @@ private: } AstNode* insertBeforeStmt(AstNode* nodep, AstNode* newp) { // Return node that must be visited, if any - // See also AstNode::addBeforeStmt; this predates that function if (debug() >= 9) nodep->dumpTree("- newstmt: "); UASSERT_OBJ(m_insStmtp, nodep, "Function not underneath a statement"); AstNode* visitp = nullptr;