Internals: Fix some clang-tidy issues. No functional change intended.

This commit is contained in:
Wilson Snyder 2022-07-30 11:52:35 -04:00
parent dce8f3d25d
commit a2d26b45bb
34 changed files with 160 additions and 165 deletions

View File

@ -322,12 +322,13 @@ cppcheck: $(CPPCHECK_DEP)
$(CPPCHECK) $(CPPCHECK_FLAGS) -DVL_DEBUG=1 -DVL_CPPCHECK=1 -DVL_THREADED=1 $(CPPCHECK_INC) $< $(CPPCHECK) $(CPPCHECK_FLAGS) -DVL_DEBUG=1 -DVL_CPPCHECK=1 -DVL_THREADED=1 $(CPPCHECK_INC) $<
CLANGTIDY = clang-tidy CLANGTIDY = clang-tidy
CLANGTIDY_FLAGS = -config='' -checks='-fuchsia-*,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-init-variables' CLANGTIDY_FLAGS = -config='' \
-header-filter='.*' \
-checks='-fuchsia-*,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-init-variables,-cppcoreguidelines-avoid-goto,-modernize-avoid-c-arrays,-readability-magic-numbers,-readability-simplify-boolean-expr,-cppcoreguidelines-macro-usage' \
CLANGTIDY_DEP = $(subst .h,.h.tidy,$(CPPCHECK_H)) \ CLANGTIDY_DEP = $(subst .h,.h.tidy,$(CPPCHECK_H)) \
$(subst .cpp,.cpp.tidy,$(CPPCHECK_CPP)) $(subst .cpp,.cpp.tidy,$(CPPCHECK_CPP))
CLANGTIDY_DEFS = -DVL_DEBUG=1 -DVL_THREADED=1 -DVL_CPPCHECK=1 CLANGTIDY_DEFS = -DVL_DEBUG=1 -DVL_THREADED=1 -DVL_CPPCHECK=1
# cppcoreguidelines-avoid-goto modernize-avoid-c-arrays readability-magic-numbers readability-simplify-boolean-expr
# cppcoreguidelines-macro-usage
clang-tidy: $(CLANGTIDY_DEP) clang-tidy: $(CLANGTIDY_DEP)
%.cpp.tidy: %.cpp %.cpp.tidy: %.cpp

View File

