Internals: Clean up some constructors. No functional change intended.
This commit is contained in:
parent
08fef668cd
commit
6c9cbaef62
|
@ -45,11 +45,11 @@ public:
|
|||
|
||||
ArrayInfo(const std::string& name, void* datap, int index, const std::vector<IData>& indices,
|
||||
const std::vector<size_t>& idxWidths)
|
||||
: m_name(name)
|
||||
, m_datap(datap)
|
||||
, m_index(index)
|
||||
, m_indices(indices)
|
||||
, m_idxWidths(idxWidths) {}
|
||||
: m_name{name}
|
||||
, m_datap{datap}
|
||||
, m_index{index}
|
||||
, m_indices{indices}
|
||||
, m_idxWidths{idxWidths} {}
|
||||
};
|
||||
using ArrayInfoMap = std::map<std::string, std::shared_ptr<const ArrayInfo>>;
|
||||
|
||||
|
|
|
@ -1415,7 +1415,7 @@ public:
|
|||
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
constexpr VStrength(en strengthLevel)
|
||||
: m_e(strengthLevel) {}
|
||||
: m_e{strengthLevel} {}
|
||||
explicit VStrength(int _e)
|
||||
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
|
||||
constexpr operator en() const { return m_e; }
|
||||
|
|
|
@ -245,12 +245,12 @@ protected:
|
|||
numeric(VSigning::fromBool(numericUnpack.isSigned()));
|
||||
}
|
||||
AstNodeUOrStructDType(const AstNodeUOrStructDType& other)
|
||||
: AstNodeDType(other)
|
||||
, m_name(other.m_name)
|
||||
, m_uniqueNum(uniqueNumInc())
|
||||
, m_packed(other.m_packed)
|
||||
, m_isFourstate(other.m_isFourstate)
|
||||
, m_constrainedRand(false) {}
|
||||
: AstNodeDType{other}
|
||||
, m_name{other.m_name}
|
||||
, m_uniqueNum{uniqueNumInc()}
|
||||
, m_packed{other.m_packed}
|
||||
, m_isFourstate{other.m_isFourstate}
|
||||
, m_constrainedRand{false} {}
|
||||
|
||||
public:
|
||||
ASTGEN_MEMBERS_AstNodeUOrStructDType;
|
||||
|
@ -684,8 +684,8 @@ public:
|
|||
}
|
||||
AstDefImplicitDType(const AstDefImplicitDType& other)
|
||||
: AstNodeDType(other)
|
||||
, m_name(other.m_name)
|
||||
, m_uniqueNum(uniqueNumInc()) {}
|
||||
, m_name{other.m_name}
|
||||
, m_uniqueNum{uniqueNumInc()} {}
|
||||
ASTGEN_MEMBERS_AstDefImplicitDType;
|
||||
int uniqueNum() const { return m_uniqueNum; }
|
||||
bool sameNode(const AstNode* samep) const override {
|
||||
|
@ -800,9 +800,9 @@ public:
|
|||
widthFromSub(subDTypep());
|
||||
}
|
||||
AstEnumDType(const AstEnumDType& other)
|
||||
: AstNodeDType(other)
|
||||
, m_name(other.m_name)
|
||||
, m_uniqueNum(uniqueNumInc()) {}
|
||||
: AstNodeDType{other}
|
||||
, m_name{other.m_name}
|
||||
, m_uniqueNum{uniqueNumInc()} {}
|
||||
ASTGEN_MEMBERS_AstEnumDType;
|
||||
|
||||
const char* broken() const override;
|
||||
|
@ -925,7 +925,7 @@ public:
|
|||
AstNode* valuep)
|
||||
: ASTGEN_SUPER_MemberDType(fl)
|
||||
, m_name{name}
|
||||
, m_constrainedRand(false) {
|
||||
, m_constrainedRand{false} {
|
||||
childDTypep(dtp); // Only for parser
|
||||
this->valuep(valuep);
|
||||
dtypep(nullptr); // V3Width will resolve
|
||||
|
@ -934,7 +934,7 @@ public:
|
|||
AstMemberDType(FileLine* fl, const string& name, AstNodeDType* dtp)
|
||||
: ASTGEN_SUPER_MemberDType(fl)
|
||||
, m_name{name}
|
||||
, m_constrainedRand(false) {
|
||||
, m_constrainedRand{false} {
|
||||
UASSERT(dtp, "AstMember created with no dtype");
|
||||
refDTypep(dtp);
|
||||
dtypep(this);
|
||||
|
@ -1434,7 +1434,7 @@ public:
|
|||
// isSoft implies packed
|
||||
AstUnionDType(FileLine* fl, bool isSoft, VSigning numericUnpack)
|
||||
: ASTGEN_SUPER_UnionDType(fl, numericUnpack)
|
||||
, m_isSoft(isSoft) {
|
||||
, m_isSoft{isSoft} {
|
||||
packed(packed() | m_isSoft);
|
||||
}
|
||||
ASTGEN_MEMBERS_AstUnionDType;
|
||||
|
|
|
@ -820,14 +820,14 @@ public:
|
|||
: ASTGEN_SUPER_ConsDynArray(fl) {}
|
||||
explicit AstConsDynArray(FileLine* fl, bool lhsIsValue, AstNode* lhsp)
|
||||
: ASTGEN_SUPER_ConsDynArray(fl)
|
||||
, m_lhsIsValue(lhsIsValue) {
|
||||
, m_lhsIsValue{lhsIsValue} {
|
||||
this->lhsp(lhsp);
|
||||
}
|
||||
explicit AstConsDynArray(FileLine* fl, bool lhsIsValue, AstNode* lhsp, bool rhsIsValue,
|
||||
AstNode* rhsp)
|
||||
: ASTGEN_SUPER_ConsDynArray(fl)
|
||||
, m_lhsIsValue(lhsIsValue)
|
||||
, m_rhsIsValue(rhsIsValue) {
|
||||
, m_lhsIsValue{lhsIsValue}
|
||||
, m_rhsIsValue{rhsIsValue} {
|
||||
this->lhsp(lhsp);
|
||||
this->rhsp(rhsp);
|
||||
}
|
||||
|
@ -902,14 +902,14 @@ public:
|
|||
: ASTGEN_SUPER_ConsQueue(fl) {}
|
||||
explicit AstConsQueue(FileLine* fl, bool lhsIsValue, AstNode* lhsp)
|
||||
: ASTGEN_SUPER_ConsQueue(fl)
|
||||
, m_lhsIsValue(lhsIsValue) {
|
||||
, m_lhsIsValue{lhsIsValue} {
|
||||
this->lhsp(lhsp);
|
||||
}
|
||||
explicit AstConsQueue(FileLine* fl, bool lhsIsValue, AstNode* lhsp, bool rhsIsValue,
|
||||
AstNode* rhsp)
|
||||
: ASTGEN_SUPER_ConsQueue(fl)
|
||||
, m_lhsIsValue(lhsIsValue)
|
||||
, m_rhsIsValue(rhsIsValue) {
|
||||
, m_lhsIsValue{lhsIsValue}
|
||||
, m_rhsIsValue{rhsIsValue} {
|
||||
this->lhsp(lhsp);
|
||||
this->rhsp(rhsp);
|
||||
}
|
||||
|
@ -1605,7 +1605,7 @@ public:
|
|||
AstLambdaArgRef(FileLine* fl, const string& name, bool index)
|
||||
: ASTGEN_SUPER_LambdaArgRef(fl)
|
||||
, m_name{name}
|
||||
, m_index(index) {}
|
||||
, m_index{index} {}
|
||||
bool sameNode(const AstNode* /*samep*/) const override { return true; }
|
||||
string emitVerilog() override { return name(); }
|
||||
string emitC() override { V3ERROR_NA_RETURN(""); }
|
||||
|
|
|
@ -510,7 +510,7 @@ public:
|
|||
AstNodeReadWriteMem(VNType t, FileLine* fl, bool hex, AstNodeExpr* filenamep,
|
||||
AstNodeExpr* memp, AstNodeExpr* lsbp, AstNodeExpr* msbp)
|
||||
: AstNodeStmt{t, fl}
|
||||
, m_isHex(hex) {
|
||||
, m_isHex{hex} {
|
||||
this->filenamep(filenamep);
|
||||
this->memp(memp);
|
||||
this->lsbp(lsbp);
|
||||
|
@ -1114,7 +1114,7 @@ class AstConstraint final : public AstNode {
|
|||
public:
|
||||
AstConstraint(FileLine* fl, const string& name, AstNode* itemsp)
|
||||
: ASTGEN_SUPER_Constraint(fl)
|
||||
, m_name(name) {
|
||||
, m_name{name} {
|
||||
addItemsp(itemsp);
|
||||
}
|
||||
ASTGEN_MEMBERS_AstConstraint;
|
||||
|
@ -1579,7 +1579,7 @@ public:
|
|||
AstPragma(FileLine* fl, VPragmaType pragType, const VTimescale& timescale)
|
||||
: ASTGEN_SUPER_Pragma(fl)
|
||||
, m_pragType{pragType}
|
||||
, m_timescale(timescale) {}
|
||||
, m_timescale{timescale} {}
|
||||
ASTGEN_MEMBERS_AstPragma;
|
||||
VPragmaType pragType() const { return m_pragType; } // *=type of the pragma
|
||||
bool isPredictOptimizable() const override { return false; }
|
||||
|
@ -2880,7 +2880,7 @@ class AstCReset final : public AstNodeStmt {
|
|||
public:
|
||||
AstCReset(FileLine* fl, AstVarRef* varrefp, bool constructing)
|
||||
: ASTGEN_SUPER_CReset(fl)
|
||||
, m_constructing(constructing) {
|
||||
, m_constructing{constructing} {
|
||||
this->varrefp(varrefp);
|
||||
}
|
||||
ASTGEN_MEMBERS_AstCReset;
|
||||
|
@ -3518,7 +3518,7 @@ class AstStop final : public AstNodeStmt {
|
|||
public:
|
||||
AstStop(FileLine* fl, bool isFatal)
|
||||
: ASTGEN_SUPER_Stop(fl)
|
||||
, m_isFatal(isFatal) {}
|
||||
, m_isFatal{isFatal} {}
|
||||
ASTGEN_MEMBERS_AstStop;
|
||||
void dump(std::ostream& str) const override;
|
||||
void dumpJson(std::ostream& str) const override;
|
||||
|
@ -4094,7 +4094,7 @@ public:
|
|||
explicit AstTextBlock(FileLine* fl, const string& textp = "", bool tracking = false,
|
||||
bool commas = false)
|
||||
: ASTGEN_SUPER_TextBlock(fl, textp, tracking)
|
||||
, m_commas(commas) {}
|
||||
, m_commas{commas} {}
|
||||
ASTGEN_MEMBERS_AstTextBlock;
|
||||
bool commas() const { return m_commas; }
|
||||
void commas(bool flag) { m_commas = flag; }
|
||||
|
|
|
@ -788,7 +788,7 @@ string AstVar::dpiTmpVarType(const string& varName) const {
|
|||
|
||||
public:
|
||||
explicit converter(const string& name)
|
||||
: m_name(name) {}
|
||||
: m_name{name} {}
|
||||
};
|
||||
return converter{varName}.convert(this);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class CUseVisitor final : public VNVisitorConst {
|
|||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit CUseVisitor(AstNodeModule* modp)
|
||||
: m_modp(modp) {
|
||||
: m_modp{modp} {
|
||||
iterateConst(modp);
|
||||
|
||||
for (auto& used : m_didUse) {
|
||||
|
|
|
@ -83,7 +83,7 @@ class CoverageVisitor final : public VNVisitor {
|
|||
CoverTerm(AstNodeExpr* exprp, bool objective, const string& emitV)
|
||||
: m_exprp{exprp}
|
||||
, m_objective{objective}
|
||||
, m_emitV(emitV) {}
|
||||
, m_emitV{emitV} {}
|
||||
};
|
||||
using CoverExpr = std::deque<CoverTerm>;
|
||||
using CoverExprs = std::list<CoverExpr>;
|
||||
|
|
|
@ -93,7 +93,7 @@ class EmitCLazyDecls final : public VNVisitorConst {
|
|||
|
||||
public:
|
||||
explicit EmitCLazyDecls(EmitCBaseVisitorConst& emitter)
|
||||
: m_emitter(emitter) {}
|
||||
: m_emitter{emitter} {}
|
||||
void emit(AstNode* nodep) {
|
||||
m_needsBlankLine = false;
|
||||
iterateChildrenConst(nodep);
|
||||
|
@ -1513,7 +1513,7 @@ public:
|
|||
} // LCOV_EXCL_STOP
|
||||
|
||||
EmitCFunc()
|
||||
: m_lazyDecls(*this) {}
|
||||
: m_lazyDecls{*this} {}
|
||||
EmitCFunc(AstNode* nodep, V3OutCFile* ofp, AstCFile* cfilep, bool trackText = false)
|
||||
: EmitCFunc{} {
|
||||
setOutputFile(ofp, cfilep);
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
static std::unordered_map<const ExecMTask*, MTaskState> mtaskState;
|
||||
|
||||
explicit ThreadSchedule(uint32_t nThreads)
|
||||
: m_id(s_nextId++)
|
||||
: m_id{s_nextId++}
|
||||
, threads{nThreads} {}
|
||||
ThreadSchedule(ThreadSchedule&&) = default;
|
||||
ThreadSchedule& operator=(ThreadSchedule&&) = default;
|
||||
|
|
|
@ -211,7 +211,7 @@ public:
|
|||
LinkDotState(AstNetlist* rootp, VLinkDotStep step)
|
||||
: m_syms{rootp}
|
||||
, m_mods{rootp}
|
||||
, m_step(step) {
|
||||
, m_step{step} {
|
||||
UINFO(4, __FUNCTION__ << ": ");
|
||||
s_errorThisp = this;
|
||||
V3Error::errorExitCb(preErrorDumpHandler); // If get error, dump self
|
||||
|
|
|
@ -276,7 +276,7 @@ class CodeMotionAnalysisVisitor final : public VNVisitorConst {
|
|||
|
||||
// CONSTRUCTOR
|
||||
CodeMotionAnalysisVisitor(AstNode* nodep, StmtPropertiesAllocator& stmtProperties)
|
||||
: m_stmtProperties(stmtProperties) {
|
||||
: m_stmtProperties{stmtProperties} {
|
||||
iterateAndNextConstNull(nodep);
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ class CodeMotionOptimizeVisitor final : public VNVisitor {
|
|||
|
||||
// CONSTRUCTOR
|
||||
CodeMotionOptimizeVisitor(AstNode* nodep, const StmtPropertiesAllocator& stmtProperties)
|
||||
: m_stmtProperties(stmtProperties) {
|
||||
: m_stmtProperties{stmtProperties} {
|
||||
// We assert the given node is at the head of the list otherwise we might move a node
|
||||
// before the given node. This is easy to fix in the above iteration with a check on a
|
||||
// boundary node we should not move past, if we ever need to do so.
|
||||
|
|
|
@ -153,7 +153,7 @@ public:
|
|||
|
||||
// CONSTRUCTORS
|
||||
explicit AppendHelper(V3OptionParser& parser)
|
||||
: m_parser(parser) {}
|
||||
: m_parser{parser} {}
|
||||
};
|
||||
|
||||
#define V3OPTION_PARSER_DECL_TAGS \
|
||||
|
|
|
@ -1206,9 +1206,9 @@ class CaptureVisitor final : public VNVisitor {
|
|||
|
||||
public:
|
||||
explicit CaptureVisitor(AstNode* const nodep, AstNodeModule* callerp, AstClass* const targetp)
|
||||
: m_argsp(nullptr)
|
||||
, m_callerp(callerp)
|
||||
, m_targetp(targetp) {
|
||||
: m_argsp{nullptr}
|
||||
, m_callerp{callerp}
|
||||
, m_targetp{targetp} {
|
||||
iterateAndNextNull(nodep);
|
||||
}
|
||||
|
||||
|
@ -2355,7 +2355,7 @@ class RandomizeVisitor final : public VNVisitor {
|
|||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit RandomizeVisitor(AstNetlist* nodep)
|
||||
: m_inlineUniqueNames("__Vrandwith") {
|
||||
: m_inlineUniqueNames{"__Vrandwith"} {
|
||||
createRandomizeClassVars(nodep);
|
||||
iterate(nodep);
|
||||
nodep->foreach([&](AstConstraint* constrp) {
|
||||
|
|
|
@ -46,12 +46,12 @@ class VSymEnt final {
|
|||
using IdNameMap = std::multimap<std::string, VSymEnt*>;
|
||||
IdNameMap m_idNameMap; // Hash of variables by name
|
||||
AstNode* m_nodep; // Node that entry belongs to
|
||||
VSymEnt* m_fallbackp; // Table "above" this one in name scope, for fallback resolution
|
||||
VSymEnt* m_parentp; // Table that created this table, dot notation needed to resolve into it
|
||||
AstNodeModule* m_classOrPackagep; // Package node is in (for V3LinkDot, unused here)
|
||||
VSymEnt* m_fallbackp = nullptr; // Table "above" this in name scope, for fallback resolution
|
||||
VSymEnt* m_parentp = nullptr; // Table that created this
|
||||
AstNodeModule* m_classOrPackagep = nullptr; // Package node is in (for V3LinkDot, unused here)
|
||||
string m_symPrefix; // String to prefix symbols with (for V3LinkDot, unused here)
|
||||
bool m_exported; // Allow importing
|
||||
bool m_imported; // Was imported
|
||||
bool m_exported = true; // Allow importing
|
||||
bool m_imported = false; // Was imported
|
||||
#ifdef VL_DEBUG
|
||||
VL_DEFINE_DEBUG_FUNCTIONS;
|
||||
#else
|
||||
|
@ -68,6 +68,11 @@ public:
|
|||
<< std::setw(0) << std::right;
|
||||
os << " se" << cvtToHex(this) << std::setw(0);
|
||||
os << " fallb=se" << cvtToHex(m_fallbackp);
|
||||
if (m_imported || m_exported) {
|
||||
os << " ";
|
||||
if (m_imported) os << "[I]";
|
||||
if (m_exported) os << "[E]";
|
||||
}
|
||||
if (m_symPrefix != "") os << " symPrefix=" << m_symPrefix;
|
||||
if (nodep()) os << " n=" << nodep();
|
||||
os << '\n';
|
||||
|
@ -332,25 +337,20 @@ protected:
|
|||
//######################################################################
|
||||
|
||||
inline VSymEnt::VSymEnt(VSymGraph* graphp, AstNode* nodep)
|
||||
: m_nodep(nodep) {
|
||||
: m_nodep{nodep} {
|
||||
// No argument to set fallbackp, as generally it's wrong to set it in the new call,
|
||||
// Instead it needs to be set on a "findOrNew()" return, as it may have been new'ed
|
||||
// by an earlier search insertion.
|
||||
m_fallbackp = nullptr;
|
||||
m_parentp = nullptr;
|
||||
m_classOrPackagep = nullptr;
|
||||
m_exported = true;
|
||||
m_imported = false;
|
||||
graphp->pushNewEnt(this);
|
||||
}
|
||||
|
||||
inline VSymEnt::VSymEnt(VSymGraph* graphp, const VSymEnt* symp)
|
||||
: m_nodep(symp->m_nodep) {
|
||||
m_fallbackp = symp->m_fallbackp;
|
||||
m_parentp = symp->m_parentp;
|
||||
m_classOrPackagep = symp->m_classOrPackagep;
|
||||
m_exported = symp->m_exported;
|
||||
m_imported = symp->m_imported;
|
||||
: m_nodep{symp->m_nodep}
|
||||
, m_fallbackp{symp->m_fallbackp}
|
||||
, m_parentp{symp->m_parentp}
|
||||
, m_classOrPackagep{symp->m_classOrPackagep}
|
||||
, m_exported{symp->m_exported}
|
||||
, m_imported{symp->m_imported} {
|
||||
graphp->pushNewEnt(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class UndrivenVarEntry final {
|
|||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit UndrivenVarEntry(AstVar* varp)
|
||||
: m_varp(varp) { // Construction for when a var is used
|
||||
: m_varp{varp} { // Construction for when a var is used
|
||||
UINFO(9, "create " << varp);
|
||||
m_wholeFlags.resize(FLAGS_PER_BIT);
|
||||
for (int i = 0; i < FLAGS_PER_BIT; i++) m_wholeFlags[i] = false;
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
V3UniqueNames() = default;
|
||||
explicit V3UniqueNames(const std::string& prefix, bool addSuffix = true)
|
||||
: m_prefix{prefix}
|
||||
, m_addSuffix(addSuffix) {
|
||||
, m_addSuffix{addSuffix} {
|
||||
if (!m_prefix.empty()) {
|
||||
UASSERT(VString::startsWith(m_prefix, "__V"), "Prefix must start with '__V'");
|
||||
UASSERT(!VString::endsWith(m_prefix, "_"), "Prefix must not end with '_'");
|
||||
|
|
Loading…
Reference in New Issue