Internals: Add addNextNull. No functional change intended.
This commit is contained in:
parent
821eacebea
commit
14a94b6de9
10
src/V3Ast.h
10
src/V3Ast.h
|
|
@ -821,6 +821,16 @@ public:
|
|||
if (!newp) return nodep;
|
||||
return static_cast<T_NodeResult*>(addNext<AstNode, AstNode>(nodep, newp));
|
||||
}
|
||||
template <typename T_NodeResult, typename T_NodeNext>
|
||||
static T_NodeResult* addNextNull(T_NodeResult* nodep, T_NodeNext* newp) {
|
||||
static_assert(std::is_base_of<AstNode, T_NodeResult>::value,
|
||||
"'T_NodeResult' must be a subtype of AstNode");
|
||||
static_assert(std::is_base_of<T_NodeResult, T_NodeNext>::value,
|
||||
"'T_NodeNext' must be a subtype of 'T_NodeResult'");
|
||||
if (!newp) return nodep;
|
||||
if (!nodep) return newp;
|
||||
return static_cast<T_NodeResult*>(addNext<AstNode, AstNode>(nodep, newp));
|
||||
}
|
||||
inline AstNode* addNext(AstNode* newp);
|
||||
void addNextHere(AstNode* newp); // Insert newp at this->nextp
|
||||
void addHereThisAsNext(AstNode* newp); // Adds at old place of this, this becomes next
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ public:
|
|||
if (nextp) nextp->unlinkFrBackWithNext();
|
||||
if (itemsp && skewp) skewp = skewp->cloneTree(false);
|
||||
AstClockingItem* itemp = new AstClockingItem{flp, direction, skewp, nodep};
|
||||
itemsp = itemsp ? itemsp->addNext(itemp) : itemp;
|
||||
itemsp = AstNode::addNextNull(itemsp, itemp);
|
||||
}
|
||||
return itemsp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2673,7 +2673,7 @@ class RandomizeVisitor final : public VNVisitor {
|
|||
if (!structSelp->dtypep()) structSelp->dtypep(smemberp->subDTypep());
|
||||
randp = newRandStmtsp(fl, structSelp, nullptr, outputVarp);
|
||||
}
|
||||
stmtsp = stmtsp ? stmtsp->addNext(randp) : randp;
|
||||
stmtsp = AstNode::addNextNull(stmtsp, randp);
|
||||
}
|
||||
return stmtsp;
|
||||
} else if (const auto* const unionDtp = VN_CAST(memberDtp, UnionDType)) {
|
||||
|
|
|
|||
|
|
@ -5098,7 +5098,7 @@ class WidthVisitor final : public VNVisitor {
|
|||
AstNodeExpr* const valuep = patternMemberValueIterate(patp);
|
||||
AstConsPackMember* const cpmp
|
||||
= new AstConsPackMember{patp->fileline(), memp, valuep};
|
||||
membersp = membersp ? membersp->addNext(cpmp) : cpmp;
|
||||
membersp = AstNode::addNextNull(membersp, cpmp);
|
||||
}
|
||||
newp = new AstConsPackUOrStruct{nodep->fileline(), vdtypep, membersp};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ void yyerror(const char* errmsg) { PARSEP->bisonLastFileline()->v3error(errmsg);
|
|||
|
||||
template <typename T_Node, typename T_Next>
|
||||
static T_Node* addNextNull(T_Node* nodep, T_Next* nextp) {
|
||||
if (!nextp) return nodep;
|
||||
return AstNode::addNext<T_Node, T_Next>(nodep, nextp);
|
||||
return AstNode::addNextNull<T_Node, T_Next>(nodep, nextp);
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
|
|
|
|||
Loading…
Reference in New Issue