@ -700,7 +700,8 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
= VL_EXTEND_WQ(b, 0, tmp2, std::numeric_limits<uint64_t>::max()); // breaks shifted = VL_EXTEND_WQ(b, 0, tmp2, std::numeric_limits<uint64_t>::max()); // breaks shifted
if (VL_GT_W(w, integer, max64Bit)) { if (VL_GT_W(w, integer, max64Bit)) {
WDataOutP v = VL_ASSIGN_W(b, tmp3, integer); // breaks fracDigitsPow10 WDataOutP v = VL_ASSIGN_W(b, tmp3, integer); // breaks fracDigitsPow10
VlWide<w> zero, ten; VlWide<w> zero;
VlWide<w> ten;
VL_ZERO_W(b, zero); VL_ZERO_W(b, zero);
VL_EXTEND_WI(b, 0, ten, 10); VL_EXTEND_WI(b, 0, ten, 10);
char buf[128]; // 128B is obviously long enough to represent 128bit integer in decimal char buf[128]; // 128B is obviously long enough to represent 128bit integer in decimal
@ -1850,8 +1851,7 @@ VlReadMem::VlReadMem(bool hex, int bits, const std::string& filename, QData star
, m_bits{bits} , m_bits{bits}
, m_filename(filename) // Need () or GCC 4.8 false warning , m_filename(filename) // Need () or GCC 4.8 false warning
, m_end{end} , m_end{end}
, m_addr{start} , m_addr{start} {
, m_linenum{0} {
m_fp = std::fopen(filename.c_str(), "r"); m_fp = std::fopen(filename.c_str(), "r");
if (VL_UNLIKELY(!m_fp)) { if (VL_UNLIKELY(!m_fp)) {
// We don't report the Verilog source filename as it slow to have to pass it down // We don't report the Verilog source filename as it slow to have to pass it down
@ -1985,8 +1985,7 @@ void VlReadMem::setData(void* valuep, const std::string& rhs) {
VlWriteMem::VlWriteMem(bool hex, int bits, const std::string& filename, QData start, QData end) VlWriteMem::VlWriteMem(bool hex, int bits, const std::string& filename, QData start, QData end)
: m_hex{hex} : m_hex{hex}
, m_bits{bits} , m_bits{bits} {
, m_addr{0} {
if (VL_UNLIKELY(start > end)) { if (VL_UNLIKELY(start > end)) {
VL_FATAL_MT(filename.c_str(), 0, "", "$writemem invalid address range"); VL_FATAL_MT(filename.c_str(), 0, "", "$writemem invalid address range");
return; return;
@ -2311,7 +2310,7 @@ std::string VerilatedContext::dumpfile() const VL_MT_SAFE_EXCLUDES(m_timeDumpMut
return m_dumpfile; return m_dumpfile;
} }
std::string VerilatedContext::dumpfileCheck() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex) { std::string VerilatedContext::dumpfileCheck() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex) {
const std::string out = dumpfile(); std::string out = dumpfile();
if (VL_UNLIKELY(out.empty())) { if (VL_UNLIKELY(out.empty())) {
VL_PRINTF_MT("%%Warning: $dumpvar ignored as not proceeded by $dumpfile\n"); VL_PRINTF_MT("%%Warning: $dumpvar ignored as not proceeded by $dumpfile\n");
return ""; return "";

View File

@ -558,7 +558,8 @@ public:
/// releases - contact the authors before production use. /// releases - contact the authors before production use.
void scopesDump() const VL_MT_SAFE; void scopesDump() const VL_MT_SAFE;
public: // But for internal use only // METHODS - public but for internal use only
// Internal: access to implementation class // Internal: access to implementation class
VerilatedContextImp* impp() { return reinterpret_cast<VerilatedContextImp*>(this); } VerilatedContextImp* impp() { return reinterpret_cast<VerilatedContextImp*>(this); }
const VerilatedContextImp* impp() const { const VerilatedContextImp* impp() const {
@ -884,7 +885,6 @@ public:
} }
#endif #endif
public:
// METHODS - INTERNAL USE ONLY (but public due to what uses it) // METHODS - INTERNAL USE ONLY (but public due to what uses it)
// Internal: Create a new module name by concatenating two strings // Internal: Create a new module name by concatenating two strings
// Returns pointer to thread-local static data (overwritten on next call) // Returns pointer to thread-local static data (overwritten on next call)

View File

@ -205,7 +205,7 @@ private:
// Forward to . so we have a whole word // Forward to . so we have a whole word
const std::string suffix = *bpost ? std::string{bpost + 1} : ""; const std::string suffix = *bpost ? std::string{bpost + 1} : "";
const std::string out = prefix + "*" + suffix; std::string out = prefix + "*" + suffix;
// cout << "\nch pre="<<prefix<<" s="<<suffix<<"\nch a="<<old<<"\nch b="<<add // cout << "\nch pre="<<prefix<<" s="<<suffix<<"\nch a="<<old<<"\nch b="<<add
// <<"\ncho="<<out<<endl; // <<"\ncho="<<out<<endl;

View File

@ -120,7 +120,8 @@ public:
/// Zero coverage points /// Zero coverage points
void zero() VL_MT_SAFE; void zero() VL_MT_SAFE;
public: // But Internal use only // METHODS - public but Internal use only
// Insert a coverage item // Insert a coverage item
// We accept from 1-30 key/value pairs, all as strings. // We accept from 1-30 key/value pairs, all as strings.
// Call _insert1, followed by _insert2 and _insert3 // Call _insert1, followed by _insert2 and _insert3
@ -158,7 +159,7 @@ protected:
// CONSTRUCTORS // CONSTRUCTORS
// Internal: Only made as part of VerilatedCovImp // Internal: Only made as part of VerilatedCovImp
VerilatedCovContext() = default; VerilatedCovContext() = default;
virtual ~VerilatedCovContext() = default; ~VerilatedCovContext() override = default;
// METHODS // METHODS
// Internal: access to implementation class // Internal: access to implementation class

View File

@ -92,8 +92,7 @@ static_assert(static_cast<int>(FST_ST_VCD_PROGRAM) == static_cast<int>(VLT_TRACE
//============================================================================= //=============================================================================
// VerilatedFst // VerilatedFst
VerilatedFst::VerilatedFst(void* fst) VerilatedFst::VerilatedFst(void* /*fst*/) {}
: m_fst{fst} {}
VerilatedFst::~VerilatedFst() { VerilatedFst::~VerilatedFst() {
if (m_fst) fstWriterClose(m_fst); if (m_fst) fstWriterClose(m_fst);

View File

@ -48,7 +48,7 @@ private:
//========================================================================= //=========================================================================
// FST specific internals // FST specific internals
void* m_fst; void* m_fst = nullptr;
std::map<uint32_t, fstHandle> m_code2symbol; std::map<uint32_t, fstHandle> m_code2symbol;
std::map<int, fstEnumHandle> m_local2fstdtype; std::map<int, fstEnumHandle> m_local2fstdtype;
std::list<std::string> m_curScope; std::list<std::string> m_curScope;

View File

@ -51,7 +51,7 @@ public:
} }
spTrace()->set_time_resolution(sc_get_time_resolution().to_string()); spTrace()->set_time_resolution(sc_get_time_resolution().to_string());
} }
virtual ~VerilatedFstSc() { close(); } ~VerilatedFstSc() override { close(); }
// METHODS // METHODS
/// Called by SystemC simulate() /// Called by SystemC simulate()

View File

@ -143,11 +143,10 @@ class VerilatedThreadMsgQueue final {
public: public:
// CONSTRUCTORS // CONSTRUCTORS
VerilatedThreadMsgQueue() {} VerilatedThreadMsgQueue() = default;
~VerilatedThreadMsgQueue() { ~VerilatedThreadMsgQueue() = default;
// The only call of this with a non-empty queue is a fatal error. // The only call of destructor with a non-empty queue is a fatal error.
// So this does not flush the queue, as the destination queue is not known to this class. // So this does not flush the queue, as the destination queue is not known to this class.
}
private: private:
VL_UNCOPYABLE(VerilatedThreadMsgQueue); VL_UNCOPYABLE(VerilatedThreadMsgQueue);
@ -188,11 +187,11 @@ class VerilatedFpList final {
public: public:
using const_iterator = FILE* const*; using const_iterator = FILE* const*;
explicit VerilatedFpList() {} explicit VerilatedFpList() = default;
const_iterator begin() const { return m_fp; } const_iterator begin() const { return m_fp; }
const_iterator end() const { return m_fp + m_sz; } const_iterator end() const { return m_fp + m_sz; }
std::size_t size() const { return m_sz; } std::size_t size() const { return m_sz; }
std::size_t capacity() const { return 31; } static std::size_t capacity() { return 31; }
void push_back(FILE* fd) { void push_back(FILE* fd) {
if (VL_LIKELY(size() < capacity())) m_fp[m_sz++] = fd; if (VL_LIKELY(size() < capacity())) m_fp[m_sz++] = fd;
} }
@ -236,12 +235,11 @@ class VerilatedContextImp final : VerilatedContext {
return s_s; return s_s;
} }
private: public: // But only for verilated*.cpp
// CONSTRUCTORS - no data can live here, use only VerilatedContext // CONSTRUCTORS - no data can live here, use only VerilatedContext
VerilatedContextImp() = delete; VerilatedContextImp() = delete;
~VerilatedContextImp() = delete; ~VerilatedContextImp() = delete;
public: // But only for verilated*.cpp
// METHODS - extending into VerilatedContext, call via impp()-> // METHODS - extending into VerilatedContext, call via impp()->
// Random seed handling // Random seed handling
@ -272,13 +270,12 @@ public: // But only for verilated*.cpp
std::string argPlusMatch(const char* prefixp) VL_MT_SAFE_EXCLUDES(m_argMutex); std::string argPlusMatch(const char* prefixp) VL_MT_SAFE_EXCLUDES(m_argMutex);
std::pair<int, char**> argc_argv() VL_MT_SAFE_EXCLUDES(m_argMutex); std::pair<int, char**> argc_argv() VL_MT_SAFE_EXCLUDES(m_argMutex);
public: // But only for verilated*.cpp // METHODS - scope name - INTERNAL only for verilated*.cpp
// METHODS - scope name
void scopeInsert(const VerilatedScope* scopep) VL_MT_SAFE; void scopeInsert(const VerilatedScope* scopep) VL_MT_SAFE;
void scopeErase(const VerilatedScope* scopep) VL_MT_SAFE; void scopeErase(const VerilatedScope* scopep) VL_MT_SAFE;
public: // But only for verilated*.cpp // METHODS - file IO - INTERNAL only for verilated*.cpp
// METHODS - file IO
IData fdNewMcd(const char* filenamep) VL_MT_SAFE_EXCLUDES(m_fdMutex) { IData fdNewMcd(const char* filenamep) VL_MT_SAFE_EXCLUDES(m_fdMutex) {
const VerilatedLockGuard lock{m_fdMutex}; const VerilatedLockGuard lock{m_fdMutex};
if (m_fdFreeMct.empty()) return 0; if (m_fdFreeMct.empty()) return 0;
@ -298,7 +295,7 @@ public: // But only for verilated*.cpp
const std::size_t start = std::max<std::size_t>(31UL + 1UL + 3UL, m_fdps.size()); const std::size_t start = std::max<std::size_t>(31UL + 1UL + 3UL, m_fdps.size());
const std::size_t excess = 10; const std::size_t excess = 10;
m_fdps.resize(start + excess); m_fdps.resize(start + excess);
std::fill(m_fdps.begin() + start, m_fdps.end(), (FILE*)0); std::fill(m_fdps.begin() + start, m_fdps.end(), static_cast<FILE*>(nullptr));
m_fdFree.resize(excess); m_fdFree.resize(excess);
for (std::size_t i = 0, id = start; i < m_fdFree.size(); ++i, ++id) { for (std::size_t i = 0, id = start; i < m_fdFree.size(); ++i, ++id) {
m_fdFree[i] = id; m_fdFree[i] = id;
@ -344,7 +341,7 @@ public: // But only for verilated*.cpp
if (VL_UNLIKELY(idx <= 2)) return; // stdout/stdin/stderr if (VL_UNLIKELY(idx <= 2)) return; // stdout/stdin/stderr
if (VL_UNLIKELY(!m_fdps[idx])) return; // Already free if (VL_UNLIKELY(!m_fdps[idx])) return; // Already free
std::fclose(m_fdps[idx]); std::fclose(m_fdps[idx]);
m_fdps[idx] = (FILE*)0; m_fdps[idx] = nullptr;
m_fdFree.push_back(idx); m_fdFree.push_back(idx);
} else { } else {
// MCD case // MCD case
@ -464,7 +461,6 @@ public:
// METHODS - debug // METHODS - debug
static void versionDump() VL_MT_SAFE; static void versionDump() VL_MT_SAFE;
public:
// METHODS - user scope tracking // METHODS - user scope tracking
// We implement this as a single large map instead of one map per scope. // We implement this as a single large map instead of one map per scope.
// There's often many more scopes than userdata's and thus having a ~48byte // There's often many more scopes than userdata's and thus having a ~48byte
@ -486,7 +482,8 @@ public:
return it->second; return it->second;
} }
public: // But only for verilated.cpp // METHODS - But only for verilated.cpp
// Symbol table destruction cleans up the entries for each scope. // Symbol table destruction cleans up the entries for each scope.
static void userEraseScope(const VerilatedScope* scopep) VL_MT_SAFE { static void userEraseScope(const VerilatedScope* scopep) VL_MT_SAFE {
// Slow ok - called once/scope on destruction, so we only iterate. // Slow ok - called once/scope on destruction, so we only iterate.
@ -512,8 +509,7 @@ public: // But only for verilated.cpp
} }
} }
public: // But only for verilated*.cpp // METHODS - hierarchy - only for verilated*.cpp
// METHODS - hierarchy
static void hierarchyAdd(const VerilatedScope* fromp, const VerilatedScope* top) VL_MT_SAFE { static void hierarchyAdd(const VerilatedScope* fromp, const VerilatedScope* top) VL_MT_SAFE {
// Slow ok - called at construction for VPI accessible elements // Slow ok - called at construction for VPI accessible elements
const VerilatedLockGuard lock{s().m_hierMapMutex}; const VerilatedLockGuard lock{s().m_hierMapMutex};
@ -534,8 +530,7 @@ public: // But only for verilated*.cpp
return &s().m_hierMap; return &s().m_hierMap;
} }
public: // But only for verilated*.cpp // METHODS - export names - only for verilated*.cpp
// METHODS - export names
// Each function prototype is converted to a function number which we // Each function prototype is converted to a function number which we
// then use to index a 2D table also indexed by scope number, because we // then use to index a 2D table also indexed by scope number, because we

View File

@ -165,14 +165,14 @@ class VlExecutionProfiler final : public VerilatedVirtualBase {
public: public:
// CONSTRUCTOR // CONSTRUCTOR
explicit VlExecutionProfiler(VerilatedContext& context); explicit VlExecutionProfiler(VerilatedContext& context);
virtual ~VlExecutionProfiler() = default; ~VlExecutionProfiler() override = default;
// METHODS // METHODS
// Is profiling enabled // Is profiling enabled
inline bool enabled() const { return m_enabled; } inline bool enabled() const { return m_enabled; }
// Append a trace record to the trace buffer of the current thread // Append a trace record to the trace buffer of the current thread
inline VlExecutionRecord& addRecord() { static inline VlExecutionRecord& addRecord() {
t_trace.emplace_back(); t_trace.emplace_back();
return t_trace.back(); return t_trace.back();
} }

View File

@ -77,7 +77,7 @@ public:
virtual void flush() VL_MT_UNSAFE_ONE {} virtual void flush() VL_MT_UNSAFE_ONE {}
/// Write data to stream /// Write data to stream
VerilatedSerialize& write(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE { VerilatedSerialize& write(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE {
const uint8_t* __restrict dp = (const uint8_t* __restrict)datap; const uint8_t* __restrict dp = static_cast<const uint8_t* __restrict>(datap);
while (size) { while (size) {
bufferCheck(); bufferCheck();
size_t blk = size; size_t blk = size;
@ -287,7 +287,8 @@ inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& r
uint32_t len = 0; uint32_t len = 0;
os >> len; os >> len;
rhs.resize(len); rhs.resize(len);
return os.read((void*)rhs.data(), len); // C cast is required below
return os.read((void*)(rhs.data()), len);
} }
VerilatedSerialize& operator<<(VerilatedSerialize& os, VerilatedContext* rhsp); VerilatedSerialize& operator<<(VerilatedSerialize& os, VerilatedContext* rhsp);
VerilatedDeserialize& operator>>(VerilatedDeserialize& os, VerilatedContext* rhsp); VerilatedDeserialize& operator>>(VerilatedDeserialize& os, VerilatedContext* rhsp);

View File

@ -134,7 +134,6 @@ public:
initUnpacked(ulims); initUnpacked(ulims);
} }
public:
~VerilatedVarProps() = default; ~VerilatedVarProps() = default;
// METHODS // METHODS
bool magicOk() const { return m_magic == MAGIC; } bool magicOk() const { return m_magic == MAGIC; }

View File

@ -136,13 +136,10 @@ class VlWorkerThread final {
private: private:
// TYPES // TYPES
struct ExecRec { struct ExecRec {
VlExecFnp m_fnp; // Function to execute VlExecFnp m_fnp = nullptr; // Function to execute
VlSelfP m_selfp; // Symbol table to execute VlSelfP m_selfp = nullptr; // Symbol table to execute
bool m_evenCycle; // Even/odd for flag alternation bool m_evenCycle = false; // Even/odd for flag alternation
ExecRec() ExecRec() = default;
: m_fnp{nullptr}
, m_selfp{nullptr}
, m_evenCycle{false} {}
ExecRec(VlExecFnp fnp, VlSelfP selfp, bool evenCycle) ExecRec(VlExecFnp fnp, VlSelfP selfp, bool evenCycle)
: m_fnp{fnp} : m_fnp{fnp}
, m_selfp{selfp} , m_selfp{selfp}
@ -222,7 +219,7 @@ public:
// pool will create these threads and make them available to execute tasks // pool will create these threads and make them available to execute tasks
// via this->workerp(index)->addTask(...) // via this->workerp(index)->addTask(...)
VlThreadPool(VerilatedContext* contextp, unsigned nThreads); VlThreadPool(VerilatedContext* contextp, unsigned nThreads);
virtual ~VlThreadPool(); ~VlThreadPool() override;
// METHODS // METHODS
inline int numThreads() const { return m_workers.size(); } inline int numThreads() const { return m_workers.size(); }

View File

@ -401,7 +401,7 @@ protected:
EData* const m_sigs_enabledp; // Bit vector of enabled codes (nullptr = all on) EData* const m_sigs_enabledp; // Bit vector of enabled codes (nullptr = all on)
explicit VerilatedTraceBuffer(Trace& owner); explicit VerilatedTraceBuffer(Trace& owner);
virtual ~VerilatedTraceBuffer() = default; ~VerilatedTraceBuffer() override = default;
public: public:
//========================================================================= //=========================================================================
@ -487,7 +487,7 @@ class VerilatedTraceOffloadBuffer final : public VerilatedTraceBuffer<T_Buffer>
uint32_t* const m_offloadBufferEndp; // End of offload buffer uint32_t* const m_offloadBufferEndp; // End of offload buffer
explicit VerilatedTraceOffloadBuffer(Trace& owner); explicit VerilatedTraceOffloadBuffer(Trace& owner);
virtual ~VerilatedTraceOffloadBuffer() = default; ~VerilatedTraceOffloadBuffer() override = default;
public: public:
//========================================================================= //=========================================================================

View File

@ -113,7 +113,7 @@ protected:
void commitTraceBuffer(Buffer*) override; void commitTraceBuffer(Buffer*) override;
// Configure sub-class // Configure sub-class
void configure(const VerilatedTraceConfig&) override { return; }; void configure(const VerilatedTraceConfig&) override{};
public: public:
//========================================================================= //=========================================================================
@ -253,7 +253,6 @@ public:
/// Destruct, flush, and close the dump /// Destruct, flush, and close the dump
virtual ~VerilatedVcdC() { close(); } virtual ~VerilatedVcdC() { close(); }
public:
// METHODS - User called // METHODS - User called
/// Return if file is open /// Return if file is open

View File

@ -54,7 +54,7 @@ public:
spTrace()->set_time_resolution(sc_get_time_resolution().to_string()); spTrace()->set_time_resolution(sc_get_time_resolution().to_string());
} }
/// Destruct, flush, and close the dump /// Destruct, flush, and close the dump
virtual ~VerilatedVcdSc() { close(); } ~VerilatedVcdSc() override { close(); }
// METHODS - for SC kernel // METHODS - for SC kernel
// Called by SystemC simulate() // Called by SystemC simulate()

View File

@ -47,7 +47,7 @@ public:
static bool callValueCbs() VL_MT_UNSAFE_ONE; static bool callValueCbs() VL_MT_UNSAFE_ONE;
/// Call callbacks of arbitrary types. /// Call callbacks of arbitrary types.
/// User wrapper code should call this from their main loops. /// User wrapper code should call this from their main loops.
static bool callCbs(const uint32_t reason) VL_MT_UNSAFE_ONE; static bool callCbs(uint32_t reason) VL_MT_UNSAFE_ONE;
/// Returns time of the next registered VPI callback, or /// Returns time of the next registered VPI callback, or
/// ~(0ULL) if none are registered /// ~(0ULL) if none are registered
static QData cbNextDeadline() VL_MT_UNSAFE_ONE; static QData cbNextDeadline() VL_MT_UNSAFE_ONE;

View File

@ -95,7 +95,7 @@ public:
// const char* ascii() const {...}; // const char* ascii() const {...};
enum en m_e; enum en m_e;
// cppcheck-suppress uninitVar // responsibility of each subclass // cppcheck-suppress uninitVar // responsibility of each subclass
inline VNType() {} inline VNType() = default;
// cppcheck-suppress noExplicitConstructor // cppcheck-suppress noExplicitConstructor
inline VNType(en _e) inline VNType(en _e)
: m_e{_e} {} : m_e{_e} {}
@ -997,7 +997,7 @@ public:
return false; return false;
} }
// //
VNumRange() {} VNumRange() = default;
VNumRange(int hi, int lo, bool littleEndian) { init(hi, lo, littleEndian); } VNumRange(int hi, int lo, bool littleEndian) { init(hi, lo, littleEndian); }
VNumRange(int left, int right) VNumRange(int left, int right)
: m_left{left} : m_left{left}
@ -1123,7 +1123,7 @@ class VNUser final {
} m_u; } m_u;
public: public:
VNUser() {} VNUser() = default;
// non-explicit: // non-explicit:
// cppcheck-suppress noExplicitConstructor // cppcheck-suppress noExplicitConstructor
VNUser(int i) { VNUser(int i) {
@ -2444,7 +2444,7 @@ public:
void fromp(AstNode* nodep) { return setOp1p(nodep); } void fromp(AstNode* nodep) { return setOp1p(nodep); }
void rhsp(AstNode* nodep) { return setOp2p(nodep); } void rhsp(AstNode* nodep) { return setOp2p(nodep); }
void thsp(AstNode* nodep) { return setOp3p(nodep); } void thsp(AstNode* nodep) { return setOp3p(nodep); }
void attrp(AstAttrOf* nodep) { return setOp4p((AstNode*)nodep); } void attrp(AstAttrOf* nodep) { return setOp4p(reinterpret_cast<AstNode*>(nodep)); }
// METHODS // METHODS
virtual bool same(const AstNode*) const override { return true; } virtual bool same(const AstNode*) const override { return true; }
}; };
@ -2536,7 +2536,7 @@ public:
AstNode* bodysp() const { return op4p(); } // op4 = body of loop AstNode* bodysp() const { return op4p(); } // op4 = body of loop
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } virtual int instrCount() const override { return INSTR_COUNT_BRANCH; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstNodeIf VL_NOT_FINAL : public AstNodeStmt { class AstNodeIf VL_NOT_FINAL : public AstNodeStmt {
@ -2563,7 +2563,7 @@ public:
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isGateDedupable() const override { return true; } virtual bool isGateDedupable() const override { return true; }
virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } virtual int instrCount() const override { return INSTR_COUNT_BRANCH; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
void branchPred(VBranchPred flag) { m_branchPred = flag; } void branchPred(VBranchPred flag) { m_branchPred = flag; }
VBranchPred branchPred() const { return m_branchPred; } VBranchPred branchPred() const { return m_branchPred; }
void isBoundsCheck(bool flag) { m_isBoundsCheck = flag; } void isBoundsCheck(bool flag) { m_isBoundsCheck = flag; }

View File

@ -189,7 +189,7 @@ public:
explicit AstEmpty(FileLine* fl) explicit AstEmpty(FileLine* fl)
: ASTGEN_SUPER_Empty(fl) {} : ASTGEN_SUPER_Empty(fl) {}
ASTNODE_NODE_FUNCS(Empty) ASTNODE_NODE_FUNCS(Empty)
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstEmptyQueue final : public AstNodeMath { class AstEmptyQueue final : public AstNodeMath {
@ -199,7 +199,7 @@ public:
ASTNODE_NODE_FUNCS(EmptyQueue) ASTNODE_NODE_FUNCS(EmptyQueue)
virtual string emitC() override { V3ERROR_NA_RETURN(""); } virtual string emitC() override { V3ERROR_NA_RETURN(""); }
virtual string emitVerilog() override { return "{}"; } virtual string emitVerilog() override { return "{}"; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
}; };
@ -246,7 +246,7 @@ public:
bool littleEndian() const { return leftConst() < rightConst(); } bool littleEndian() const { return leftConst() < rightConst(); }
virtual void dump(std::ostream& str) const override; virtual void dump(std::ostream& str) const override;
virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitC() { V3ERROR_NA_RETURN(""); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstBracketRange final : public AstNodeRange { class AstBracketRange final : public AstNodeRange {
@ -260,7 +260,7 @@ public:
ASTNODE_NODE_FUNCS(BracketRange) ASTNODE_NODE_FUNCS(BracketRange)
virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitC() { V3ERROR_NA_RETURN(""); }
virtual string emitVerilog() { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() { V3ERROR_NA_RETURN(""); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
// Will be removed in V3Width, which relies on this // Will be removed in V3Width, which relies on this
// being a child not a dtype pointed node // being a child not a dtype pointed node
virtual bool maybePointedTo() const override { return false; } virtual bool maybePointedTo() const override { return false; }
@ -275,7 +275,7 @@ public:
ASTNODE_NODE_FUNCS(UnsizedRange) ASTNODE_NODE_FUNCS(UnsizedRange)
virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitC() { V3ERROR_NA_RETURN(""); }
virtual string emitVerilog() { return "[]"; } virtual string emitVerilog() { return "[]"; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstWildcardRange final : public AstNodeRange { class AstWildcardRange final : public AstNodeRange {
@ -286,7 +286,7 @@ public:
ASTNODE_NODE_FUNCS(WildcardRange) ASTNODE_NODE_FUNCS(WildcardRange)
virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitC() { V3ERROR_NA_RETURN(""); }
virtual string emitVerilog() { return "[*]"; } virtual string emitVerilog() { return "[*]"; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstGatePin final : public AstNodeMath { class AstGatePin final : public AstNodeMath {
@ -660,7 +660,7 @@ class AstDynArrayDType final : public AstNodeDType {
// Dynamic array data type, ie "[]" // Dynamic array data type, ie "[]"
// Children: DTYPE (moved to refDTypep() in V3Width) // Children: DTYPE (moved to refDTypep() in V3Width)
private: private:
AstNodeDType* m_refDTypep; // Elements of this type (after widthing) AstNodeDType* m_refDTypep = nullptr; // Elements of this type (after widthing)
public: public:
AstDynArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp) AstDynArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp)
: ASTGEN_SUPER_DynArrayDType(fl) { : ASTGEN_SUPER_DynArrayDType(fl) {
@ -1042,7 +1042,7 @@ class AstConstDType final : public AstNodeDType {
// ConstDType are removed in V3LinkLValue and become AstVar::isConst. // ConstDType are removed in V3LinkLValue and become AstVar::isConst.
// When more generic types are supported AstConstDType will be propagated further. // When more generic types are supported AstConstDType will be propagated further.
private: private:
AstNodeDType* m_refDTypep; // Inherit from this base data type AstNodeDType* m_refDTypep = nullptr; // Inherit from this base data type
public: public:
AstConstDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp) AstConstDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp)
: ASTGEN_SUPER_ConstDType(fl) { : ASTGEN_SUPER_ConstDType(fl) {
@ -1201,7 +1201,7 @@ class AstQueueDType final : public AstNodeDType {
// Queue array data type, ie "[ $ ]" // Queue array data type, ie "[ $ ]"
// Children: DTYPE (moved to refDTypep() in V3Width) // Children: DTYPE (moved to refDTypep() in V3Width)
private: private:
AstNodeDType* m_refDTypep; // Elements of this type (after widthing) AstNodeDType* m_refDTypep = nullptr; // Elements of this type (after widthing)
public: public:
AstQueueDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstNode* boundp) AstQueueDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstNode* boundp)
: ASTGEN_SUPER_QueueDType(fl) { : ASTGEN_SUPER_QueueDType(fl) {
@ -1395,7 +1395,7 @@ class AstMemberDType final : public AstNodeDType {
// A member of a struct/union // A member of a struct/union
// PARENT: AstNodeUOrStructDType // PARENT: AstNodeUOrStructDType
private: private:
AstNodeDType* m_refDTypep; // Elements of this type (after widthing) AstNodeDType* m_refDTypep = nullptr; // Elements of this type (after widthing)
string m_name; // Name of variable string m_name; // Name of variable
string m_tag; // Holds the string of the verilator tag -- used in XML output. string m_tag; // Holds the string of the verilator tag -- used in XML output.
int m_lsb = -1; // Within this level's packed struct, the LSB of the first bit of the member int m_lsb = -1; // Within this level's packed struct, the LSB of the first bit of the member
@ -1584,8 +1584,8 @@ class AstEnumDType final : public AstNodeDType {
// Children: ENUMVALUEs // Children: ENUMVALUEs
private: private:
string m_name; // Name from upper typedef, if any string m_name; // Name from upper typedef, if any
AstNodeDType* m_refDTypep; // Elements are of this type after V3Width AstNodeDType* m_refDTypep = nullptr; // Elements are of this type after V3Width
const int m_uniqueNum; const int m_uniqueNum = 0;
public: public:
AstEnumDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstNode* itemsp) AstEnumDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstNode* itemsp)
@ -1708,7 +1708,7 @@ public:
return true; return true;
} // esp for V3Const::ifSameAssign } // esp for V3Const::ifSameAssign
virtual bool isPredictOptimizable() const override { return true; } virtual bool isPredictOptimizable() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
// Special operators // Special operators
// Return base var (or const) nodep dereferences // Return base var (or const) nodep dereferences
@ -1749,7 +1749,7 @@ public:
return true; return true;
} // esp for V3Const::ifSameAssign } // esp for V3Const::ifSameAssign
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
}; };
@ -1787,7 +1787,7 @@ public:
return true; return true;
} // esp for V3Const::ifSameAssign } // esp for V3Const::ifSameAssign
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
}; };
@ -1814,7 +1814,7 @@ public:
virtual bool cleanRhs() const override { return true; } virtual bool cleanRhs() const override { return true; }
virtual bool sizeMattersLhs() const override { return false; } virtual bool sizeMattersLhs() const override { return false; }
virtual bool sizeMattersRhs() const override { return false; } virtual bool sizeMattersRhs() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstSelLoopVars final : public AstNode { class AstSelLoopVars final : public AstNode {
@ -1827,7 +1827,7 @@ public:
addNOp2p(elementsp); addNOp2p(elementsp);
} }
ASTNODE_NODE_FUNCS(SelLoopVars) ASTNODE_NODE_FUNCS(SelLoopVars)
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual bool maybePointedTo() const override { return false; } virtual bool maybePointedTo() const override { return false; }
AstNode* fromp() const { return op1p(); } AstNode* fromp() const { return op1p(); }
void fromp(AstNode* nodep) { setOp1p(nodep); } void fromp(AstNode* nodep) { setOp1p(nodep); }
@ -3357,7 +3357,7 @@ public:
addNOp2p(exprp); addNOp2p(exprp);
} }
ASTNODE_NODE_FUNCS(WithParse) ASTNODE_NODE_FUNCS(WithParse)
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
// //
AstNode* funcrefp() const { return op1p(); } AstNode* funcrefp() const { return op1p(); }
AstNode* exprp() const { return op2p(); } AstNode* exprp() const { return op2p(); }
@ -3377,7 +3377,7 @@ public:
, m_name{name} , m_name{name}
, m_index(index) {} , m_index(index) {}
ASTNODE_NODE_FUNCS(LambdaArgRef) ASTNODE_NODE_FUNCS(LambdaArgRef)
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual string emitVerilog() override { return name(); } virtual string emitVerilog() override { return name(); }
virtual string emitC() override { V3ERROR_NA_RETURN(""); } virtual string emitC() override { V3ERROR_NA_RETURN(""); }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
@ -3404,7 +3404,7 @@ public:
addNOp3p(exprp); addNOp3p(exprp);
} }
ASTNODE_NODE_FUNCS(With) ASTNODE_NODE_FUNCS(With)
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual bool hasDType() const override { return true; } virtual bool hasDType() const override { return true; }
virtual const char* broken() const override { virtual const char* broken() const override {
BROKEN_RTN(!indexArgRefp()); // varp needed to know lambda's arg dtype BROKEN_RTN(!indexArgRefp()); // varp needed to know lambda's arg dtype
@ -3578,7 +3578,7 @@ public:
addNOp2p(bodysp); addNOp2p(bodysp);
} }
ASTNODE_NODE_FUNCS(AlwaysPublic) ASTNODE_NODE_FUNCS(AlwaysPublic)
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
// //
AstSenTree* sensesp() const { return VN_AS(op1p(), SenTree); } // op1 = Sensitivity list AstSenTree* sensesp() const { return VN_AS(op1p(), SenTree); } // op1 = Sensitivity list
AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate
@ -3909,7 +3909,7 @@ public:
} }
ASTNODE_NODE_FUNCS(CoverToggle) ASTNODE_NODE_FUNCS(CoverToggle)
virtual int instrCount() const override { return 3 + INSTR_COUNT_BRANCH + INSTR_COUNT_LD; } virtual int instrCount() const override { return 3 + INSTR_COUNT_BRANCH + INSTR_COUNT_LD; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return true; } virtual bool isPredictOptimizable() const override { return true; }
virtual bool isOutputter() const override { virtual bool isOutputter() const override {
@ -3931,7 +3931,7 @@ public:
setNOp2p(stmtsp); setNOp2p(stmtsp);
} }
ASTNODE_NODE_FUNCS(Delay) ASTNODE_NODE_FUNCS(Delay)
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
// //
AstNode* lhsp() const { return op1p(); } // op1 = delay value AstNode* lhsp() const { return op1p(); } // op1 = delay value
void lhsp(AstNode* nodep) { setOp1p(nodep); } void lhsp(AstNode* nodep) { setOp1p(nodep); }
@ -4137,7 +4137,7 @@ public:
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool cleanOut() const { return true; } virtual bool cleanOut() const { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
VDumpCtlType ctlType() const { return m_ctlType; } VDumpCtlType ctlType() const { return m_ctlType; }
AstNode* exprp() const { return op1p(); } // op2 = Expressions to output AstNode* exprp() const { return op1p(); } // op2 = Expressions to output
void exprp(AstNode* nodep) { setOp1p(nodep); } void exprp(AstNode* nodep) { setOp1p(nodep); }
@ -4208,7 +4208,7 @@ public:
virtual bool isOutputter() const override { return false; } virtual bool isOutputter() const override { return false; }
virtual bool cleanOut() const { return false; } virtual bool cleanOut() const { return false; }
virtual int instrCount() const override { return INSTR_COUNT_PLI; } virtual int instrCount() const override { return INSTR_COUNT_PLI; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
void fmtp(AstSFormatF* nodep) { addOp1p(nodep); } // op1 = To-String formatter void fmtp(AstSFormatF* nodep) { addOp1p(nodep); } // op1 = To-String formatter
AstSFormatF* fmtp() const { return VN_AS(op1p(), SFormatF); } AstSFormatF* fmtp() const { return VN_AS(op1p(), SFormatF); }
AstNode* lhsp() const { return op3p(); } AstNode* lhsp() const { return op3p(); }
@ -4231,7 +4231,7 @@ public:
virtual bool isPure() const override { return true; } virtual bool isPure() const override { return true; }
virtual bool isOutputter() const override { return false; } virtual bool isOutputter() const override { return false; }
virtual int instrCount() const override { return 0; } virtual int instrCount() const override { return 0; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* lhsp() const { return op1p(); } // op1 = Expressions to eval AstNode* lhsp() const { return op1p(); } // op1 = Expressions to eval
void lhsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to eval void lhsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to eval
}; };
@ -4272,7 +4272,7 @@ public:
virtual bool isPure() const override { return false; } virtual bool isPure() const override { return false; }
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* filep() const { return op2p(); } AstNode* filep() const { return op2p(); }
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); } void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
}; };
@ -4293,7 +4293,7 @@ public:
virtual bool isPure() const override { return false; } virtual bool isPure() const override { return false; }
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* filep() const { return op1p(); } AstNode* filep() const { return op1p(); }
AstNode* filenamep() const { return op2p(); } AstNode* filenamep() const { return op2p(); }
AstNode* modep() const { return op3p(); } AstNode* modep() const { return op3p(); }
@ -4314,7 +4314,7 @@ public:
virtual bool isPure() const override { return false; } virtual bool isPure() const override { return false; }
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* filep() const { return op1p(); } AstNode* filep() const { return op1p(); }
AstNode* filenamep() const { return op2p(); } AstNode* filenamep() const { return op2p(); }
}; };
@ -4334,7 +4334,7 @@ public:
virtual bool isPure() const override { return false; } virtual bool isPure() const override { return false; }
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* filep() const { return op2p(); } AstNode* filep() const { return op2p(); }
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); } void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
}; };
@ -4362,7 +4362,7 @@ public:
virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering
virtual bool isOutputter() const override { return true; } // SPECIAL: makes output virtual bool isOutputter() const override { return true; } // SPECIAL: makes output
virtual bool cleanOut() const override { return false; } virtual bool cleanOut() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* memp() const { return op1p(); } AstNode* memp() const { return op1p(); }
void memp(AstNode* nodep) { setOp1p(nodep); } void memp(AstNode* nodep) { setOp1p(nodep); }
AstNode* filep() const { return op2p(); } AstNode* filep() const { return op2p(); }
@ -4391,7 +4391,7 @@ public:
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool cleanOut() const override { return false; } virtual bool cleanOut() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* filep() const { return op2p(); } AstNode* filep() const { return op2p(); }
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); } void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
}; };
@ -4414,7 +4414,7 @@ public:
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool cleanOut() const override { return false; } virtual bool cleanOut() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* filep() const { return op2p(); } AstNode* filep() const { return op2p(); }
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); } void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
}; };
@ -4440,7 +4440,7 @@ public:
virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering
virtual bool isOutputter() const override { return true; } // SPECIAL: makes output virtual bool isOutputter() const override { return true; } // SPECIAL: makes output
virtual bool cleanOut() const override { return false; } virtual bool cleanOut() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* filep() const { return op2p(); } AstNode* filep() const { return op2p(); }
void filep(AstNode* nodep) { setOp2p(nodep); } void filep(AstNode* nodep) { setOp2p(nodep); }
AstNode* offset() const { return op3p(); } AstNode* offset() const { return op3p(); }
@ -4604,7 +4604,7 @@ public:
virtual bool isPure() const override { return false; } virtual bool isPure() const override { return false; }
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* lhsp() const { return op1p(); } AstNode* lhsp() const { return op1p(); }
}; };
@ -4625,7 +4625,7 @@ public:
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool isUnlikely() const override { return true; } virtual bool isUnlikely() const override { return true; }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* lhsp() const { return op1p(); } AstNode* lhsp() const { return op1p(); }
}; };
@ -4646,7 +4646,7 @@ public:
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool isPure() const override { return !outp(); } virtual bool isPure() const override { return !outp(); }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* searchp() const { return op1p(); } // op1 = Search expression AstNode* searchp() const { return op1p(); } // op1 = Search expression
void searchp(AstNode* nodep) { setOp1p(nodep); } void searchp(AstNode* nodep) { setOp1p(nodep); }
AstNode* outp() const { return op2p(); } // op2 = Expressions to output AstNode* outp() const { return op2p(); } // op2 = Expressions to output
@ -4668,7 +4668,7 @@ public:
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstNode* searchp() const { return op1p(); } // op1 = Search expression AstNode* searchp() const { return op1p(); } // op1 = Search expression
void searchp(AstNode* nodep) { setOp1p(nodep); } void searchp(AstNode* nodep) { setOp1p(nodep); }
}; };
@ -4692,7 +4692,7 @@ public:
AstNode* bodysp() const { return op4p(); } // op4 = body of loop AstNode* bodysp() const { return op4p(); } // op4 = body of loop
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } virtual int instrCount() const override { return INSTR_COUNT_BRANCH; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstRepeat final : public AstNodeStmt { class AstRepeat final : public AstNodeStmt {
@ -4709,7 +4709,7 @@ public:
return false; return false;
} // Not relevant - converted to FOR } // Not relevant - converted to FOR
virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } virtual int instrCount() const override { return INSTR_COUNT_BRANCH; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstWait final : public AstNodeStmt { class AstWait final : public AstNodeStmt {
@ -4742,7 +4742,7 @@ public:
void addIncsp(AstNode* newp) { addOp4p(newp); } void addIncsp(AstNode* newp) { addOp4p(newp); }
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } virtual int instrCount() const override { return INSTR_COUNT_BRANCH; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
// Stop statement searchback here // Stop statement searchback here
virtual void addBeforeStmt(AstNode* newp, AstNode* belowp) override; virtual void addBeforeStmt(AstNode* newp, AstNode* belowp) override;
// Stop statement searchback here // Stop statement searchback here
@ -4862,7 +4862,7 @@ public:
ASTNODE_NODE_FUNCS(JumpBlock) ASTNODE_NODE_FUNCS(JumpBlock)
virtual int instrCount() const override { return 0; } virtual int instrCount() const override { return 0; }
virtual bool maybePointedTo() const override { return true; } virtual bool maybePointedTo() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
// op1 = Statements // op1 = Statements
AstNode* stmtsp() const { return op1p(); } // op1 = List of statements AstNode* stmtsp() const { return op1p(); } // op1 = List of statements
void addStmtsp(AstNode* nodep) { addNOp1p(nodep); } void addStmtsp(AstNode* nodep) { addNOp1p(nodep); }
@ -4948,7 +4948,7 @@ public:
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual int instrCount() const override { return widthInstrs() * 2; } // xor, or/logor virtual int instrCount() const override { return widthInstrs() * 2; } // xor, or/logor
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstConsAssoc final : public AstNodeMath { class AstConsAssoc final : public AstNodeMath {
@ -4967,7 +4967,7 @@ public:
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
AstNode* defaultp() const { return op1p(); } AstNode* defaultp() const { return op1p(); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstSetAssoc final : public AstNodeMath { class AstSetAssoc final : public AstNodeMath {
// Set an assoc array element and return object, '{} // Set an assoc array element and return object, '{}
@ -4989,7 +4989,7 @@ public:
AstNode* lhsp() const { return op1p(); } AstNode* lhsp() const { return op1p(); }
AstNode* keyp() const { return op2p(); } AstNode* keyp() const { return op2p(); }
AstNode* valuep() const { return op3p(); } AstNode* valuep() const { return op3p(); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstConsWildcard final : public AstNodeMath { class AstConsWildcard final : public AstNodeMath {
@ -5008,7 +5008,7 @@ public:
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
AstNode* defaultp() const { return op1p(); } AstNode* defaultp() const { return op1p(); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstSetWildcard final : public AstNodeMath { class AstSetWildcard final : public AstNodeMath {
// Set a wildcard assoc array element and return object, '{} // Set a wildcard assoc array element and return object, '{}
@ -5030,7 +5030,7 @@ public:
AstNode* lhsp() const { return op1p(); } AstNode* lhsp() const { return op1p(); }
AstNode* keyp() const { return op2p(); } AstNode* keyp() const { return op2p(); }
AstNode* valuep() const { return op3p(); } AstNode* valuep() const { return op3p(); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstConsDynArray final : public AstNodeMath { class AstConsDynArray final : public AstNodeMath {
@ -5051,7 +5051,7 @@ public:
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
AstNode* lhsp() const { return op1p(); } // op1 = expression AstNode* lhsp() const { return op1p(); } // op1 = expression
AstNode* rhsp() const { return op2p(); } // op2 = expression AstNode* rhsp() const { return op2p(); } // op2 = expression
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstConsQueue final : public AstNodeMath { class AstConsQueue final : public AstNodeMath {
@ -5072,7 +5072,7 @@ public:
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
AstNode* lhsp() const { return op1p(); } // op1 = expression AstNode* lhsp() const { return op1p(); } // op1 = expression
AstNode* rhsp() const { return op2p(); } // op2 = expression AstNode* rhsp() const { return op2p(); } // op2 = expression
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstBegin final : public AstNodeBlock { class AstBegin final : public AstNodeBlock {
@ -5249,7 +5249,7 @@ public:
: ASTGEN_SUPER_New(fl, false, "new", pinsp) {} : ASTGEN_SUPER_New(fl, false, "new", pinsp) {}
ASTNODE_NODE_FUNCS(New) ASTNODE_NODE_FUNCS(New)
virtual bool cleanOut() const { return true; } virtual bool cleanOut() const { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual bool hasDType() const override { return true; } virtual bool hasDType() const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
}; };
@ -5268,7 +5268,7 @@ public:
virtual string emitVerilog() override { return "new"; } virtual string emitVerilog() override { return "new"; }
virtual string emitC() override { V3ERROR_NA_RETURN(""); } virtual string emitC() override { V3ERROR_NA_RETURN(""); }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
AstNode* rhsp() const { return op1p(); } AstNode* rhsp() const { return op1p(); }
}; };
@ -5288,7 +5288,7 @@ public:
virtual string emitVerilog() override { return "new"; } virtual string emitVerilog() override { return "new"; }
virtual string emitC() override { V3ERROR_NA_RETURN(""); } virtual string emitC() override { V3ERROR_NA_RETURN(""); }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
AstNode* sizep() const { return op1p(); } AstNode* sizep() const { return op1p(); }
AstNode* rhsp() const { return op2p(); } AstNode* rhsp() const { return op2p(); }
@ -5721,7 +5721,7 @@ public:
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual int instrCount() const override { return INSTR_COUNT_PLI; } virtual int instrCount() const override { return INSTR_COUNT_PLI; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
bool combinable(const AstRand* samep) const { bool combinable(const AstRand* samep) const {
return !seedp() && !samep->seedp() && reset() == samep->reset() return !seedp() && !samep->seedp() && reset() == samep->reset()
&& urandom() == samep->urandom(); && urandom() == samep->urandom();
@ -5772,7 +5772,7 @@ public:
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual int instrCount() const override { return INSTR_COUNT_TIME; } virtual int instrCount() const override { return INSTR_COUNT_TIME; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual void dump(std::ostream& str = std::cout) const override; virtual void dump(std::ostream& str = std::cout) const override;
void timeunit(const VTimescale& flag) { m_timeunit = flag; } void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; } VTimescale timeunit() const { return m_timeunit; }
@ -5793,7 +5793,7 @@ public:
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual int instrCount() const override { return INSTR_COUNT_TIME; } virtual int instrCount() const override { return INSTR_COUNT_TIME; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
virtual void dump(std::ostream& str = std::cout) const override; virtual void dump(std::ostream& str = std::cout) const override;
void timeunit(const VTimescale& flag) { m_timeunit = flag; } void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; } VTimescale timeunit() const { return m_timeunit; }
@ -5818,7 +5818,7 @@ public:
virtual bool isSubstOptimizable() const override { return false; } virtual bool isSubstOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual int instrCount() const override { return INSTR_COUNT_PLI; } virtual int instrCount() const override { return INSTR_COUNT_PLI; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
//====================================================================== //======================================================================
@ -6406,7 +6406,7 @@ public:
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
virtual bool cleanLhs() const override { return true; } virtual bool cleanLhs() const override { return true; }
virtual bool sizeMattersLhs() const override { return false; } virtual bool sizeMattersLhs() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstFEof final : public AstNodeUniop { class AstFEof final : public AstNodeUniop {
@ -6448,7 +6448,7 @@ public:
AstNode* filep() const { return op1p(); } AstNode* filep() const { return op1p(); }
void strp(AstNode* nodep) { setOp2p(nodep); } void strp(AstNode* nodep) { setOp2p(nodep); }
AstNode* strp() const { return op2p(); } AstNode* strp() const { return op2p(); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstFGetC final : public AstNodeUniop { class AstFGetC final : public AstNodeUniop {
@ -8573,7 +8573,7 @@ public:
AstNode* exprp() const { return op1p(); } // op1 = expression AstNode* exprp() const { return op1p(); } // op1 = expression
AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain
void sentreep(AstSenTree* sentreep) { addOp2p(sentreep); } // op2 = clock domain void sentreep(AstSenTree* sentreep) { addOp2p(sentreep); } // op2 = clock domain
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstPast final : public AstNodeMath { class AstPast final : public AstNodeMath {
@ -8596,7 +8596,7 @@ public:
AstNode* ticksp() const { return op2p(); } // op2 = ticks or nullptr means 1 AstNode* ticksp() const { return op2p(); } // op2 = ticks or nullptr means 1
AstSenTree* sentreep() const { return VN_AS(op4p(), SenTree); } // op4 = clock domain AstSenTree* sentreep() const { return VN_AS(op4p(), SenTree); } // op4 = clock domain
void sentreep(AstSenTree* sentreep) { addOp4p(sentreep); } // op4 = clock domain void sentreep(AstSenTree* sentreep) { addOp4p(sentreep); } // op4 = clock domain
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstRose final : public AstNodeMath { class AstRose final : public AstNodeMath {
@ -8617,7 +8617,7 @@ public:
AstNode* exprp() const { return op1p(); } // op1 = expression AstNode* exprp() const { return op1p(); } // op1 = expression
AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain
void sentreep(AstSenTree* sentreep) { addOp2p(sentreep); } // op2 = clock domain void sentreep(AstSenTree* sentreep) { addOp2p(sentreep); } // op2 = clock domain
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstSampled final : public AstNodeMath { class AstSampled final : public AstNodeMath {
@ -8636,7 +8636,7 @@ public:
virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); }
virtual int instrCount() const override { return 0; } virtual int instrCount() const override { return 0; }
AstNode* exprp() const { return op1p(); } // op1 = expression AstNode* exprp() const { return op1p(); } // op1 = expression
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstStable final : public AstNodeMath { class AstStable final : public AstNodeMath {
@ -8657,7 +8657,7 @@ public:
AstNode* exprp() const { return op1p(); } // op1 = expression AstNode* exprp() const { return op1p(); } // op1 = expression
AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain
void sentreep(AstSenTree* sentreep) { addOp2p(sentreep); } // op2 = clock domain void sentreep(AstSenTree* sentreep) { addOp2p(sentreep); } // op2 = clock domain
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
class AstPattern final : public AstNodeMath { class AstPattern final : public AstNodeMath {
@ -8732,7 +8732,7 @@ public:
void rhsp(AstNode* nodep) { return setOp2p(nodep); } void rhsp(AstNode* nodep) { return setOp2p(nodep); }
AstSenTree* sentreep() const { return VN_AS(op4p(), SenTree); } // op4 = clock domain AstSenTree* sentreep() const { return VN_AS(op4p(), SenTree); } // op4 = clock domain
void sentreep(AstSenTree* sentreep) { addOp4p(sentreep); } // op4 = clock domain void sentreep(AstSenTree* sentreep) { addOp4p(sentreep); } // op4 = clock domain
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
//====================================================================== //======================================================================
@ -8953,7 +8953,7 @@ public:
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool isPure() const override { return false; } virtual bool isPure() const override { return false; }
virtual bool isOutputter() const override { return true; } virtual bool isOutputter() const override { return true; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
}; };
//====================================================================== //======================================================================
@ -8973,7 +8973,7 @@ public:
ASTNODE_BASE_FUNCS(NodeFile) ASTNODE_BASE_FUNCS(NodeFile)
virtual void dump(std::ostream& str) const override; virtual void dump(std::ostream& str) const override;
virtual string name() const override { return m_name; } virtual string name() const override { return m_name; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
void tblockp(AstTextBlock* tblockp) { setOp1p(tblockp); } void tblockp(AstTextBlock* tblockp) { setOp1p(tblockp); }
AstTextBlock* tblockp() { return VN_AS(op1p(), TextBlock); } AstTextBlock* tblockp() { return VN_AS(op1p(), TextBlock); }
}; };
@ -9241,7 +9241,7 @@ public:
} }
ASTNODE_NODE_FUNCS(CReturn) ASTNODE_NODE_FUNCS(CReturn)
virtual int instrCount() const override { return widthInstrs(); } virtual int instrCount() const override { return widthInstrs(); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
// //
AstNode* lhsp() const { return op1p(); } AstNode* lhsp() const { return op1p(); }
}; };
@ -9272,7 +9272,7 @@ public:
virtual bool cleanOut() const override { return m_cleanOut; } virtual bool cleanOut() const override { return m_cleanOut; }
virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); }
virtual string emitC() override { V3ERROR_NA_RETURN(""); } virtual string emitC() override { V3ERROR_NA_RETURN(""); }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
void addBodysp(AstNode* nodep) { addNOp1p(nodep); } void addBodysp(AstNode* nodep) { addNOp1p(nodep); }
AstNode* bodysp() const { return op1p(); } // op1 = expressions to print AstNode* bodysp() const { return op1p(); } // op1 = expressions to print
bool pure() const { return m_pure; } bool pure() const { return m_pure; }
@ -9289,7 +9289,7 @@ public:
ASTNODE_NODE_FUNCS(CReset) ASTNODE_NODE_FUNCS(CReset)
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
AstVarRef* varrefp() const { return VN_AS(op1p(), VarRef); } // op1 = varref to reset AstVarRef* varrefp() const { return VN_AS(op1p(), VarRef); } // op1 = varref to reset
}; };
@ -9307,7 +9307,7 @@ public:
ASTNODE_NODE_FUNCS(CStmt) ASTNODE_NODE_FUNCS(CStmt)
virtual bool isGateOptimizable() const override { return false; } virtual bool isGateOptimizable() const override { return false; }
virtual bool isPredictOptimizable() const override { return false; } virtual bool isPredictOptimizable() const override { return false; }
virtual bool same(const AstNode* samep) const override { return true; } virtual bool same(const AstNode* /*samep*/) const override { return true; }
void addBodysp(AstNode* nodep) { addNOp1p(nodep); } void addBodysp(AstNode* nodep) { addNOp1p(nodep); }
AstNode* bodysp() const { return op1p(); } // op1 = expressions to print AstNode* bodysp() const { return op1p(); } // op1 = expressions to print
}; };
@ -9403,7 +9403,7 @@ class AstTypeTable final : public AstNode {
AstEmptyQueueDType* m_emptyQueuep = nullptr; AstEmptyQueueDType* m_emptyQueuep = nullptr;
AstQueueDType* m_queueIndexp = nullptr; AstQueueDType* m_queueIndexp = nullptr;
AstVoidDType* m_voidp = nullptr; AstVoidDType* m_voidp = nullptr;
AstBasicDType* m_basicps[VBasicDTypeKwd::_ENUM_MAX]; AstBasicDType* m_basicps[VBasicDTypeKwd::_ENUM_MAX]{};
// //
using DetailedMap = std::map<VBasicTypeKey, AstBasicDType*>; using DetailedMap = std::map<VBasicTypeKey, AstBasicDType*>;
DetailedMap m_detailedMap; DetailedMap m_detailedMap;

View File

@ -85,7 +85,7 @@ private:
} }
if (AstNode* const subnodep = nodep->getChildDTypep()) subnodep->user1Inc(); if (AstNode* const subnodep = nodep->getChildDTypep()) subnodep->user1Inc();
} }
void checkVarRef(AstNodeVarRef* nodep) { void checkVarRef(AstNodeVarRef* nodep) const {
if (nodep->classOrPackagep() && m_elimCells) nodep->classOrPackagep(nullptr); if (nodep->classOrPackagep() && m_elimCells) nodep->classOrPackagep(nullptr);
} }
void checkDType(AstNodeDType* nodep) { void checkDType(AstNodeDType* nodep) {
@ -316,7 +316,7 @@ private:
} }
} }
} }
bool mightElimVar(AstVar* nodep) { bool mightElimVar(AstVar* nodep) const {
if (nodep->isSigPublic()) return false; // Can't elim publics! if (nodep->isSigPublic()) return false; // Can't elim publics!
if (nodep->isIO() || nodep->isClassMember()) return false; if (nodep->isIO() || nodep->isClassMember()) return false;
if (nodep->isTemp() && !nodep->isTrace()) return true; if (nodep->isTemp() && !nodep->isTrace()) return true;

View File

@ -44,7 +44,7 @@ class V3DupFinder final : private std::multimap<V3Hash, AstNode*> {
using Super = std::multimap<V3Hash, AstNode*>; using Super = std::multimap<V3Hash, AstNode*>;
// MEMBERS // MEMBERS
const V3Hasher* const m_hasherp; // Pointer to owned hasher const V3Hasher* const m_hasherp = nullptr; // Pointer to owned hasher
const V3Hasher& m_hasher; // Reference to hasher const V3Hasher& m_hasher; // Reference to hasher
public: public:
@ -53,8 +53,7 @@ public:
: m_hasherp{new V3Hasher} : m_hasherp{new V3Hasher}
, m_hasher{*m_hasherp} {} , m_hasher{*m_hasherp} {}
explicit V3DupFinder(const V3Hasher& hasher) explicit V3DupFinder(const V3Hasher& hasher)
: m_hasherp{nullptr} : m_hasher{hasher} {}
, m_hasher{hasher} {}
~V3DupFinder() { ~V3DupFinder() {
if (m_hasherp) delete m_hasherp; if (m_hasherp) delete m_hasherp;
} }

View File

@ -126,7 +126,7 @@ string VFileContent::getLine(int lineno) const {
return ""; return "";
} }
} }
const string text = m_lines[lineno]; string text = m_lines[lineno];
UINFO(9, "Get Stream[ct" << m_id << "+" << lineno << "]: " << text); UINFO(9, "Get Stream[ct" << m_id << "+" << lineno << "]: " << text);
return text; return text;
} }

View File

@ -162,7 +162,7 @@ public:
m_firstColumn = firstColumn; m_firstColumn = firstColumn;
m_lastColumn = lastColumn; m_lastColumn = lastColumn;
} }
void language(V3LangCode lang) { singleton().numberToLang(filenameno(), lang); } void language(V3LangCode lang) const { singleton().numberToLang(filenameno(), lang); }
void filename(const string& name) { m_filenameno = singleton().nameToNumber(name); } void filename(const string& name) { m_filenameno = singleton().nameToNumber(name); }
void parent(FileLine* fileline) { m_parent = fileline; } void parent(FileLine* fileline) { m_parent = fileline; }
void lineDirective(const char* textp, int& enterExitRef); void lineDirective(const char* textp, int& enterExitRef);
@ -213,7 +213,7 @@ public:
void warnStyleOff(bool flag); void warnStyleOff(bool flag);
void warnStateFrom(const FileLine& from) { m_warnOn = from.m_warnOn; } void warnStateFrom(const FileLine& from) { m_warnOn = from.m_warnOn; }
void warnResetDefault() { warnStateFrom(defaultFileLine()); } void warnResetDefault() { warnStateFrom(defaultFileLine()); }
bool lastWarnWaived() { return m_waive; } bool lastWarnWaived() const { return m_waive; }
// Specific flag ACCESSORS/METHODS // Specific flag ACCESSORS/METHODS
bool celldefineOn() const { return m_warnOn.test(V3ErrorCode::I_CELLDEFINE); } bool celldefineOn() const { return m_warnOn.test(V3ErrorCode::I_CELLDEFINE); }

View File

@ -201,7 +201,7 @@ string V3HierBlock::hierGenerated(bool withDir) const {
} }
string V3HierBlock::vFileIfNecessary() const { string V3HierBlock::vFileIfNecessary() const {
const string filename = V3Os::filenameRealPath(m_modp->fileline()->filename()); string filename = V3Os::filenameRealPath(m_modp->fileline()->filename());
for (const string& v : v3Global.opt.vFiles()) { for (const string& v : v3Global.opt.vFiles()) {
// Already listed in vFiles, so no need to add the file. // Already listed in vFiles, so no need to add the file.
if (filename == V3Os::filenameRealPath(v)) return ""; if (filename == V3Os::filenameRealPath(v)) return "";

View File

@ -339,7 +339,7 @@ bool V3Options::hasParameter(const string& name) {
} }
string V3Options::parameter(const string& name) { string V3Options::parameter(const string& name) {
const string value = m_parameters.find(name)->second; string value = m_parameters.find(name)->second;
m_parameters.erase(m_parameters.find(name)); m_parameters.erase(m_parameters.find(name));
return value; return value;
} }
@ -477,7 +477,7 @@ string V3Options::fileExists(const string& filename) {
return ""; // Not found return ""; // Not found
} }
// Check if it is a directory, ignore if so // Check if it is a directory, ignore if so
const string filenameOut = V3Os::filenameFromDirBase(dir, basename); string filenameOut = V3Os::filenameFromDirBase(dir, basename);
if (!fileStatNormal(filenameOut)) return ""; // Directory if (!fileStatNormal(filenameOut)) return ""; // Directory
return filenameOut; return filenameOut;
} }
@ -518,11 +518,11 @@ string V3Options::filePath(FileLine* fl, const string& modname, const string& la
// using the incdir and libext's. // using the incdir and libext's.
// Return "" if not found. // Return "" if not found.
for (const string& dir : m_impp->m_incDirUsers) { for (const string& dir : m_impp->m_incDirUsers) {
const string exists = filePathCheckOneDir(modname, dir); string exists = filePathCheckOneDir(modname, dir);
if (exists != "") return exists; if (exists != "") return exists;
} }
for (const string& dir : m_impp->m_incDirFallbacks) { for (const string& dir : m_impp->m_incDirFallbacks) {
const string exists = filePathCheckOneDir(modname, dir); string exists = filePathCheckOneDir(modname, dir);
if (exists != "") return exists; if (exists != "") return exists;
} }

View File

@ -270,7 +270,8 @@ string V3ParseGrammar::deQuote(FileLine* fileline, string text) {
} else if (*cp == 'x' && isxdigit(cp[1]) } else if (*cp == 'x' && isxdigit(cp[1])
&& isxdigit(cp[2])) { // SystemVerilog 3.1 && isxdigit(cp[2])) { // SystemVerilog 3.1
#define vl_decodexdigit(c) ((isdigit(c) ? ((c) - '0') : (tolower((c)) - 'a' + 10))) #define vl_decodexdigit(c) ((isdigit(c) ? ((c) - '0') : (tolower((c)) - 'a' + 10)))
newtext += (char)(16 * vl_decodexdigit(cp[1]) + vl_decodexdigit(cp[2])); newtext
+= static_cast<char>(16 * vl_decodexdigit(cp[1]) + vl_decodexdigit(cp[2]));
cp += 2; cp += 2;
} else if (isalnum(*cp)) { } else if (isalnum(*cp)) {
fileline->v3error("Unknown escape sequence: \\" << *cp); fileline->v3error("Unknown escape sequence: \\" << *cp);

View File

@ -173,9 +173,10 @@ public:
} }
static int debug() { static int debug() {
static int level = -1; static int level = -1;
if (VL_UNLIKELY(level < 0)) if (VL_UNLIKELY(level < 0)) {
level = std::max(std::max(debugBison(), debugFlex()), level = std::max(std::max(debugBison(), debugFlex()),
v3Global.opt.debugSrcLevel("V3ParseImp")); v3Global.opt.debugSrcLevel("V3ParseImp"));
}
return level; return level;
} }
@ -273,7 +274,7 @@ public:
//==== Symbol tables //==== Symbol tables
V3ParseSym* symp() { return m_symp; } V3ParseSym* symp() { return m_symp; }
AstPackage* unitPackage(FileLine* fl) { AstPackage* unitPackage(FileLine* /*fl*/) {
// Find one made earlier? // Find one made earlier?
const VSymEnt* const rootSymp const VSymEnt* const rootSymp
= symp()->symRootp()->findIdFlat(AstPackage::dollarUnitName()); = symp()->symRootp()->findIdFlat(AstPackage::dollarUnitName());

View File

@ -30,7 +30,7 @@
class AbstractMTask VL_NOT_FINAL : public V3GraphVertex { class AbstractMTask VL_NOT_FINAL : public V3GraphVertex {
public: public:
AbstractMTask(V3Graph* graphp) explicit AbstractMTask(V3Graph* graphp)
: V3GraphVertex{graphp} {} : V3GraphVertex{graphp} {}
virtual ~AbstractMTask() override = default; virtual ~AbstractMTask() override = default;
virtual uint32_t id() const = 0; virtual uint32_t id() const = 0;
@ -42,7 +42,7 @@ public:
// TYPES // TYPES
using VxList = std::list<MTaskMoveVertex*>; using VxList = std::list<MTaskMoveVertex*>;
// CONSTRUCTORS // CONSTRUCTORS
AbstractLogicMTask(V3Graph* graphp) explicit AbstractLogicMTask(V3Graph* graphp)
: AbstractMTask{graphp} {} : AbstractMTask{graphp} {}
virtual ~AbstractLogicMTask() override = default; virtual ~AbstractLogicMTask() override = default;
// METHODS // METHODS

View File

@ -1612,7 +1612,7 @@ string V3PreProcImp::getline() {
// Make new string with data up to the newline. // Make new string with data up to the newline.
const int len = rtnp - m_lineChars.c_str() + 1; const int len = rtnp - m_lineChars.c_str() + 1;
const string theLine(m_lineChars, 0, len); string theLine(m_lineChars, 0, len);
m_lineChars = m_lineChars.erase(0, len); // Remove returned characters m_lineChars = m_lineChars.erase(0, len); // Remove returned characters
if (debug() >= 4) { if (debug() >= 4) {
const string lncln = V3PreLex::cleanDbgStrg(theLine); const string lncln = V3PreLex::cleanDbgStrg(theLine);

View File

@ -183,7 +183,7 @@ public:
} }
m_whyNotOptimizable = why; m_whyNotOptimizable = why;
std::ostringstream stack; std::ostringstream stack;
for (auto& callstack : vlstd::reverse_view(m_callStack)) { for (const auto& callstack : vlstd::reverse_view(m_callStack)) {
AstFuncRef* const funcp = callstack->m_funcp; AstFuncRef* const funcp = callstack->m_funcp;
stack << "\n " << funcp->fileline() << "... Called from " stack << "\n " << funcp->fileline() << "... Called from "
<< funcp->prettyName() << "() with parameters:"; << funcp->prettyName() << "() with parameters:";
@ -193,11 +193,12 @@ public:
AstVar* const portp = conIt->first; AstVar* const portp = conIt->first;
AstNode* const pinp = conIt->second->exprp(); AstNode* const pinp = conIt->second->exprp();
AstNodeDType* const dtypep = pinp->dtypep(); AstNodeDType* const dtypep = pinp->dtypep();
if (AstConst* const valp = fetchConstNull(pinp)) if (AstConst* const valp = fetchConstNull(pinp)) {
stack << "\n " << portp->prettyName() << " = " stack << "\n " << portp->prettyName() << " = "
<< prettyNumber(&valp->num(), dtypep); << prettyNumber(&valp->num(), dtypep);
} }
} }
}
m_whyNotOptimizable += stack.str(); m_whyNotOptimizable += stack.str();
} }
} }
@ -380,7 +381,7 @@ private:
UASSERT_OBJ(vscp, nodep, "Not linked"); UASSERT_OBJ(vscp, nodep, "Not linked");
return vscp; return vscp;
} }
int unrollCount() { int unrollCount() const {
return m_params ? v3Global.opt.unrollCount() * 16 : v3Global.opt.unrollCount(); return m_params ? v3Global.opt.unrollCount() * 16 : v3Global.opt.unrollCount();
} }
bool jumpingOver(AstNode* nodep) { bool jumpingOver(AstNode* nodep) {

View File

@ -192,7 +192,9 @@ private:
m_subFuncSize += stmtp->nodeCount(); m_subFuncSize += stmtp->nodeCount();
} }
std::string getScopeChar(VltTraceScope sct) { return std::string(1, (char)(0x80 + sct)); } std::string getScopeChar(VltTraceScope sct) {
return std::string(1, static_cast<char>(0x80 + sct));
}
std::string addAboveInterface(const std::string& scopeName) { std::string addAboveInterface(const std::string& scopeName) {
std::string out; std::string out;

View File

@ -360,7 +360,7 @@ class TristateVisitor final : public TristateBaseVisitor {
VDouble0 m_statTriSigs; // stat tracking VDouble0 m_statTriSigs; // stat tracking
// METHODS // METHODS
string dbgState() { string dbgState() const {
string o = (m_graphing ? " gr " : " ng "); string o = (m_graphing ? " gr " : " ng ");
if (m_alhs) o += "alhs "; if (m_alhs) o += "alhs ";
return o; return o;

View File

@ -58,7 +58,7 @@ private:
VL_DEBUG_FUNC; // Declare debug() VL_DEBUG_FUNC; // Declare debug()
// VISITORS // VISITORS
bool cantUnroll(AstNode* nodep, const char* reason) { bool cantUnroll(AstNode* nodep, const char* reason) const {
if (m_generate) if (m_generate)
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Can't unroll generate for; " << reason); nodep->v3warn(E_UNSUPPORTED, "Unsupported: Can't unroll generate for; " << reason);
UINFO(3, " Can't Unroll: " << reason << " :" << nodep << endl); UINFO(3, " Can't Unroll: " << reason << " :" << nodep << endl);

View File

@ -96,20 +96,20 @@ public:
} }
uint64_t popCount() const { uint64_t popCount() const {
uint64_t pop = 0; uint64_t pop = 0;
for (uint64_t i = 0; i < m_dataSize; i++) { for (uint64_t i = 0; i < m_dataSize; ++i) {
if (hits(i)) pop++; if (hits(i)) ++pop;
} }
return pop; return pop;
} }
uint64_t dataPopCount(const VlcBuckets& remaining) { uint64_t dataPopCount(const VlcBuckets& remaining) {
uint64_t pop = 0; uint64_t pop = 0;
for (uint64_t i = 0; i < m_dataSize; i++) { for (uint64_t i = 0; i < m_dataSize; ++i) {
if (hits(i) && remaining.hits(i)) pop++; if (hits(i) && remaining.hits(i)) ++pop;
} }
return pop; return pop;
} }
void orData(const VlcBuckets& ordata) { void orData(const VlcBuckets& ordata) {
for (uint64_t i = 0; i < m_dataSize; i++) { for (uint64_t i = 0; i < m_dataSize; ++i) {
if (hits(i) && ordata.hits(i)) clearHits(i); if (hits(i) && ordata.hits(i)) clearHits(i);
} }
} }