Internals: Fix constructor style.

This commit is contained in:
Wilson Snyder 2022-11-10 22:58:27 -05:00
parent 528a73a492
commit 0c75d4eaca
5 changed files with 17 additions and 16 deletions

View File

@ -203,7 +203,7 @@ public:
explicit V3GraphVertex(V3Graph* graphp);
//! Clone copy constructor. Doesn't copy edges or user/userp.
virtual V3GraphVertex* clone(V3Graph* graphp) const {
return new V3GraphVertex(graphp, *this);
return new V3GraphVertex{graphp, *this};
}
virtual ~V3GraphVertex() = default;
void unlinkEdges(V3Graph* graphp);
@ -271,6 +271,7 @@ protected:
friend class V3GraphVertex;
friend class GraphAcyc;
friend class GraphAcycEdge;
V3ListEnt<V3GraphEdge*> m_outs; // Next Outbound edge for same vertex (linked list)
V3ListEnt<V3GraphEdge*> m_ins; // Next Inbound edge for same vertex (linked list)
//
@ -303,7 +304,7 @@ public:
}
//! Clone copy constructor. Doesn't copy existing vertices or user/userp.
virtual V3GraphEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) const {
return new V3GraphEdge(graphp, fromp, top, *this);
return new V3GraphEdge{graphp, fromp, top, *this};
}
virtual ~V3GraphEdge() = default;
// METHODS

View File

@ -233,7 +233,7 @@ public:
return strp;
}
V3Number* newNumber(FileLine* flp, const char* text) {
V3Number* nump = new V3Number(flp, text);
V3Number* nump = new V3Number{flp, text};
m_numberps.push_back(nump);
return nump;
}

View File

@ -109,14 +109,14 @@ class SliceVisitor final : public VNVisitor {
+ (!snodep->declRange().littleEndian()
? snodep->declRange().elements() - 1 - offset
: offset));
newp = new AstArraySel(nodep->fileline(), snodep->fromp()->cloneTree(false), leOffset);
newp = new AstArraySel{nodep->fileline(), snodep->fromp()->cloneTree(false), leOffset};
} else if (VN_IS(nodep, ArraySel) || VN_IS(nodep, NodeVarRef) || VN_IS(nodep, NodeSel)
|| VN_IS(nodep, CMethodHard) || VN_IS(nodep, MemberSel)) {
UINFO(9, " cloneSel(" << elements << "," << offset << ") " << nodep << endl);
const int leOffset = !arrayp->rangep()->littleEndian()
? arrayp->rangep()->elementsConst() - 1 - offset
: offset;
newp = new AstArraySel(nodep->fileline(), nodep->cloneTree(false), leOffset);
newp = new AstArraySel{nodep->fileline(), nodep->cloneTree(false), leOffset};
} else {
if (!m_assignError) {
nodep->v3error(nodep->prettyTypeName()
@ -189,10 +189,10 @@ class SliceVisitor final : public VNVisitor {
// EQ(a,b) -> LOGAND(EQ(ARRAYSEL(a,0), ARRAYSEL(b,0)), ...[1])
AstNodeBiop* const clonep
= VN_AS(nodep->cloneType(
new AstArraySel(nodep->fileline(),
nodep->lhsp()->cloneTree(false), index),
new AstArraySel(nodep->fileline(),
nodep->rhsp()->cloneTree(false), index)),
new AstArraySel{nodep->fileline(),
nodep->lhsp()->cloneTree(false), index},
new AstArraySel{nodep->fileline(),
nodep->rhsp()->cloneTree(false), index}),
NodeBiop);
if (!logp) {
logp = clonep;
@ -200,11 +200,11 @@ class SliceVisitor final : public VNVisitor {
switch (nodep->type()) {
case VNType::atEq: // FALLTHRU
case VNType::atEqCase:
logp = new AstLogAnd(nodep->fileline(), logp, clonep);
logp = new AstLogAnd{nodep->fileline(), logp, clonep};
break;
case VNType::atNeq: // FALLTHRU
case VNType::atNeqCase:
logp = new AstLogOr(nodep->fileline(), logp, clonep);
logp = new AstLogOr{nodep->fileline(), logp, clonep};
break;
default:
nodep->v3fatalSrc("Unknown node type processing array slice");

View File

@ -183,7 +183,7 @@ private:
bool honorExport) {
if ((!honorExport || srcp->exported())
&& !findIdFlat(name)) { // Don't insert over existing entry
VSymEnt* const symp = new VSymEnt(graphp, srcp);
VSymEnt* const symp = new VSymEnt{graphp, srcp};
symp->exported(false); // Can't reimport an import without an export
symp->imported(true);
reinsert(name, symp);
@ -248,7 +248,7 @@ public:
VSymEnt* const subSrcp = it->second;
const AstVar* const varp = VN_CAST(subSrcp->nodep(), Var);
if (!onlyUnmodportable || (varp && varp->isParam())) {
VSymEnt* const subSymp = new VSymEnt(graphp, subSrcp);
VSymEnt* const subSymp = new VSymEnt{graphp, subSrcp};
reinsert(name, subSymp);
// And recurse to create children
subSymp->importFromIface(graphp, subSrcp);
@ -290,7 +290,7 @@ class VSymGraph final {
VL_DEFINE_DEBUG_FUNCTIONS;
public:
explicit VSymGraph(AstNetlist* nodep) { m_symRootp = new VSymEnt(this, nodep); }
explicit VSymGraph(AstNetlist* nodep) { m_symRootp = new VSymEnt{this, nodep}; }
~VSymGraph() {
for (const VSymEnt* entp : m_symsp) delete entp;
}

View File

@ -80,10 +80,10 @@ public:
static AstConst* newIfConstCommitSize(AstConst* nodep) {
if (((nodep->dtypep()->width() != nodep->num().width()) || !nodep->num().sized())
&& !nodep->num().isString()) { // Need to force the number from unsized to sized
V3Number num(nodep, nodep->dtypep()->width());
V3Number num{nodep, nodep->dtypep()->width()};
num.opAssign(nodep->num());
num.isSigned(nodep->isSigned());
AstConst* const newp = new AstConst(nodep->fileline(), num);
AstConst* const newp = new AstConst{nodep->fileline(), num};
newp->dtypeFrom(nodep);
return newp;
} else {