Internals: Add some additional dangling checks. No functional change intended
This commit is contained in:
parent
587f363e03
commit
35a794687b
|
|
@ -303,7 +303,7 @@ class AssertVisitor final : public VNVisitor {
|
|||
if (AstPExpr* const pexprp = VN_CAST(propp, PExpr)) {
|
||||
AstFork* const forkp = new AstFork{nodep->fileline(), VJoinType::JOIN_NONE};
|
||||
forkp->addForksp(pexprp->bodyp()->unlinkFrBack());
|
||||
VL_DO_DANGLING(pushDeletep(pexprp), pexprp);
|
||||
VL_DO_DANGLING2(pushDeletep(pexprp), pexprp, propp);
|
||||
bodyp = forkp;
|
||||
} else {
|
||||
bodyp = assertCond(nodep, VN_AS(propp, NodeExpr), passsp, failsp);
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ class CaseVisitor final : public VNVisitor {
|
|||
condp = irangep->newAndFromInside(cexprp->cloneTreePure(true),
|
||||
irangep->lhsp()->unlinkFrBack(),
|
||||
irangep->rhsp()->unlinkFrBack());
|
||||
VL_DO_DANGLING(icondp->deleteTree(), icondp);
|
||||
VL_DO_DANGLING2(icondp->deleteTree(), icondp, irangep);
|
||||
} else if (iconstp && iconstp->num().isFourState()
|
||||
&& (nodep->casex() || nodep->casez() || nodep->caseInside())) {
|
||||
V3Number nummask{itemp, iconstp->width()};
|
||||
|
|
|
|||
|
|
@ -3648,7 +3648,7 @@ class ConstVisitor final : public VNVisitor {
|
|||
while (AstNode* const nextp = lastp->nextp()) lastp = nextp;
|
||||
if (AstLoopTest* const testp = VN_CAST(lastp, LoopTest)) {
|
||||
if (testp->condp()->isZero()) {
|
||||
VL_DO_DANGLING(pushDeletep(testp->unlinkFrBack()), testp);
|
||||
VL_DO_DANGLING2(pushDeletep(testp->unlinkFrBack()), testp, lastp);
|
||||
nodep->replaceWith(nodep->stmtsp()->unlinkFrBackWithNext());
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1229,7 +1229,7 @@ class DelayedVisitor final : public VNVisitor {
|
|||
// Replace with result
|
||||
currp->replaceWith(exprp->resultp()->unlinkFrBack());
|
||||
// Get rid of the AstExprStmt
|
||||
VL_DO_DANGLING(pushDeletep(currp), currp);
|
||||
VL_DO_DANGLING2(pushDeletep(currp), currp, exprp);
|
||||
} else if (AstVarRef* const refp = VN_CAST(currp, VarRef)) {
|
||||
// Ignore reads (e.g.: '_[*here*] <= _')
|
||||
if (refp->access().isReadOnly()) return;
|
||||
|
|
|
|||
|
|
@ -1870,13 +1870,13 @@ class LinkDotFindVisitor final : public VNVisitor {
|
|||
for (AstNode *nextp, *argp = loopvarsp->elementsp(); argp; argp = nextp) {
|
||||
nextp = argp->nextp();
|
||||
AstVar* argrefp = nullptr;
|
||||
if (const auto parserefp = VN_CAST(argp, ParseRef)) {
|
||||
if (AstParseRef* const parserefp = VN_CAST(argp, ParseRef)) {
|
||||
// We use an int type, this might get changed in V3Width when types resolve
|
||||
argrefp = new AstVar{parserefp->fileline(), VVarType::BLOCKTEMP,
|
||||
parserefp->name(), argp->findSigned32DType()};
|
||||
argrefp->lifetime(VLifetime::AUTOMATIC_EXPLICIT);
|
||||
parserefp->replaceWith(argrefp);
|
||||
VL_DO_DANGLING(parserefp->deleteTree(), parserefp);
|
||||
VL_DO_DANGLING2(parserefp->deleteTree(), parserefp, argp);
|
||||
// Insert argref's name into symbol table
|
||||
m_statep->insertSym(m_curSymp, argrefp->name(), argrefp, nullptr);
|
||||
} else if (const auto largrefp = VN_CAST(argp, Var)) {
|
||||
|
|
@ -4646,7 +4646,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
|||
AstNode* addp = pinp;
|
||||
if (AstArg* const argp = VN_CAST(pinp, Arg)) {
|
||||
addp = argp->exprp()->unlinkFrBack();
|
||||
VL_DO_DANGLING(pushDeletep(pinp), pinp);
|
||||
VL_DO_DANGLING2(pushDeletep(pinp), pinp, argp);
|
||||
}
|
||||
outp = AstNode::addNext(outp, addp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -619,7 +619,7 @@ class LinkParseVisitor final : public VNVisitor {
|
|||
= new AstSelLoopVars{selp->fileline(), selp->fromp()->unlinkFrBack(),
|
||||
selp->bitp()->unlinkFrBackWithNext()};
|
||||
selp->replaceWith(newp);
|
||||
VL_DO_DANGLING(selp->deleteTree(), selp);
|
||||
VL_DO_DANGLING2(selp->deleteTree(), selp, bracketp);
|
||||
} else if (VN_IS(bracketp, SelLoopVars)) {
|
||||
// Ok
|
||||
} else {
|
||||
|
|
@ -952,7 +952,7 @@ class LinkParseVisitor final : public VNVisitor {
|
|||
citemp->v3fatalSrc("Incorrect direction");
|
||||
}
|
||||
}
|
||||
VL_DO_DANGLING(pushDeletep(citemp->unlinkFrBack()), citemp);
|
||||
VL_DO_DANGLING2(pushDeletep(citemp->unlinkFrBack()), citemp, itemp);
|
||||
}
|
||||
}
|
||||
iterateChildren(nodep);
|
||||
|
|
|
|||
|
|
@ -5597,7 +5597,7 @@ class WidthVisitor final : public VNVisitor {
|
|||
AstNode* const bodyp = nodep->stmtsp();
|
||||
userIterateAndNext(bodyp, nullptr);
|
||||
if (AstForeach* const loopp = VN_CAST(nodep, Foreach)) {
|
||||
VL_DO_DANGLING(V3Begin::convertToWhile(loopp), nodep);
|
||||
VL_DO_DANGLING2(V3Begin::convertToWhile(loopp), loopp, nodep);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -8945,7 +8945,7 @@ class WidthVisitor final : public VNVisitor {
|
|||
if (!constp || (noFourState && constp->num().isFourState())) {
|
||||
nodep->v3error(message);
|
||||
nodep->replaceWith(new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1});
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
VL_DO_DANGLING2(pushDeletep(nodep), nodep, constp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue