Internal member initialization. No functional change intended.

This commit is contained in:
Wilson Snyder 2020-11-15 15:40:35 -05:00
parent e74cc32f2d
commit f6f7684ccd
12 changed files with 39 additions and 72 deletions

View File

@ -268,8 +268,8 @@ protected:
// MEMBERS // MEMBERS
union VerilatedImpU { ///< Enclose in an union to call ctor/dtor manually union VerilatedImpU { ///< Enclose in an union to call ctor/dtor manually
VerilatedImpData v; VerilatedImpData v;
VerilatedImpU() {} VerilatedImpU() {} // Can't be = default;
~VerilatedImpU() {} ~VerilatedImpU() {} // Can't be = default;
}; };
static VerilatedImpU s_s; ///< Static Singleton; One and only static this static VerilatedImpU s_s; ///< Static Singleton; One and only static this

View File

@ -37,15 +37,13 @@
// See also V3Ast::VNumRange // See also V3Ast::VNumRange
class VerilatedRange { class VerilatedRange {
int m_left; int m_left = 0;
int m_right; int m_right = 0;
protected: protected:
friend class VerilatedVarProps; friend class VerilatedVarProps;
friend class VerilatedScope; friend class VerilatedScope;
VerilatedRange() VerilatedRange() {}
: m_left{0}
, m_right{0} {}
VerilatedRange(int left, int right) VerilatedRange(int left, int right)
: m_left{left} : m_left{left}
, m_right{right} {} , m_right{right} {}

View File

@ -211,7 +211,7 @@ public:
class VerilatedVpioVar : public VerilatedVpio { class VerilatedVpioVar : public VerilatedVpio {
const VerilatedVar* m_varp; const VerilatedVar* m_varp;
const VerilatedScope* m_scopep; const VerilatedScope* m_scopep;
vluint8_t* m_prevDatap; // Previous value of data, for cbValueChange vluint8_t* m_prevDatap = nullptr; // Previous value of data, for cbValueChange
union { union {
vluint8_t u8[4]; vluint8_t u8[4];
vluint32_t u32; vluint32_t u32;
@ -219,7 +219,7 @@ class VerilatedVpioVar : public VerilatedVpio {
vluint32_t m_entSize; // memoized variable size vluint32_t m_entSize; // memoized variable size
protected: protected:
void* m_varDatap; // varp()->datap() adjusted for array entries void* m_varDatap; // varp()->datap() adjusted for array entries
vlsint32_t m_index; vlsint32_t m_index = 0;
const VerilatedRange& get_range() const { const VerilatedRange& get_range() const {
// Determine number of dimensions and return outermost // Determine number of dimensions and return outermost
return (m_varp->dims() > 1) ? m_varp->unpacked() : m_varp->packed(); return (m_varp->dims() > 1) ? m_varp->unpacked() : m_varp->packed();
@ -228,9 +228,7 @@ protected:
public: public:
VerilatedVpioVar(const VerilatedVar* varp, const VerilatedScope* scopep) VerilatedVpioVar(const VerilatedVar* varp, const VerilatedScope* scopep)
: m_varp{varp} : m_varp{varp}
, m_scopep{scopep} , m_scopep{scopep} {
, m_index{0} {
m_prevDatap = nullptr;
m_mask.u32 = VL_MASK_I(varp->packed().elements()); m_mask.u32 = VL_MASK_I(varp->packed().elements());
m_entSize = varp->entSize(); m_entSize = varp->entSize();
m_varDatap = varp->datap(); m_varDatap = varp->datap();

View File

@ -977,8 +977,8 @@ inline std::ostream& operator<<(std::ostream& os, const VParseRefExp& rhs) {
class VNumRange { class VNumRange {
public: public:
int m_hi; // HI part, HI always >= LO int m_hi = 0; // HI part, HI always >= LO
int m_lo; // LO int m_lo = 0; // LO
union { union {
int mu_flags; int mu_flags;
struct { struct {
@ -1001,19 +1001,13 @@ public:
// //
class LeftRight {}; class LeftRight {};
VNumRange() VNumRange()
: m_hi{0} : mu_flags{0} {}
, m_lo{0}
, mu_flags{0} {}
VNumRange(int hi, int lo, bool littleEndian) VNumRange(int hi, int lo, bool littleEndian)
: m_hi{0} : mu_flags{0} {
, m_lo{0}
, mu_flags{0} {
init(hi, lo, littleEndian); init(hi, lo, littleEndian);
} }
VNumRange(LeftRight, int left, int right) VNumRange(LeftRight, int left, int right)
: m_hi{0} : mu_flags{0} {
, m_lo{0}
, mu_flags{0} {
init((right > left) ? right : left, (right > left) ? left : right, (right > left)); init((right > left) ? right : left, (right > left) ? left : right, (right > left));
} }
~VNumRange() {} ~VNumRange() {}

View File

@ -5348,7 +5348,7 @@ public:
class AstRand : public AstNodeTermop { class AstRand : public AstNodeTermop {
// Return a random number, based upon width() // Return a random number, based upon width()
private: private:
bool m_reset; // Random reset, versus always random bool m_reset = false; // Random reset, versus always random
public: public:
AstRand(FileLine* fl, AstNodeDType* dtp, bool reset) AstRand(FileLine* fl, AstNodeDType* dtp, bool reset)
: ASTGEN_SUPER(fl) : ASTGEN_SUPER(fl)
@ -5356,8 +5356,7 @@ public:
dtypep(dtp); dtypep(dtp);
} }
explicit AstRand(FileLine* fl) explicit AstRand(FileLine* fl)
: ASTGEN_SUPER(fl) : ASTGEN_SUPER(fl) {}
, m_reset{false} {}
ASTNODE_NODE_FUNCS(Rand) ASTNODE_NODE_FUNCS(Rand)
virtual string emitVerilog() override { return "%f$random"; } virtual string emitVerilog() override { return "%f$random"; }
virtual string emitC() override { virtual string emitC() override {

View File

@ -67,13 +67,12 @@ class V3FileDependImp {
class DependFile { class DependFile {
// A single file // A single file
bool m_target; // True if write, else read bool m_target; // True if write, else read
bool m_exists; bool m_exists = true;
string m_filename; // Filename string m_filename; // Filename
struct stat m_stat; // Stat information struct stat m_stat; // Stat information
public: public:
DependFile(const string& filename, bool target) DependFile(const string& filename, bool target)
: m_target{target} : m_target{target}
, m_exists{true}
, m_filename{filename} { , m_filename{filename} {
m_stat.st_ctime = 0; m_stat.st_ctime = 0;
m_stat.st_mtime = 0; m_stat.st_mtime = 0;

View File

@ -143,14 +143,7 @@ std::ostream& operator<<(std::ostream& os, VFileContent* contentp) {
// FileLine class functions // FileLine class functions
// Sort of a singleton // Sort of a singleton
FileLine::FileLine(FileLine::EmptySecret) FileLine::FileLine(FileLine::EmptySecret) {
: m_firstLineno{0}
, m_firstColumn{0}
, m_lastLineno{0}
, m_lastColumn{0}
, m_contentLineno{0}
, m_contentp{nullptr}
, m_parent{nullptr} {
m_filenameno = singleton().nameToNumber(FileLine::builtInFilename()); m_filenameno = singleton().nameToNumber(FileLine::builtInFilename());
m_warnOn = 0; m_warnOn = 0;

View File

@ -93,16 +93,16 @@ class FileLine {
// MEMBERS // MEMBERS
// Columns here means number of chars from beginning (i.e. tabs count as one) // Columns here means number of chars from beginning (i.e. tabs count as one)
int m_firstLineno; // `line corrected token's first line number int m_firstLineno = 0; // `line corrected token's first line number
int m_firstColumn; // `line corrected token's first column number int m_firstColumn = 0; // `line corrected token's first column number
int m_lastLineno; // `line corrected token's last line number int m_lastLineno = 0; // `line corrected token's last line number
int m_lastColumn; // `line corrected token's last column number int m_lastColumn = 0; // `line corrected token's last column number
int m_filenameno; // `line corrected filename number int m_filenameno; // `line corrected filename number
int m_contentLineno; // Line number within source stream int m_contentLineno = 0; // Line number within source stream
VFileContent* m_contentp; // Source text contents line is within VFileContent* m_contentp = nullptr; // Source text contents line is within
FileLine* m_parent; // Parent line that included this line FileLine* m_parent = nullptr; // Parent line that included this line
std::bitset<V3ErrorCode::_ENUM_MAX> m_warnOn; std::bitset<V3ErrorCode::_ENUM_MAX> m_warnOn;
bool m_waive; // Waive warning bool m_waive = false; // Waive warning
protected: protected:
// User routines should never need to change line numbers // User routines should never need to change line numbers
@ -126,16 +126,8 @@ private:
public: public:
explicit FileLine(const string& filename) explicit FileLine(const string& filename)
: m_firstLineno{0} : m_filenameno{singleton().nameToNumber(filename)}
, m_firstColumn{0} , m_warnOn{defaultFileLine().m_warnOn} {}
, m_lastLineno{0}
, m_lastColumn{0}
, m_filenameno{singleton().nameToNumber(filename)}
, m_contentLineno{0}
, m_contentp{nullptr}
, m_parent{nullptr}
, m_warnOn{defaultFileLine().m_warnOn}
, m_waive{false} {}
explicit FileLine(FileLine* fromp) explicit FileLine(FileLine* fromp)
: m_firstLineno{fromp->m_firstLineno} : m_firstLineno{fromp->m_firstLineno}
, m_firstColumn{fromp->m_firstColumn} , m_firstColumn{fromp->m_firstColumn}

View File

@ -51,8 +51,7 @@ struct GraphPCNode {
// GraphPathChecker implementation // GraphPathChecker implementation
GraphPathChecker::GraphPathChecker(const V3Graph* graphp, V3EdgeFuncP edgeFuncp) GraphPathChecker::GraphPathChecker(const V3Graph* graphp, V3EdgeFuncP edgeFuncp)
: GraphAlg<const V3Graph>{graphp, edgeFuncp} : GraphAlg<const V3Graph>{graphp, edgeFuncp} {
, m_generation{0} {
for (V3GraphVertex* vxp = graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { for (V3GraphVertex* vxp = graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) {
// Setup tracking structure for each node. If delete a vertex // Setup tracking structure for each node. If delete a vertex
// there would be a leak, but ok as accept only const V3Graph*'s. // there would be a leak, but ok as accept only const V3Graph*'s.

View File

@ -34,7 +34,7 @@ class GraphPathChecker : GraphAlg<const V3Graph> {
// the graph. Each node is marked with the last generation that scanned // the graph. Each node is marked with the last generation that scanned
// it, to enable asserting there are no cycles, and to avoid recursing // it, to enable asserting there are no cycles, and to avoid recursing
// through the same node twice while searching for a path. // through the same node twice while searching for a path.
vluint64_t m_generation; vluint64_t m_generation = 0;
public: public:
// CONSTRUCTORS // CONSTRUCTORS

View File

@ -124,7 +124,7 @@ public:
class OrderEitherVertex : public V3GraphVertex { class OrderEitherVertex : public V3GraphVertex {
AstScope* m_scopep; // Scope the vertex is in AstScope* m_scopep; // Scope the vertex is in
AstSenTree* m_domainp; // Clock domain (nullptr = to be computed as we iterate) AstSenTree* m_domainp; // Clock domain (nullptr = to be computed as we iterate)
bool m_isFromInput; // From input, or derived therefrom (conservatively false) bool m_isFromInput = false; // From input, or derived therefrom (conservatively false)
protected: protected:
OrderEitherVertex(V3Graph* graphp, const OrderEitherVertex& old) OrderEitherVertex(V3Graph* graphp, const OrderEitherVertex& old)
: V3GraphVertex{graphp, old} : V3GraphVertex{graphp, old}
@ -136,8 +136,7 @@ public:
OrderEitherVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp) OrderEitherVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp)
: V3GraphVertex{graphp} : V3GraphVertex{graphp}
, m_scopep{scopep} , m_scopep{scopep}
, m_domainp{domainp} , m_domainp{domainp} {}
, m_isFromInput{false} {}
virtual ~OrderEitherVertex() override {} virtual ~OrderEitherVertex() override {}
virtual OrderEitherVertex* clone(V3Graph* graphp) const override = 0; virtual OrderEitherVertex* clone(V3Graph* graphp) const override = 0;
// Methods // Methods
@ -200,8 +199,8 @@ public:
class OrderVarVertex : public OrderEitherVertex { class OrderVarVertex : public OrderEitherVertex {
AstVarScope* m_varScp; AstVarScope* m_varScp;
bool m_isClock; // Used as clock bool m_isClock = false; // Used as clock
bool m_isDelayed; // Set in a delayed assignment bool m_isDelayed = false; // Set in a delayed assignment
protected: protected:
OrderVarVertex(V3Graph* graphp, const OrderVarVertex& old) OrderVarVertex(V3Graph* graphp, const OrderVarVertex& old)
: OrderEitherVertex{graphp, old} : OrderEitherVertex{graphp, old}
@ -212,9 +211,7 @@ protected:
public: public:
OrderVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) OrderVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp)
: OrderEitherVertex{graphp, scopep, nullptr} : OrderEitherVertex{graphp, scopep, nullptr}
, m_varScp{varScp} , m_varScp{varScp} {}
, m_isClock{false}
, m_isDelayed{false} {}
virtual ~OrderVarVertex() override {} virtual ~OrderVarVertex() override {}
virtual OrderVarVertex* clone(V3Graph* graphp) const override = 0; virtual OrderVarVertex* clone(V3Graph* graphp) const override = 0;
virtual OrderVEdgeType type() const override = 0; virtual OrderVEdgeType type() const override = 0;

View File

@ -28,12 +28,11 @@ class AstNetlist;
class VDouble0 { class VDouble0 {
// Double counter, initializes to zero for easy use // Double counter, initializes to zero for easy use
double m_d; ///< Count of occurrences/ value double m_d = 0.0; ///< Count of occurrences/ value
public: public:
// METHODS // METHODS
VDouble0() VDouble0() = default;
: m_d{0.0} {} ~VDouble0() = default;
~VDouble0() {}
// Implicit conversion operators: // Implicit conversion operators:
explicit VDouble0(const vluint64_t v) explicit VDouble0(const vluint64_t v)
@ -73,7 +72,7 @@ class V3Statistic {
string m_stage; ///< Runtime stage string m_stage; ///< Runtime stage
bool m_sumit; ///< Do summation of similar stats bool m_sumit; ///< Do summation of similar stats
bool m_perf; ///< Performance section bool m_perf; ///< Performance section
bool m_printit; ///< Print the results bool m_printit = true; ///< Print the results
public: public:
// METHODS // METHODS
string stage() const { return m_stage; } string stage() const { return m_stage; }
@ -94,8 +93,7 @@ public:
, m_count{count} , m_count{count}
, m_stage{stage} , m_stage{stage}
, m_sumit{sumit} , m_sumit{sumit}
, m_perf{perf} , m_perf{perf} {}
, m_printit{true} {}
virtual ~V3Statistic() {} virtual ~V3Statistic() {}
}; };