C++11: Use member declaration initalizations (in nodes). No functional change intended.

This commit is contained in:
Wilson Snyder 2020-08-16 11:40:42 -04:00
parent 72d2cff0a1
commit 034737d2a8
8 changed files with 326 additions and 346 deletions

View File

@ -82,9 +82,9 @@ public:
inline AstType() {}
// cppcheck-suppress noExplicitConstructor
inline AstType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline AstType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};
inline bool operator==(const AstType& lhs, const AstType& rhs) { return lhs.m_e == rhs.m_e; }
@ -103,12 +103,12 @@ public:
return names[m_e];
}
inline VLifetime()
: m_e(NONE) {}
: m_e{NONE} {}
// cppcheck-suppress noExplicitConstructor
inline VLifetime(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VLifetime(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
bool isNone() const { return m_e == NONE; }
bool isAutomatic() const { return m_e == AUTOMATIC; }
@ -137,15 +137,15 @@ public:
return names[m_e];
}
inline VSigning()
: m_e(UNSIGNED) {}
: m_e{UNSIGNED} {}
// cppcheck-suppress noExplicitConstructor
inline VSigning(en _e)
: m_e(_e) {}
: m_e{_e} {}
static inline VSigning fromBool(bool isSigned) { // Factory method
return isSigned ? VSigning(SIGNED) : VSigning(UNSIGNED);
}
explicit inline VSigning(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
inline bool isSigned() const { return m_e == SIGNED; }
inline bool isNosign() const { return m_e == NOSIGN; }
@ -177,12 +177,12 @@ public:
};
enum en m_e;
inline AstPragmaType()
: m_e(ILLEGAL) {}
: m_e{ILLEGAL} {}
// cppcheck-suppress noExplicitConstructor
inline AstPragmaType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline AstPragmaType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};
inline bool operator==(const AstPragmaType& lhs, const AstPragmaType& rhs) {
@ -208,12 +208,12 @@ public:
};
enum en m_e;
inline AstCFuncType()
: m_e(FT_NORMAL) {}
: m_e{FT_NORMAL} {}
// cppcheck-suppress noExplicitConstructor
inline AstCFuncType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline AstCFuncType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
// METHODS
bool isTrace() const { return m_e != FT_NORMAL; }
@ -298,12 +298,12 @@ public:
return false;
}
inline VEdgeType()
: m_e(ET_ILLEGAL) {}
: m_e{ET_ILLEGAL} {}
// cppcheck-suppress noExplicitConstructor
inline VEdgeType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VEdgeType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};
inline bool operator==(const VEdgeType& lhs, const VEdgeType& rhs) { return lhs.m_e == rhs.m_e; }
@ -378,12 +378,12 @@ public:
return names[m_e];
}
inline AstAttrType()
: m_e(ILLEGAL) {}
: m_e{ILLEGAL} {}
// cppcheck-suppress noExplicitConstructor
inline AstAttrType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline AstAttrType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};
inline bool operator==(const AstAttrType& lhs, const AstAttrType& rhs) {
@ -448,12 +448,12 @@ public:
"SelfTest: Enum mismatch");
}
inline AstBasicDTypeKwd()
: m_e(UNKNOWN) {}
: m_e{UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline AstBasicDTypeKwd(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline AstBasicDTypeKwd(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
int width() const {
switch (m_e) {
@ -535,12 +535,12 @@ public:
enum en { NONE, INPUT, OUTPUT, INOUT, REF, CONSTREF };
enum en m_e;
inline VDirection()
: m_e(NONE) {}
: m_e{NONE} {}
// cppcheck-suppress noExplicitConstructor
inline VDirection(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VDirection(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[] = {"NONE", "INPUT", "OUTPUT", "INOUT", "REF", "CONSTREF"};
@ -581,12 +581,12 @@ public:
enum en m_e;
// CONSTRUCTOR - note defaults to *UNKNOWN*
inline VBoolOrUnknown()
: m_e(BU_UNKNOWN) {}
: m_e{BU_UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline VBoolOrUnknown(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VBoolOrUnknown(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
const char* ascii() const {
static const char* const names[] = {"FALSE", "TRUE", "UNK"};
return names[m_e];
@ -620,12 +620,12 @@ public:
enum en m_e;
// CONSTRUCTOR - note defaults to *UNKNOWN*
inline VJoinType()
: m_e(JOIN) {}
: m_e{JOIN} {}
// cppcheck-suppress noExplicitConstructor
inline VJoinType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VJoinType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
const char* ascii() const {
static const char* const names[] = {"JOIN", "JOIN_ANY", "JOIN_NONE"};
return names[m_e];
@ -673,12 +673,12 @@ public:
};
enum en m_e;
inline AstVarType()
: m_e(UNKNOWN) {}
: m_e{UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline AstVarType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline AstVarType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[] = {
@ -721,12 +721,12 @@ public:
enum en m_e;
// CONSTRUCTOR - note defaults to *UNKNOWN*
inline VBranchPred()
: m_e(BP_UNKNOWN) {}
: m_e{BP_UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline VBranchPred(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VBranchPred(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
bool unknown() const { return m_e == BP_UNKNOWN; }
bool likely() const { return m_e == BP_LIKELY; }
@ -762,12 +762,12 @@ public:
enum en m_e;
// CONSTRUCTOR - note defaults to *UNKNOWN*
inline VVarAttrClocker()
: m_e(CLOCKER_UNKNOWN) {}
: m_e{CLOCKER_UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline VVarAttrClocker(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VVarAttrClocker(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
bool unknown() const { return m_e == CLOCKER_UNKNOWN; }
VVarAttrClocker invert() const {
@ -804,12 +804,12 @@ public:
enum en { ALWAYS, ALWAYS_FF, ALWAYS_LATCH, ALWAYS_COMB };
enum en m_e;
inline VAlwaysKwd()
: m_e(ALWAYS) {}
: m_e{ALWAYS} {}
// cppcheck-suppress noExplicitConstructor
inline VAlwaysKwd(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VAlwaysKwd(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[] = {"always", "always_ff", "always_latch", "always_comb"};
@ -827,12 +827,12 @@ public:
enum en { CT_CASE, CT_CASEX, CT_CASEZ, CT_CASEINSIDE };
enum en m_e;
inline VCaseType()
: m_e(CT_CASE) {}
: m_e{CT_CASE} {}
// cppcheck-suppress noExplicitConstructor
inline VCaseType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VCaseType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};
inline bool operator==(const VCaseType& lhs, const VCaseType& rhs) { return lhs.m_e == rhs.m_e; }
@ -846,12 +846,12 @@ public:
enum en { DT_DISPLAY, DT_WRITE, DT_INFO, DT_ERROR, DT_WARNING, DT_FATAL };
enum en m_e;
inline AstDisplayType()
: m_e(DT_DISPLAY) {}
: m_e{DT_DISPLAY} {}
// cppcheck-suppress noExplicitConstructor
inline AstDisplayType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline AstDisplayType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
bool addNewline() const { return m_e != DT_WRITE; }
bool needScopeTracking() const { return m_e != DT_DISPLAY && m_e != DT_WRITE; }
@ -878,12 +878,12 @@ public:
enum en { FILE, VARS, ALL, FLUSH, LIMIT, OFF, ON };
enum en m_e;
inline VDumpCtlType()
: m_e(ON) {}
: m_e{ON} {}
// cppcheck-suppress noExplicitConstructor
inline VDumpCtlType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VDumpCtlType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[] = {"$dumpfile", "$dumpvars", "$dumpall", "$dumpflush",
@ -908,12 +908,12 @@ public:
};
enum en m_e;
inline VParseRefExp()
: m_e(PX_NONE) {}
: m_e{PX_NONE} {}
// cppcheck-suppress noExplicitConstructor
inline VParseRefExp(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VParseRefExp(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[] = {"", "$root", "TEXT", "PREDOT"};
@ -959,19 +959,19 @@ public:
//
class LeftRight {};
VNumRange()
: m_hi(0)
, m_lo(0)
, mu_flags(0) {}
: m_hi{0}
, m_lo{0}
, mu_flags{0} {}
VNumRange(int hi, int lo, bool littleEndian)
: m_hi(0)
, m_lo(0)
, mu_flags(0) {
: m_hi{0}
, m_lo{0}
, mu_flags{0} {
init(hi, lo, littleEndian);
}
VNumRange(LeftRight, int left, int right)
: m_hi(0)
, m_lo(0)
, mu_flags(0) {
: m_hi{0}
, m_lo{0}
, mu_flags{0} {
init((right > left) ? right : left, (right > left) ? left : right, (right > left));
}
~VNumRange() {}
@ -1022,12 +1022,12 @@ public:
};
enum en m_e;
inline VUseType()
: m_e(IMP_FWD_CLASS) {}
: m_e{IMP_FWD_CLASS} {}
// cppcheck-suppress noExplicitConstructor
inline VUseType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VUseType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
bool isInclude() const { return m_e == IMP_INCLUDE || m_e == INT_INCLUDE; }
bool isFwdClass() const { return m_e == IMP_FWD_CLASS || m_e == INT_FWD_CLASS; }
operator en() const { return m_e; }
@ -1071,11 +1071,11 @@ public:
}
VBasicTypeKey(int width, int widthMin, VSigning numeric, AstBasicDTypeKwd kwd,
const VNumRange& nrange)
: m_width(width)
, m_widthMin(widthMin)
, m_numeric(numeric)
, m_keyword(kwd)
, m_nrange(nrange) {}
: m_width{width}
, m_widthMin{widthMin}
, m_numeric{numeric}
, m_keyword{kwd}
, m_nrange{nrange} {}
~VBasicTypeKey() {}
};
@ -1437,11 +1437,11 @@ public:
protected:
// CONSTRUCTORS
AstNode(AstType t)
: m_type(t) {
: m_type{t} {
init();
}
AstNode(AstType t, FileLine* fl)
: m_type(t) {
: m_type{t} {
init();
m_fileline = fl;
}
@ -1880,7 +1880,7 @@ class AstNodeMath : public AstNode {
// Math -- anything that's part of an expression tree
public:
AstNodeMath(AstType t, FileLine* fl)
: AstNode(t, fl) {}
: AstNode{t, fl} {}
ASTNODE_BASE_FUNCS(NodeMath)
// METHODS
virtual bool hasDType() const override { return true; }
@ -1899,7 +1899,7 @@ class AstNodeTermop : public AstNodeMath {
// Terminal operator -- a operator with no "inputs"
public:
AstNodeTermop(AstType t, FileLine* fl)
: AstNodeMath(t, fl) {}
: AstNodeMath{t, fl} {}
ASTNODE_BASE_FUNCS(NodeTermop)
// Know no children, and hot function, so skip iterator for speed
// See checkTreeIter also that asserts no children
@ -1911,7 +1911,7 @@ class AstNodeUniop : public AstNodeMath {
// Unary math
public:
AstNodeUniop(AstType t, FileLine* fl, AstNode* lhsp)
: AstNodeMath(t, fl) {
: AstNodeMath{t, fl} {
dtypeFrom(lhsp);
setOp1p(lhsp);
}
@ -1936,7 +1936,7 @@ class AstNodeBiop : public AstNodeMath {
// Binary math
public:
AstNodeBiop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeMath(t, fl) {
: AstNodeMath{t, fl} {
setOp1p(lhs);
setOp2p(rhs);
}
@ -1968,7 +1968,7 @@ class AstNodeTriop : public AstNodeMath {
// Trinary math
public:
AstNodeTriop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
: AstNodeMath(t, fl) {
: AstNodeMath{t, fl} {
setOp1p(lhs);
setOp2p(rhs);
setOp3p(ths);
@ -2000,7 +2000,7 @@ class AstNodeQuadop : public AstNodeMath {
// Quaternary math
public:
AstNodeQuadop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths, AstNode* fhs)
: AstNodeMath(t, fl) {
: AstNodeMath{t, fl} {
setOp1p(lhs);
setOp2p(rhs);
setOp3p(ths);
@ -2037,7 +2037,7 @@ class AstNodeBiCom : public AstNodeBiop {
// Binary math with commutative properties
public:
AstNodeBiCom(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiop(t, fl, lhs, rhs) {}
: AstNodeBiop{t, fl, lhs, rhs} {}
ASTNODE_BASE_FUNCS(NodeBiCom)
};
@ -2045,13 +2045,13 @@ class AstNodeBiComAsv : public AstNodeBiCom {
// Binary math with commutative & associative properties
public:
AstNodeBiComAsv(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiCom(t, fl, lhs, rhs) {}
: AstNodeBiCom{t, fl, lhs, rhs} {}
ASTNODE_BASE_FUNCS(NodeBiComAsv)
};
class AstNodeCond : public AstNodeTriop {
public:
AstNodeCond(AstType t, FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p)
: AstNodeTriop(t, fl, condp, expr1p, expr2p) {
: AstNodeTriop{t, fl, condp, expr1p, expr2p} {
if (expr1p) {
dtypeFrom(expr1p);
} else if (expr2p) {
@ -2088,8 +2088,8 @@ private:
bool m_unnamed; // Originally unnamed (name change does not affect this)
public:
AstNodeBlock(AstType t, FileLine* fl, const string& name, AstNode* stmtsp)
: AstNode(t, fl)
, m_name(name) {
: AstNode{t, fl}
, m_name{name} {
addNOp1p(stmtsp);
m_unnamed = (name == "");
}
@ -2107,7 +2107,7 @@ class AstNodePreSel : public AstNode {
// Something that becomes an AstSel
public:
AstNodePreSel(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
: AstNode(t, fl) {
: AstNode{t, fl} {
setOp1p(lhs);
setOp2p(rhs);
setNOp3p(ths);
@ -2131,7 +2131,7 @@ class AstNodeProcedure : public AstNode {
// IEEE procedure: initial, final, always
public:
AstNodeProcedure(AstType t, FileLine* fl, AstNode* bodysp)
: AstNode(t, fl) {
: AstNode{t, fl} {
addNOp2p(bodysp);
}
ASTNODE_BASE_FUNCS(NodeProcedure)
@ -2146,8 +2146,8 @@ class AstNodeStmt : public AstNode {
bool m_statement; // Really a statement (e.g. not a function with return)
public:
AstNodeStmt(AstType t, FileLine* fl, bool statement = true)
: AstNode(t, fl)
, m_statement(statement) {}
: AstNode{t, fl}
, m_statement{statement} {}
ASTNODE_BASE_FUNCS(NodeStmt)
// METHODS
bool isStatement() const { return m_statement; } // Really a statement
@ -2159,7 +2159,7 @@ public:
class AstNodeAssign : public AstNodeStmt {
public:
AstNodeAssign(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeStmt(t, fl) {
: AstNodeStmt{t, fl} {
setOp1p(rhsp);
setOp2p(lhsp);
dtypeFrom(lhsp);
@ -2185,7 +2185,7 @@ class AstNodeFor : public AstNodeStmt {
public:
AstNodeFor(AstType t, FileLine* fl, AstNode* initsp, AstNode* condp, AstNode* incsp,
AstNode* bodysp)
: AstNodeStmt(t, fl) {
: AstNodeStmt{t, fl} {
addNOp1p(initsp);
setOp2p(condp);
addNOp3p(incsp);
@ -2207,7 +2207,7 @@ private:
VBranchPred m_branchPred; // Branch prediction as taken/untaken?
public:
AstNodeIf(AstType t, FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp)
: AstNodeStmt(t, fl) {
: AstNodeStmt{t, fl} {
setOp1p(condp);
addNOp2p(ifsp);
addNOp3p(elsesp);
@ -2231,7 +2231,7 @@ public:
class AstNodeCase : public AstNodeStmt {
public:
AstNodeCase(AstType t, FileLine* fl, AstNode* exprp, AstNode* casesp)
: AstNodeStmt(t, fl) {
: AstNodeStmt{t, fl} {
setOp1p(exprp);
addNOp2p(casesp);
}
@ -2259,15 +2259,15 @@ private:
public:
AstNodeVarRef(AstType t, FileLine* fl, const string& name, bool lvalue)
: AstNodeMath(t, fl)
, m_lvalue(lvalue)
, m_name(name) {
: AstNodeMath{t, fl}
, m_lvalue{lvalue}
, m_name{name} {
this->varp(nullptr);
}
AstNodeVarRef(AstType t, FileLine* fl, const string& name, AstVar* varp, bool lvalue)
: AstNodeMath(t, fl)
, m_lvalue(lvalue)
, m_name(name) {
: AstNodeMath{t, fl}
, m_lvalue{lvalue}
, m_name{name} {
// May have varp==nullptr
this->varp(varp);
}
@ -2304,7 +2304,7 @@ private:
public:
// Node that simply puts text into the output stream
AstNodeText(AstType t, FileLine* fl, const string& textp)
: AstNode(t, fl) {
: AstNode{t, fl} {
m_text = textp; // Copy it
}
ASTNODE_BASE_FUNCS(NodeText)
@ -2333,7 +2333,7 @@ private:
public:
// CONSTRUCTORS
AstNodeDType(AstType t, FileLine* fl)
: AstNode(t, fl) {
: AstNode{t, fl} {
m_width = 0;
m_widthMin = 0;
m_generic = false;
@ -2421,7 +2421,7 @@ private:
public:
AstNodeUOrStructDType(AstType t, FileLine* fl, VSigning numericUnpack)
: AstNodeDType(t, fl) {
: AstNodeDType{t, fl} {
// VSigning::NOSIGN overloaded to indicate not packed
m_packed = (numericUnpack != VSigning::NOSIGN);
m_isFourstate = false; // V3Width computes
@ -2477,13 +2477,11 @@ class AstNodeArrayDType : public AstNodeDType {
// Children: DTYPE (moved to refDTypep() in V3Width)
// Children: RANGE (array bounds)
private:
AstNodeDType* m_refDTypep; // Elements of this type (after widthing)
AstNodeDType* m_refDTypep = nullptr; // Elements of this type (after widthing)
AstNode* rangenp() const { return op2p(); } // op2 = Array(s) of variable
public:
AstNodeArrayDType(AstType t, FileLine* fl)
: AstNodeDType(t, fl) {
m_refDTypep = nullptr;
}
: AstNodeDType{t, fl} {}
ASTNODE_BASE_FUNCS(NodeArrayDType)
virtual void dump(std::ostream& str) const override;
virtual void dumpSmall(std::ostream& str) const override;
@ -2541,7 +2539,7 @@ class AstNodeSel : public AstNodeBiop {
// Single bit range extraction, perhaps with non-constant selection or array selection
public:
AstNodeSel(AstType t, FileLine* fl, AstNode* fromp, AstNode* bitp)
: AstNodeBiop(t, fl, fromp, bitp) {}
: AstNodeBiop{t, fl, fromp, bitp} {}
ASTNODE_BASE_FUNCS(NodeSel)
AstNode* fromp() const {
return op1p();
@ -2557,7 +2555,7 @@ class AstNodeStream : public AstNodeBiop {
// Verilog {rhs{lhs}} - Note rhsp() is the slice size, not the lhsp()
public:
AstNodeStream(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeBiop(t, fl, lhsp, rhsp) {
: AstNodeBiop{t, fl, lhsp, rhsp} {
if (lhsp->dtypep()) { dtypeSetLogicSized(lhsp->dtypep()->width(), VSigning::UNSIGNED); }
}
ASTNODE_BASE_FUNCS(NodeStream)
@ -2575,16 +2573,15 @@ class AstNodeCCall : public AstNodeStmt {
public:
AstNodeCCall(AstType t, FileLine* fl, AstCFunc* funcp, AstNode* argsp = nullptr)
: AstNodeStmt(t, fl, true)
, m_funcp(funcp) {
: AstNodeStmt{t, fl, true}
, m_funcp{funcp} {
addNOp2p(argsp);
}
// Replacement form for V3Combine
// Note this removes old attachments from the oldp
AstNodeCCall(AstType t, AstNodeCCall* oldp, AstCFunc* funcp)
: AstNodeStmt(t, oldp->fileline(), true)
, m_funcp(funcp) {
m_funcp = funcp;
: AstNodeStmt{t, oldp->fileline(), true}
, m_funcp{funcp} {
m_hiername = oldp->hiername();
m_argTypes = oldp->argTypes();
if (oldp->argsp()) addNOp2p(oldp->argsp()->unlinkFrBackWithNext());
@ -2637,22 +2634,22 @@ private:
VLifetime m_lifetime; // Lifetime
public:
AstNodeFTask(AstType t, FileLine* fl, const string& name, AstNode* stmtsp)
: AstNode(t, fl)
, m_name(name)
, m_taskPublic(false)
, m_attrIsolateAssign(false)
, m_classMethod(false)
, m_extern(false)
, m_prototype(false)
, m_dpiExport(false)
, m_dpiImport(false)
, m_dpiContext(false)
, m_dpiOpenChild(false)
, m_dpiTask(false)
, m_isConstructor(false)
, m_pure(false)
, m_pureVirtual(false)
, m_virtual(false) {
: AstNode{t, fl}
, m_name{name}
, m_taskPublic{false}
, m_attrIsolateAssign{false}
, m_classMethod{false}
, m_extern{false}
, m_prototype{false}
, m_dpiExport{false}
, m_dpiImport{false}
, m_dpiContext{false}
, m_dpiOpenChild{false}
, m_dpiTask{false}
, m_isConstructor{false}
, m_pure{false}
, m_pureVirtual{false}
, m_virtual{false} {
addNOp3p(stmtsp);
cname(name); // Might be overridden by dpi import/export
}
@ -2725,13 +2722,13 @@ private:
bool m_pli = false; // Pli system call ($name)
public:
AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, AstNode* namep, AstNode* pinsp)
: AstNodeStmt(t, fl, statement) {
: AstNodeStmt{t, fl, statement} {
setOp1p(namep);
addNOp3p(pinsp);
}
AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, const string& name, AstNode* pinsp)
: AstNodeStmt(t, fl, statement)
, m_name(name) {
: AstNodeStmt{t, fl, statement}
, m_name{name} {
addNOp3p(pinsp);
}
ASTNODE_BASE_FUNCS(NodeFTaskRef)
@ -2794,17 +2791,17 @@ private:
VOptionBool m_unconnectedDrive; // State of `unconnected_drive
public:
AstNodeModule(AstType t, FileLine* fl, const string& name)
: AstNode(t, fl)
, m_name(name)
, m_origName(name)
, m_modPublic(false)
, m_modTrace(false)
, m_inLibrary(false)
, m_dead(false)
, m_hierBlock(false)
, m_internal(false)
, m_recursive(false)
, m_recursiveClone(false) {}
: AstNode{t, fl}
, m_name{name}
, m_origName{name}
, m_modPublic{false}
, m_modTrace{false}
, m_inLibrary{false}
, m_dead{false}
, m_hierBlock{false}
, m_internal{false}
, m_recursive{false}
, m_recursiveClone{false} {}
ASTNODE_BASE_FUNCS(NodeModule)
virtual void dump(std::ostream& str) const override;
virtual bool maybePointedTo() const override { return true; }
@ -2853,7 +2850,7 @@ class AstNodeRange : public AstNode {
// A range, sized or unsized
public:
AstNodeRange(AstType t, FileLine* fl)
: AstNode(t, fl) {}
: AstNode{t, fl} {}
ASTNODE_BASE_FUNCS(NodeRange)
};

View File

@ -369,8 +369,8 @@ public:
AstParamTypeDType(FileLine* fl, AstVarType type, const string& name, VFlagChildDType,
AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_varType(type)
, m_name(name) {
, m_varType{type}
, m_name{name} {
childDTypep(dtp); // Only for parser
dtypep(nullptr); // V3Width will resolve
}
@ -413,7 +413,7 @@ public:
AstTypedef(FileLine* fl, const string& name, AstNode* attrsp, VFlagChildDType,
AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
childDTypep(dtp); // Only for parser
addAttrsp(attrsp);
dtypep(nullptr); // V3Width will resolve
@ -447,7 +447,7 @@ private:
public:
AstTypedefFwd(FileLine* fl, const string& name)
: ASTGEN_SUPER(fl)
, m_name(name) {}
, m_name{name} {}
ASTNODE_NODE_FUNCS(TypedefFwd)
// METHODS
virtual string name() const override { return m_name; }
@ -468,8 +468,8 @@ public:
AstDefImplicitDType(FileLine* fl, const string& name, void* containerp, VFlagChildDType,
AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_containerp(containerp) {
, m_name{name}
, m_containerp{containerp} {
childDTypep(dtp); // Only for parser
dtypep(nullptr); // V3Width will resolve
m_uniqueNum = uniqueNumInc();
@ -980,7 +980,7 @@ private:
public:
AstClassRefDType(FileLine* fl, AstClass* classp)
: ASTGEN_SUPER(fl)
, m_classp(classp) {
, m_classp{classp} {
dtypep(this);
}
ASTNODE_NODE_FUNCS(ClassRefDType)
@ -1033,17 +1033,17 @@ private:
public:
AstIfaceRefDType(FileLine* fl, const string& cellName, const string& ifaceName)
: ASTGEN_SUPER(fl)
, m_modportFileline(nullptr)
, m_cellName(cellName)
, m_ifaceName(ifaceName)
, m_modportName("") {}
, m_modportFileline{nullptr}
, m_cellName{cellName}
, m_ifaceName{ifaceName}
, m_modportName{""} {}
AstIfaceRefDType(FileLine* fl, FileLine* modportFl, const string& cellName,
const string& ifaceName, const string& modport)
: ASTGEN_SUPER(fl)
, m_modportFileline(modportFl)
, m_cellName(cellName)
, m_ifaceName(ifaceName)
, m_modportName(modport) {}
, m_modportFileline{modportFl}
, m_cellName{cellName}
, m_ifaceName{ifaceName}
, m_modportName{modport} {}
ASTNODE_NODE_FUNCS(IfaceRefDType)
// METHODS
virtual const char* broken() const override;
@ -1149,10 +1149,10 @@ private:
public:
AstRefDType(FileLine* fl, const string& name)
: ASTGEN_SUPER(fl)
, m_name(name) {}
, m_name{name} {}
AstRefDType(FileLine* fl, const string& name, AstNode* classOrPackagep, AstNode* paramsp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
setNOp3p(classOrPackagep);
addNOp4p(paramsp);
}
@ -1269,14 +1269,14 @@ private:
public:
AstMemberDType(FileLine* fl, const string& name, VFlagChildDType, AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
childDTypep(dtp); // Only for parser
dtypep(nullptr); // V3Width will resolve
refDTypep(nullptr);
}
AstMemberDType(FileLine* fl, const string& name, AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
UASSERT(dtp, "AstMember created with no dtype");
refDTypep(dtp);
dtypep(this);
@ -1355,7 +1355,7 @@ public:
// Parents: ENUM
AstEnumItem(FileLine* fl, const string& name, AstNode* rangep, AstNode* initp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
addNOp1p(rangep);
addNOp2p(initp);
}
@ -1377,8 +1377,8 @@ private:
public:
AstEnumItemRef(FileLine* fl, AstEnumItem* itemp, AstNodeModule* packagep)
: ASTGEN_SUPER(fl)
, m_itemp(itemp)
, m_packagep(packagep) {
, m_itemp{itemp}
, m_packagep{packagep} {
dtypeFrom(m_itemp);
}
ASTNODE_NODE_FUNCS(EnumItemRef)
@ -1671,15 +1671,15 @@ private:
int m_declElWidth; // If a packed array, the number of bits per element
public:
AstSel(FileLine* fl, AstNode* fromp, AstNode* lsbp, AstNode* widthp)
: ASTGEN_SUPER(fl, fromp, lsbp, widthp) {
m_declElWidth = 1;
: ASTGEN_SUPER(fl, fromp, lsbp, widthp)
, m_declElWidth{1} {
if (VN_IS(widthp, Const)) {
dtypeSetLogicSized(VN_CAST(widthp, Const)->toUInt(), VSigning::UNSIGNED);
}
}
AstSel(FileLine* fl, AstNode* fromp, int lsb, int bitwidth)
: ASTGEN_SUPER(fl, fromp, new AstConst(fl, lsb), new AstConst(fl, bitwidth)) {
m_declElWidth = 1;
: ASTGEN_SUPER(fl, fromp, new AstConst(fl, lsb), new AstConst(fl, bitwidth))
, m_declElWidth{1} {
dtypeSetLogicSized(bitwidth, VSigning::UNSIGNED);
}
ASTNODE_NODE_FUNCS(Sel)
@ -1730,7 +1730,7 @@ public:
AstSliceSel(FileLine* fl, AstNode* fromp, const VNumRange& declRange)
: ASTGEN_SUPER(fl, fromp, new AstConst(fl, declRange.lo()),
new AstConst(fl, declRange.elements()))
, m_declRange(declRange) {}
, m_declRange{declRange} {}
ASTNODE_NODE_FUNCS(SliceSel)
virtual void dump(std::ostream& str) const override;
virtual void numberOperate(V3Number& out, const V3Number& from, const V3Number& lo,
@ -1803,14 +1803,14 @@ public:
AstCMethodHard(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name,
AstNode* pinsp)
: ASTGEN_SUPER(fl, false)
, m_name(name) {
, m_name{name} {
setOp1p(fromp);
dtypep(nullptr); // V3Width will resolve
addNOp2p(pinsp);
}
AstCMethodHard(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp)
: ASTGEN_SUPER(fl, false)
, m_name(name) {
, m_name{name} {
setOp1p(fromp);
addNOp2p(pinsp);
}
@ -1922,8 +1922,8 @@ private:
public:
AstVar(FileLine* fl, AstVarType type, const string& name, VFlagChildDType, AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_origName(name) {
, m_name{name}
, m_origName{name} {
init();
combineType(type);
childDTypep(dtp); // Only for parser
@ -1936,8 +1936,8 @@ public:
}
AstVar(FileLine* fl, AstVarType type, const string& name, AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_origName(name) {
, m_name{name}
, m_origName{name} {
init();
combineType(type);
UASSERT(dtp, "AstVar created with no dtype");
@ -1950,8 +1950,8 @@ public:
}
AstVar(FileLine* fl, AstVarType type, const string& name, VFlagLogicPacked, int wantwidth)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_origName(name) {
, m_name{name}
, m_origName{name} {
init();
combineType(type);
dtypeSetLogicSized(wantwidth, VSigning::UNSIGNED);
@ -1959,8 +1959,8 @@ public:
}
AstVar(FileLine* fl, AstVarType type, const string& name, VFlagBitPacked, int wantwidth)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_origName(name) {
, m_name{name}
, m_origName{name} {
init();
combineType(type);
dtypeSetBitSized(wantwidth, VSigning::UNSIGNED);
@ -1968,8 +1968,8 @@ public:
}
AstVar(FileLine* fl, AstVarType type, const string& name, AstVar* examplep)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_origName(name) {
, m_name{name}
, m_origName{name} {
init();
combineType(type);
if (examplep->childDTypep()) { childDTypep(examplep->childDTypep()->cloneTree(true)); }
@ -2223,10 +2223,10 @@ public:
AstScope(FileLine* fl, AstNodeModule* modp, const string& name, AstScope* aboveScopep,
AstCell* aboveCellp)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_aboveScopep(aboveScopep)
, m_aboveCellp(aboveCellp)
, m_modp(modp) {}
, m_name{name}
, m_aboveScopep{aboveScopep}
, m_aboveCellp{aboveCellp}
, m_modp{modp} {}
ASTNODE_NODE_FUNCS(Scope)
virtual void cloneRelink() override;
virtual const char* broken() const override;
@ -2277,8 +2277,8 @@ private:
public:
AstVarScope(FileLine* fl, AstScope* scopep, AstVar* varp)
: ASTGEN_SUPER(fl)
, m_scopep(scopep)
, m_varp(varp) {
, m_scopep{scopep}
, m_varp{varp} {
m_circular = false;
m_trace = true;
dtypeFrom(varp);
@ -2365,10 +2365,10 @@ private:
public:
AstVarXRef(FileLine* fl, const string& name, const string& dotted, bool lvalue)
: ASTGEN_SUPER(fl, name, nullptr, lvalue)
, m_dotted(dotted) {}
, m_dotted{dotted} {}
AstVarXRef(FileLine* fl, AstVar* varp, const string& dotted, bool lvalue)
: ASTGEN_SUPER(fl, varp->name(), varp, lvalue)
, m_dotted(dotted) {
, m_dotted{dotted} {
dtypeFrom(varp);
}
ASTNODE_NODE_FUNCS(VarXRef)
@ -2402,14 +2402,14 @@ private:
public:
AstPin(FileLine* fl, int pinNum, const string& name, AstNode* exprp)
: ASTGEN_SUPER(fl)
, m_name(name) {
m_pinNum = pinNum;
, m_pinNum{pinNum}
, m_name{name} {
setNOp1p(exprp);
}
AstPin(FileLine* fl, int pinNum, AstVarRef* varname, AstNode* exprp)
: ASTGEN_SUPER(fl) {
m_name = varname->name();
m_pinNum = pinNum;
: ASTGEN_SUPER(fl)
, m_pinNum{pinNum}
, m_name{varname->name()} {
setNOp1p(exprp);
}
ASTNODE_NODE_FUNCS(Pin)
@ -2451,7 +2451,7 @@ private:
public:
AstArg(FileLine* fl, const string& name, AstNode* exprp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
setNOp1p(exprp);
}
ASTNODE_NODE_FUNCS(Arg)
@ -2471,7 +2471,7 @@ private:
public:
AstModule(FileLine* fl, const string& name, bool program = false)
: ASTGEN_SUPER(fl, name)
, m_isProgram(program) {}
, m_isProgram{program} {}
ASTNODE_NODE_FUNCS(Module)
virtual string verilogKwd() const override { return m_isProgram ? "program" : "module"; }
};
@ -2522,8 +2522,8 @@ private:
public:
AstPackageExport(FileLine* fl, AstPackage* packagep, const string& name)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_packagep(packagep) {}
, m_name{name}
, m_packagep{packagep} {}
ASTNODE_NODE_FUNCS(PackageExport)
virtual const char* broken() const override {
BROKEN_RTN(!m_packagep || !m_packagep->brokeExists());
@ -2546,8 +2546,8 @@ private:
public:
AstPackageImport(FileLine* fl, AstPackage* packagep, const string& name)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_packagep(packagep) {}
, m_name{name}
, m_packagep{packagep} {}
ASTNODE_NODE_FUNCS(PackageImport)
virtual const char* broken() const override {
BROKEN_RTN(!m_packagep || !m_packagep->brokeExists());
@ -2580,13 +2580,13 @@ private:
public:
AstMemberSel(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
setOp1p(fromp);
dtypep(nullptr); // V3Width will resolve
}
AstMemberSel(FileLine* fl, AstNode* fromp, AstNodeDType* dtp)
: ASTGEN_SUPER(fl)
, m_name(dtp->name()) {
, m_name{dtp->name()} {
setOp1p(fromp);
dtypep(dtp);
}
@ -2628,8 +2628,8 @@ private:
public:
AstModportFTaskRef(FileLine* fl, const string& name, bool isExport)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_export(isExport) {}
, m_name{name}
, m_export{isExport} {}
ASTNODE_NODE_FUNCS(ModportFTaskRef)
virtual const char* broken() const override {
BROKEN_RTN(m_ftaskp && !m_ftaskp->brokeExists());
@ -2657,8 +2657,8 @@ private:
public:
AstModportVarRef(FileLine* fl, const string& name, VDirection::en direction)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_direction(direction) {}
, m_name{name}
, m_direction{direction} {}
ASTNODE_NODE_FUNCS(ModportVarRef)
virtual const char* broken() const override {
BROKEN_RTN(m_varp && !m_varp->brokeExists());
@ -2682,7 +2682,7 @@ private:
public:
AstModport(FileLine* fl, const string& name, AstNode* varsp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
addNOp1p(varsp);
}
virtual string name() const override { return m_name; }
@ -2698,7 +2698,7 @@ private:
public:
AstIntfRef(FileLine* fl, const string& name)
: ASTGEN_SUPER(fl)
, m_name(name) {}
, m_name{name} {}
virtual string name() const override { return m_name; }
ASTNODE_NODE_FUNCS(IntfRef)
};
@ -2718,13 +2718,13 @@ public:
AstCell(FileLine* fl, FileLine* mfl, const string& instName, const string& modName,
AstPin* pinsp, AstPin* paramsp, AstRange* rangep)
: ASTGEN_SUPER(fl)
, m_modNameFileline(mfl)
, m_name(instName)
, m_origName(instName)
, m_modName(modName)
, m_hasIfaceVar(false)
, m_recursive(false)
, m_trace(true) {
, m_modNameFileline{mfl}
, m_name{instName}
, m_origName{instName}
, m_modName{modName}
, m_hasIfaceVar{false}
, m_recursive{false}
, m_trace{true} {
addNOp1p(pinsp);
addNOp2p(paramsp);
setNOp3p(rangep);
@ -2780,9 +2780,9 @@ public:
AstCellInline(FileLine* fl, const string& name, const string& origModName,
const VTimescale& timeunit)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_origModName(origModName)
, m_timeunit(timeunit) {}
, m_name{name}
, m_origModName{origModName}
, m_timeunit{timeunit} {}
ASTNODE_NODE_FUNCS(CellInline)
virtual void dump(std::ostream& str) const override;
virtual const char* broken() const override {
@ -2806,7 +2806,7 @@ private:
public:
AstCellRef(FileLine* fl, const string& name, AstNode* cellp, AstNode* exprp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
addNOp1p(cellp);
addNOp2p(exprp);
}
@ -2824,7 +2824,7 @@ private:
public:
AstCellArrayRef(FileLine* fl, const string& name, AstNode* selectExprp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
addNOp1p(selectExprp);
}
ASTNODE_NODE_FUNCS(CellArrayRef)
@ -2840,7 +2840,7 @@ private:
public:
AstUnlinkedRef(FileLine* fl, AstNode* refp, const string& name, AstNode* crp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
addNOp1p(refp);
addNOp2p(crp);
}
@ -2859,7 +2859,7 @@ private:
public:
AstBind(FileLine* fl, const string& name, AstNode* cellsp)
: ASTGEN_SUPER(fl)
, m_name(name) {
, m_name{name} {
UASSERT_OBJ(VN_IS(cellsp, Cell), cellsp, "Only cells allowed to be bound");
addNOp1p(cellsp);
}
@ -2878,8 +2878,8 @@ private:
public:
AstPort(FileLine* fl, int pinnum, const string& name)
: ASTGEN_SUPER(fl)
, m_pinNum(pinnum)
, m_name(name) {}
, m_pinNum{pinnum}
, m_name{name} {}
ASTNODE_NODE_FUNCS(Port)
virtual string name() const override { return m_name; } // * = Port name
int pinNum() const { return m_pinNum; } // * = Pin number, for order based instantiation
@ -2902,8 +2902,8 @@ public:
AstParseRef(FileLine* fl, VParseRefExp expect, const string& name, AstNode* lhsp = nullptr,
AstNodeFTaskRef* ftaskrefp = nullptr)
: ASTGEN_SUPER(fl)
, m_expect(expect)
, m_name(name) {
, m_expect{expect}
, m_name{name} {
setNOp1p(lhsp);
setNOp2p(ftaskrefp);
}
@ -2932,8 +2932,8 @@ public:
AstClassOrPackageRef(FileLine* fl, const string& name, AstNode* classOrPackagep,
AstNode* paramsp)
: ASTGEN_SUPER(fl)
, m_name(name)
, m_classOrPackagep(classOrPackagep) {
, m_name{name}
, m_classOrPackagep{classOrPackagep} {
addNOp4p(paramsp);
}
ASTNODE_NODE_FUNCS(ClassOrPackageRef)
@ -2967,7 +2967,7 @@ class AstDot : public AstNode {
public:
AstDot(FileLine* fl, bool colon, AstNode* lhsp, AstNode* rhsp)
: ASTGEN_SUPER(fl)
, m_colon(colon) {
, m_colon{colon} {
setOp1p(lhsp);
setOp2p(rhsp);
}
@ -3051,8 +3051,8 @@ private:
public:
AstDpiExport(FileLine* fl, const string& vname, const string& cname)
: ASTGEN_SUPER(fl)
, m_name(vname)
, m_cname(cname) {}
, m_name{vname}
, m_cname{cname} {}
ASTNODE_NODE_FUNCS(DpiExport)
virtual string name() const override { return m_name; }
virtual void name(const string& name) override { m_name = name; }
@ -3090,29 +3090,24 @@ public:
class Never {}; // for creator type-overload selection
AstSenItem(FileLine* fl, VEdgeType edgeType, AstNode* varrefp)
: ASTGEN_SUPER(fl)
, m_edgeType(edgeType) {
, m_edgeType{edgeType} {
setOp1p(varrefp);
}
AstSenItem(FileLine* fl, Combo)
: ASTGEN_SUPER(fl) {
m_edgeType = VEdgeType::ET_COMBO;
}
: ASTGEN_SUPER(fl)
, m_edgeType{VEdgeType::ET_COMBO} {}
AstSenItem(FileLine* fl, Illegal)
: ASTGEN_SUPER(fl) {
m_edgeType = VEdgeType::ET_ILLEGAL;
}
: ASTGEN_SUPER(fl)
, m_edgeType{VEdgeType::ET_ILLEGAL} {}
AstSenItem(FileLine* fl, Initial)
: ASTGEN_SUPER(fl) {
m_edgeType = VEdgeType::ET_INITIAL;
}
: ASTGEN_SUPER(fl)
, m_edgeType{VEdgeType::ET_INITIAL} {}
AstSenItem(FileLine* fl, Settle)
: ASTGEN_SUPER(fl) {
m_edgeType = VEdgeType::ET_SETTLE;
}
: ASTGEN_SUPER(fl)
, m_edgeType{VEdgeType::ET_SETTLE} {}
AstSenItem(FileLine* fl, Never)
: ASTGEN_SUPER(fl) {
m_edgeType = VEdgeType::ET_NEVER;
}
: ASTGEN_SUPER(fl)
, m_edgeType{VEdgeType::ET_NEVER} {}
ASTNODE_NODE_FUNCS(SenItem)
virtual void dump(std::ostream& str) const override;
virtual V3Hash sameHash() const override { return V3Hash(edgeType()); }
@ -3185,7 +3180,7 @@ class AstAlways : public AstNodeProcedure {
public:
AstAlways(FileLine* fl, VAlwaysKwd keyword, AstSenTree* sensesp, AstNode* bodysp)
: ASTGEN_SUPER(fl, bodysp)
, m_keyword(keyword) {
, m_keyword{keyword} {
addNOp1p(sensesp);
}
ASTNODE_NODE_FUNCS(Always)
@ -3356,8 +3351,8 @@ private:
public:
AstComment(FileLine* fl, const string& name, bool showAt = false)
: ASTGEN_SUPER(fl)
, m_showAt(showAt)
, m_name(name) {}
, m_showAt{showAt}
, m_name{name} {}
ASTNODE_NODE_FUNCS(Comment)
virtual string name() const override { return m_name; } // * = Text
virtual V3Hash sameHash() const override { return V3Hash(); } // Ignore name in comments
@ -3462,9 +3457,8 @@ private:
AstCoverDecl* m_declp; // [After V3Coverage] Pointer to declaration
public:
AstCoverInc(FileLine* fl, AstCoverDecl* declp)
: ASTGEN_SUPER(fl) {
m_declp = declp;
}
: ASTGEN_SUPER(fl)
, m_declp{declp} {}
ASTNODE_NODE_FUNCS(CoverInc)
virtual const char* broken() const override {
BROKEN_RTN(!declp()->brokeExists());
@ -3546,21 +3540,15 @@ class AstCase : public AstNodeCase {
// casesp Children: CASEITEMs
private:
VCaseType m_casex; // 0=case, 1=casex, 2=casez
bool m_fullPragma; // Synthesis full_case
bool m_parallelPragma; // Synthesis parallel_case
bool m_uniquePragma; // unique case
bool m_unique0Pragma; // unique0 case
bool m_priorityPragma; // priority case
bool m_fullPragma = false; // Synthesis full_case
bool m_parallelPragma = false; // Synthesis parallel_case
bool m_uniquePragma = false; // unique case
bool m_unique0Pragma = false; // unique0 case
bool m_priorityPragma = false; // priority case
public:
AstCase(FileLine* fl, VCaseType casex, AstNode* exprp, AstNode* casesp)
: ASTGEN_SUPER(fl, exprp, casesp) {
m_casex = casex;
m_fullPragma = false;
m_parallelPragma = false;
m_uniquePragma = false;
m_unique0Pragma = false;
m_priorityPragma = false;
}
: ASTGEN_SUPER(fl, exprp, casesp)
, m_casex{casex} {}
ASTNODE_NODE_FUNCS(Case)
virtual string verilogKwd() const override {
return casez() ? "casez" : casex() ? "casex" : "case";
@ -3591,13 +3579,12 @@ class AstCaseItem : public AstNode {
// condsp Children: MATH (Null condition used for default block)
// bodysp Children: Statements
private:
bool m_ignoreOverlap; // Default created by assertions; ignore overlaps
bool m_ignoreOverlap = false; // Default created by assertions; ignore overlaps
public:
AstCaseItem(FileLine* fl, AstNode* condsp, AstNode* bodysp)
: ASTGEN_SUPER(fl) {
addNOp1p(condsp);
addNOp2p(bodysp);
m_ignoreOverlap = false;
}
ASTNODE_NODE_FUNCS(CaseItem)
virtual int instrCount() const override { return widthInstrs() + instrCountBranch(); }
@ -3623,10 +3610,10 @@ public:
AstSFormatF(FileLine* fl, const string& text, bool hidden, AstNode* exprsp,
char missingArgChar = 'd')
: ASTGEN_SUPER(fl)
, m_text(text)
, m_hidden(hidden)
, m_hasFormat(true)
, m_missingArgChar(missingArgChar) {
, m_text{text}
, m_hidden{hidden}
, m_hasFormat{true}
, m_missingArgChar{missingArgChar} {
dtypeSetString();
addNOp1p(exprsp);
addNOp2p(nullptr);
@ -3634,10 +3621,10 @@ public:
AstSFormatF(FileLine* fl, NoFormat, AstNode* exprsp, char missingArgChar = 'd',
bool hidden = true)
: ASTGEN_SUPER(fl)
, m_text("")
, m_hidden(hidden)
, m_hasFormat(false)
, m_missingArgChar(missingArgChar) {
, m_text{""}
, m_hidden{hidden}
, m_hasFormat{false}
, m_missingArgChar{missingArgChar} {
dtypeSetString();
addNOp1p(exprsp);
addNOp2p(nullptr);
@ -3730,7 +3717,7 @@ class AstDumpCtl : public AstNodeStmt {
public:
AstDumpCtl(FileLine* fl, VDumpCtlType ctlType, AstNode* exprp = nullptr)
: ASTGEN_SUPER(fl)
, m_ctlType(ctlType) {
, m_ctlType{ctlType} {
setNOp1p(exprp);
}
ASTNODE_NODE_FUNCS(DumpCtl)
@ -4076,7 +4063,7 @@ private:
public:
AstFScanF(FileLine* fl, const string& text, AstNode* filep, AstNode* exprsp)
: ASTGEN_SUPER(fl)
, m_text(text) {
, m_text{text} {
addNOp1p(exprsp);
setNOp2p(filep);
}
@ -4112,7 +4099,7 @@ private:
public:
AstSScanF(FileLine* fl, const string& text, AstNode* fromp, AstNode* exprsp)
: ASTGEN_SUPER(fl)
, m_text(text) {
, m_text{text} {
addNOp1p(exprsp);
setOp2p(fromp);
}
@ -4264,7 +4251,7 @@ private:
public:
AstTestPlusArgs(FileLine* fl, const string& text)
: ASTGEN_SUPER(fl)
, m_text(text) {}
, m_text{text} {}
ASTNODE_NODE_FUNCS(TestPlusArgs)
virtual string name() const override { return m_text; }
virtual string verilogKwd() const override { return "$test$plusargs"; }
@ -4390,7 +4377,7 @@ private:
public:
AstDisable(FileLine* fl, const string& name)
: ASTGEN_SUPER(fl)
, m_name(name) {}
, m_name{name} {}
ASTNODE_NODE_FUNCS(Disable)
virtual string name() const override { return m_name; } // * = Block name
virtual void name(const string& flag) override { m_name = flag; }
@ -4498,7 +4485,7 @@ private:
public:
AstJumpLabel(FileLine* fl, AstJumpBlock* blockp)
: ASTGEN_SUPER(fl)
, m_blockp(blockp) {}
, m_blockp{blockp} {}
ASTNODE_NODE_FUNCS(JumpLabel)
virtual bool maybePointedTo() const override { return true; }
virtual const char* broken() const override {
@ -4528,7 +4515,7 @@ private:
public:
AstJumpGo(FileLine* fl, AstJumpLabel* labelp)
: ASTGEN_SUPER(fl)
, m_labelp(labelp) {}
, m_labelp{labelp} {}
ASTNODE_NODE_FUNCS(JumpGo);
virtual const char* broken() const override {
BROKEN_RTN(!labelp()->brokeExistsBelow());
@ -4612,10 +4599,9 @@ public:
// Node that simply puts name into the output stream
AstBegin(FileLine* fl, const string& name, AstNode* stmtsp, bool generate = false,
bool implied = false)
: ASTGEN_SUPER(fl, name, stmtsp) {
m_generate = generate;
m_implied = implied;
}
: ASTGEN_SUPER(fl, name, stmtsp)
, m_generate{generate}
, m_implied{implied} {}
ASTNODE_NODE_FUNCS(Begin)
virtual void dump(std::ostream& str) const override;
// op1p is statements in NodeBlock
@ -4833,9 +4819,8 @@ public:
// Pragmas don't result in any output code, they're just flags that affect
// other processing in verilator.
AstPragma(FileLine* fl, AstPragmaType pragType)
: ASTGEN_SUPER(fl) {
m_pragType = pragType;
}
: ASTGEN_SUPER(fl)
, m_pragType{pragType} {}
ASTNODE_NODE_FUNCS(Pragma)
AstPragmaType pragType() const { return m_pragType; } // *=type of the pragma
virtual V3Hash sameHash() const override { return V3Hash(pragType()); }
@ -4994,16 +4979,16 @@ public:
AstNode* valuep, const VNumRange& bitRange, const VNumRange& arrayRange,
bool isScoped)
: ASTGEN_SUPER(fl)
, m_showname(showname)
, m_bitRange(bitRange)
, m_arrayRange(arrayRange)
, m_showname{showname}
, m_bitRange{bitRange}
, m_arrayRange{arrayRange}
, m_codeInc(
((arrayRange.ranged() ? arrayRange.elements() : 1) * valuep->dtypep()->widthWords()
* (VL_EDATASIZE / 32))) // A code is always 32-bits
, m_varType(varp->varType())
, m_declKwd(varp->declKwd())
, m_declDirection(varp->declDirection())
, m_isScoped(isScoped) {
, m_varType{varp->varType()}
, m_declKwd{varp->declKwd()}
, m_declDirection{varp->declDirection()}
, m_isScoped{isScoped} {
dtypeFrom(valuep);
addNOp1p(valuep);
}
@ -5039,8 +5024,8 @@ private:
public:
AstTraceInc(FileLine* fl, AstTraceDecl* declp, bool full)
: ASTGEN_SUPER(fl)
, m_declp(declp)
, m_full(full) {
, m_declp{declp}
, m_full{full} {
dtypeFrom(declp);
addOp2p(declp->valuep()->cloneTree(true));
}
@ -5193,7 +5178,7 @@ class AstUdpTableLine : public AstNode {
public:
AstUdpTableLine(FileLine* fl, const string& text)
: ASTGEN_SUPER(fl)
, m_text(text) {}
, m_text{text} {}
ASTNODE_NODE_FUNCS(UdpTableLine)
virtual string name() const override { return m_text; }
string text() const { return m_text; }
@ -5208,13 +5193,13 @@ private:
bool m_reset; // Random reset, versus always random
public:
AstRand(FileLine* fl, AstNodeDType* dtp, bool reset)
: ASTGEN_SUPER(fl) {
: ASTGEN_SUPER(fl)
, m_reset{reset} {
dtypep(dtp);
m_reset = reset;
}
explicit AstRand(FileLine* fl)
: ASTGEN_SUPER(fl)
, m_reset(false) {}
, m_reset{false} {}
ASTNODE_NODE_FUNCS(Rand)
virtual string emitVerilog() override { return "%f$random"; }
virtual string emitC() override {
@ -5233,7 +5218,7 @@ class AstTime : public AstNodeTermop {
public:
AstTime(FileLine* fl, const VTimescale& timeunit)
: ASTGEN_SUPER(fl)
, m_timeunit(timeunit) {
, m_timeunit{timeunit} {
dtypeSetUInt64();
}
ASTNODE_NODE_FUNCS(Time)
@ -5255,7 +5240,7 @@ class AstTimeD : public AstNodeTermop {
public:
AstTimeD(FileLine* fl, const VTimescale& timeunit)
: ASTGEN_SUPER(fl)
, m_timeunit(timeunit) {
, m_timeunit{timeunit} {
dtypeSetDouble();
}
ASTNODE_NODE_FUNCS(TimeD)
@ -6265,7 +6250,7 @@ private:
public:
AstAtoN(FileLine* fl, AstNode* lhsp, FmtType fmt)
: ASTGEN_SUPER(fl, lhsp)
, m_fmt(fmt) {
, m_fmt{fmt} {
fmt == ATOREAL ? dtypeSetDouble() : dtypeSetSigned32();
}
ASTNODE_NODE_FUNCS(AtoN)
@ -8017,7 +8002,7 @@ private:
public:
AstCompareNN(FileLine* fl, AstNode* lhsp, AstNode* rhsp, bool ignoreCase)
: ASTGEN_SUPER(fl, lhsp, rhsp)
, m_ignoreCase(ignoreCase) {
, m_ignoreCase{ignoreCase} {
dtypeSetUInt32();
}
ASTNODE_NODE_FUNCS(CompareNN)
@ -8180,13 +8165,12 @@ class AstPatMember : public AstNodeMath {
// Parents: AstPattern
// Children: expression, AstPattern, replication count
private:
bool m_default;
bool m_default = false;
public:
AstPatMember(FileLine* fl, AstNode* lhsp, AstNode* keyp, AstNode* repp)
: ASTGEN_SUPER(fl) {
addOp1p(lhsp), setNOp2p(keyp), setNOp3p(repp);
m_default = false;
}
ASTNODE_NODE_FUNCS(PatMember)
virtual string emitVerilog() override { return lhssp() ? "%f{%r{%k%l}}" : "%l"; }
@ -8460,11 +8444,10 @@ private:
bool m_support : 1; ///< Support file (non systemc)
public:
AstCFile(FileLine* fl, const string& name)
: ASTGEN_SUPER(fl, name) {
m_slow = false;
m_source = false;
m_support = false;
}
: ASTGEN_SUPER(fl, name)
, m_slow{false}
, m_source{false}
, m_support{false} {}
ASTNODE_NODE_FUNCS(CFile)
virtual void dump(std::ostream& str = std::cout) const override;
bool slow() const { return m_slow; }
@ -8701,15 +8684,15 @@ public:
// Emit C textual math function (like AstUCFunc)
AstCMath(FileLine* fl, AstNode* exprsp)
: ASTGEN_SUPER(fl)
, m_cleanOut(true)
, m_pure(false) {
, m_cleanOut{true}
, m_pure{false} {
addOp1p(exprsp);
dtypeFrom(exprsp);
}
AstCMath(FileLine* fl, const string& textStmt, int setwidth, bool cleanOut = true)
: ASTGEN_SUPER(fl)
, m_cleanOut(cleanOut)
, m_pure(true) {
, m_cleanOut{cleanOut}
, m_pure{true} {
addNOp1p(new AstText(fl, textStmt, true));
if (setwidth) { dtypeSetLogicSized(setwidth, VSigning::UNSIGNED); }
}
@ -8772,8 +8755,8 @@ private:
public:
AstCUse(FileLine* fl, VUseType useType, const string& name)
: ASTGEN_SUPER(fl)
, m_useType(useType)
, m_name(name) {}
, m_useType{useType}
, m_name{name} {}
ASTNODE_NODE_FUNCS(CUse)
virtual string name() const override { return m_name; }
virtual void dump(std::ostream& str = std::cout) const override;

View File

@ -129,13 +129,13 @@ public:
// clang-format on
enum en m_e;
inline V3ErrorCode()
: m_e(EC_MIN) {}
: m_e{EC_MIN} {}
// cppcheck-suppress noExplicitConstructor
inline V3ErrorCode(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit V3ErrorCode(const char* msgp); // Matching code or ERROR
explicit inline V3ErrorCode(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
const char* ascii() const {
// clang-format off

View File

@ -46,12 +46,12 @@ public:
enum en { LINT_WIDTH, MATCHES_WIDTH, VERILOG_WIDTH };
enum en m_e;
inline VWidthMinUsage()
: m_e(LINT_WIDTH) {}
: m_e{LINT_WIDTH} {}
// cppcheck-suppress noExplicitConstructor
inline VWidthMinUsage(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VWidthMinUsage(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};
inline bool operator==(const VWidthMinUsage& lhs, const VWidthMinUsage& rhs) {

View File

@ -55,12 +55,12 @@ public:
};
enum en m_e;
inline GraphWay()
: m_e(FORWARD) {}
: m_e{FORWARD} {}
// cppcheck-suppress noExplicitConstructor
inline GraphWay(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline GraphWay(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[] = {"FORWARD", "REVERSE"};

View File

@ -56,13 +56,13 @@ public:
//
enum en m_e;
inline V3LangCode()
: m_e(L_ERROR) {}
: m_e{L_ERROR} {}
// cppcheck-suppress noExplicitConstructor
inline V3LangCode(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit V3LangCode(const char* textp);
explicit inline V3LangCode(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};

View File

@ -40,12 +40,12 @@ public:
enum en { OPT_DEFAULT_FALSE = 0, OPT_DEFAULT_TRUE, OPT_TRUE, OPT_FALSE, _ENUM_END };
enum en m_e;
inline VOptionBool()
: m_e(OPT_DEFAULT_FALSE) {}
: m_e{OPT_DEFAULT_FALSE} {}
// cppcheck-suppress noExplicitConstructor
inline VOptionBool(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VOptionBool(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
bool isDefault() const { return m_e == OPT_DEFAULT_FALSE || m_e == OPT_DEFAULT_TRUE; }
bool isTrue() const { return m_e == OPT_TRUE || m_e == OPT_DEFAULT_TRUE; }
@ -87,12 +87,12 @@ public:
enum en m_e;
// CONSTRUCTOR
inline VTimescale()
: m_e(NONE) {}
: m_e{NONE} {}
// cppcheck-suppress noExplicitConstructor
inline VTimescale(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline VTimescale(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
// Construct from string
VTimescale(const string& value, bool& badr);
VTimescale(double value, bool& badr) {
@ -172,9 +172,9 @@ public:
enum en { VCD = 0, FST } m_e;
// cppcheck-suppress noExplicitConstructor
inline TraceFormat(en _e = VCD)
: m_e(_e) {}
: m_e{_e} {}
explicit inline TraceFormat(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
bool fst() const { return m_e == FST; }
string classBase() const {

View File

@ -89,12 +89,12 @@ struct OrderVEdgeType {
}
enum en m_e;
inline OrderVEdgeType()
: m_e(VERTEX_UNKNOWN) {}
: m_e{VERTEX_UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline OrderVEdgeType(en _e)
: m_e(_e) {}
: m_e{_e} {}
explicit inline OrderVEdgeType(int _e)
: m_e(static_cast<en>(_e)) {}
: m_e{static_cast<en>(_e)} {}
operator en() const { return m_e; }
};
inline bool operator==(const OrderVEdgeType& lhs, const OrderVEdgeType& rhs) {