Use AstNode::addHereThisAsNext in a few places

This commit is contained in:
Geza Lore 2022-07-13 13:55:40 +01:00
parent e0a38ce2c2
commit 3fc8249429
3 changed files with 3 additions and 12 deletions

View File

@ -68,10 +68,7 @@ private:
// Put assignment before the referencing statement
AstAssign* const assp = new AstAssign{
nodep->fileline(), new AstVarRef{nodep->fileline(), varp, VAccess::WRITE}, nodep};
VNRelinker linker2;
m_stmtp->unlinkFrBack(&linker2);
assp->addNext(m_stmtp);
linker2.relink(assp);
m_stmtp->addHereThisAsNext(assp);
}
// VISITORS

View File

@ -82,10 +82,7 @@ private:
static void insertBefore(AstNode* placep, AstNode* newp) {
newp->user1(1); // Already processed, don't need to re-iterate
VNRelinker linker;
placep->unlinkFrBack(&linker);
newp->addNext(placep);
linker.relink(newp);
placep->addHereThisAsNext(newp);
}
static void replaceWithDelete(AstNode* nodep, AstNode* newp) {
newp->user1(1); // Already processed, don't need to re-iterate

View File

@ -109,10 +109,7 @@ private:
} else if (m_inTracep) {
m_inTracep->addPrecondsp(newp);
} else if (m_stmtp) {
VNRelinker linker;
m_stmtp->unlinkFrBack(&linker);
newp->addNext(m_stmtp);
linker.relink(newp);
m_stmtp->addHereThisAsNext(newp);
} else {
newp->v3fatalSrc("No statement insertion point.");
}