From 0c75d4eaca8b38c2592c7ba76a5fb9658d584435 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 10 Nov 2022 22:58:27 -0500 Subject: [PATCH] Internals: Fix constructor style. --- src/V3Graph.h | 5 +++-- src/V3ParseImp.h | 2 +- src/V3Slice.cpp | 16 ++++++++-------- src/V3SymTable.h | 6 +++--- src/V3WidthCommit.h | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/V3Graph.h b/src/V3Graph.h index 0de50222a..ee7f7a2ef 100644 --- a/src/V3Graph.h +++ b/src/V3Graph.h @@ -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 m_outs; // Next Outbound edge for same vertex (linked list) V3ListEnt 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 diff --git a/src/V3ParseImp.h b/src/V3ParseImp.h index 9e3303923..fb89516ad 100644 --- a/src/V3ParseImp.h +++ b/src/V3ParseImp.h @@ -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; } diff --git a/src/V3Slice.cpp b/src/V3Slice.cpp index 57cca7785..332612d87 100644 --- a/src/V3Slice.cpp +++ b/src/V3Slice.cpp @@ -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"); diff --git a/src/V3SymTable.h b/src/V3SymTable.h index 879c898e9..714574096 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -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; } diff --git a/src/V3WidthCommit.h b/src/V3WidthCommit.h index ca2f9a584..5dc6283e2 100644 --- a/src/V3WidthCommit.h +++ b/src/V3WidthCommit.h @@ -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 {