diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 7694e1e69..3bc1325bc 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -927,7 +927,7 @@ AstNode* AstNode::iterateSubtreeReturnEdits(VNVisitor& v) { } else if (!nodep->backp()) { // Calling on standalone tree; insert a shim node so we can keep // track, then delete it on completion - AstBegin* const tempp = new AstBegin(nodep->fileline(), "[EditWrapper]", nodep); + AstBegin* const tempp = new AstBegin{nodep->fileline(), "[EditWrapper]", nodep}; { VL_DO_DANGLING(tempp->stmtsp()->accept(v), nodep); // nodep to null as may be replaced diff --git a/src/V3Ast.h b/src/V3Ast.h index 3e8d474a9..86d4a324f 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -166,7 +166,7 @@ public: : m_e(static_cast(_e)) {} // Need () or GCC 4.8 false warning operator en() const { return m_e; } VAccess invert() const { - return (m_e == READWRITE) ? VAccess(m_e) : (m_e == WRITE ? VAccess(READ) : VAccess(WRITE)); + return (m_e == READWRITE) ? VAccess{m_e} : (m_e == WRITE ? VAccess{READ} : VAccess{WRITE}); } bool isReadOnly() const { return m_e == READ; } // False with READWRITE bool isWriteOnly() const { return m_e == WRITE; } // False with READWRITE @@ -200,7 +200,7 @@ public: inline VSigning(en _e) : m_e{_e} {} static inline VSigning fromBool(bool isSigned) { // Factory method - return isSigned ? VSigning(SIGNED) : VSigning(UNSIGNED); + return isSigned ? VSigning{SIGNED} : VSigning{UNSIGNED}; } explicit inline VSigning(int _e) : m_e(static_cast(_e)) {} // Need () or GCC 4.8 false warning @@ -465,9 +465,9 @@ public: return names[m_e]; } static void selfTest() { - UASSERT(0 == std::strcmp(VBasicDTypeKwd(_ENUM_MAX).ascii(), " MAX"), + UASSERT(0 == std::strcmp(VBasicDTypeKwd{_ENUM_MAX}.ascii(), " MAX"), "SelfTest: Enum mismatch"); - UASSERT(0 == std::strcmp(VBasicDTypeKwd(_ENUM_MAX).dpiType(), " MAX"), + UASSERT(0 == std::strcmp(VBasicDTypeKwd{_ENUM_MAX}.dpiType(), " MAX"), "SelfTest: Enum mismatch"); } inline VBasicDTypeKwd() @@ -1172,7 +1172,7 @@ public: AstNode* toNodep() const { return to(); } V3GraphVertex* toGraphVertex() const { return to(); } int toInt() const { return m_u.ui; } - static VNUser fromInt(int i) { return VNUser(i); } + static VNUser fromInt(int i) { return VNUser{i}; } }; //###################################################################### @@ -1438,15 +1438,15 @@ class AstNode VL_NOT_FINAL { static int s_cloneCntGbl; // Count of which userp is set // This member ordering both allows 64 bit alignment and puts associated data together - VNUser m_user1u = VNUser{0}; // Contains any information the user iteration routine wants + VNUser m_user1u{0}; // Contains any information the user iteration routine wants uint32_t m_user1Cnt = 0; // Mark of when userp was set uint32_t m_user2Cnt = 0; // Mark of when userp was set - VNUser m_user2u = VNUser{0}; // Contains any information the user iteration routine wants - VNUser m_user3u = VNUser{0}; // Contains any information the user iteration routine wants + VNUser m_user2u{0}; // Contains any information the user iteration routine wants + VNUser m_user3u{0}; // Contains any information the user iteration routine wants uint32_t m_user3Cnt = 0; // Mark of when userp was set uint32_t m_user4Cnt = 0; // Mark of when userp was set - VNUser m_user4u = VNUser{0}; // Contains any information the user iteration routine wants - VNUser m_user5u = VNUser{0}; // Contains any information the user iteration routine wants + VNUser m_user4u{0}; // Contains any information the user iteration routine wants + VNUser m_user5u{0}; // Contains any information the user iteration routine wants uint32_t m_user5Cnt = 0; // Mark of when userp was set // METHODS @@ -1638,13 +1638,13 @@ public: VNUser user1u() const { // Slows things down measurably, so disabled by default //UASSERT_STATIC(VNUser1InUse::s_userBusy, "userp set w/o busy"); - return ((m_user1Cnt==VNUser1InUse::s_userCntGbl) ? m_user1u : VNUser(0)); + return ((m_user1Cnt==VNUser1InUse::s_userCntGbl) ? m_user1u : VNUser{0}); } AstNode* user1p() const { return user1u().toNodep(); } void user1u(const VNUser& user) { m_user1u=user; m_user1Cnt=VNUser1InUse::s_userCntGbl; } - void user1p(void* userp) { user1u(VNUser(userp)); } + void user1p(void* userp) { user1u(VNUser{userp}); } int user1() const { return user1u().toInt(); } - void user1(int val) { user1u(VNUser(val)); } + void user1(int val) { user1u(VNUser{val}); } int user1Inc(int val=1) { int v=user1(); user1(v+val); return v; } int user1SetOnce() { int v=user1(); if (!v) user1(1); return v; } // Better for cache than user1Inc() static void user1ClearTree() { VNUser1InUse::clear(); } // Clear userp()'s across the entire tree @@ -1652,13 +1652,13 @@ public: VNUser user2u() const { // Slows things down measurably, so disabled by default //UASSERT_STATIC(VNUser2InUse::s_userBusy, "userp set w/o busy"); - return ((m_user2Cnt==VNUser2InUse::s_userCntGbl) ? m_user2u : VNUser(0)); + return ((m_user2Cnt==VNUser2InUse::s_userCntGbl) ? m_user2u : VNUser{0}); } AstNode* user2p() const { return user2u().toNodep(); } void user2u(const VNUser& user) { m_user2u=user; m_user2Cnt=VNUser2InUse::s_userCntGbl; } - void user2p(void* userp) { user2u(VNUser(userp)); } + void user2p(void* userp) { user2u(VNUser{userp}); } int user2() const { return user2u().toInt(); } - void user2(int val) { user2u(VNUser(val)); } + void user2(int val) { user2u(VNUser{val}); } int user2Inc(int val=1) { int v=user2(); user2(v+val); return v; } int user2SetOnce() { int v=user2(); if (!v) user2(1); return v; } // Better for cache than user2Inc() static void user2ClearTree() { VNUser2InUse::clear(); } // Clear userp()'s across the entire tree @@ -1666,13 +1666,13 @@ public: VNUser user3u() const { // Slows things down measurably, so disabled by default //UASSERT_STATIC(VNUser3InUse::s_userBusy, "userp set w/o busy"); - return ((m_user3Cnt==VNUser3InUse::s_userCntGbl) ? m_user3u : VNUser(0)); + return ((m_user3Cnt==VNUser3InUse::s_userCntGbl) ? m_user3u : VNUser{0}); } AstNode* user3p() const { return user3u().toNodep(); } void user3u(const VNUser& user) { m_user3u=user; m_user3Cnt=VNUser3InUse::s_userCntGbl; } - void user3p(void* userp) { user3u(VNUser(userp)); } + void user3p(void* userp) { user3u(VNUser{userp}); } int user3() const { return user3u().toInt(); } - void user3(int val) { user3u(VNUser(val)); } + void user3(int val) { user3u(VNUser{val}); } int user3Inc(int val=1) { int v=user3(); user3(v+val); return v; } int user3SetOnce() { int v=user3(); if (!v) user3(1); return v; } // Better for cache than user3Inc() static void user3ClearTree() { VNUser3InUse::clear(); } // Clear userp()'s across the entire tree @@ -1680,13 +1680,13 @@ public: VNUser user4u() const { // Slows things down measurably, so disabled by default //UASSERT_STATIC(VNUser4InUse::s_userBusy, "userp set w/o busy"); - return ((m_user4Cnt==VNUser4InUse::s_userCntGbl) ? m_user4u : VNUser(0)); + return ((m_user4Cnt==VNUser4InUse::s_userCntGbl) ? m_user4u : VNUser{0}); } AstNode* user4p() const { return user4u().toNodep(); } void user4u(const VNUser& user) { m_user4u=user; m_user4Cnt=VNUser4InUse::s_userCntGbl; } - void user4p(void* userp) { user4u(VNUser(userp)); } + void user4p(void* userp) { user4u(VNUser{userp}); } int user4() const { return user4u().toInt(); } - void user4(int val) { user4u(VNUser(val)); } + void user4(int val) { user4u(VNUser{val}); } int user4Inc(int val=1) { int v=user4(); user4(v+val); return v; } int user4SetOnce() { int v=user4(); if (!v) user4(1); return v; } // Better for cache than user4Inc() static void user4ClearTree() { VNUser4InUse::clear(); } // Clear userp()'s across the entire tree @@ -1694,13 +1694,13 @@ public: VNUser user5u() const { // Slows things down measurably, so disabled by default //UASSERT_STATIC(VNUser5InUse::s_userBusy, "userp set w/o busy"); - return ((m_user5Cnt==VNUser5InUse::s_userCntGbl) ? m_user5u : VNUser(0)); + return ((m_user5Cnt==VNUser5InUse::s_userCntGbl) ? m_user5u : VNUser{0}); } AstNode* user5p() const { return user5u().toNodep(); } void user5u(const VNUser& user) { m_user5u=user; m_user5Cnt=VNUser5InUse::s_userCntGbl; } - void user5p(void* userp) { user5u(VNUser(userp)); } + void user5p(void* userp) { user5u(VNUser{userp}); } int user5() const { return user5u().toInt(); } - void user5(int val) { user5u(VNUser(val)); } + void user5(int val) { user5u(VNUser{val}); } int user5Inc(int val=1) { int v=user5(); user5(v+val); return v; } int user5SetOnce() { int v=user5(); if (!v) user5(1); return v; } // Better for cache than user5Inc() static void user5ClearTree() { VNUser5InUse::clear(); } // Clear userp()'s across the entire tree @@ -2406,7 +2406,7 @@ inline AstNode* VNVisitor::iterateSubtreeReturnEdits(AstNode* nodep) { #define ASTNODE_NODE_FUNCS_NO_DTOR(name) \ virtual void accept(VNVisitor& v) override { v.visit(this); } \ - virtual AstNode* clone() override { return new Ast##name(*this); } \ + virtual AstNode* clone() override { return new Ast##name{*this}; } \ static Ast##name* cloneTreeNull(Ast##name* nodep, bool cloneNextLink) { \ return nodep ? nodep->cloneTree(cloneNextLink) : nullptr; \ } \ diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index e942e7c00..aa35e36a2 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -191,7 +191,7 @@ private: string m_name; ///< Filename public: AstNodeFile(VNType t, FileLine* fl, const string& name) - : AstNode(t, fl) + : AstNode{t, fl} , m_name{name} {} ASTNODE_BASE_FUNCS(NodeFile) virtual void dump(std::ostream& str) const override; diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 3ed73a6a7..bf1cac868 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1872,7 +1872,7 @@ void AstTypeTable::dump(std::ostream& str) const { for (int i = 0; i < static_cast(VBasicDTypeKwd::_ENUM_MAX); ++i) { if (AstBasicDType* const subnodep = m_basicps[i]) { str << '\n'; // Newline from caller, so newline first - str << "\t\t" << std::setw(8) << VBasicDTypeKwd(i).ascii(); + str << "\t\t" << std::setw(8) << VBasicDTypeKwd{i}.ascii(); str << " -> "; subnodep->dump(str); } diff --git a/src/V3AstUserAllocator.h b/src/V3AstUserAllocator.h index 76ec4fc5d..478c31dfa 100644 --- a/src/V3AstUserAllocator.h +++ b/src/V3AstUserAllocator.h @@ -56,15 +56,15 @@ private: inline void setUserp(T_Node* nodep, T_Data* userp) const { if VL_CONSTEXPR_CXX17 (T_UserN == 1) { - nodep->user1u(VNUser(userp)); + nodep->user1u(VNUser{userp}); } else if VL_CONSTEXPR_CXX17 (T_UserN == 2) { - nodep->user2u(VNUser(userp)); + nodep->user2u(VNUser{userp}); } else if VL_CONSTEXPR_CXX17 (T_UserN == 3) { - nodep->user3u(VNUser(userp)); + nodep->user3u(VNUser{userp}); } else if VL_CONSTEXPR_CXX17 (T_UserN == 4) { - nodep->user4u(VNUser(userp)); + nodep->user4u(VNUser{userp}); } else { - nodep->user5u(VNUser(userp)); + nodep->user5u(VNUser{userp}); } } diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index d94728f35..f750d2059 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -100,7 +100,7 @@ private: const string newvarname = (string("__Vclklast__") + vscp->scopep()->nameDotless() + "__" + varp->name()); AstVar* const newvarp = new AstVar(vscp->fileline(), VVarType::MODULETEMP, newvarname, - VFlagLogicPacked(), 1); + VFlagLogicPacked{}, 1); newvarp->noReset(true); // Reset by below assign m_modp->addStmtp(newvarp); AstVarScope* const newvscp = new AstVarScope(vscp->fileline(), m_scopep, newvarp); diff --git a/src/V3Error.cpp b/src/V3Error.cpp index be30eae9b..4912e67b4 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -54,7 +54,7 @@ v3errorIniter v3errorInit; V3ErrorCode::V3ErrorCode(const char* msgp) { // Return error encoding for given string, or ERROR, which is a bad code for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { - const V3ErrorCode code = V3ErrorCode(codei); + const V3ErrorCode code{codei}; if (0 == VL_STRCASECMP(msgp, code.ascii())) { m_e = code; return; @@ -69,9 +69,9 @@ V3ErrorCode::V3ErrorCode(const char* msgp) { void V3Error::init() { for (int i = 0; i < V3ErrorCode::_ENUM_MAX; i++) { s_describedEachWarn[i] = false; - s_pretendError[i] = V3ErrorCode(i).pretendError(); + s_pretendError[i] = V3ErrorCode{i}.pretendError(); } - if (VL_UNCOVERABLE(string(V3ErrorCode(V3ErrorCode::_ENUM_MAX).ascii()) != " MAX")) { + if (VL_UNCOVERABLE(string(V3ErrorCode{V3ErrorCode::_ENUM_MAX}.ascii()) != " MAX")) { v3fatalSrc("Enum table in V3ErrorCode::EC_ascii() is munged"); } } diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index 0d9705c82..93940bac6 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -149,7 +149,7 @@ FileLine::FileLine(FileLine::EmptySecret) { m_warnOn = 0; for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { - const V3ErrorCode code = V3ErrorCode(codei); + const V3ErrorCode code{codei}; warnOff(code, code.defaultsOff()); } } @@ -309,14 +309,14 @@ bool FileLine::warnOff(const string& msg, bool flag) { void FileLine::warnLintOff(bool flag) { for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { - const V3ErrorCode code = V3ErrorCode(codei); + const V3ErrorCode code{codei}; if (code.lintError()) warnOff(code, flag); } } void FileLine::warnStyleOff(bool flag) { for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { - const V3ErrorCode code = V3ErrorCode(codei); + const V3ErrorCode code{codei}; if (code.styleError()) warnOff(code, flag); } } @@ -335,7 +335,7 @@ bool FileLine::warnIsOff(V3ErrorCode code) const { void FileLine::modifyStateInherit(const FileLine* fromp) { // Any warnings that are off in "from", become off in "this". for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { - const V3ErrorCode code = V3ErrorCode(codei); + const V3ErrorCode code{codei}; if (fromp->warnIsOff(code)) warnOff(code, true); } } diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index e4b2e8853..f7c9ed428 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -62,8 +62,8 @@ public: explicit GateGraphBaseVisitor(V3Graph* graphp) : m_graphp{graphp} {} virtual ~GateGraphBaseVisitor() = default; - virtual VNUser visit(GateLogicVertex* vertexp, VNUser vu = VNUser(0)) = 0; - virtual VNUser visit(GateVarVertex* vertexp, VNUser vu = VNUser(0)) = 0; + virtual VNUser visit(GateLogicVertex* vertexp, VNUser vu = VNUser{0}) = 0; + virtual VNUser visit(GateVarVertex* vertexp, VNUser vu = VNUser{0}) = 0; VL_DEBUG_FUNC; // Declare debug() }; @@ -102,10 +102,10 @@ public: clearReducible(nonReducibleReason); clearDedupable(nonReducibleReason); } - virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) = 0; + virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) = 0; // Returns only the result from the LAST vertex iterated over - VNUser iterateInEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) { - VNUser ret = VNUser(0); + VNUser iterateInEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) { + VNUser ret{0}; for (V3GraphEdge* edgep = inBeginp(); edgep; edgep = edgep->inNextp()) { ret = static_cast(edgep->fromp())->accept(v, vu); } @@ -115,8 +115,8 @@ public: // Note: This behaves differently than iterateInEdges() in that it will traverse // all edges that exist when it is initially called, whereas // iterateInEdges() will stop traversing edges if one is deleted - VNUser iterateCurrentOutEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) { - VNUser ret = VNUser(0); + VNUser iterateCurrentOutEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) { + VNUser ret{0}; V3GraphEdge* next_edgep = nullptr; for (V3GraphEdge* edgep = outBeginp(); edgep; edgep = next_edgep) { // Need to find the next edge before visiting in case the edge is deleted @@ -162,7 +162,7 @@ public: setIsClock(); } } - virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) override { + virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override { return v.visit(this, vu); } }; @@ -188,7 +188,7 @@ public: AstNode* nodep() const { return m_nodep; } AstActive* activep() const { return m_activep; } bool slow() const { return m_slow; } - virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) override { + virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override { return v.visit(this, vu); } }; @@ -1046,14 +1046,14 @@ private: virtual VNUser visit(GateVarVertex* vvertexp, VNUser) override { // Check that we haven't been here before if (m_depth > GATE_DEDUP_MAX_DEPTH) - return VNUser(0); // Break loops; before user2 set so hit this vertex later - if (vvertexp->varScp()->user2()) return VNUser(0); + return VNUser{0}; // Break loops; before user2 set so hit this vertex later + if (vvertexp->varScp()->user2()) return VNUser{0}; vvertexp->varScp()->user2(true); m_depth++; if (vvertexp->inSize1()) { AstNodeVarRef* const dupVarRefp = static_cast( - vvertexp->iterateInEdges(*this, VNUser(vvertexp)).toNodep()); + vvertexp->iterateInEdges(*this, VNUser{vvertexp}).toNodep()); if (dupVarRefp) { // visit(GateLogicVertex*...) returned match const V3GraphEdge* edgep = vvertexp->inBeginp(); GateLogicVertex* const lvertexp = static_cast(edgep->fromp()); @@ -1100,7 +1100,7 @@ private: } } m_depth--; - return VNUser(0); + return VNUser{0}; } // Given iterated logic, starting at vu which was consumer's GateVarVertex @@ -1118,9 +1118,9 @@ private: // different generated clocks will never compare as equal, even if the // generated clocks are deduped into one clock. AstActive* const activep = lvertexp->activep(); - return VNUser(m_varVisitor.findDupe(nodep, consumerVarScopep, activep)); + return VNUser{m_varVisitor.findDupe(nodep, consumerVarScopep, activep)}; } - return VNUser(0); + return VNUser{0}; } public: @@ -1257,10 +1257,10 @@ private: } } } - return VNUser(0); + return VNUser{0}; } virtual VNUser visit(GateLogicVertex*, VNUser) override { // - return VNUser(0); + return VNUser{0}; } public: @@ -1363,7 +1363,7 @@ private: virtual VNUser visit(GateVarVertex* vvertexp, VNUser vu) override { // Check that we haven't been here before AstVarScope* const vsp = vvertexp->varScp(); - if (vsp->user2SetOnce()) return VNUser(0); + if (vsp->user2SetOnce()) return VNUser{0}; UINFO(9, "CLK DECOMP Var - " << vvertexp << " : " << vsp << endl); if (vsp->varp()->width() > 1) { m_seen_clk_vectors++; @@ -1371,10 +1371,10 @@ private: } const GateClkDecompState* const currState = reinterpret_cast(vu.c()); GateClkDecompState nextState(currState->m_offset, vsp); - vvertexp->iterateCurrentOutEdges(*this, VNUser(&nextState)); + vvertexp->iterateCurrentOutEdges(*this, VNUser{&nextState}); if (vsp->varp()->width() > 1) --m_seen_clk_vectors; vsp->user2(false); - return VNUser(0); // Unused + return VNUser{0}; // Unused } virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) override { @@ -1390,37 +1390,37 @@ private: UINFO(9, "CLK DECOMP Sel [ " << rselp->msbConst() << " : " << rselp->lsbConst() << " ] dropped clock (" << clk_offset << ")" << endl); - return VNUser(0); + return VNUser{0}; } clk_offset -= rselp->lsbConst(); } else { - return VNUser(0); + return VNUser{0}; } } else if (AstConcat* const catp = VN_CAST(assignp->rhsp(), Concat)) { UINFO(9, "CLK DECOMP Concat searching - " << assignp->lhsp() << endl); int concat_offset; if (!m_concat_visitor.concatOffset(catp, currState->m_last_vsp, concat_offset /*ref*/)) { - return VNUser(0); + return VNUser{0}; } clk_offset += concat_offset; } else if (VN_IS(assignp->rhsp(), VarRef)) { UINFO(9, "CLK DECOMP VarRef searching - " << assignp->lhsp() << endl); } else { - return VNUser(0); + return VNUser{0}; } // LHS if (const AstSel* const lselp = VN_CAST(assignp->lhsp(), Sel)) { if (VN_IS(lselp->lsbp(), Const) && VN_IS(lselp->widthp(), Const)) { clk_offset += lselp->lsbConst(); } else { - return VNUser(0); + return VNUser{0}; } } else if (const AstVarRef* const vrp = VN_CAST(assignp->lhsp(), VarRef)) { if (vrp->dtypep()->width() == 1 && m_seen_clk_vectors) { if (clk_offset != 0) { UINFO(9, "Should only make it here with clk_offset = 0" << endl); - return VNUser(0); + return VNUser{0}; } UINFO(9, "CLK DECOMP Connecting - " << assignp->lhsp() << endl); UINFO(9, " to - " << m_clk_vsp << endl); @@ -1433,12 +1433,12 @@ private: m_total_decomposed_clk_vectors++; } } else { - return VNUser(0); + return VNUser{0}; } GateClkDecompState nextState(clk_offset, currState->m_last_vsp); - return lvertexp->iterateCurrentOutEdges(*this, VNUser(&nextState)); + return lvertexp->iterateCurrentOutEdges(*this, VNUser{&nextState}); } - return VNUser(0); + return VNUser{0}; } public: @@ -1455,7 +1455,7 @@ public: m_clk_vsp = vvertexp->varScp(); m_clk_vvertexp = vvertexp; GateClkDecompState nextState(0, m_clk_vsp); - vvertexp->accept(*this, VNUser(&nextState)); + vvertexp->accept(*this, VNUser{&nextState}); } }; diff --git a/src/V3LangCode.h b/src/V3LangCode.h index 3877dcf3d..0565a948d 100644 --- a/src/V3LangCode.h +++ b/src/V3LangCode.h @@ -48,7 +48,7 @@ public: "1800-2005", "1800-2009", "1800-2012", "1800-2017"}; return names[m_e]; } - static V3LangCode mostRecent() { return V3LangCode(L1800_2017); } + static V3LangCode mostRecent() { return V3LangCode{L1800_2017}; } bool systemVerilog() const { return m_e == L1800_2005 || m_e == L1800_2009 || m_e == L1800_2012 || m_e == L1800_2017; } diff --git a/src/V3Life.cpp b/src/V3Life.cpp index 112c3920e..482a4d301 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -165,7 +165,7 @@ public: checkRemoveAssign(it); it->second.simpleAssign(assp); } else { - m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::SIMPLEASSIGN(), assp)); + m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::SIMPLEASSIGN{}, assp}); } // lifeDump(); } @@ -175,7 +175,7 @@ public: if (it != m_map.end()) { it->second.complexAssign(); } else { - m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::COMPLEXASSIGN())); + m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::COMPLEXASSIGN{}}); } } void varUsageReplace(AstVarScope* nodep, AstVarRef* varrefp) { @@ -196,7 +196,7 @@ public: UINFO(4, " usage: " << nodep << endl); it->second.consumed(); } else { - m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::CONSUMED())); + m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::CONSUMED{}}); } } void complexAssignFind(AstVarScope* nodep) { @@ -205,7 +205,7 @@ public: UINFO(4, " casfind: " << it->first << endl); it->second.complexAssign(); } else { - m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::COMPLEXASSIGN())); + m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::COMPLEXASSIGN{}}); } } void consumedFind(AstVarScope* nodep) { @@ -213,7 +213,7 @@ public: if (it != m_map.end()) { it->second.consumed(); } else { - m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::CONSUMED())); + m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::CONSUMED{}}); } } void lifeToAbove() { diff --git a/src/V3LifePost.cpp b/src/V3LifePost.cpp index 51b2e0e2c..da18dec1b 100644 --- a/src/V3LifePost.cpp +++ b/src/V3LifePost.cpp @@ -59,7 +59,7 @@ private: UASSERT_OBJ(vscp, nodep, "Scope not assigned"); if (AstVarScope* const newvscp = reinterpret_cast(vscp->user4p())) { UINFO(9, " Replace " << nodep << " to " << newvscp << endl); - AstVarRef* const newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->access()); + AstVarRef* const newrefp = new AstVarRef{nodep->fileline(), newvscp, nodep->access()}; nodep->replaceWith(newrefp); VL_DO_DANGLING(nodep->deleteTree(), nodep); } diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 493beaf4d..6a85a0ff4 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -1024,7 +1024,7 @@ class LinkDotFindVisitor final : public VNVisitor { } AstVar* const newvarp = new AstVar(nodep->fileline(), VVarType::VAR, nodep->name(), - VFlagChildDType(), dtypep); // Not dtype resolved yet + VFlagChildDType{}, dtypep); // Not dtype resolved yet newvarp->direction(VDirection::OUTPUT); newvarp->lifetime(VLifetime::AUTOMATIC); newvarp->funcReturn(true); @@ -1139,8 +1139,8 @@ class LinkDotFindVisitor final : public VNVisitor { // We first search if the parameter is overwritten and then replace it with a // new value. It will keep the same FileLine information. if (v3Global.opt.hasParameter(nodep->name())) { - AstVar* const newp = new AstVar( - nodep->fileline(), VVarType(VVarType::GPARAM), nodep->name(), nodep); + AstVar* const newp = new AstVar{ + nodep->fileline(), VVarType{VVarType::GPARAM}, nodep->name(), nodep}; newp->combineType(nodep); const string svalue = v3Global.opt.parameter(nodep->name()); if (AstNode* const valuep @@ -1935,7 +1935,7 @@ private: } } AstVar* const newp = new AstVar(nodep->fileline(), VVarType::WIRE, nodep->name(), - VFlagLogicPacked(), 1); + VFlagLogicPacked{}, 1); newp->trace(modp->modTrace()); nodep->varp(newp); modp->addStmtp(newp); @@ -2509,7 +2509,7 @@ private: UINFO(7, " ErrParseRef curSymp=se" << cvtToHex(m_curSymp) << " ds=" << m_ds.ascii() << endl); const string suggest = m_statep->suggestSymFallback( - m_ds.m_dotSymp, nodep->name(), VNodeMatcher()); + m_ds.m_dotSymp, nodep->name(), VNodeMatcher{}); nodep->v3error("Can't find definition of " << expectWhat << ": " << nodep->prettyNameQ() << '\n' << (suggest.empty() ? "" : nodep->warnMore() + suggest)); diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index b9ecca249..3e9130ed3 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -94,7 +94,7 @@ void V3LinkLevel::timescaling(const ModVec& mods) { } } unit = v3Global.opt.timeComputeUnit(unit); // Apply override - if (unit.isNone()) unit = VTimescale(VTimescale::TS_DEFAULT); + if (unit.isNone()) unit = VTimescale{VTimescale::TS_DEFAULT}; v3Global.rootp()->timeunit(unit); bool dunitTimed = false; // $unit had a timeunit @@ -127,7 +127,7 @@ void V3LinkLevel::timescaling(const ModVec& mods) { if (v3Global.rootp()->timeprecision().isNone()) { v3Global.rootp()->timeprecisionMerge(v3Global.rootp()->fileline(), - VTimescale(VTimescale::TS_DEFAULT)); + VTimescale{VTimescale::TS_DEFAULT}); } // Classes under package have timescale propaged in V3LinkParse diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 2acc01f3e..af7185f60 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -73,7 +73,7 @@ private: // We could have verilog.l create a new one on every token, // but that's a lot more structures than only doing AST nodes. if (m_filelines.find(nodep->fileline()) != m_filelines.end()) { - nodep->fileline(new FileLine(nodep->fileline())); + nodep->fileline(new FileLine{nodep->fileline()}); } m_filelines.insert(nodep->fileline()); } diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 6836b5167..10d83bd1b 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -113,7 +113,7 @@ public: V3LangCode::V3LangCode(const char* textp) { // Return code for given string, or ERROR, which is a bad code for (int codei = V3LangCode::L_ERROR; codei < V3LangCode::_ENUM_END; ++codei) { - const V3LangCode code = V3LangCode(codei); + const V3LangCode code{codei}; if (0 == VL_STRCASECMP(textp, code.ascii())) { m_e = code; return; @@ -265,7 +265,7 @@ void VTimescale::parseSlashed(FileLine* fl, const char* textp, VTimescale& unitr if (!precStr.empty()) { VTimescale prec(VTimescale::NONE); bool precbad; - prec = VTimescale(precStr, precbad /*ref*/); + prec = VTimescale{precStr, precbad /*ref*/}; if (precbad) { fl->v3error("`timescale timeprecision syntax error: '" << precStr << "'"); return; @@ -1164,7 +1164,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char DECL_OPTION("-LDFLAGS", CbVal, callStrSetter(&V3Options::addLdLibs)); const auto setLang = [this, fl](const char* valp) { - const V3LangCode optval = V3LangCode(valp); + const V3LangCode optval{valp}; if (optval.legal()) { m_defaultLanguage = optval; } else { diff --git a/src/V3Order.cpp b/src/V3Order.cpp index 9c20558e4..74e4aaf0a 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -1335,9 +1335,10 @@ class OrderProcess final : VNDeleter { ~OrderProcess() override { // Stats for (int type = 0; type < OrderVEdgeType::_ENUM_END; type++) { - const double count = double(m_statCut[type]); + const double count{m_statCut[type]}; if (count != 0.0) { - V3Stats::addStat(string("Order, cut, ") + OrderVEdgeType(type).ascii(), count); + V3Stats::addStat(std::string{"Order, cut, "} + OrderVEdgeType{type}.ascii(), + count); } } } diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index 1d2832ce5..37da5a1fc 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -89,19 +89,19 @@ void V3ParseImp::lexTimescaleParse(FileLine* fl, const char* textp) { } void V3ParseImp::timescaleMod(FileLine* fl, AstNodeModule* modp, bool unitSet, double unitVal, bool precSet, double precVal) { - VTimescale unit(VTimescale::NONE); + VTimescale unit{VTimescale::NONE}; if (unitSet) { bool bad; - unit = VTimescale(unitVal, bad /*ref*/); + unit = VTimescale{unitVal, bad /*ref*/}; if (bad) { UINFO(1, "Value = " << unitVal << endl); fl->v3error("timeunit illegal value"); } } - VTimescale prec(VTimescale::NONE); + VTimescale prec{VTimescale::NONE}; if (precSet) { bool bad; - prec = VTimescale(precVal, bad /*ref*/); + prec = VTimescale{precVal, bad /*ref*/}; if (bad) { UINFO(1, "Value = " << precVal << endl); fl->v3error("timeprecision illegal value"); diff --git a/src/V3Simulate.h b/src/V3Simulate.h index 0c9c6f43f..17f22e127 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -625,8 +625,8 @@ private: iterate(nodep->lhsp()); if (optimizable()) { if (fetchConst(nodep->lhsp())->num().isEqZero()) { - const AstConst cnst(nodep->fileline(), AstConst::WidthedValue(), 1, - 1); // a one + const AstConst cnst{nodep->fileline(), AstConst::WidthedValue{}, 1, + 1}; // a one newValue(nodep, &cnst); // a one } else { iterate(nodep->rhsp()); @@ -1022,8 +1022,8 @@ private: m_callStack.push_back(&stackNode); // Clear output variable if (const auto* const basicp = VN_CAST(funcp->fvarp(), Var)->basicp()) { - AstConst cnst(funcp->fvarp()->fileline(), AstConst::WidthedValue(), basicp->widthMin(), - 0); + AstConst cnst{funcp->fvarp()->fileline(), AstConst::WidthedValue{}, basicp->widthMin(), + 0}; if (basicp->isZeroInit()) { cnst.num().setAllBits0(); } else { diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 97d2514b8..11512254d 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -231,7 +231,7 @@ public: V3Stats::addStat(m_stage, "Var space, scoped, bytes", m_statVarScpBytes); } for (unsigned i = 0; i < m_statVarWidths.size(); i++) { - const double count = double(m_statVarWidths.at(i)); + const double count{m_statVarWidths.at(i)}; if (count != 0.0) { if (v3Global.opt.statsVars()) { const NameMap& nameMapr = m_statVarWidthNames.at(i); @@ -249,7 +249,7 @@ public: } // Node types for (int type = 0; type < VNType::_ENUM_END; type++) { - const double count = double(m_statTypeCount.at(type)); + const double count{m_statTypeCount.at(type)}; if (count != 0.0) { V3Stats::addStat(m_stage, std::string{"Node count, "} + VNType{type}.ascii(), count); @@ -257,18 +257,18 @@ public: } for (int type = 0; type < VNType::_ENUM_END; type++) { for (int type2 = 0; type2 < VNType::_ENUM_END; type2++) { - const double count = double(m_statAbove[type][type2]); + const double count{m_statAbove[type][type2]}; if (count != 0.0) { V3Stats::addStat(m_stage, (std::string{"Node pairs, "} + VNType{type}.ascii() + "_" - + VNType(type2).ascii()), + + VNType{type2}.ascii()), count); } } } // Branch pred for (int type = 0; type < VBranchPred::_ENUM_END; type++) { - const double count = double(m_statPred[type]); + const double count{m_statPred[type]}; if (count != 0.0) { V3Stats::addStat(m_stage, (std::string{"Branch prediction, "} + VBranchPred{type}.ascii()), diff --git a/src/V3Table.cpp b/src/V3Table.cpp index e1f6cc2f0..8829e9cbf 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -298,8 +298,8 @@ private: uint32_t shift = 0; for (AstVarScope* invscp : m_inVarps) { // LSB is first variable, so extract it that way - const AstConst cnst(invscp->fileline(), AstConst::WidthedValue(), invscp->width(), - VL_MASK_I(invscp->width()) & (inValue >> shift)); + const AstConst cnst{invscp->fileline(), AstConst::WidthedValue{}, invscp->width(), + VL_MASK_I(invscp->width()) & (inValue >> shift)}; simvis.newValue(invscp, &cnst); shift += invscp->width(); // We are using 32 bit arithmetic, because there's no way the input table can be diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 4a596e434..8268ec487 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -392,7 +392,7 @@ private: // Everything downstream is packed, so deal with as one trace unit. // This may not be the nicest for user presentation, but is // a much faster way to trace - addTraceDecl(VNumRange(), nodep->width()); + addTraceDecl(VNumRange{}, nodep->width()); } else { FileLine* const flp = nodep->fileline(); AstNodeDType* const subtypep = nodep->subDTypep()->skipRefToEnump(); @@ -418,7 +418,7 @@ private: // Everything downstream is packed, so deal with as one trace unit // This may not be the nicest for user presentation, but is // a much faster way to trace - addTraceDecl(VNumRange(), nodep->width()); + addTraceDecl(VNumRange{}, nodep->width()); } else if (!nodep->packed()) { addIgnore("Unsupported: Unpacked struct/union"); } else { @@ -454,7 +454,7 @@ private: if (nodep->isString()) { addIgnore("Unsupported: strings"); } else { - addTraceDecl(VNumRange(), 0); + addTraceDecl(VNumRange{}, 0); } } } diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 12f011366..5d027a135 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -331,8 +331,8 @@ private: // We use the special XTEMP type so it doesn't break pure functions UASSERT_OBJ(m_modp, nodep, "X number not under module"); AstVar* const newvarp - = new AstVar(nodep->fileline(), VVarType::XTEMP, m_xrandNames.get(nodep), - VFlagLogicPacked(), nodep->width()); + = new AstVar{nodep->fileline(), VVarType::XTEMP, m_xrandNames.get(nodep), + VFlagLogicPacked{}, nodep->width()}; newvarp->lifetime(VLifetime::STATIC); ++m_statUnkVars; VNRelinker replaceHandle; @@ -454,7 +454,7 @@ private: nodep->unlinkFrBack(&replaceHandle); V3Number xnum(nodep, nodep->width()); if (nodep->isString()) { - xnum = V3Number(V3Number::String(), nodep, ""); + xnum = V3Number{V3Number::String{}, nodep, ""}; } else { xnum.setAllBitsX(); } diff --git a/src/V3Width.cpp b/src/V3Width.cpp index a784b3024..6a303ee0b 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -6282,7 +6282,7 @@ private: VNumRange declRange; // ranged() set false for (int i = 1; i <= dim; ++i) { // UINFO(9, " dim at "<declRange(); if (i < dim) dtypep = adtypep->subDTypep()->skipRefp(); diff --git a/src/V3WidthSel.cpp b/src/V3WidthSel.cpp index d958f6d52..19392df58 100644 --- a/src/V3WidthSel.cpp +++ b/src/V3WidthSel.cpp @@ -524,8 +524,8 @@ private: // up array: lsb/hi -: width const int32_t msb = VN_IS(nodep, SelPlus) ? rhs + width - 1 : rhs; const int32_t lsb = VN_IS(nodep, SelPlus) ? rhs : rhs - width + 1; - AstSliceSel* const newp = new AstSliceSel( - nodep->fileline(), fromp, VNumRange(msb, lsb, fromRange.littleEndian())); + AstSliceSel* const newp = new AstSliceSel{ + nodep->fileline(), fromp, VNumRange{msb, lsb, fromRange.littleEndian()}}; nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else { diff --git a/src/verilog.y b/src/verilog.y index 161fe8f67..3eba4ed3b 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -3926,7 +3926,7 @@ system_f_call_or_t: // IEEE: part of system_tf_call (can be task or | yD_POW '(' expr ',' expr ')' { $$ = new AstPowD($1,$3,$5); } | yD_RANDOM '(' expr ')' { $$ = new AstRand($1, $3, false); } | yD_RANDOM parenE { $$ = new AstRand($1, nullptr, false); } - | yD_REALTIME parenE { $$ = new AstTimeD($1, VTimescale(VTimescale::NONE)); } + | yD_REALTIME parenE { $$ = new AstTimeD{$1, VTimescale{VTimescale::NONE}}; } | yD_REALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); } | yD_REWIND '(' idClassSel ')' { $$ = new AstFSeek($1, $3, new AstConst($1, 0), new AstConst($1, 0)); } | yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_RIGHT,$3,nullptr); } @@ -3944,13 +3944,14 @@ system_f_call_or_t: // IEEE: part of system_tf_call (can be task or | yD_SIZE '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_SIZE,$3,$5); } | yD_SQRT '(' expr ')' { $$ = new AstSqrtD($1,$3); } | yD_SSCANF '(' expr ',' str commaVRDListE ')' { $$ = new AstSScanF($1,*$5,$3,$6); } - | yD_STIME parenE { $$ = new AstSel($1, new AstTime($1, VTimescale(VTimescale::NONE)), 0, 32); } + | yD_STIME parenE + { $$ = new AstSel{$1, new AstTime{$1, VTimescale{VTimescale::NONE}}, 0, 32}; } | yD_STABLE '(' expr ')' { $$ = new AstStable($1,$3); } | yD_STABLE '(' expr ',' expr ')' { $$ = $3; BBUNSUP($1, "Unsupported: $stable and clock arguments"); } | yD_TAN '(' expr ')' { $$ = new AstTanD($1,$3); } | yD_TANH '(' expr ')' { $$ = new AstTanhD($1,$3); } | yD_TESTPLUSARGS '(' expr ')' { $$ = new AstTestPlusArgs($1, $3); } - | yD_TIME parenE { $$ = new AstTime($1, VTimescale(VTimescale::NONE)); } + | yD_TIME parenE { $$ = new AstTime{$1, VTimescale{VTimescale::NONE}}; } | yD_TYPENAME '(' exprOrDataType ')' { $$ = new AstAttrOf($1, VAttrType::TYPENAME, $3); } | yD_UNGETC '(' expr ',' expr ')' { $$ = new AstFUngetC($1, $5, $3); } // Arg swap to file first | yD_UNPACKED_DIMENSIONS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_UNPK_DIMENSIONS,$3); } @@ -6631,7 +6632,7 @@ vltOffFront: | yVLT_TRACING_OFF { $$ = V3ErrorCode::I_TRACING; } | yVLT_LINT_OFF { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_OFF yVLT_D_RULE idAny - { $$ = V3ErrorCode((*$3).c_str()); + { $$ = V3ErrorCode{(*$3).c_str()}; if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: " << *$3); } } ; @@ -6640,7 +6641,7 @@ vltOnFront: | yVLT_TRACING_ON { $$ = V3ErrorCode::I_TRACING; } | yVLT_LINT_ON { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_ON yVLT_D_RULE idAny - { $$ = V3ErrorCode((*$3).c_str()); + { $$ = V3ErrorCode{(*$3).c_str()}; if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: " << *$3); } } ;