mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
clang-tidy cleanups. No functional change intended.
This commit is contained in:
parent
8664aac225
commit
44eb362a18
@ -442,11 +442,11 @@ cppcheck: $(CPPCHECK_DEP)
|
||||
$(CPPCHECK) $(CPPCHECK_FLAGS) -DVL_DEBUG=1 -DVL_CPPCHECK=1 -DVL_THREADED=1 $(CPPCHECK_INC) $<
|
||||
|
||||
CLANGTIDY = clang-tidy
|
||||
CLANGTIDY_FLAGS = -config=''
|
||||
CLANGTIDY_FLAGS = -config='' -checks='-fuchsia-*,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-init-variables'
|
||||
CLANGTIDY_DEP = $(subst .h,.h.tidy,$(CPPCHECK_H)) \
|
||||
$(subst .cpp,.cpp.tidy,$(CPPCHECK_CPP))
|
||||
|
||||
clangtidy: $(CLANGTIDY_DEP)
|
||||
clang-tidy: $(CLANGTIDY_DEP)
|
||||
%.cpp.tidy: %.cpp
|
||||
$(CLANGTIDY) $(CLANGTIDY_FLAGS) $< -- -DVL_DEBUG=1 -DVL_CPPCHECK=1 $(CPPCHECK_INC) | 2>&1 tee $@
|
||||
%.h.tidy: %.h
|
||||
|
@ -556,7 +556,7 @@ WDataOutP VL_POWSS_WWW(int obits, int, int rbits, WDataOutP owp, WDataInP lwp, W
|
||||
return owp;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return owp;
|
||||
}
|
||||
return VL_POW_WWW(obits, rbits, rbits, owp, lwp, rwp);
|
||||
}
|
||||
@ -1301,8 +1301,8 @@ IData VL_FGETS_IXI(int obits, void* destp, IData fpi) VL_MT_SAFE {
|
||||
}
|
||||
|
||||
// declared in verilated_heavy.h
|
||||
IData VL_FGETS_NI(std::string& str, IData fpi) VL_MT_SAFE {
|
||||
return getLine(str, fpi, std::numeric_limits<size_t>::max());
|
||||
IData VL_FGETS_NI(std::string& dest, IData fpi) VL_MT_SAFE {
|
||||
return getLine(dest, fpi, std::numeric_limits<size_t>::max());
|
||||
}
|
||||
|
||||
IData VL_FERROR_IN(IData, std::string& outputr) VL_MT_SAFE {
|
||||
|
@ -854,18 +854,16 @@ extern std::string VL_SUBSTR_N(const std::string& lhs, IData rhs, IData ths) VL_
|
||||
inline IData VL_CMP_NN(const std::string& lhs, const std::string& rhs, bool ignoreCase) VL_PURE {
|
||||
// SystemVerilog does not allow a string variable to contain '\0'.
|
||||
// So C functions such as strcmp() can correctly compare strings.
|
||||
int result;
|
||||
if (ignoreCase) {
|
||||
result = VL_STRCASECMP(lhs.c_str(), rhs.c_str());
|
||||
return VL_STRCASECMP(lhs.c_str(), rhs.c_str());
|
||||
} else {
|
||||
result = std::strcmp(lhs.c_str(), rhs.c_str());
|
||||
return std::strcmp(lhs.c_str(), rhs.c_str());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
extern IData VL_ATOI_N(const std::string& str, int base) VL_PURE;
|
||||
|
||||
extern IData VL_FGETS_NI(std::string& destp, IData fpi);
|
||||
extern IData VL_FGETS_NI(std::string& dest, IData fpi);
|
||||
|
||||
//======================================================================
|
||||
// Dumping
|
||||
|
@ -98,10 +98,8 @@ VlThreadPool::VlThreadPool(int nThreads, bool profiling)
|
||||
}
|
||||
|
||||
VlThreadPool::~VlThreadPool() {
|
||||
for (int i = 0; i < m_workers.size(); ++i) {
|
||||
// Each ~WorkerThread will wait for its thread to exit.
|
||||
delete m_workers[i];
|
||||
}
|
||||
// Each ~WorkerThread will wait for its thread to exit.
|
||||
for (auto& i : m_workers) delete i;
|
||||
if (VL_UNLIKELY(m_profiling)) tearDownProfilingClientThread();
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef VL_CPPCHECK
|
||||
#ifndef VL_DERIVED_T
|
||||
# error "This file should be included in trace format implementations"
|
||||
#endif
|
||||
@ -641,3 +642,5 @@ inline static void cvtQDataToStr(char* dstp, QData value) {
|
||||
}
|
||||
|
||||
#define cvtEDataToStr cvtIDataToStr
|
||||
|
||||
#endif // VL_CPPCHECK
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
virtual vluint32_t type() const { return 0; }
|
||||
virtual vluint32_t size() const { return 0; }
|
||||
virtual const VerilatedRange* rangep() const { return nullptr; }
|
||||
virtual vpiHandle dovpi_scan() { return 0; }
|
||||
virtual vpiHandle dovpi_scan() { return nullptr; }
|
||||
};
|
||||
|
||||
typedef PLI_INT32 (*VerilatedPliCb)(struct t_cb_data*);
|
||||
@ -187,7 +187,7 @@ public:
|
||||
nextp->iterationInc();
|
||||
return ((nextp)->castVpiHandle());
|
||||
}
|
||||
return 0; // End of list - only one deep
|
||||
return nullptr; // End of list - only one deep
|
||||
}
|
||||
};
|
||||
|
||||
@ -312,14 +312,14 @@ public:
|
||||
m_it = varsp->begin();
|
||||
m_started = true;
|
||||
} else if (VL_UNLIKELY(m_it == varsp->end())) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
} else {
|
||||
++m_it;
|
||||
}
|
||||
if (m_it == varsp->end()) return 0;
|
||||
if (m_it == varsp->end()) return nullptr;
|
||||
return ((new VerilatedVpioVar(&(m_it->second), m_scopep))->castVpiHandle());
|
||||
}
|
||||
return 0; // End of list - only one deep
|
||||
return nullptr; // End of list - only one deep
|
||||
}
|
||||
};
|
||||
|
||||
@ -346,7 +346,7 @@ public:
|
||||
}
|
||||
virtual vpiHandle dovpi_scan() override {
|
||||
vpiHandle result;
|
||||
if (m_done) return 0;
|
||||
if (m_done) return nullptr;
|
||||
result = vpi_handle_by_index(m_handle, m_iteration);
|
||||
iterationInc();
|
||||
return result;
|
||||
@ -387,7 +387,7 @@ public:
|
||||
}
|
||||
virtual vluint32_t type() const override { return vpiIterator; }
|
||||
virtual vpiHandle dovpi_scan() override {
|
||||
if (m_it == m_vec->end()) return 0;
|
||||
if (m_it == m_vec->end()) return nullptr;
|
||||
const VerilatedScope* modp = *m_it++;
|
||||
return (new VerilatedVpioModule(modp))->castVpiHandle();
|
||||
}
|
||||
@ -1053,10 +1053,10 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
|
||||
}
|
||||
}
|
||||
|
||||
PLI_INT32 vpi_remove_cb(vpiHandle object) {
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_remove_cb %p\n", object););
|
||||
PLI_INT32 vpi_remove_cb(vpiHandle cb_obj) {
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_remove_cb %p\n", cb_obj););
|
||||
VerilatedVpiImp::assertOneCheck();
|
||||
VerilatedVpioCb* vop = VerilatedVpioCb::castp(object);
|
||||
VerilatedVpioCb* vop = VerilatedVpioCb::castp(cb_obj);
|
||||
_VL_VPI_ERROR_RESET();
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
if (vop->cb_datap()->reason == cbAfterDelay) {
|
||||
@ -1070,7 +1070,7 @@ PLI_INT32 vpi_remove_cb(vpiHandle object) {
|
||||
void vpi_get_cb_info(vpiHandle /*object*/, p_cb_data /*cb_data_p*/) { _VL_VPI_UNIMP(); }
|
||||
vpiHandle vpi_register_systf(p_vpi_systf_data /*systf_data_p*/) {
|
||||
_VL_VPI_UNIMP();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
void vpi_get_systf_info(vpiHandle /*object*/, p_vpi_systf_data /*systf_data_p*/) {
|
||||
_VL_VPI_UNIMP();
|
||||
@ -1136,24 +1136,24 @@ vpiHandle vpi_handle_by_index(vpiHandle object, PLI_INT32 indx) {
|
||||
VerilatedVpioVar* varop = VerilatedVpioVar::castp(object);
|
||||
_VL_VPI_ERROR_RESET();
|
||||
if (VL_LIKELY(varop)) {
|
||||
if (varop->varp()->dims() < 2) return 0;
|
||||
if (varop->varp()->dims() < 2) return nullptr;
|
||||
if (VL_LIKELY(varop->varp()->unpacked().left() >= varop->varp()->unpacked().right())) {
|
||||
if (VL_UNLIKELY(indx > varop->varp()->unpacked().left()
|
||||
|| indx < varop->varp()->unpacked().right()))
|
||||
return 0;
|
||||
return nullptr;
|
||||
return (new VerilatedVpioMemoryWord(varop->varp(), varop->scopep(), indx,
|
||||
indx - varop->varp()->unpacked().right()))
|
||||
->castVpiHandle();
|
||||
}
|
||||
if (VL_UNLIKELY(indx < varop->varp()->unpacked().left()
|
||||
|| indx > varop->varp()->unpacked().right()))
|
||||
return 0;
|
||||
return nullptr;
|
||||
return (new VerilatedVpioMemoryWord(varop->varp(), varop->scopep(), indx,
|
||||
indx - varop->varp()->unpacked().left()))
|
||||
->castVpiHandle();
|
||||
}
|
||||
_VL_VPI_INTERNAL(__FILE__, __LINE__, "%s : can't resolve handle", VL_FUNC);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// for traversing relationships
|
||||
@ -1165,56 +1165,56 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle object) {
|
||||
switch (type) {
|
||||
case vpiLeftRange: {
|
||||
if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) {
|
||||
if (VL_UNLIKELY(!vop->rangep())) return 0;
|
||||
if (VL_UNLIKELY(!vop->rangep())) return nullptr;
|
||||
return (new VerilatedVpioConst(vop->rangep()->left()))->castVpiHandle();
|
||||
} else if (VerilatedVpioRange* vop = VerilatedVpioRange::castp(object)) {
|
||||
if (VL_UNLIKELY(!vop->rangep())) return 0;
|
||||
if (VL_UNLIKELY(!vop->rangep())) return nullptr;
|
||||
return (new VerilatedVpioConst(vop->rangep()->left()))->castVpiHandle();
|
||||
}
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__,
|
||||
"%s: Unsupported vpiHandle (%p) for type %s, nothing will be returned",
|
||||
VL_FUNC, object, VerilatedVpiError::strFromVpiMethod(type));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
case vpiRightRange: {
|
||||
if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) {
|
||||
if (VL_UNLIKELY(!vop->rangep())) return 0;
|
||||
if (VL_UNLIKELY(!vop->rangep())) return nullptr;
|
||||
return (new VerilatedVpioConst(vop->rangep()->right()))->castVpiHandle();
|
||||
} else if (VerilatedVpioRange* vop = VerilatedVpioRange::castp(object)) {
|
||||
if (VL_UNLIKELY(!vop->rangep())) return 0;
|
||||
if (VL_UNLIKELY(!vop->rangep())) return nullptr;
|
||||
return (new VerilatedVpioConst(vop->rangep()->right()))->castVpiHandle();
|
||||
}
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__,
|
||||
"%s: Unsupported vpiHandle (%p) for type %s, nothing will be returned",
|
||||
VL_FUNC, object, VerilatedVpiError::strFromVpiMethod(type));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
case vpiIndex: {
|
||||
VerilatedVpioVar* vop = VerilatedVpioVar::castp(object);
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
if (VL_UNLIKELY(!vop)) return nullptr;
|
||||
return (new VerilatedVpioConst(vop->index()))->castVpiHandle();
|
||||
}
|
||||
case vpiScope: {
|
||||
VerilatedVpioVar* vop = VerilatedVpioVar::castp(object);
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
if (VL_UNLIKELY(!vop)) return nullptr;
|
||||
return (new VerilatedVpioScope(vop->scopep()))->castVpiHandle();
|
||||
}
|
||||
case vpiParent: {
|
||||
VerilatedVpioMemoryWord* vop = VerilatedVpioMemoryWord::castp(object);
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
if (VL_UNLIKELY(!vop)) return nullptr;
|
||||
return (new VerilatedVpioVar(vop->varp(), vop->scopep()))->castVpiHandle();
|
||||
}
|
||||
default:
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported type %s, nothing will be returned",
|
||||
VL_FUNC, VerilatedVpiError::strFromVpiMethod(type));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
vpiHandle vpi_handle_multi(PLI_INT32 /*type*/, vpiHandle /*refHandle1*/, vpiHandle /*refHandle2*/,
|
||||
...) {
|
||||
_VL_VPI_UNIMP();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
||||
@ -1224,8 +1224,8 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
||||
switch (type) {
|
||||
case vpiMemoryWord: {
|
||||
VerilatedVpioVar* vop = VerilatedVpioVar::castp(object);
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
if (vop->varp()->dims() < 2) return 0;
|
||||
if (VL_UNLIKELY(!vop)) return nullptr;
|
||||
if (vop->varp()->dims() < 2) return nullptr;
|
||||
if (vop->varp()->dims() > 2) {
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__,
|
||||
"%s: %s, object %s has unsupported number of indices (%d)", VL_FUNC,
|
||||
@ -1236,8 +1236,8 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
||||
}
|
||||
case vpiRange: {
|
||||
VerilatedVpioVar* vop = VerilatedVpioVar::castp(object);
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
if (vop->varp()->dims() < 2) return 0;
|
||||
if (VL_UNLIKELY(!vop)) return nullptr;
|
||||
if (vop->varp()->dims() < 2) return nullptr;
|
||||
// Unsupported is multidim list
|
||||
if (vop->varp()->dims() > 2) {
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__,
|
||||
@ -1249,7 +1249,7 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
||||
}
|
||||
case vpiReg: {
|
||||
VerilatedVpioScope* vop = VerilatedVpioScope::castp(object);
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
if (VL_UNLIKELY(!vop)) return nullptr;
|
||||
return ((new VerilatedVpioVarIter(vop->scopep()))->castVpiHandle());
|
||||
}
|
||||
case vpiModule: {
|
||||
@ -1257,13 +1257,13 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
||||
const VerilatedHierarchyMap* map = VerilatedImp::hierarchyMap();
|
||||
const VerilatedScope* mod = vop ? vop->scopep() : nullptr;
|
||||
const auto it = vlstd::as_const(map)->find(const_cast<VerilatedScope*>(mod));
|
||||
if (it == map->end()) return 0;
|
||||
if (it == map->end()) return nullptr;
|
||||
return ((new VerilatedVpioModuleIter(it->second))->castVpiHandle());
|
||||
}
|
||||
default:
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported type %s, nothing will be returned",
|
||||
VL_FUNC, VerilatedVpiError::strFromVpiObjType(type));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
vpiHandle vpi_scan(vpiHandle object) {
|
||||
@ -1347,7 +1347,7 @@ PLI_BYTE8* vpi_get_str(PLI_INT32 property, vpiHandle object) {
|
||||
default:
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported type %s, nothing will be returned",
|
||||
VL_FUNC, VerilatedVpiError::strFromVpiProp(property));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1644,7 +1644,7 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_
|
||||
_VL_VPI_ERROR_RESET();
|
||||
if (VL_UNLIKELY(!valuep)) {
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_put_value with nullptr value pointer");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) {
|
||||
VL_DEBUG_IF_PLI(
|
||||
@ -1657,9 +1657,9 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_
|
||||
"Ignoring vpi_put_value to signal marked read-only,"
|
||||
" use public_flat_rw instead: %s",
|
||||
vop->fullname());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (!vl_check_format(vop->varp(), valuep, vop->fullname(), false)) return 0;
|
||||
if (!vl_check_format(vop->varp(), valuep, vop->fullname(), false)) return nullptr;
|
||||
if (valuep->format == vpiVectorVal) {
|
||||
if (VL_UNLIKELY(!valuep->value.vector)) return nullptr;
|
||||
if (vop->varp()->vltype() == VLVT_UINT8) {
|
||||
@ -1760,7 +1760,7 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_
|
||||
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Parsing failed for '%s' as value %s for %s",
|
||||
VL_FUNC, valuep->value.str,
|
||||
VerilatedVpiError::strFromVpiVal(valuep->format), vop->fullname());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (success > 1) {
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__,
|
||||
@ -1849,11 +1849,11 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_
|
||||
} else if (VerilatedVpioParam* vop = VerilatedVpioParam::castp(object)) {
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Ignoring vpi_put_value to vpiParameter: %s",
|
||||
VL_FUNC, vop->fullname());
|
||||
return 0;
|
||||
return nullptr;
|
||||
} else if (VerilatedVpioConst* vop = VerilatedVpioConst::castp(object)) {
|
||||
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Ignoring vpi_put_value to vpiConstant: %s",
|
||||
VL_FUNC, vop->fullname());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported vpiHandle (%p)", VL_FUNC, object);
|
||||
return nullptr;
|
||||
@ -1915,7 +1915,7 @@ PLI_UINT32 vpi_mcd_close(PLI_UINT32 mcd) {
|
||||
|
||||
PLI_BYTE8* vpi_mcd_name(PLI_UINT32 /*mcd*/) {
|
||||
_VL_VPI_UNIMP();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PLI_INT32 vpi_mcd_printf(PLI_UINT32 mcd, PLI_BYTE8* formatp, ...) {
|
||||
@ -2025,7 +2025,7 @@ PLI_INT32 vpi_put_data(PLI_INT32 /*id*/, PLI_BYTE8* /*dataLoc*/, PLI_INT32 /*num
|
||||
}
|
||||
void* vpi_get_userdata(vpiHandle /*obj*/) {
|
||||
_VL_VPI_UNIMP();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
PLI_INT32 vpi_put_userdata(vpiHandle /*obj*/, void* /*userdata*/) {
|
||||
_VL_VPI_UNIMP();
|
||||
@ -2056,5 +2056,5 @@ PLI_INT32 vpi_control(PLI_INT32 operation, ...) {
|
||||
vpiHandle vpi_handle_by_multi_index(vpiHandle /*obj*/, PLI_INT32 /*num_index*/,
|
||||
PLI_INT32* /*index_array*/) {
|
||||
_VL_VPI_UNIMP();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2463,7 +2463,7 @@ public:
|
||||
|
||||
private:
|
||||
class CTypeRecursed;
|
||||
CTypeRecursed cTypeRecurse(bool forFunc, bool compound) const;
|
||||
CTypeRecursed cTypeRecurse(bool compound) const;
|
||||
};
|
||||
|
||||
class AstNodeUOrStructDType : public AstNodeDType {
|
||||
|
@ -568,23 +568,23 @@ public:
|
||||
};
|
||||
|
||||
string AstNodeDType::cType(const string& name, bool forFunc, bool isRef) const {
|
||||
CTypeRecursed info = cTypeRecurse(forFunc, false);
|
||||
CTypeRecursed info = cTypeRecurse(false);
|
||||
return info.render(name, isRef);
|
||||
}
|
||||
|
||||
AstNodeDType::CTypeRecursed AstNodeDType::cTypeRecurse(bool forFunc, bool compound) const {
|
||||
AstNodeDType::CTypeRecursed AstNodeDType::cTypeRecurse(bool compound) const {
|
||||
CTypeRecursed info;
|
||||
|
||||
const AstNodeDType* dtypep = this->skipRefp();
|
||||
if (const auto* adtypep = VN_CAST_CONST(dtypep, AssocArrayDType)) {
|
||||
const CTypeRecursed key = adtypep->keyDTypep()->cTypeRecurse(false, true);
|
||||
const CTypeRecursed val = adtypep->subDTypep()->cTypeRecurse(false, true);
|
||||
const CTypeRecursed key = adtypep->keyDTypep()->cTypeRecurse(true);
|
||||
const CTypeRecursed val = adtypep->subDTypep()->cTypeRecurse(true);
|
||||
info.m_type = "VlAssocArray<" + key.m_type + ", " + val.m_type + ">";
|
||||
} else if (const auto* adtypep = VN_CAST_CONST(dtypep, DynArrayDType)) {
|
||||
const CTypeRecursed sub = adtypep->subDTypep()->cTypeRecurse(false, true);
|
||||
const CTypeRecursed sub = adtypep->subDTypep()->cTypeRecurse(true);
|
||||
info.m_type = "VlQueue<" + sub.m_type + ">";
|
||||
} else if (const auto* adtypep = VN_CAST_CONST(dtypep, QueueDType)) {
|
||||
const CTypeRecursed sub = adtypep->subDTypep()->cTypeRecurse(false, true);
|
||||
const CTypeRecursed sub = adtypep->subDTypep()->cTypeRecurse(true);
|
||||
info.m_type = "VlQueue<" + sub.m_type;
|
||||
// + 1 below as VlQueue uses 0 to mean unlimited, 1 to mean size() max is 1
|
||||
if (adtypep->boundp()) info.m_type += ", " + cvtToStr(adtypep->boundConst() + 1);
|
||||
@ -595,7 +595,7 @@ AstNodeDType::CTypeRecursed AstNodeDType::cTypeRecurse(bool forFunc, bool compou
|
||||
if (compound) {
|
||||
v3fatalSrc("Dynamic arrays or queues with unpacked elements are not yet supported");
|
||||
}
|
||||
const CTypeRecursed sub = adtypep->subDTypep()->cTypeRecurse(false, compound);
|
||||
const CTypeRecursed sub = adtypep->subDTypep()->cTypeRecurse(compound);
|
||||
info.m_type = sub.m_type;
|
||||
info.m_dims = "[" + cvtToStr(adtypep->declRange().elements()) + "]" + sub.m_dims;
|
||||
} else if (const AstBasicDType* bdtypep = dtypep->basicp()) {
|
||||
|
@ -148,7 +148,7 @@ class CUseVisitor : public AstNVisitor {
|
||||
funcp->isStatic(false);
|
||||
funcp->protect(false);
|
||||
AstNode* exprp = new AstCMath(nodep->fileline(),
|
||||
"std::string(\"'{\") + to_string_middle() + \"}\"", 0);
|
||||
R"(std::string("'{") + to_string_middle() + "}")", 0);
|
||||
exprp->dtypeSetString();
|
||||
funcp->addStmtsp(new AstCReturn(nodep->fileline(), exprp));
|
||||
nodep->addStmtp(funcp);
|
||||
|
@ -73,7 +73,7 @@ private:
|
||||
ensureLower32Cast(castp);
|
||||
nodep->user1(1); // Now must be of known size
|
||||
}
|
||||
int castSize(AstNode* nodep) {
|
||||
static int castSize(AstNode* nodep) {
|
||||
if (nodep->isQuad()) {
|
||||
return VL_QUADSIZE;
|
||||
} else if (nodep->width() <= 8) {
|
||||
|
@ -311,13 +311,12 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
string spaces(int level) {
|
||||
static string spaces(int level) {
|
||||
string out;
|
||||
while (level--) out += " ";
|
||||
return out;
|
||||
} // LCOV_EXCL_LINE
|
||||
|
||||
string pad(unsigned column, const string& in) {
|
||||
static string pad(unsigned column, const string& in) {
|
||||
string out = in;
|
||||
while (out.length() < column) out += ' ';
|
||||
return out;
|
||||
|
@ -1941,7 +1941,8 @@ private:
|
||||
ifp->rhsp(new AstCond(truep->fileline(), condp, truep, falsep));
|
||||
nodep->replaceWith(ifp);
|
||||
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||
} else if (0 // Disabled, as vpm assertions are faster without due to short-circuiting
|
||||
} else if (false // Disabled, as vpm assertions are faster
|
||||
// without due to short-circuiting
|
||||
&& operandIfIf(nodep)) {
|
||||
UINFO(9, "IF({a}) IF({b}) => IF({a} && {b})" << endl);
|
||||
AstNodeIf* lowerIfp = VN_CAST(nodep->ifsp(), NodeIf);
|
||||
|
@ -1245,7 +1245,6 @@ public:
|
||||
nodep->v3fatalSrc("Unknown node type reached emitter: " << nodep->prettyTypeName());
|
||||
}
|
||||
|
||||
public:
|
||||
EmitCStmts() {
|
||||
m_suppressSemi = false;
|
||||
m_wideTempRefp = nullptr;
|
||||
@ -2353,7 +2352,7 @@ void EmitCStmts::displayNode(AstNode* nodep, AstScopeName* scopenamep, const str
|
||||
//######################################################################
|
||||
// Internal EmitC
|
||||
|
||||
void EmitCImp::emitCoverageDecl(AstNodeModule* modp) {
|
||||
void EmitCImp::emitCoverageDecl(AstNodeModule*) {
|
||||
if (v3Global.opt.coverage()) {
|
||||
ofp()->putsPrivate(true);
|
||||
putsDecoration("// Coverage\n");
|
||||
@ -2400,7 +2399,7 @@ void EmitCImp::emitMTaskVertexCtors(bool* firstp) {
|
||||
void EmitCImp::emitCtorImp(AstNodeModule* modp) {
|
||||
puts("\n");
|
||||
bool first = true;
|
||||
string section("");
|
||||
string section;
|
||||
emitParams(modp, true, &first, section /*ref*/);
|
||||
|
||||
if (VN_IS(modp, Class)) {
|
||||
@ -2480,7 +2479,7 @@ void EmitCImp::emitConfigureImp(AstNodeModule* modp) {
|
||||
splitSizeInc(10);
|
||||
}
|
||||
|
||||
void EmitCImp::emitCoverageImp(AstNodeModule* modp) {
|
||||
void EmitCImp::emitCoverageImp(AstNodeModule*) {
|
||||
if (v3Global.opt.coverage()) {
|
||||
puts("\n// Coverage\n");
|
||||
// Rather than putting out VL_COVER_INSERT calls directly, we do it via this function
|
||||
@ -3033,7 +3032,7 @@ void EmitCImp::emitMTaskState() {
|
||||
puts("bool __Vm_even_cycle;\n");
|
||||
}
|
||||
|
||||
void EmitCImp::emitIntTop(AstNodeModule* modp) {
|
||||
void EmitCImp::emitIntTop(AstNodeModule*) {
|
||||
// Always have this first; gcc has short circuiting if #ifdef is first in a file
|
||||
ofp()->putsGuard();
|
||||
puts("\n");
|
||||
|
@ -150,37 +150,37 @@ class CMakeEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
global.push_back("${VERILATOR_ROOT}/include/verilated.cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/verilated.cpp");
|
||||
if (v3Global.dpi()) { //
|
||||
global.push_back("${VERILATOR_ROOT}/include/verilated_dpi.cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/verilated_dpi.cpp");
|
||||
}
|
||||
if (v3Global.opt.vpi()) {
|
||||
global.push_back("${VERILATOR_ROOT}/include/verilated_vpi.cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/verilated_vpi.cpp");
|
||||
}
|
||||
if (v3Global.opt.savable()) {
|
||||
global.push_back("${VERILATOR_ROOT}/include/verilated_save.cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/verilated_save.cpp");
|
||||
}
|
||||
if (v3Global.opt.coverage()) {
|
||||
global.push_back("${VERILATOR_ROOT}/include/verilated_cov.cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/verilated_cov.cpp");
|
||||
}
|
||||
if (v3Global.opt.trace()) {
|
||||
global.push_back("${VERILATOR_ROOT}/include/" + v3Global.opt.traceSourceBase()
|
||||
+ "_c.cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/" + v3Global.opt.traceSourceBase()
|
||||
+ "_c.cpp");
|
||||
if (v3Global.opt.systemC()) {
|
||||
if (v3Global.opt.traceFormat() != TraceFormat::VCD) {
|
||||
v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: This trace format is not supported in SystemC, "
|
||||
"use VCD format.");
|
||||
}
|
||||
global.push_back("${VERILATOR_ROOT}/include/" + v3Global.opt.traceSourceLang()
|
||||
+ ".cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/" + v3Global.opt.traceSourceLang()
|
||||
+ ".cpp");
|
||||
}
|
||||
}
|
||||
if (v3Global.opt.mtasks()) {
|
||||
global.push_back("${VERILATOR_ROOT}/include/verilated_threads.cpp");
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/verilated_threads.cpp");
|
||||
}
|
||||
if (!v3Global.opt.protectLib().empty()) {
|
||||
global.push_back(v3Global.opt.makeDir() + "/" + v3Global.opt.protectLib() + ".cpp");
|
||||
global.emplace_back(v3Global.opt.makeDir() + "/" + v3Global.opt.protectLib() + ".cpp");
|
||||
}
|
||||
|
||||
*of << "# Global classes, need linked once per executable\n";
|
||||
|
@ -296,7 +296,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||
if (VN_IS(m_modp, Class)) return; // The ClassPackage is what is visible
|
||||
nameCheck(nodep);
|
||||
|
||||
m_scopes.push_back(make_pair(nodep, m_modp));
|
||||
m_scopes.emplace_back(make_pair(nodep, m_modp));
|
||||
|
||||
if (v3Global.opt.vpi() && !nodep->isTop()) {
|
||||
string name_dedot = AstNode::dedotName(nodep->shortName());
|
||||
@ -331,7 +331,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||
virtual void visit(AstVar* nodep) override {
|
||||
nameCheck(nodep);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isSigUserRdPublic()) { m_modVars.push_back(make_pair(m_modp, nodep)); }
|
||||
if (nodep->isSigUserRdPublic()) { m_modVars.emplace_back(make_pair(m_modp, nodep)); }
|
||||
}
|
||||
virtual void visit(AstCoverDecl* nodep) override {
|
||||
// Assign numbers to all bins, so we know how big of an array to use
|
||||
|
@ -281,7 +281,6 @@ public:
|
||||
of.putsHeader();
|
||||
}
|
||||
|
||||
public:
|
||||
explicit EmitMk() {
|
||||
emitClassMake();
|
||||
emitOverallMake();
|
||||
|
@ -587,12 +587,12 @@ protected:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
size_t listSize(StrList& sl) {
|
||||
static size_t listSize(StrList& sl) {
|
||||
size_t out = 0;
|
||||
for (const string& i : sl) out += i.length();
|
||||
return out;
|
||||
}
|
||||
string listString(StrList& sl) {
|
||||
static string listString(StrList& sl) {
|
||||
string out;
|
||||
for (const string& i : sl) out += i;
|
||||
return out;
|
||||
|
@ -90,8 +90,8 @@ int VFileContent::debug() {
|
||||
|
||||
void VFileContent::pushText(const string& text) {
|
||||
if (m_lines.size() == 0) {
|
||||
m_lines.push_back(""); // no such thing as line [0]
|
||||
m_lines.push_back(""); // start with no leftover
|
||||
m_lines.emplace_back(""); // no such thing as line [0]
|
||||
m_lines.emplace_back(""); // start with no leftover
|
||||
}
|
||||
|
||||
// Any leftover text is stored on largest line (might be "")
|
||||
@ -112,7 +112,7 @@ void VFileContent::pushText(const string& text) {
|
||||
}
|
||||
}
|
||||
// Keep leftover for next time
|
||||
m_lines.push_back(string(leftover, line_start)); // Might be ""
|
||||
m_lines.emplace_back(string(leftover, line_start)); // Might be ""
|
||||
}
|
||||
|
||||
string VFileContent::getLine(int lineno) const {
|
||||
|
@ -603,7 +603,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) {
|
||||
<< " ob" << vvertexp->outBeginp() << " on"
|
||||
<< (vvertexp->outBeginp()
|
||||
? vvertexp->outBeginp()->outNextp()
|
||||
: 0)
|
||||
: nullptr)
|
||||
<< " " << vvertexp->name() << endl);
|
||||
for (V3GraphEdge* edgep = vvertexp->outBeginp(); edgep;
|
||||
edgep = edgep->outNextp()) {
|
||||
@ -940,7 +940,7 @@ private:
|
||||
|
||||
public:
|
||||
GateDedupeHash() {}
|
||||
~GateDedupeHash() {
|
||||
virtual ~GateDedupeHash() override {
|
||||
if (v3Global.opt.debugCheck()) check();
|
||||
}
|
||||
|
||||
@ -966,7 +966,7 @@ public:
|
||||
}
|
||||
|
||||
// Callback from V3Hashed::findDuplicate
|
||||
bool isSame(AstNode* node1p, AstNode* node2p) {
|
||||
virtual bool isSame(AstNode* node1p, AstNode* node2p) override {
|
||||
// Assignment may have been hashReplaced, if so consider non-match (effectively removed)
|
||||
if (isReplaced(node1p) || isReplaced(node2p)) {
|
||||
// UINFO(9, "isSame hit on replaced "<<(void*)node1p<<" "<<(void*)node2p<<endl);
|
||||
@ -1087,7 +1087,7 @@ private:
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
GateDedupeVarVisitor() {}
|
||||
~GateDedupeVarVisitor() {}
|
||||
virtual ~GateDedupeVarVisitor() override {}
|
||||
// PUBLIC METHODS
|
||||
AstNodeVarRef* findDupe(AstNode* nodep, AstVarScope* consumerVarScopep, AstActive* activep) {
|
||||
m_assignp = nullptr;
|
||||
@ -1349,7 +1349,7 @@ private:
|
||||
}
|
||||
return VNUser(0);
|
||||
}
|
||||
virtual VNUser visit(GateLogicVertex*, VNUser vu) override { //
|
||||
virtual VNUser visit(GateLogicVertex*, VNUser) override { //
|
||||
return VNUser(0);
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,8 @@ private:
|
||||
|
||||
// METHODS
|
||||
DfaGraph* graphp() { return static_cast<DfaGraph*>(m_graphp); }
|
||||
bool nfaState(V3GraphVertex* vertexp) { return vertexp->color() == 0; }
|
||||
// bool dfaState(V3GraphVertex* vertexp) { return vertexp->color()==1; }
|
||||
static bool nfaState(V3GraphVertex* vertexp) { return vertexp->color() == 0; }
|
||||
// static bool dfaState(V3GraphVertex* vertexp) { return vertexp->color()==1; }
|
||||
|
||||
void nextStep() { m_step++; }
|
||||
|
||||
|
@ -75,8 +75,9 @@ public:
|
||||
void check(); // Check assertions on structure
|
||||
// Hash the node, and insert into map. Return iterator to inserted
|
||||
iterator hashAndInsert(AstNode* nodep);
|
||||
void hash(AstNode* nodep); // Only hash the node
|
||||
bool sameNodes(AstNode* node1p, AstNode* node2p); // After hashing, and tell if identical
|
||||
static void hash(AstNode* nodep); // Only hash the node
|
||||
// After hashing, and tell if identical
|
||||
static bool sameNodes(AstNode* node1p, AstNode* node2p);
|
||||
void erase(iterator it); // Remove node from structures
|
||||
// Return duplicate in hash, if any, with optional user check for sameness
|
||||
iterator findDuplicate(AstNode* nodep, V3HashedUserSame* checkp = nullptr);
|
||||
|
@ -436,6 +436,6 @@ void V3HierBlockPlan::writeCommandArgsFiles(bool forCMake) const {
|
||||
*of << v3Global.opt.allArgsStringForHierBlock(true) << "\n";
|
||||
}
|
||||
|
||||
string V3HierBlockPlan::topCommandArgsFileName(bool forCMake) const {
|
||||
string V3HierBlockPlan::topCommandArgsFileName(bool forCMake) {
|
||||
return V3HierCommandArgsFileName(v3Global.opt.prefix(), forCMake);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
|
||||
// Write command line arguments to .f files for child Verilation run
|
||||
void writeCommandArgsFiles(bool forCMake) const;
|
||||
string topCommandArgsFileName(bool forCMake) const;
|
||||
static string topCommandArgsFileName(bool forCMake);
|
||||
|
||||
static void createPlan(AstNetlist* nodep);
|
||||
};
|
||||
|
@ -417,7 +417,7 @@ private:
|
||||
// Track what scope it was originally under so V3LinkDot can resolve it
|
||||
string newdots = VString::dot(m_cellp->name(), ".", nodep->inlinedDots());
|
||||
nodep->inlinedDots(newdots);
|
||||
for (string tryname = nodep->dotted(); 1;) {
|
||||
for (string tryname = nodep->dotted(); true;) {
|
||||
if (m_renamedInterfaces.count(tryname)) {
|
||||
nodep->dotted(m_cellp->name() + "__DOT__" + nodep->dotted());
|
||||
break;
|
||||
|
@ -178,7 +178,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit InstDeModVarVisitor() {}
|
||||
void main(AstNodeModule* nodep) {
|
||||
|
@ -49,7 +49,6 @@ public:
|
||||
VDouble0 m_statAssnCon; // Statistic tracking
|
||||
std::vector<AstNode*> m_unlinkps;
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
LifeState() {}
|
||||
~LifeState() {
|
||||
@ -68,35 +67,29 @@ public:
|
||||
// Structure for each variable encountered
|
||||
|
||||
class LifeVarEntry {
|
||||
AstNodeAssign* m_assignp; // Last assignment to this varscope, nullptr if no longer relevant
|
||||
AstConst* m_constp; // Known constant value
|
||||
// Last assignment to this varscope, nullptr if no longer relevant
|
||||
AstNodeAssign* m_assignp = nullptr;
|
||||
AstConst* m_constp = nullptr; // Known constant value
|
||||
// First access was a set (and thus block above may have a set that can be deleted
|
||||
bool m_setBeforeUse;
|
||||
// Was ever assigned (and thus above block may not preserve constant propagation)
|
||||
bool m_everSet;
|
||||
|
||||
inline void init(bool setBeforeUse) {
|
||||
m_assignp = nullptr;
|
||||
m_constp = nullptr;
|
||||
m_setBeforeUse = setBeforeUse;
|
||||
m_everSet = false;
|
||||
}
|
||||
bool m_everSet = false;
|
||||
|
||||
public:
|
||||
class SIMPLEASSIGN {};
|
||||
class COMPLEXASSIGN {};
|
||||
class CONSUMED {};
|
||||
|
||||
LifeVarEntry(SIMPLEASSIGN, AstNodeAssign* assp) {
|
||||
init(true);
|
||||
LifeVarEntry(SIMPLEASSIGN, AstNodeAssign* assp)
|
||||
: m_setBeforeUse{true} {
|
||||
simpleAssign(assp);
|
||||
}
|
||||
explicit LifeVarEntry(COMPLEXASSIGN) {
|
||||
init(false);
|
||||
explicit LifeVarEntry(COMPLEXASSIGN)
|
||||
: m_setBeforeUse{false} {
|
||||
complexAssign();
|
||||
}
|
||||
explicit LifeVarEntry(CONSUMED) {
|
||||
init(false);
|
||||
explicit LifeVarEntry(CONSUMED)
|
||||
: m_setBeforeUse{false} {
|
||||
consumed();
|
||||
}
|
||||
~LifeVarEntry() {}
|
||||
|
@ -99,13 +99,11 @@ public:
|
||||
// and a sequence number within the mtask:
|
||||
|
||||
struct LifeLocation {
|
||||
const ExecMTask* mtaskp;
|
||||
uint32_t sequence;
|
||||
const ExecMTask* mtaskp = nullptr;
|
||||
uint32_t sequence = 0;
|
||||
|
||||
public:
|
||||
LifeLocation()
|
||||
: mtaskp{nullptr}
|
||||
, sequence{0} {}
|
||||
LifeLocation() {}
|
||||
LifeLocation(const ExecMTask* mtaskp_, uint32_t sequence_)
|
||||
: mtaskp{mtaskp_}
|
||||
, sequence{sequence_} {}
|
||||
@ -120,9 +118,8 @@ public:
|
||||
|
||||
struct LifePostLocation {
|
||||
LifeLocation loc;
|
||||
AstAssignPost* nodep;
|
||||
LifePostLocation()
|
||||
: nodep{nullptr} {}
|
||||
AstAssignPost* nodep = nullptr;
|
||||
LifePostLocation() {}
|
||||
LifePostLocation(LifeLocation loc_, AstAssignPost* nodep_)
|
||||
: loc{loc_}
|
||||
, nodep{nodep_} {}
|
||||
|
@ -172,27 +172,27 @@ private:
|
||||
addwherep->addNext(assignp);
|
||||
}
|
||||
} else { // Old V1995 sensitivity list; we'll probably mostly ignore
|
||||
bool did = 1;
|
||||
bool did = true;
|
||||
while (did) {
|
||||
did = 0;
|
||||
did = false;
|
||||
if (AstNodeSel* selp = VN_CAST(nodep->sensp(), NodeSel)) {
|
||||
AstNode* fromp = selp->fromp()->unlinkFrBack();
|
||||
selp->replaceWith(fromp);
|
||||
VL_DO_DANGLING(selp->deleteTree(), selp);
|
||||
did = 1;
|
||||
did = true;
|
||||
}
|
||||
// NodeSel doesn't include AstSel....
|
||||
if (AstSel* selp = VN_CAST(nodep->sensp(), Sel)) {
|
||||
AstNode* fromp = selp->fromp()->unlinkFrBack();
|
||||
selp->replaceWith(fromp);
|
||||
VL_DO_DANGLING(selp->deleteTree(), selp);
|
||||
did = 1;
|
||||
did = true;
|
||||
}
|
||||
if (AstNodePreSel* selp = VN_CAST(nodep->sensp(), NodePreSel)) {
|
||||
AstNode* fromp = selp->lhsp()->unlinkFrBack();
|
||||
selp->replaceWith(fromp);
|
||||
VL_DO_DANGLING(selp->deleteTree(), selp);
|
||||
did = 1;
|
||||
did = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -359,7 +359,7 @@ private:
|
||||
if (!inpercent && c == '%') {
|
||||
inpercent = true;
|
||||
} else if (inpercent) {
|
||||
inpercent = 0;
|
||||
inpercent = false;
|
||||
switch (c) {
|
||||
case '0': // FALLTHRU
|
||||
case '1': // FALLTHRU
|
||||
@ -392,7 +392,7 @@ private:
|
||||
return newFormat;
|
||||
}
|
||||
|
||||
void expectDescriptor(AstNode* nodep, AstNodeVarRef* filep) {
|
||||
static void expectDescriptor(AstNode* nodep, AstNodeVarRef* filep) {
|
||||
if (!filep) {
|
||||
nodep->v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: $fopen/$fclose/$f* descriptor must be a simple variable");
|
||||
|
@ -498,7 +498,7 @@ string V3Options::filePathCheckOneDir(const string& modname, const string& dirna
|
||||
// 0: Keep the option including its argument
|
||||
// 1: Delete the option which has no argument
|
||||
// 2: Delete the option and its argument
|
||||
int V3Options::stripOptionsForChildRun(const string& opt, bool forTop) const {
|
||||
int V3Options::stripOptionsForChildRun(const string& opt, bool forTop) {
|
||||
if (opt == "Mdir" || opt == "clk" || opt == "f" || opt == "j" || opt == "l2-name"
|
||||
|| opt == "mod-prefix" || opt == "prefix" || opt == "protect-lib" || opt == "protect-key"
|
||||
|| opt == "threads" || opt == "top-module" || opt == "v") {
|
||||
|
@ -410,13 +410,13 @@ private:
|
||||
void optimize(int level);
|
||||
void showVersion(bool verbose);
|
||||
void coverage(bool flag) { m_coverageLine = m_coverageToggle = m_coverageUser = flag; }
|
||||
bool onoff(const char* sw, const char* arg, bool& flag);
|
||||
bool onoffb(const char* sw, const char* arg, VOptionBool& flagr);
|
||||
bool suffixed(const string& sw, const char* arg);
|
||||
string parseFileArg(const string& optdir, const string& relfilename);
|
||||
static bool onoff(const char* sw, const char* arg, bool& flag);
|
||||
static bool onoffb(const char* sw, const char* arg, VOptionBool& flagr);
|
||||
static bool suffixed(const string& sw, const char* arg);
|
||||
static string parseFileArg(const string& optdir, const string& relfilename);
|
||||
bool parseLangExt(const char* swp, const char* langswp, const V3LangCode& lc);
|
||||
string filePathCheckOneDir(const string& modname, const string& dirname);
|
||||
int stripOptionsForChildRun(const string& opt, bool forTop) const;
|
||||
static int stripOptionsForChildRun(const string& opt, bool forTop);
|
||||
|
||||
// CONSTRUCTORS
|
||||
VL_UNCOPYABLE(V3Options);
|
||||
|
@ -217,7 +217,6 @@ public:
|
||||
return vertexp;
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
OrderUser() {
|
||||
for (int i = 0; i < WV_MAX; i++) m_vertexp[i] = nullptr;
|
||||
@ -565,14 +564,15 @@ public:
|
||||
: m_pomGraphp{pomGraphp}
|
||||
, m_pomWaitingp{pomWaitingp} {}
|
||||
// METHODS
|
||||
OrderMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex*,
|
||||
const AstScope* scopep, const AstSenTree* domainp) {
|
||||
virtual OrderMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex*,
|
||||
const AstScope* scopep,
|
||||
const AstSenTree* domainp) override {
|
||||
OrderMoveVertex* resultp = new OrderMoveVertex(m_pomGraphp, lvertexp);
|
||||
resultp->domScopep(OrderMoveDomScope::findCreate(domainp, scopep));
|
||||
resultp->m_pomWaitingE.pushBack(*m_pomWaitingp, resultp);
|
||||
return resultp;
|
||||
}
|
||||
void freeVertexp(OrderMoveVertex* freeMep) {
|
||||
virtual void freeVertexp(OrderMoveVertex* freeMep) override {
|
||||
freeMep->m_pomWaitingE.unlink(*m_pomWaitingp, freeMep);
|
||||
freeMep->unlinkDelete(m_pomGraphp);
|
||||
}
|
||||
@ -587,14 +587,18 @@ class OrderMTaskMoveVertexMaker : public ProcessMoveBuildGraph<MTaskMoveVertex>:
|
||||
public:
|
||||
explicit OrderMTaskMoveVertexMaker(V3Graph* pomGraphp)
|
||||
: m_pomGraphp{pomGraphp} {}
|
||||
MTaskMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex* varVertexp,
|
||||
const AstScope* scopep, const AstSenTree* domainp) {
|
||||
virtual MTaskMoveVertex* makeVertexp(OrderLogicVertex* lvertexp,
|
||||
const OrderEitherVertex* varVertexp,
|
||||
const AstScope* scopep,
|
||||
const AstSenTree* domainp) override {
|
||||
// Exclude initial/settle logic from the mtasks graph.
|
||||
// We'll output time-zero logic separately.
|
||||
if (domainp->hasInitial() || domainp->hasSettle()) return nullptr;
|
||||
return new MTaskMoveVertex(m_pomGraphp, lvertexp, varVertexp, scopep, domainp);
|
||||
}
|
||||
void freeVertexp(MTaskMoveVertex* freeMep) { freeMep->unlinkDelete(m_pomGraphp); }
|
||||
virtual void freeVertexp(MTaskMoveVertex* freeMep) override {
|
||||
freeMep->unlinkDelete(m_pomGraphp);
|
||||
}
|
||||
|
||||
private:
|
||||
VL_UNCOPYABLE(OrderMTaskMoveVertexMaker);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
// CONSTRUCTORS
|
||||
V3Lexer()
|
||||
: V3LexerBase{nullptr} {}
|
||||
~V3Lexer() {}
|
||||
~V3Lexer() override {}
|
||||
// METHODS
|
||||
void unputString(const char* textp, size_t length) {
|
||||
// Add characters to input stream in back-to-front order
|
||||
|
@ -284,7 +284,7 @@ private:
|
||||
if (it != m_cp.end()) return it->second;
|
||||
return 0;
|
||||
}
|
||||
uint32_t cost(const V3GraphVertex*) const { return 1; }
|
||||
static uint32_t cost(const V3GraphVertex*) { return 1; }
|
||||
void partInitCriticalPaths(bool checkOnly) {
|
||||
// Set up the FORWARD cp's only. This test only looks in one
|
||||
// direction, it assumes REVERSE is symmetrical and would be
|
||||
@ -726,10 +726,10 @@ class SiblingMC : public MergeCandidate {
|
||||
private:
|
||||
LogicMTask* m_ap;
|
||||
LogicMTask* m_bp;
|
||||
// CONSTRUCTORS
|
||||
SiblingMC() = delete;
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
SiblingMC() = delete;
|
||||
SiblingMC(LogicMTask* ap, LogicMTask* bp) {
|
||||
// Assign 'ap' and 'bp' in a canonical order, so we can more easily
|
||||
// compare pairs of SiblingMCs
|
||||
@ -745,7 +745,7 @@ public:
|
||||
// METHODS
|
||||
LogicMTask* ap() const { return m_ap; }
|
||||
LogicMTask* bp() const { return m_bp; }
|
||||
bool mergeWouldCreateCycle() const {
|
||||
bool mergeWouldCreateCycle() const override {
|
||||
return (LogicMTask::pathExistsFrom(m_ap, m_bp, nullptr)
|
||||
|| LogicMTask::pathExistsFrom(m_bp, m_ap, nullptr));
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ private:
|
||||
|
||||
string commentCleanup(const string& text);
|
||||
bool commentTokenMatch(string& cmdr, const char* strg);
|
||||
string trimWhitespace(const string& strg, bool trailing);
|
||||
static string trimWhitespace(const string& strg, bool trailing);
|
||||
void unputString(const string& strg);
|
||||
void unputDefrefString(const string& strg);
|
||||
|
||||
@ -238,24 +238,24 @@ private:
|
||||
|
||||
public:
|
||||
// METHODS, called from upper level shell
|
||||
void openFile(FileLine* fl, VInFilter* filterp, const string& filename);
|
||||
bool isEof() const { return m_lexp->curStreamp()->m_eof; }
|
||||
void openFile(FileLine* fl, VInFilter* filterp, const string& filename) override;
|
||||
bool isEof() const override { return m_lexp->curStreamp()->m_eof; }
|
||||
void forceEof() { m_lexp->curStreamp()->m_eof = true; }
|
||||
string getline();
|
||||
void insertUnreadback(const string& text) { m_lineCmt += text; }
|
||||
string getline() override;
|
||||
void insertUnreadback(const string& text) override { m_lineCmt += text; }
|
||||
void insertUnreadbackAtBol(const string& text);
|
||||
void addLineComment(int enterExit);
|
||||
void dumpDefines(std::ostream& os);
|
||||
void candidateDefines(VSpellCheck* spellerp);
|
||||
void dumpDefines(std::ostream& os) override;
|
||||
void candidateDefines(VSpellCheck* spellerp) override;
|
||||
|
||||
// METHODS, callbacks
|
||||
virtual void comment(const string& text); // Comment detected (if keepComments==2)
|
||||
virtual void include(const string& filename); // Request a include file be processed
|
||||
virtual void undef(const string& name);
|
||||
virtual void comment(const string& text) override; // Comment detected (if keepComments==2)
|
||||
virtual void include(const string& filename) override; // Request a include file be processed
|
||||
virtual void undef(const string& name) override;
|
||||
virtual void undefineall();
|
||||
virtual void define(FileLine* fl, const string& name, const string& value,
|
||||
const string& params, bool cmdline);
|
||||
virtual string removeDefines(const string& text); // Remove defines in a text string
|
||||
const string& params, bool cmdline) override;
|
||||
virtual string removeDefines(const string& text) override; // Remove defines in a text string
|
||||
|
||||
// CONSTRUCTORS
|
||||
V3PreProcImp() {
|
||||
@ -274,7 +274,7 @@ public:
|
||||
m_lexp->m_pedantic = pedantic();
|
||||
m_lexp->debug(debug() >= 5 ? debug() : 0); // See also V3PreProc::debug() method
|
||||
}
|
||||
~V3PreProcImp() {
|
||||
~V3PreProcImp() override {
|
||||
if (m_lexp) VL_DO_CLEAR(delete m_lexp, m_lexp = nullptr);
|
||||
}
|
||||
};
|
||||
@ -764,7 +764,7 @@ string V3PreProcImp::defineSubst(VDefineRef* refp) {
|
||||
//**********************************************************************
|
||||
// Parser routines
|
||||
|
||||
void V3PreProcImp::openFile(FileLine* fl, VInFilter* filterp, const string& filename) {
|
||||
void V3PreProcImp::openFile(FileLine*, VInFilter* filterp, const string& filename) {
|
||||
// Open a new file, possibly overriding the current one which is active.
|
||||
if (m_incError) return;
|
||||
V3File::addSrcDepend(filename);
|
||||
|
@ -767,7 +767,7 @@ public:
|
||||
: m_refs{} {
|
||||
iterate(nodep);
|
||||
}
|
||||
~SplitUnpackedVarVisitor() {
|
||||
~SplitUnpackedVarVisitor() override {
|
||||
UASSERT(m_refs.empty(), "Don't forget to call split()");
|
||||
V3Stats::addStat("SplitVar, Split unpacked arrays", m_numSplit);
|
||||
}
|
||||
@ -916,8 +916,8 @@ public:
|
||||
std::vector<std::pair<int, bool>> points; // <bit location, is end>
|
||||
points.reserve(m_lhs.size() * 2 + 2); // 2 points will be added per one PackedVarRefEntry
|
||||
for (const_iterator it = m_lhs.begin(), itend = m_lhs.end(); it != itend; ++it) {
|
||||
points.push_back(std::make_pair(it->lsb(), false)); // Start of a region
|
||||
points.push_back(std::make_pair(it->msb() + 1, true)); // End of a region
|
||||
points.emplace_back(std::make_pair(it->lsb(), false)); // Start of a region
|
||||
points.emplace_back(std::make_pair(it->msb() + 1, true)); // End of a region
|
||||
}
|
||||
if (skipUnused && !m_rhs.empty()) { // Range to be read must be kept, so add points here
|
||||
int lsb = m_basicp->msb() + 1;
|
||||
@ -927,12 +927,12 @@ public:
|
||||
msb = std::max(msb, m_rhs[i].msb());
|
||||
}
|
||||
UASSERT_OBJ(lsb <= msb, m_basicp, "lsb:" << lsb << " msb:" << msb << " are wrong");
|
||||
points.push_back(std::make_pair(lsb, false));
|
||||
points.push_back(std::make_pair(msb + 1, true));
|
||||
points.emplace_back(std::make_pair(lsb, false));
|
||||
points.emplace_back(std::make_pair(msb + 1, true));
|
||||
}
|
||||
if (!skipUnused) { // All bits are necessary
|
||||
points.push_back(std::make_pair(m_basicp->lsb(), false));
|
||||
points.push_back(std::make_pair(m_basicp->msb() + 1, true));
|
||||
points.emplace_back(std::make_pair(m_basicp->lsb(), false));
|
||||
points.emplace_back(std::make_pair(m_basicp->msb() + 1, true));
|
||||
}
|
||||
std::sort(points.begin(), points.end(), SortByFirst());
|
||||
|
||||
@ -947,7 +947,7 @@ public:
|
||||
}
|
||||
UASSERT(refcount >= 0, "refcounut must not be negative");
|
||||
if (bitwidth == 0 || refcount == 0) continue; // Vacant region
|
||||
plan.push_back(SplitNewVar(points[i].first, bitwidth));
|
||||
plan.emplace_back(SplitNewVar(points[i].first, bitwidth));
|
||||
}
|
||||
|
||||
return plan;
|
||||
@ -1216,7 +1216,7 @@ public:
|
||||
m_modp = nullptr;
|
||||
}
|
||||
}
|
||||
~SplitPackedVarVisitor() {
|
||||
~SplitPackedVarVisitor() override {
|
||||
UASSERT(m_refs.empty(), "Forgot to call split()");
|
||||
V3Stats::addStat("SplitVar, Split packed variables", m_numSplit);
|
||||
}
|
||||
|
@ -645,11 +645,11 @@ void V3TSP::selfTestString() {
|
||||
minGraph.findEulerTour(&result);
|
||||
|
||||
std::vector<string> expect;
|
||||
expect.push_back("0");
|
||||
expect.push_back("2");
|
||||
expect.push_back("1");
|
||||
expect.push_back("2");
|
||||
expect.push_back("3");
|
||||
expect.emplace_back("0");
|
||||
expect.emplace_back("2");
|
||||
expect.emplace_back("1");
|
||||
expect.emplace_back("2");
|
||||
expect.emplace_back("3");
|
||||
|
||||
if (VL_UNCOVERABLE(expect != result)) {
|
||||
for (const string& i : result) cout << i << " ";
|
||||
|
@ -2673,7 +2673,7 @@ private:
|
||||
if (!nodep->firstAbovep()) { newp->makeStatement(); }
|
||||
} else if (nodep->name() == "reverse" || nodep->name() == "shuffle"
|
||||
|| nodep->name() == "sort" || nodep->name() == "rsort") {
|
||||
AstWith* withp = NULL;
|
||||
AstWith* withp = nullptr;
|
||||
if (nodep->name() == "sort" || nodep->name() == "rsort") {
|
||||
withp = methodWithArgument(nodep, false, true, nullptr, adtypep->subDTypep());
|
||||
}
|
||||
@ -2804,7 +2804,7 @@ private:
|
||||
if (!nodep->firstAbovep()) { newp->makeStatement(); }
|
||||
} else if (nodep->name() == "reverse" || nodep->name() == "shuffle"
|
||||
|| nodep->name() == "sort" || nodep->name() == "rsort") {
|
||||
AstWith* withp = NULL;
|
||||
AstWith* withp = nullptr;
|
||||
if (nodep->name() == "sort" || nodep->name() == "rsort") {
|
||||
withp = methodWithArgument(nodep, false, true, nullptr, adtypep->subDTypep());
|
||||
}
|
||||
@ -2958,7 +2958,7 @@ private:
|
||||
nodep->dtypeFrom(adtypep->subDTypep()); // Best guess
|
||||
}
|
||||
}
|
||||
void methodCallEvent(AstMethodCall* nodep, AstBasicDType* adtypep) {
|
||||
void methodCallEvent(AstMethodCall* nodep, AstBasicDType*) {
|
||||
// Method call on event
|
||||
if (nodep->name() == "triggered") {
|
||||
// We represent events as numbers, so can just return number
|
||||
@ -2970,7 +2970,7 @@ private:
|
||||
nodep->v3error("Unknown built-in event method " << nodep->prettyNameQ());
|
||||
}
|
||||
}
|
||||
void methodCallString(AstMethodCall* nodep, AstBasicDType* adtypep) {
|
||||
void methodCallString(AstMethodCall* nodep, AstBasicDType*) {
|
||||
// Method call on string
|
||||
if (nodep->name() == "len") {
|
||||
// Constant value
|
||||
@ -3399,7 +3399,7 @@ private:
|
||||
// if (debug() >= 9) newp->dumpTree("-apat-out: ");
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
|
||||
}
|
||||
void patternDynArray(AstPattern* nodep, AstDynArrayDType* arrayp, AstPatMember* defaultp) {
|
||||
void patternDynArray(AstPattern* nodep, AstDynArrayDType* arrayp, AstPatMember*) {
|
||||
AstNode* newp = new AstConsDynArray(nodep->fileline());
|
||||
newp->dtypeFrom(arrayp);
|
||||
for (AstPatMember* patp = VN_CAST(nodep->itemsp(), PatMember); patp;
|
||||
@ -3414,7 +3414,7 @@ private:
|
||||
// if (debug() >= 9) newp->dumpTree("-apat-out: ");
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
|
||||
}
|
||||
void patternQueue(AstPattern* nodep, AstQueueDType* arrayp, AstPatMember* defaultp) {
|
||||
void patternQueue(AstPattern* nodep, AstQueueDType* arrayp, AstPatMember*) {
|
||||
AstNode* newp = new AstConsQueue(nodep->fileline());
|
||||
newp->dtypeFrom(arrayp);
|
||||
for (AstPatMember* patp = VN_CAST(nodep->itemsp(), PatMember); patp;
|
||||
@ -5007,7 +5007,7 @@ private:
|
||||
return false; // No change
|
||||
}
|
||||
|
||||
bool similarDTypeRecurse(AstNodeDType* node1p, AstNodeDType* node2p) {
|
||||
static bool similarDTypeRecurse(AstNodeDType* node1p, AstNodeDType* node2p) {
|
||||
return node1p->skipRefp()->similarDType(node2p->skipRefp());
|
||||
}
|
||||
void iterateCheckFileDesc(AstNode* nodep, AstNode* underp, Stage stage) {
|
||||
|
Loading…
Reference in New Issue
Block a user