Internals: Fix constructor style.

This commit is contained in:
Wilson Snyder 2022-11-21 20:41:32 -05:00
parent 0af02563ca
commit 73d6de4471
7 changed files with 25 additions and 24 deletions

View File

@ -138,7 +138,7 @@ public:
class AstNodeSystemBiop VL_NOT_FINAL : public AstNodeBiop { class AstNodeSystemBiop VL_NOT_FINAL : public AstNodeBiop {
public: public:
AstNodeSystemBiop(VNType t, FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* rhsp) AstNodeSystemBiop(VNType t, FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* rhsp)
: AstNodeBiop(t, fl, lhsp, rhsp) { : AstNodeBiop{t, fl, lhsp, rhsp} {
dtypeSetDouble(); dtypeSetDouble();
} }
ASTGEN_MEMBERS_AstNodeSystemBiop; ASTGEN_MEMBERS_AstNodeSystemBiop;
@ -391,7 +391,7 @@ public:
class AstNodeSystemUniop VL_NOT_FINAL : public AstNodeUniop { class AstNodeSystemUniop VL_NOT_FINAL : public AstNodeUniop {
public: public:
AstNodeSystemUniop(VNType t, FileLine* fl, AstNodeExpr* lhsp) AstNodeSystemUniop(VNType t, FileLine* fl, AstNodeExpr* lhsp)
: AstNodeUniop(t, fl, lhsp) { : AstNodeUniop{t, fl, lhsp} {
dtypeSetDouble(); dtypeSetDouble();
} }
ASTGEN_MEMBERS_AstNodeSystemUniop; ASTGEN_MEMBERS_AstNodeSystemUniop;
@ -825,7 +825,7 @@ public:
class VerilogStringLiteral {}; // for creator type-overload selection class VerilogStringLiteral {}; // for creator type-overload selection
AstConst(FileLine* fl, VerilogStringLiteral, const string& str) AstConst(FileLine* fl, VerilogStringLiteral, const string& str)
: ASTGEN_SUPER_Const(fl) : ASTGEN_SUPER_Const(fl)
, m_num(V3Number::VerilogStringLiteral(), this, str) { , m_num(V3Number::VerilogStringLiteral{}, this, str) {
initWithNumber(); initWithNumber();
} }
AstConst(FileLine* fl, uint32_t num) AstConst(FileLine* fl, uint32_t num)
@ -871,7 +871,7 @@ public:
class String {}; // for creator type-overload selection class String {}; // for creator type-overload selection
AstConst(FileLine* fl, String, const string& num) AstConst(FileLine* fl, String, const string& num)
: ASTGEN_SUPER_Const(fl) : ASTGEN_SUPER_Const(fl)
, m_num(V3Number::String(), this, num) { , m_num(V3Number::String{}, this, num) {
dtypeSetString(); dtypeSetString();
} }
class BitFalse {}; class BitFalse {};

View File

@ -59,7 +59,7 @@ public:
// '+' combines hashes // '+' combines hashes
template <class T> template <class T>
V3Hash operator+(T that) const { 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 // '+=' combines in place

View File

@ -266,7 +266,7 @@ void VTimescale::parseSlashed(FileLine* fl, const char* textp, VTimescale& unitr
unitr = unit; unitr = unit;
if (!precStr.empty()) { if (!precStr.empty()) {
VTimescale prec(VTimescale::NONE); VTimescale prec{VTimescale::NONE};
bool precbad; bool precbad;
prec = VTimescale{precStr, precbad /*ref*/}; prec = VTimescale{precStr, precbad /*ref*/};
if (precbad) { if (precbad) {

View File

@ -53,7 +53,7 @@ private:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
SenTreeFinder() SenTreeFinder()
: SenTreeFinder(v3Global.rootp()) {} : SenTreeFinder{v3Global.rootp()} {}
explicit SenTreeFinder(AstNetlist* netlistp) explicit SenTreeFinder(AstNetlist* netlistp)
: m_topScopep{netlistp->topScopep()} { : m_topScopep{netlistp->topScopep()} {

View File

@ -396,7 +396,7 @@ private:
// If (maxmsb >= selected), we're in bound // If (maxmsb >= selected), we're in bound
AstNodeExpr* condp AstNodeExpr* condp
= new AstGte{nodep->fileline(), = new AstGte{nodep->fileline(),
new AstConst(nodep->fileline(), AstConst::WidthedValue(), new AstConst(nodep->fileline(), AstConst::WidthedValue{},
nodep->lsbp()->width(), maxmsb), nodep->lsbp()->width(), maxmsb),
nodep->lsbp()->cloneTree(false)}; nodep->lsbp()->cloneTree(false)};
// See if the condition is constant true (e.g. always in bound due to constant select) // See if the condition is constant true (e.g. always in bound due to constant select)

View File

@ -195,7 +195,7 @@ class VariableOrder final {
} }
public: public:
static void processModule(AstNodeModule* modp) { VariableOrder().orderModuleVars(modp); } static void processModule(AstNodeModule* modp) { VariableOrder{}.orderModuleVars(modp); }
}; };
//###################################################################### //######################################################################

View File

@ -2300,7 +2300,7 @@ private:
if (nodep->lhsp()) { if (nodep->lhsp()) {
if (VN_IS(nodep->lhsp()->dtypep(), DynArrayDType) if (VN_IS(nodep->lhsp()->dtypep(), DynArrayDType)
|| VN_IS(nodep->lhsp(), ConsDynArray)) { || VN_IS(nodep->lhsp(), ConsDynArray)) {
userIterateAndNext(nodep->lhsp(), WidthVP(vdtypep, FINAL).p()); userIterateAndNext(nodep->lhsp(), WidthVP{vdtypep, FINAL}.p());
} else { } else {
// Sub elements are not queues, but concats, must always pass concats down // Sub elements are not queues, but concats, must always pass concats down
iterateCheckTyped(nodep, "LHS", nodep->lhsp(), vdtypep->subDTypep(), FINAL); iterateCheckTyped(nodep, "LHS", nodep->lhsp(), vdtypep->subDTypep(), FINAL);
@ -2309,7 +2309,7 @@ private:
if (nodep->rhsp()) { if (nodep->rhsp()) {
if (VN_IS(nodep->rhsp()->dtypep(), DynArrayDType) if (VN_IS(nodep->rhsp()->dtypep(), DynArrayDType)
|| VN_IS(nodep->rhsp(), ConsDynArray)) { || VN_IS(nodep->rhsp(), ConsDynArray)) {
userIterateAndNext(nodep->rhsp(), WidthVP(vdtypep, FINAL).p()); userIterateAndNext(nodep->rhsp(), WidthVP{vdtypep, FINAL}.p());
} else { } else {
iterateCheckTyped(nodep, "RHS", nodep->rhsp(), vdtypep->subDTypep(), FINAL); iterateCheckTyped(nodep, "RHS", nodep->rhsp(), vdtypep->subDTypep(), FINAL);
} }
@ -2341,7 +2341,7 @@ private:
if (nodep->rhsp()) { if (nodep->rhsp()) {
if (VN_IS(nodep->rhsp()->dtypep(), QueueDType) if (VN_IS(nodep->rhsp()->dtypep(), QueueDType)
|| VN_IS(nodep->rhsp(), ConsQueue)) { || VN_IS(nodep->rhsp(), ConsQueue)) {
userIterateAndNext(nodep->rhsp(), WidthVP(vdtypep, FINAL).p()); userIterateAndNext(nodep->rhsp(), WidthVP{vdtypep, FINAL}.p());
} else { } else {
iterateCheckTyped(nodep, "RHS", nodep->rhsp(), vdtypep->subDTypep(), FINAL); iterateCheckTyped(nodep, "RHS", nodep->rhsp(), vdtypep->subDTypep(), FINAL);
} }
@ -2360,7 +2360,7 @@ private:
nodep->dtypep(vdtypep); nodep->dtypep(vdtypep);
const AstNodeDType* const arrayp = vdtypep->skipRefp(); const AstNodeDType* const arrayp = vdtypep->skipRefp();
if (VN_IS(arrayp, NodeArrayDType) || VN_IS(arrayp, AssocArrayDType)) { if (VN_IS(arrayp, NodeArrayDType) || VN_IS(arrayp, AssocArrayDType)) {
userIterateChildren(nodep, WidthVP(arrayp->subDTypep(), BOTH).p()); userIterateChildren(nodep, WidthVP{arrayp->subDTypep(), BOTH}.p());
} else { } else {
UINFO(1, "dtype object " << vdtypep->skipRefp() << endl); UINFO(1, "dtype object " << vdtypep->skipRefp() << endl);
nodep->v3fatalSrc("InitArray on non-array"); nodep->v3fatalSrc("InitArray on non-array");
@ -2709,7 +2709,7 @@ private:
if (AstWith* const withp = VN_CAST(nodep->pinsp(), With)) { if (AstWith* const withp = VN_CAST(nodep->pinsp(), With)) {
withp->indexArgRefp()->dtypep(indexDtp); withp->indexArgRefp()->dtypep(indexDtp);
withp->valueArgRefp()->dtypep(valueDtp); withp->valueArgRefp()->dtypep(valueDtp);
userIterate(withp, WidthVP(returnDtp, BOTH).p()); userIterate(withp, WidthVP{returnDtp, BOTH}.p());
withp->unlinkFrBack(); withp->unlinkFrBack();
return withp; return withp;
} else if (required) { } else if (required) {
@ -4000,7 +4000,7 @@ private:
} }
AstNodeExpr* patternMemberValueIterate(AstPatMember* patp) { AstNodeExpr* patternMemberValueIterate(AstPatMember* patp) {
// Determine values - might be another InitArray // 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 // Convert to InitArray or constify immediately
AstNodeExpr* valuep = patp->lhssp()->unlinkFrBack(); AstNodeExpr* valuep = patp->lhssp()->unlinkFrBack();
if (VN_IS(valuep, Const)) { if (VN_IS(valuep, Const)) {
@ -4822,7 +4822,7 @@ private:
} }
// Very much like like an assignment, but which side is LH/RHS // Very much like like an assignment, but which side is LH/RHS
// depends on pin being a in/output/inout. // 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* modDTypep = nodep->modVarp()->dtypep();
AstNodeDType* conDTypep = nodep->exprp()->dtypep(); AstNodeDType* conDTypep = nodep->exprp()->dtypep();
if (!modDTypep) nodep->v3fatalSrc("Unlinked pin data type"); if (!modDTypep) nodep->v3fatalSrc("Unlinked pin data type");
@ -4834,7 +4834,7 @@ private:
const int conwidth = conDTypep->width(); const int conwidth = conDTypep->width();
if (conDTypep == modDTypep // If match, we're golden if (conDTypep == modDTypep // If match, we're golden
|| similarDTypeRecurse(conDTypep, modDTypep)) { || similarDTypeRecurse(conDTypep, modDTypep)) {
userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p()); userIterateAndNext(nodep->exprp(), WidthVP{subDTypep, FINAL}.p());
} else if (m_cellp->rangep()) { } else if (m_cellp->rangep()) {
const int numInsts = m_cellp->rangep()->elementsConst(); const int numInsts = m_cellp->rangep()->elementsConst();
if (conwidth == modwidth) { if (conwidth == modwidth) {
@ -4855,7 +4855,7 @@ private:
<< " bits. (IEEE 1800-2017 23.3.3)"); << " bits. (IEEE 1800-2017 23.3.3)");
subDTypep = conDTypep; // = same expr dtype subDTypep = conDTypep; // = same expr dtype
} }
userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p()); userIterateAndNext(nodep->exprp(), WidthVP{subDTypep, FINAL}.p());
} else { } else {
if (nodep->modVarp()->direction() == VDirection::REF) { if (nodep->modVarp()->direction() == VDirection::REF) {
nodep->v3error("Ref connection " nodep->v3error("Ref connection "
@ -4955,9 +4955,10 @@ private:
const int conwidth = conDTypep->width(); const int conwidth = conDTypep->width();
if (conwidth == 1 && modwidth > 1) { // Multiple connections if (conwidth == 1 && modwidth > 1) { // Multiple connections
AstNodeDType* const subDTypep = nodep->findLogicDType(1, 1, conDTypep->numeric()); AstNodeDType* const subDTypep = nodep->findLogicDType(1, 1, conDTypep->numeric());
userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p()); userIterateAndNext(nodep->exprp(), WidthVP{subDTypep, FINAL}.p());
AstNode* const newp = new AstReplicate(nodep->fileline(), AstNode* const newp
nodep->exprp()->unlinkFrBack(), numInsts); = new AstReplicate{nodep->fileline(), nodep->exprp()->unlinkFrBack(),
static_cast<uint32_t>(numInsts)};
nodep->replaceWith(newp); nodep->replaceWith(newp);
} else { } else {
// Eliminating so pass down all of vup // Eliminating so pass down all of vup
@ -5167,7 +5168,7 @@ private:
pinp = newp; pinp = newp;
} }
// AstPattern requires assignments to pass datatype on PRELIM // 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); } while (false);
// Stage 2 // Stage 2
@ -5193,7 +5194,7 @@ private:
if (!pinp) continue; // Argument error we'll find later if (!pinp) continue; // Argument error we'll find later
// Do PRELIM again, because above accept may have exited early // Do PRELIM again, because above accept may have exited early
// due to node replacement // due to node replacement
userIterate(pinp, WidthVP(portp->dtypep(), PRELIM).p()); userIterate(pinp, WidthVP{portp->dtypep(), PRELIM}.p());
} }
} }
// Cleanup any open arrays // Cleanup any open arrays
@ -5223,7 +5224,7 @@ private:
} }
if (!portp->basicp() || portp->basicp()->isOpaque()) { if (!portp->basicp() || portp->basicp()->isOpaque()) {
checkClassAssign(nodep, "Function Argument", pinp, portp->dtypep()); checkClassAssign(nodep, "Function Argument", pinp, portp->dtypep());
userIterate(pinp, WidthVP(portp->dtypep(), FINAL).p()); userIterate(pinp, WidthVP{portp->dtypep(), FINAL}.p());
} else { } else {
iterateCheckAssign(nodep, "Function Argument", pinp, FINAL, portp->dtypep()); iterateCheckAssign(nodep, "Function Argument", pinp, FINAL, portp->dtypep());
} }