From 73d6de447116c080c4535c881e17a9613785cf7b Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 21 Nov 2022 20:41:32 -0500 Subject: [PATCH] Internals: Fix constructor style. --- src/V3AstNodeExpr.h | 8 ++++---- src/V3Hash.h | 2 +- src/V3Options.cpp | 2 +- src/V3SenTree.h | 2 +- src/V3Unknown.cpp | 2 +- src/V3VariableOrder.cpp | 2 +- src/V3Width.cpp | 31 ++++++++++++++++--------------- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/V3AstNodeExpr.h b/src/V3AstNodeExpr.h index ab1fad6e5..ffac83677 100644 --- a/src/V3AstNodeExpr.h +++ b/src/V3AstNodeExpr.h @@ -138,7 +138,7 @@ public: class AstNodeSystemBiop VL_NOT_FINAL : public AstNodeBiop { public: AstNodeSystemBiop(VNType t, FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* rhsp) - : AstNodeBiop(t, fl, lhsp, rhsp) { + : AstNodeBiop{t, fl, lhsp, rhsp} { dtypeSetDouble(); } ASTGEN_MEMBERS_AstNodeSystemBiop; @@ -391,7 +391,7 @@ public: class AstNodeSystemUniop VL_NOT_FINAL : public AstNodeUniop { public: AstNodeSystemUniop(VNType t, FileLine* fl, AstNodeExpr* lhsp) - : AstNodeUniop(t, fl, lhsp) { + : AstNodeUniop{t, fl, lhsp} { dtypeSetDouble(); } ASTGEN_MEMBERS_AstNodeSystemUniop; @@ -825,7 +825,7 @@ public: class VerilogStringLiteral {}; // for creator type-overload selection AstConst(FileLine* fl, VerilogStringLiteral, const string& str) : ASTGEN_SUPER_Const(fl) - , m_num(V3Number::VerilogStringLiteral(), this, str) { + , m_num(V3Number::VerilogStringLiteral{}, this, str) { initWithNumber(); } AstConst(FileLine* fl, uint32_t num) @@ -871,7 +871,7 @@ public: class String {}; // for creator type-overload selection AstConst(FileLine* fl, String, const string& num) : ASTGEN_SUPER_Const(fl) - , m_num(V3Number::String(), this, num) { + , m_num(V3Number::String{}, this, num) { dtypeSetString(); } class BitFalse {}; diff --git a/src/V3Hash.h b/src/V3Hash.h index b9ab8bd98..8bf377cd6 100644 --- a/src/V3Hash.h +++ b/src/V3Hash.h @@ -59,7 +59,7 @@ public: // '+' combines hashes template V3Hash operator+(T that) const { - return V3Hash(combine(m_value, V3Hash{that}.m_value)); + return V3Hash{combine(m_value, V3Hash{that}.m_value)}; } // '+=' combines in place diff --git a/src/V3Options.cpp b/src/V3Options.cpp index f8dd03135..fbc408488 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -266,7 +266,7 @@ void VTimescale::parseSlashed(FileLine* fl, const char* textp, VTimescale& unitr unitr = unit; if (!precStr.empty()) { - VTimescale prec(VTimescale::NONE); + VTimescale prec{VTimescale::NONE}; bool precbad; prec = VTimescale{precStr, precbad /*ref*/}; if (precbad) { diff --git a/src/V3SenTree.h b/src/V3SenTree.h index 698406c74..eea4128f3 100644 --- a/src/V3SenTree.h +++ b/src/V3SenTree.h @@ -53,7 +53,7 @@ private: public: // CONSTRUCTORS SenTreeFinder() - : SenTreeFinder(v3Global.rootp()) {} + : SenTreeFinder{v3Global.rootp()} {} explicit SenTreeFinder(AstNetlist* netlistp) : m_topScopep{netlistp->topScopep()} { diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 55d7e63ab..459112a11 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -396,7 +396,7 @@ private: // If (maxmsb >= selected), we're in bound AstNodeExpr* condp = new AstGte{nodep->fileline(), - new AstConst(nodep->fileline(), AstConst::WidthedValue(), + new AstConst(nodep->fileline(), AstConst::WidthedValue{}, nodep->lsbp()->width(), maxmsb), nodep->lsbp()->cloneTree(false)}; // See if the condition is constant true (e.g. always in bound due to constant select) diff --git a/src/V3VariableOrder.cpp b/src/V3VariableOrder.cpp index 6ebd72c87..b360aaca0 100644 --- a/src/V3VariableOrder.cpp +++ b/src/V3VariableOrder.cpp @@ -195,7 +195,7 @@ class VariableOrder final { } public: - static void processModule(AstNodeModule* modp) { VariableOrder().orderModuleVars(modp); } + static void processModule(AstNodeModule* modp) { VariableOrder{}.orderModuleVars(modp); } }; //###################################################################### diff --git a/src/V3Width.cpp b/src/V3Width.cpp index f875fe300..27bb1ed7d 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -2300,7 +2300,7 @@ private: if (nodep->lhsp()) { if (VN_IS(nodep->lhsp()->dtypep(), DynArrayDType) || VN_IS(nodep->lhsp(), ConsDynArray)) { - userIterateAndNext(nodep->lhsp(), WidthVP(vdtypep, FINAL).p()); + userIterateAndNext(nodep->lhsp(), WidthVP{vdtypep, FINAL}.p()); } else { // Sub elements are not queues, but concats, must always pass concats down iterateCheckTyped(nodep, "LHS", nodep->lhsp(), vdtypep->subDTypep(), FINAL); @@ -2309,7 +2309,7 @@ private: if (nodep->rhsp()) { if (VN_IS(nodep->rhsp()->dtypep(), DynArrayDType) || VN_IS(nodep->rhsp(), ConsDynArray)) { - userIterateAndNext(nodep->rhsp(), WidthVP(vdtypep, FINAL).p()); + userIterateAndNext(nodep->rhsp(), WidthVP{vdtypep, FINAL}.p()); } else { iterateCheckTyped(nodep, "RHS", nodep->rhsp(), vdtypep->subDTypep(), FINAL); } @@ -2341,7 +2341,7 @@ private: if (nodep->rhsp()) { if (VN_IS(nodep->rhsp()->dtypep(), QueueDType) || VN_IS(nodep->rhsp(), ConsQueue)) { - userIterateAndNext(nodep->rhsp(), WidthVP(vdtypep, FINAL).p()); + userIterateAndNext(nodep->rhsp(), WidthVP{vdtypep, FINAL}.p()); } else { iterateCheckTyped(nodep, "RHS", nodep->rhsp(), vdtypep->subDTypep(), FINAL); } @@ -2360,7 +2360,7 @@ private: nodep->dtypep(vdtypep); const AstNodeDType* const arrayp = vdtypep->skipRefp(); if (VN_IS(arrayp, NodeArrayDType) || VN_IS(arrayp, AssocArrayDType)) { - userIterateChildren(nodep, WidthVP(arrayp->subDTypep(), BOTH).p()); + userIterateChildren(nodep, WidthVP{arrayp->subDTypep(), BOTH}.p()); } else { UINFO(1, "dtype object " << vdtypep->skipRefp() << endl); nodep->v3fatalSrc("InitArray on non-array"); @@ -2709,7 +2709,7 @@ private: if (AstWith* const withp = VN_CAST(nodep->pinsp(), With)) { withp->indexArgRefp()->dtypep(indexDtp); withp->valueArgRefp()->dtypep(valueDtp); - userIterate(withp, WidthVP(returnDtp, BOTH).p()); + userIterate(withp, WidthVP{returnDtp, BOTH}.p()); withp->unlinkFrBack(); return withp; } else if (required) { @@ -4000,7 +4000,7 @@ private: } AstNodeExpr* patternMemberValueIterate(AstPatMember* patp) { // Determine values - might be another InitArray - userIterate(patp, WidthVP(patp->dtypep(), BOTH).p()); + userIterate(patp, WidthVP{patp->dtypep(), BOTH}.p()); // Convert to InitArray or constify immediately AstNodeExpr* valuep = patp->lhssp()->unlinkFrBack(); if (VN_IS(valuep, Const)) { @@ -4822,7 +4822,7 @@ private: } // Very much like like an assignment, but which side is LH/RHS // depends on pin being a in/output/inout. - userIterateAndNext(nodep->exprp(), WidthVP(nodep->modVarp()->dtypep(), PRELIM).p()); + userIterateAndNext(nodep->exprp(), WidthVP{nodep->modVarp()->dtypep(), PRELIM}.p()); AstNodeDType* modDTypep = nodep->modVarp()->dtypep(); AstNodeDType* conDTypep = nodep->exprp()->dtypep(); if (!modDTypep) nodep->v3fatalSrc("Unlinked pin data type"); @@ -4834,7 +4834,7 @@ private: const int conwidth = conDTypep->width(); if (conDTypep == modDTypep // If match, we're golden || similarDTypeRecurse(conDTypep, modDTypep)) { - userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p()); + userIterateAndNext(nodep->exprp(), WidthVP{subDTypep, FINAL}.p()); } else if (m_cellp->rangep()) { const int numInsts = m_cellp->rangep()->elementsConst(); if (conwidth == modwidth) { @@ -4855,7 +4855,7 @@ private: << " bits. (IEEE 1800-2017 23.3.3)"); subDTypep = conDTypep; // = same expr dtype } - userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p()); + userIterateAndNext(nodep->exprp(), WidthVP{subDTypep, FINAL}.p()); } else { if (nodep->modVarp()->direction() == VDirection::REF) { nodep->v3error("Ref connection " @@ -4955,9 +4955,10 @@ private: const int conwidth = conDTypep->width(); if (conwidth == 1 && modwidth > 1) { // Multiple connections AstNodeDType* const subDTypep = nodep->findLogicDType(1, 1, conDTypep->numeric()); - userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p()); - AstNode* const newp = new AstReplicate(nodep->fileline(), - nodep->exprp()->unlinkFrBack(), numInsts); + userIterateAndNext(nodep->exprp(), WidthVP{subDTypep, FINAL}.p()); + AstNode* const newp + = new AstReplicate{nodep->fileline(), nodep->exprp()->unlinkFrBack(), + static_cast(numInsts)}; nodep->replaceWith(newp); } else { // Eliminating so pass down all of vup @@ -5167,7 +5168,7 @@ private: pinp = newp; } // AstPattern requires assignments to pass datatype on PRELIM - VL_DO_DANGLING(userIterate(pinp, WidthVP(portp->dtypep(), PRELIM).p()), pinp); + VL_DO_DANGLING(userIterate(pinp, WidthVP{portp->dtypep(), PRELIM}.p()), pinp); } } while (false); // Stage 2 @@ -5193,7 +5194,7 @@ private: if (!pinp) continue; // Argument error we'll find later // Do PRELIM again, because above accept may have exited early // due to node replacement - userIterate(pinp, WidthVP(portp->dtypep(), PRELIM).p()); + userIterate(pinp, WidthVP{portp->dtypep(), PRELIM}.p()); } } // Cleanup any open arrays @@ -5223,7 +5224,7 @@ private: } if (!portp->basicp() || portp->basicp()->isOpaque()) { checkClassAssign(nodep, "Function Argument", pinp, portp->dtypep()); - userIterate(pinp, WidthVP(portp->dtypep(), FINAL).p()); + userIterate(pinp, WidthVP{portp->dtypep(), FINAL}.p()); } else { iterateCheckAssign(nodep, "Function Argument", pinp, FINAL, portp->dtypep()); }