diff --git a/examples/make_protect_lib/sim_main.cpp b/examples/make_protect_lib/sim_main.cpp index 9850a54ad..d89aa3482 100644 --- a/examples/make_protect_lib/sim_main.cpp +++ b/examples/make_protect_lib/sim_main.cpp @@ -31,7 +31,7 @@ int main(int argc, char** argv, char** env) { #if VM_TRACE // When tracing, the contents of the secret module will not be seen - VerilatedVcdC* tfp = NULL; + VerilatedVcdC* tfp = nullptr; const char* flag = Verilated::commandArgsPlusMatch("trace"); if (flag && 0 == strcmp(flag, "+trace")) { Verilated::traceEverOn(true); @@ -62,13 +62,13 @@ int main(int argc, char** argv, char** env) { #if VM_TRACE if (tfp) { tfp->close(); - tfp = NULL; + tfp = nullptr; } #endif // Destroy model delete top; - top = NULL; + top = nullptr; // Fin exit(0); diff --git a/examples/make_tracing_c/sim_main.cpp b/examples/make_tracing_c/sim_main.cpp index a934952fd..571df64a8 100644 --- a/examples/make_tracing_c/sim_main.cpp +++ b/examples/make_tracing_c/sim_main.cpp @@ -99,7 +99,7 @@ int main(int argc, char** argv, char** env) { // Destroy model delete top; - top = NULL; + top = nullptr; // Fin exit(0); diff --git a/examples/make_tracing_sc/sc_main.cpp b/examples/make_tracing_sc/sc_main.cpp index 8ab3120d4..b9a81b37b 100644 --- a/examples/make_tracing_sc/sc_main.cpp +++ b/examples/make_tracing_sc/sc_main.cpp @@ -98,7 +98,7 @@ int sc_main(int argc, char* argv[]) { #if VM_TRACE // If verilator was invoked with --trace argument, // and if at run time passed the +trace argument, turn on tracing - VerilatedVcdSc* tfp = NULL; + VerilatedVcdSc* tfp = nullptr; const char* flag = Verilated::commandArgsPlusMatch("trace"); if (flag && 0 == strcmp(flag, "+trace")) { cout << "Enabling waves into logs/vlt_dump.vcd...\n"; @@ -139,7 +139,7 @@ int sc_main(int argc, char* argv[]) { #if VM_TRACE if (tfp) { tfp->close(); - tfp = NULL; + tfp = nullptr; } #endif @@ -151,7 +151,7 @@ int sc_main(int argc, char* argv[]) { // Destroy model delete top; - top = NULL; + top = nullptr; // Fin return 0; diff --git a/include/verilated.cpp b/include/verilated.cpp index 326657e78..3e35abece 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -176,7 +176,7 @@ void VL_FATAL_MT(const char* filename, int linenum, const char* hier, const char std::string _vl_string_vprintf(const char* formatp, va_list ap) VL_MT_SAFE { va_list aq; va_copy(aq, ap); - int len = VL_VSNPRINTF(NULL, 0, formatp, aq); + int len = VL_VSNPRINTF(nullptr, 0, formatp, aq); va_end(aq); if (VL_UNLIKELY(len < 1)) return ""; @@ -262,7 +262,7 @@ Verilated::NonSerialized::NonSerialized() { Verilated::NonSerialized::~NonSerialized() { if (s_profThreadsFilenamep) { VL_DO_CLEAR(free(const_cast(s_profThreadsFilenamep)), - s_profThreadsFilenamep = NULL); + s_profThreadsFilenamep = nullptr); } } @@ -687,7 +687,7 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) VL_MT_SA // Note also assumes variables < 64 are not wide, this assumption is // sometimes not true in low-level routines written here in verilated.cpp static VL_THREAD_LOCAL char tmp[VL_VALUE_STRING_MAX_WIDTH]; - const char* pctp = NULL; // Most recent %##.##g format + const char* pctp = nullptr; // Most recent %##.##g format bool inPct = false; bool widthSet = false; bool left = false; @@ -777,7 +777,7 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) VL_MT_SA const int lbits = va_arg(ap, int); QData ld = 0; WData qlwp[VL_WQ_WORDS_E]; - WDataInP lwp = NULL; + WDataInP lwp = nullptr; if (lbits <= VL_QUADSIZE) { ld = _VL_VA_ARG_Q(ap, lbits); VL_SET_WQ(qlwp, ld); @@ -947,7 +947,7 @@ static inline int _vl_vsss_peek(FILE* fp, int& floc, WDataInP fromp, } else { if (floc < 0) return EOF; floc = floc & ~7; // Align to closest character - if (fromp == NULL) { + if (fromp == nullptr) { return fstr[fstr.length() - 1 - (floc >> 3)]; } else { return VL_BITRSHIFT_W(fromp, floc) & 0xff; @@ -969,7 +969,7 @@ static inline void _vl_vsss_read_str(FILE* fp, int& floc, WDataInP fromp, const while (true) { int c = _vl_vsss_peek(fp, floc, fromp, fstr); if (c == EOF || isspace(c)) break; - if (acceptp && NULL == strchr(acceptp, c)) break; // String - allow anything + if (acceptp && nullptr == strchr(acceptp, c)) break; // String - allow anything if (acceptp) c = tolower(c); // Non-strings we'll simplify *cp++ = c; _vl_vsss_advance(fp, floc); @@ -984,7 +984,7 @@ static inline char* _vl_vsss_read_bin(FILE* fp, int& floc, WDataInP fromp, const // whitespace). In the fp case, except descriptor to have been opened in binary mode. while (n-- > 0) { const int c = _vl_vsss_peek(fp, floc, fromp, fstr); - if (c == EOF) return NULL; + if (c == EOF) return nullptr; if (!inhibit) *beginp++ = c; _vl_vsss_advance(fp, floc); } @@ -1088,7 +1088,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf } case 's': { _vl_vsss_skipspace(fp, floc, fromp, fstr); - _vl_vsss_read_str(fp, floc, fromp, fstr, tmp, NULL); + _vl_vsss_read_str(fp, floc, fromp, fstr, tmp, nullptr); if (!tmp[0]) goto done; int lpos = (static_cast(strlen(tmp))) - 1; int lsb = 0; @@ -1118,7 +1118,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf double r; vlsint64_t ld; } u; - u.r = strtod(tmp, NULL); + u.r = strtod(tmp, nullptr); VL_SET_WQ(owp, u.ld); break; } @@ -1409,7 +1409,7 @@ IData VL_FSCANF_IX(IData fpi, const char* formatp, ...) VL_MT_SAFE { va_list ap; va_start(ap, formatp); - IData got = _vl_vsscanf(fp, 0, NULL, "", formatp, ap); + IData got = _vl_vsscanf(fp, 0, nullptr, "", formatp, ap); va_end(ap); return got; } @@ -1420,7 +1420,7 @@ IData VL_SSCANF_IIX(int lbits, IData ld, const char* formatp, ...) VL_MT_SAFE { va_list ap; va_start(ap, formatp); - IData got = _vl_vsscanf(NULL, lbits, fnw, "", formatp, ap); + IData got = _vl_vsscanf(nullptr, lbits, fnw, "", formatp, ap); va_end(ap); return got; } @@ -1430,21 +1430,21 @@ IData VL_SSCANF_IQX(int lbits, QData ld, const char* formatp, ...) VL_MT_SAFE { va_list ap; va_start(ap, formatp); - IData got = _vl_vsscanf(NULL, lbits, fnw, "", formatp, ap); + IData got = _vl_vsscanf(nullptr, lbits, fnw, "", formatp, ap); va_end(ap); return got; } IData VL_SSCANF_IWX(int lbits, WDataInP lwp, const char* formatp, ...) VL_MT_SAFE { va_list ap; va_start(ap, formatp); - IData got = _vl_vsscanf(NULL, lbits, lwp, "", formatp, ap); + IData got = _vl_vsscanf(nullptr, lbits, lwp, "", formatp, ap); va_end(ap); return got; } IData VL_SSCANF_INX(int, const std::string& ld, const char* formatp, ...) VL_MT_SAFE { va_list ap; va_start(ap, formatp); - IData got = _vl_vsscanf(NULL, ld.length() * 8, NULL, ld, formatp, ap); + IData got = _vl_vsscanf(nullptr, ld.length() * 8, nullptr, ld, formatp, ap); va_end(ap); return got; } @@ -1621,7 +1621,7 @@ IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_S const char* vl_mc_scan_plusargs(const char* prefixp) VL_MT_SAFE { const std::string& match = VerilatedImp::argPlusMatch(prefixp); static VL_THREAD_LOCAL char outstr[VL_VALUE_STRING_MAX_WIDTH]; - if (match.empty()) return NULL; + if (match.empty()) return nullptr; outstr[0] = '\0'; strncat(outstr, match.c_str() + strlen(prefixp) + 1, // +1 to skip the "+" VL_VALUE_STRING_MAX_WIDTH - 1); @@ -1701,7 +1701,7 @@ IData VL_ATOI_N(const std::string& str, int base) VL_PURE { str_mod.erase(std::remove(str_mod.begin(), str_mod.end(), '_'), str_mod.end()); errno = 0; - long v = std::strtol(str_mod.c_str(), NULL, base); + long v = std::strtol(str_mod.c_str(), nullptr, base); if (errno != 0) v = 0; return static_cast(v); } @@ -1769,14 +1769,14 @@ VlReadMem::VlReadMem(bool hex, int bits, const std::string& filename, QData star if (VL_UNLIKELY(!m_fp)) { // We don't report the Verilog source filename as it slow to have to pass it down VL_FATAL_MT(filename.c_str(), 0, "", "$readmem file not found"); - // cppcheck-suppress resourceLeak // m_fp is NULL - bug in cppcheck + // cppcheck-suppress resourceLeak // m_fp is nullptr - bug in cppcheck return; } } VlReadMem::~VlReadMem() { if (m_fp) { fclose(m_fp); - m_fp = NULL; + m_fp = nullptr; } } bool VlReadMem::get(QData& addrr, std::string& valuer) { @@ -1906,14 +1906,14 @@ VlWriteMem::VlWriteMem(bool hex, int bits, const std::string& filename, QData st m_fp = fopen(filename.c_str(), "w"); if (VL_UNLIKELY(!m_fp)) { VL_FATAL_MT(filename.c_str(), 0, "", "$writemem file not found"); - // cppcheck-suppress resourceLeak // m_fp is NULL - bug in cppcheck + // cppcheck-suppress resourceLeak // m_fp is nullptr - bug in cppcheck return; } } VlWriteMem::~VlWriteMem() { if (m_fp) { fclose(m_fp); - m_fp = NULL; + m_fp = nullptr; } } void VlWriteMem::print(QData addr, bool addrstamp, const void* valuep) { @@ -2181,7 +2181,7 @@ Verilated::ThreadLocal::ThreadLocal() , t_endOfEvalReqd(0) , #endif - t_dpiScopep(NULL) + t_dpiScopep(nullptr) , t_dpiFilename(0) , t_dpiLineno(0) { } @@ -2291,7 +2291,7 @@ void Verilated::profThreadsFilenamep(const char* flagp) VL_MT_SAFE { const char* Verilated::catName(const char* n1, const char* n2, const char* delimiter) VL_MT_SAFE { // Returns new'ed data // Used by symbol table creation to make module names - static VL_THREAD_LOCAL char* strp = NULL; + static VL_THREAD_LOCAL char* strp = nullptr; static VL_THREAD_LOCAL size_t len = 0; size_t newlen = strlen(n1) + strlen(n2) + strlen(delimiter) + 1; if (!strp || newlen > len) { @@ -2559,7 +2559,7 @@ VerilatedModule::VerilatedModule(const char* namep) VerilatedModule::~VerilatedModule() { // Memory cleanup - not called during normal operation // NOLINTNEXTLINE(google-readability-casting) - if (m_namep) VL_DO_CLEAR(free((void*)(m_namep)), m_namep = NULL); + if (m_namep) VL_DO_CLEAR(free((void*)(m_namep)), m_namep = nullptr); } //====================================================================== @@ -2587,8 +2587,8 @@ size_t VerilatedVarProps::totalSize() const { } void* VerilatedVarProps::datapAdjustIndex(void* datap, int dim, int indx) const { - if (VL_UNLIKELY(dim <= 0 || dim > udims())) return NULL; - if (VL_UNLIKELY(indx < low(dim) || indx > high(dim))) return NULL; + if (VL_UNLIKELY(dim <= 0 || dim > udims())) return nullptr; + if (VL_UNLIKELY(indx < low(dim) || indx > high(dim))) return nullptr; int indxAdj = indx - low(dim); vluint8_t* bytep = reinterpret_cast(datap); // If on index 1 of a 2 index array, then each index 1 is index2sz*entsz @@ -2602,12 +2602,12 @@ void* VerilatedVarProps::datapAdjustIndex(void* datap, int dim, int indx) const // VerilatedScope:: Methods VerilatedScope::VerilatedScope() { - m_callbacksp = NULL; - m_namep = NULL; - m_identifierp = NULL; + m_callbacksp = nullptr; + m_namep = nullptr; + m_identifierp = nullptr; m_funcnumMax = 0; - m_symsp = NULL; - m_varsp = NULL; + m_symsp = nullptr; + m_varsp = nullptr; m_timeunit = 0; m_type = SCOPE_OTHER; } @@ -2615,9 +2615,9 @@ VerilatedScope::VerilatedScope() { VerilatedScope::~VerilatedScope() { // Memory cleanup - not called during normal operation VerilatedImp::scopeErase(this); - if (m_namep) VL_DO_CLEAR(delete[] m_namep, m_namep = NULL); - if (m_callbacksp) VL_DO_CLEAR(delete[] m_callbacksp, m_callbacksp = NULL); - if (m_varsp) VL_DO_CLEAR(delete m_varsp, m_varsp = NULL); + if (m_namep) VL_DO_CLEAR(delete[] m_namep, m_namep = nullptr); + if (m_callbacksp) VL_DO_CLEAR(delete[] m_callbacksp, m_callbacksp = nullptr); + if (m_varsp) VL_DO_CLEAR(delete m_varsp, m_varsp = nullptr); m_funcnumMax = 0; // Force callback table to empty } @@ -2699,7 +2699,7 @@ VerilatedVar* VerilatedScope::varFind(const char* namep) const VL_MT_SAFE_POSTIN VerilatedVarNameMap::iterator it = m_varsp->find(namep); if (VL_LIKELY(it != m_varsp->end())) return &(it->second); } - return NULL; + return nullptr; } void* VerilatedScope::exportFindNullError(int funcnum) VL_MT_SAFE { @@ -2708,7 +2708,7 @@ void* VerilatedScope::exportFindNullError(int funcnum) VL_MT_SAFE { + "' but scope wasn't set, perhaps due to dpi import call without " + "'context', or missing svSetScope. See IEEE 1800-2017 35.5.3."); VL_FATAL_MT("unknown", 0, "", msg.c_str()); - return NULL; + return nullptr; } void* VerilatedScope::exportFindError(int funcnum) const { @@ -2717,7 +2717,7 @@ void* VerilatedScope::exportFindError(int funcnum) const { + "' but this DPI export function exists only in other scopes, not scope '" + name() + "'"); VL_FATAL_MT("unknown", 0, "", msg.c_str()); - return NULL; + return nullptr; } void VerilatedScope::scopeDump() const { diff --git a/include/verilated.h b/include/verilated.h index 099066ab7..70a476ac9 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -409,7 +409,7 @@ class Verilated { const char** argv; CommandArgValues() : argc(0) - , argv(NULL) {} + , argv(nullptr) {} ~CommandArgValues() {} } s_args; @@ -561,8 +561,8 @@ public: t_s.t_dpiFilename = filenamep; t_s.t_dpiLineno = lineno; } - static void dpiClearContext() VL_MT_SAFE { t_s.t_dpiScopep = NULL; } - static bool dpiInContext() VL_MT_SAFE { return t_s.t_dpiScopep != NULL; } + static void dpiClearContext() VL_MT_SAFE { t_s.t_dpiScopep = nullptr; } + static bool dpiInContext() VL_MT_SAFE { return t_s.t_dpiScopep != nullptr; } static const char* dpiFilenamep() VL_MT_SAFE { return t_s.t_dpiFilename; } static int dpiLineno() VL_MT_SAFE { return t_s.t_dpiLineno; } static int exportFuncNum(const char* namep) VL_MT_SAFE; diff --git a/include/verilated_cov.cpp b/include/verilated_cov.cpp index aee6e08ed..f6e8fa34d 100644 --- a/include/verilated_cov.cpp +++ b/include/verilated_cov.cpp @@ -106,8 +106,8 @@ private: // CONSTRUCTORS VerilatedCovImp() { - m_insertp = NULL; - m_insertFilenamep = NULL; + m_insertp = nullptr; + m_insertFilenamep = nullptr; m_insertLineno = 0; } VL_UNCOPYABLE(VerilatedCovImp); @@ -340,7 +340,7 @@ public: } m_items.push_back(m_insertp); // Prepare for next - m_insertp = NULL; + m_insertp = nullptr; } void write(const char* filename) VL_EXCLUDES(m_mutex) { @@ -445,15 +445,15 @@ void VerilatedCov::_insertp(A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8) A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28), A(29)) VL_MT_SAFE { const char* keyps[VerilatedCovImpBase::MAX_KEYS] - = {NULL, NULL, NULL, // filename,lineno,page - key0, key1, key2, key3, key4, key5, key6, key7, key8, key9, - key10, key11, key12, key13, key14, key15, key16, key17, key18, key19, - key20, key21, key22, key23, key24, key25, key26, key27, key28, key29}; + = {nullptr, nullptr, nullptr, // filename,lineno,page + key0, key1, key2, key3, key4, key5, key6, key7, key8, key9, + key10, key11, key12, key13, key14, key15, key16, key17, key18, key19, + key20, key21, key22, key23, key24, key25, key26, key27, key28, key29}; const char* valps[VerilatedCovImpBase::MAX_KEYS] - = {NULL, NULL, NULL, // filename,lineno,page - valp0, valp1, valp2, valp3, valp4, valp5, valp6, valp7, valp8, valp9, - valp10, valp11, valp12, valp13, valp14, valp15, valp16, valp17, valp18, valp19, - valp20, valp21, valp22, valp23, valp24, valp25, valp26, valp27, valp28, valp29}; + = {nullptr, nullptr, nullptr, // filename,lineno,page + valp0, valp1, valp2, valp3, valp4, valp5, valp6, valp7, valp8, valp9, + valp10, valp11, valp12, valp13, valp14, valp15, valp16, valp17, valp18, valp19, + valp20, valp21, valp22, valp23, valp24, valp25, valp26, valp27, valp28, valp29}; VerilatedCovImp::imp().insertp(keyps, valps); } diff --git a/include/verilated_cov.h b/include/verilated_cov.h index f9d036758..aef8eda67 100644 --- a/include/verilated_cov.h +++ b/include/verilated_cov.h @@ -112,7 +112,7 @@ public: // there's not much more gain in having a version for each number of args. #define K(n) const char* key##n #define A(n) const char *key##n, const char *valp##n // Argument list -#define D(n) const char *key##n = NULL, const char *valp##n = NULL // Argument list +#define D(n) const char *key##n = nullptr, const char *valp##n = nullptr // Argument list static void _insertp(D(0), D(1), D(2), D(3), D(4), D(5), D(6), D(7), D(8), D(9)); static void _insertp(A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10), D(11), D(12), D(13), D(14), D(15), D(16), D(17), D(18), D(19)); diff --git a/include/verilated_dpi.cpp b/include/verilated_dpi.cpp index 909a9cc2a..c1cc63f10 100644 --- a/include/verilated_dpi.cpp +++ b/include/verilated_dpi.cpp @@ -181,7 +181,7 @@ void svPutPartselLogic(svLogicVecVal* dp, const svLogicVecVal s, int lbit, int w static inline const VerilatedDpiOpenVar* _vl_openhandle_varp(const svOpenArrayHandle h) { if (VL_UNLIKELY(!h)) { VL_FATAL_MT(__FILE__, __LINE__, "", - "%%Error: DPI svOpenArrayHandle function called with NULL handle"); + "%%Error: DPI svOpenArrayHandle function called with nullptr handle"); } const VerilatedDpiOpenVar* varp = reinterpret_cast(h); if (VL_UNLIKELY(!varp->magicOk())) { @@ -202,10 +202,10 @@ int svIncrement(const svOpenArrayHandle h, int d) { return _vl_openhandle_varp(h int svSize(const svOpenArrayHandle h, int d) { return _vl_openhandle_varp(h)->elements(d); } int svDimensions(const svOpenArrayHandle h) { return _vl_openhandle_varp(h)->udims(); } -/// Return pointer to open array data, or NULL if not in IEEE standard C layout +/// Return pointer to open array data, or nullptr if not in IEEE standard C layout void* svGetArrayPtr(const svOpenArrayHandle h) { const VerilatedDpiOpenVar* varp = _vl_openhandle_varp(h); - if (VL_UNLIKELY(!varp->isDpiStdLayout())) return NULL; + if (VL_UNLIKELY(!varp->isDpiStdLayout())) return nullptr; return varp->datap(); } /// Return size of open array, or 0 if not in IEEE standard C layout @@ -226,7 +226,7 @@ static void* _vl_sv_adjusted_datap(const VerilatedDpiOpenVar* varp, int nargs, i _VL_SVDPI_WARN("%%Warning: DPI svOpenArrayHandle function called on" " %d dimensional array using %d dimensional function.\n", varp->udims(), nargs); - return NULL; + return nullptr; } if (nargs >= 1) { datap = varp->datapAdjustIndex(datap, 1, indx1); @@ -234,7 +234,7 @@ static void* _vl_sv_adjusted_datap(const VerilatedDpiOpenVar* varp, int nargs, i _VL_SVDPI_WARN("%%Warning: DPI svOpenArrayHandle function index 1 " "out of bounds; %d outside [%d:%d].\n", indx1, varp->left(1), varp->right(1)); - return NULL; + return nullptr; } } if (nargs >= 2) { @@ -243,7 +243,7 @@ static void* _vl_sv_adjusted_datap(const VerilatedDpiOpenVar* varp, int nargs, i _VL_SVDPI_WARN("%%Warning: DPI svOpenArrayHandle function index 2 " "out of bounds; %d outside [%d:%d].\n", indx2, varp->left(2), varp->right(2)); - return NULL; + return nullptr; } } if (nargs >= 3) { @@ -252,7 +252,7 @@ static void* _vl_sv_adjusted_datap(const VerilatedDpiOpenVar* varp, int nargs, i _VL_SVDPI_WARN("%%Warning: DPI svOpenArrayHandle function index 3 " "out of bounds; %d outside [%d:%d].\n", indx1, varp->left(3), varp->right(3)); - return NULL; + return nullptr; } } return datap; @@ -268,11 +268,11 @@ static int _vl_sv_adjusted_bit(const VerilatedDpiOpenVar* varp, int indx) { return indx - varp->low(0); } -/// Return pointer to simulator open array element, or NULL if outside range +/// Return pointer to simulator open array element, or nullptr if outside range static void* _vl_svGetArrElemPtr(const svOpenArrayHandle h, int nargs, int indx1, int indx2, int indx3) VL_MT_SAFE { const VerilatedDpiOpenVar* varp = _vl_openhandle_varp(h); - if (VL_UNLIKELY(!varp->isDpiStdLayout())) return NULL; + if (VL_UNLIKELY(!varp->isDpiStdLayout())) return nullptr; void* datap = _vl_sv_adjusted_datap(varp, nargs, indx1, indx2, indx3); return datap; } @@ -794,7 +794,7 @@ void svPutLogicArrElem3(const svOpenArrayHandle d, svLogic value, int indx1, int svScope svGetScope() { if (VL_UNLIKELY(!Verilated::dpiInContext())) { _VL_SVDPI_CONTEXT_WARN(); - return NULL; + return nullptr; } // NOLINTNEXTLINE(google-readability-casting) return (svScope)(Verilated::dpiScope()); diff --git a/include/verilated_fst_c.cpp b/include/verilated_fst_c.cpp index a006bd6fa..b8f6e9f05 100644 --- a/include/verilated_fst_c.cpp +++ b/include/verilated_fst_c.cpp @@ -59,13 +59,13 @@ VerilatedFst::VerilatedFst(void* fst) : m_fst(fst) - , m_symbolp(NULL) - , m_strbuf(NULL) {} + , m_symbolp(nullptr) + , m_strbuf(nullptr) {} VerilatedFst::~VerilatedFst() { if (m_fst) fstWriterClose(m_fst); - if (m_symbolp) VL_DO_CLEAR(delete[] m_symbolp, m_symbolp = NULL); - if (m_strbuf) VL_DO_CLEAR(delete[] m_strbuf, m_strbuf = NULL); + if (m_symbolp) VL_DO_CLEAR(delete[] m_symbolp, m_symbolp = nullptr); + if (m_strbuf) VL_DO_CLEAR(delete[] m_strbuf, m_strbuf = nullptr); } void VerilatedFst::open(const char* filename) VL_MT_UNSAFE { @@ -106,7 +106,7 @@ void VerilatedFst::close() { m_assertOne.check(); VerilatedTrace::close(); fstWriterClose(m_fst); - m_fst = NULL; + m_fst = nullptr; } void VerilatedFst::flush() { @@ -158,7 +158,7 @@ void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstV // Follow the hierarchy of the new variable from the common scope point while (new_it != tokens.end()) { - fstWriterSetScope(m_fst, FST_ST_VCD_SCOPE, new_it->c_str(), NULL); + fstWriterSetScope(m_fst, FST_ST_VCD_SCOPE, new_it->c_str(), nullptr); m_curScope.push_back(*new_it); new_it = tokens.erase(new_it); } diff --git a/include/verilated_fst_c.h b/include/verilated_fst_c.h index 50ec99c52..6c222e0aa 100644 --- a/include/verilated_fst_c.h +++ b/include/verilated_fst_c.h @@ -83,7 +83,7 @@ public: //========================================================================= // External interface to client code - explicit VerilatedFst(void* fst = NULL); + explicit VerilatedFst(void* fst = nullptr); ~VerilatedFst(); /// Open the file; call isOpen() to see if errors @@ -93,7 +93,7 @@ public: /// Flush any remaining data to this file void flush() VL_MT_UNSAFE; /// Is file open? - bool isOpen() const { return m_fst != NULL; } + bool isOpen() const { return m_fst != nullptr; } //========================================================================= // Internal interface to Verilator generated code @@ -135,7 +135,7 @@ class VerilatedFstC { VL_UNCOPYABLE(VerilatedFstC); public: - explicit VerilatedFstC(void* filep = NULL) + explicit VerilatedFstC(void* filep = nullptr) : m_sptrace(filep) {} ~VerilatedFstC() { close(); } /// Routines can only be called from one thread; allow next call from different thread diff --git a/include/verilated_heavy.h b/include/verilated_heavy.h index 17e83e054..f67e234bc 100644 --- a/include/verilated_heavy.h +++ b/include/verilated_heavy.h @@ -55,7 +55,7 @@ class VlReadMem { public: VlReadMem(bool hex, int bits, const std::string& filename, QData start, QData end); ~VlReadMem(); - bool isOpen() const { return m_fp != NULL; } + bool isOpen() const { return m_fp != nullptr; } int linenum() const { return m_linenum; } bool get(QData& addrr, std::string& valuer); void setData(void* valuep, const std::string& rhs); @@ -69,7 +69,7 @@ class VlWriteMem { public: VlWriteMem(bool hex, int bits, const std::string& filename, QData start, QData end); ~VlWriteMem(); - bool isOpen() const { return m_fp != NULL; } + bool isOpen() const { return m_fp != nullptr; } void print(QData addr, bool addrstamp, const void* valuep); }; diff --git a/include/verilated_imp.h b/include/verilated_imp.h index 78007b096..3ae2c1f5c 100644 --- a/include/verilated_imp.h +++ b/include/verilated_imp.h @@ -319,7 +319,7 @@ public: static inline void* userFind(const void* scopep, void* userKey) VL_MT_SAFE { const VerilatedLockGuard lock(s_s.m_userMapMutex); UserMap::const_iterator it = s_s.m_userMap.find(std::make_pair(scopep, userKey)); - if (VL_UNLIKELY(it == s_s.m_userMap.end())) return NULL; + if (VL_UNLIKELY(it == s_s.m_userMap.end())) return nullptr; return it->second; } @@ -363,7 +363,7 @@ public: // But only for verilated*.cpp const VerilatedLockGuard lock(s_s.m_nameMutex); // If too slow, can assume this is only VL_MT_SAFE_POSINIT VerilatedScopeNameMap::const_iterator it = s_s.m_nameMap.find(namep); - if (VL_UNLIKELY(it == s_s.m_nameMap.end())) return NULL; + if (VL_UNLIKELY(it == s_s.m_nameMap.end())) return nullptr; return it->second; } static void scopeErase(const VerilatedScope* scopep) VL_MT_SAFE { @@ -544,7 +544,7 @@ public: // But only for verilated*.cpp for (int i = 0; (fdi != 0) && (i < 31); i++, fdi >>= 1) { if (fdi & VL_MASK_I(1)) { fclose(s_s.m_fdps[i]); - s_s.m_fdps[i] = NULL; + s_s.m_fdps[i] = nullptr; s_s.m_fdFreeMct.push_back(i); } } @@ -553,7 +553,7 @@ public: // But only for verilated*.cpp static inline FILE* fdToFp(IData fdi) VL_MT_SAFE { const VerilatedLockGuard lock(s_s.m_fdMutex); const VerilatedFpList fdlist = fdToFpList(fdi); - if (VL_UNLIKELY(fdlist.size() != 1)) return NULL; + if (VL_UNLIKELY(fdlist.size() != 1)) return nullptr; return *fdlist.begin(); } diff --git a/include/verilated_save.h b/include/verilated_save.h index b4da0dbaf..909a12949 100644 --- a/include/verilated_save.h +++ b/include/verilated_save.h @@ -55,7 +55,7 @@ public: } virtual ~VerilatedSerialize() { close(); - if (m_bufp) VL_DO_CLEAR(delete[] m_bufp, m_bufp = NULL); + if (m_bufp) VL_DO_CLEAR(delete[] m_bufp, m_bufp = nullptr); } // METHODS bool isOpen() const { return m_isOpen; } @@ -114,11 +114,11 @@ public: m_isOpen = false; m_bufp = new vluint8_t[bufferSize()]; m_cp = m_bufp; - m_endp = NULL; + m_endp = nullptr; } virtual ~VerilatedDeserialize() { close(); - if (m_bufp) VL_DO_CLEAR(delete[] m_bufp, m_bufp = NULL); + if (m_bufp) VL_DO_CLEAR(delete[] m_bufp, m_bufp = nullptr); } // METHODS bool isOpen() const { return m_isOpen; } diff --git a/include/verilated_sym_props.h b/include/verilated_sym_props.h index 51d154e18..499f962b4 100644 --- a/include/verilated_sym_props.h +++ b/include/verilated_sym_props.h @@ -97,7 +97,7 @@ protected: , m_vlflags(vlflags) , m_pdims(pdims) , m_udims(udims) { - initUnpacked(NULL); + initUnpacked(nullptr); } public: diff --git a/include/verilated_threads.cpp b/include/verilated_threads.cpp index 8bc7347d2..ca5ca403d 100644 --- a/include/verilated_threads.cpp +++ b/include/verilated_threads.cpp @@ -21,7 +21,7 @@ std::atomic VlMTaskVertex::s_yields; -VL_THREAD_LOCAL VlThreadPool::ProfileTrace* VlThreadPool::t_profilep = NULL; +VL_THREAD_LOCAL VlThreadPool::ProfileTrace* VlThreadPool::t_profilep = nullptr; //============================================================================= // VlMTaskVertex @@ -55,7 +55,7 @@ void VlWorkerThread::workerLoop() { if (VL_UNLIKELY(m_profiling)) m_poolp->setupProfilingClientThread(); ExecRec work; - work.m_fnp = NULL; + work.m_fnp = nullptr; while (true) { if (VL_LIKELY(!work.m_fnp)) dequeWork(&work); @@ -65,7 +65,7 @@ void VlWorkerThread::workerLoop() { if (VL_LIKELY(work.m_fnp)) { work.m_fnp(work.m_evenCycle, work.m_sym); - work.m_fnp = NULL; + work.m_fnp = nullptr; } } @@ -110,7 +110,7 @@ VlThreadPool::~VlThreadPool() { void VlThreadPool::tearDownProfilingClientThread() { assert(t_profilep); delete t_profilep; - t_profilep = NULL; + t_profilep = nullptr; } void VlThreadPool::setupProfilingClientThread() { diff --git a/include/verilated_threads.h b/include/verilated_threads.h index aee15f021..fc2d54f06 100644 --- a/include/verilated_threads.h +++ b/include/verilated_threads.h @@ -174,8 +174,8 @@ private: VlThrSymTab m_sym; // Symbol table to execute bool m_evenCycle; // Even/odd for flag alternation ExecRec() - : m_fnp(NULL) - , m_sym(NULL) + : m_fnp(nullptr) + , m_sym(nullptr) , m_evenCycle(false) {} ExecRec(VlExecFnp fnp, bool evenCycle, VlThrSymTab sym) : m_fnp(fnp) diff --git a/include/verilated_trace_imp.cpp b/include/verilated_trace_imp.cpp index 3980a984c..16d39fdd3 100644 --- a/include/verilated_trace_imp.cpp +++ b/include/verilated_trace_imp.cpp @@ -39,7 +39,7 @@ // Static utility functions static double timescaleToDouble(const char* unitp) { - char* endp = NULL; + char* endp = nullptr; double value = strtod(unitp, &endp); // On error so we allow just "ns" to return 1e-9. if (value == 0.0 && endp == unitp) value = 1; @@ -276,7 +276,7 @@ template <> void VerilatedTrace::onExit(void* selfp) { template <> VerilatedTrace::VerilatedTrace() - : m_sigs_oldvalp(NULL) + : m_sigs_oldvalp(nullptr) , m_timeLastDump(0) , m_fullDump(true) , m_nextCode(0) @@ -294,7 +294,7 @@ VerilatedTrace::VerilatedTrace() } template <> VerilatedTrace::~VerilatedTrace() { - if (m_sigs_oldvalp) VL_DO_CLEAR(delete[] m_sigs_oldvalp, m_sigs_oldvalp = NULL); + if (m_sigs_oldvalp) VL_DO_CLEAR(delete[] m_sigs_oldvalp, m_sigs_oldvalp = nullptr); Verilated::removeFlushCb(VerilatedTrace::onFlush, this); Verilated::removeExitCb(VerilatedTrace::onExit, this); #ifdef VL_TRACE_THREADED diff --git a/include/verilated_vcd_c.cpp b/include/verilated_vcd_c.cpp index e38f507cf..9edfda0c3 100644 --- a/include/verilated_vcd_c.cpp +++ b/include/verilated_vcd_c.cpp @@ -93,16 +93,16 @@ VerilatedVcd::VerilatedVcd(VerilatedVcdFile* filep) , m_rolloverMB(0) , m_modDepth(0) { // Not in header to avoid link issue if header is included without this .cpp file - m_fileNewed = (filep == NULL); + m_fileNewed = (filep == nullptr); m_filep = m_fileNewed ? new VerilatedVcdFile : filep; - m_namemapp = NULL; + m_namemapp = nullptr; m_evcd = false; m_wrChunkSize = 8 * 1024; m_wrBufp = new char[m_wrChunkSize * 8]; m_wrFlushp = m_wrBufp + m_wrChunkSize * 6; m_writep = m_wrBufp; m_wroteBytes = 0; - m_suffixesp = NULL; + m_suffixesp = nullptr; } void VerilatedVcd::open(const char* filename) { @@ -211,14 +211,14 @@ void VerilatedVcd::makeNameMap() { } void VerilatedVcd::deleteNameMap() { - if (m_namemapp) VL_DO_CLEAR(delete m_namemapp, m_namemapp = NULL); + if (m_namemapp) VL_DO_CLEAR(delete m_namemapp, m_namemapp = nullptr); } VerilatedVcd::~VerilatedVcd() { close(); - if (m_wrBufp) VL_DO_CLEAR(delete[] m_wrBufp, m_wrBufp = NULL); + if (m_wrBufp) VL_DO_CLEAR(delete[] m_wrBufp, m_wrBufp = nullptr); deleteNameMap(); - if (m_filep && m_fileNewed) VL_DO_CLEAR(delete m_filep, m_filep = NULL); + if (m_filep && m_fileNewed) VL_DO_CLEAR(delete m_filep, m_filep = nullptr); } void VerilatedVcd::closePrev() { @@ -286,7 +286,7 @@ void VerilatedVcd::bufferResize(vluint64_t minsize) { memcpy(m_wrBufp, oldbufp, m_writep - oldbufp); m_writep = m_wrBufp + (m_writep - oldbufp); m_wrFlushp = m_wrBufp + m_wrChunkSize * 6; - VL_DO_CLEAR(delete[] oldbufp, oldbufp = NULL); + VL_DO_CLEAR(delete[] oldbufp, oldbufp = nullptr); } } @@ -350,7 +350,7 @@ void VerilatedVcd::printIndent(int level_change) { void VerilatedVcd::dumpHeader() { printStr("$version Generated by VerilatedVcd $end\n"); - time_t time_str = time(NULL); + time_t time_str = time(nullptr); printStr("$date "); printStr(ctime(&time_str)); printStr(" $end\n"); diff --git a/include/verilated_vcd_c.h b/include/verilated_vcd_c.h index 6c423765f..d6dca4847 100644 --- a/include/verilated_vcd_c.h +++ b/include/verilated_vcd_c.h @@ -133,7 +133,7 @@ public: //========================================================================= // External interface to client code - explicit VerilatedVcd(VerilatedVcdFile* filep = NULL); + explicit VerilatedVcd(VerilatedVcdFile* filep = nullptr); ~VerilatedVcd(); // ACCESSORS @@ -337,7 +337,7 @@ class VerilatedVcdC { VL_UNCOPYABLE(VerilatedVcdC); public: - explicit VerilatedVcdC(VerilatedVcdFile* filep = NULL) + explicit VerilatedVcdC(VerilatedVcdFile* filep = nullptr) : m_sptrace(filep) {} ~VerilatedVcdC() { close(); } /// Routines can only be called from one thread; allow next call from different thread diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index e19c332e4..f657c351e 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -95,7 +95,7 @@ public: virtual const char* defname() const { return ""; } virtual vluint32_t type() const { return 0; } virtual vluint32_t size() const { return 0; } - virtual const VerilatedRange* rangep() const { return NULL; } + virtual const VerilatedRange* rangep() const { return nullptr; } virtual vpiHandle dovpi_scan() { return 0; } }; @@ -231,13 +231,13 @@ public: : m_varp(varp) , m_scopep(scopep) , m_index(0) { - m_prevDatap = NULL; + m_prevDatap = nullptr; m_mask.u32 = VL_MASK_I(varp->packed().elements()); m_entSize = varp->entSize(); m_varDatap = varp->datap(); } virtual ~VerilatedVpioVar() { - if (m_prevDatap) VL_DO_CLEAR(delete[] m_prevDatap, m_prevDatap = NULL); + if (m_prevDatap) VL_DO_CLEAR(delete[] m_prevDatap, m_prevDatap = nullptr); } static inline VerilatedVpioVar* castp(vpiHandle h) { return dynamic_cast(reinterpret_cast(h)); @@ -427,7 +427,7 @@ class VerilatedVpiImp { static VerilatedVpiImp s_s; // Singleton public: - VerilatedVpiImp() { m_errorInfop = NULL; } + VerilatedVpiImp() { m_errorInfop = nullptr; } ~VerilatedVpiImp() {} static void assertOneCheck() { s_s.m_assertOne.check(); } static void cbReasonAdd(VerilatedVpioCb* vop) { @@ -447,9 +447,9 @@ public: static void cbReasonRemove(VerilatedVpioCb* cbp) { VpioCbList& cbObjList = s_s.m_cbObjLists[cbp->reason()]; // We do not remove it now as we may be iterating the list, - // instead set to NULL and will cleanup later + // instead set to nullptr and will cleanup later for (VpioCbList::iterator it = cbObjList.begin(); it != cbObjList.end(); ++it) { - if (*it == cbp) *it = NULL; + if (*it == cbp) *it = nullptr; } } static void cbTimedRemove(VerilatedVpioCb* cbp) { @@ -572,11 +572,11 @@ public: va_end(args); m_errorInfo.state = vpiPLI; filehold = file; - setError((PLI_BYTE8*)m_buff, NULL, const_cast(filehold.c_str()), line); + setError((PLI_BYTE8*)m_buff, nullptr, const_cast(filehold.c_str()), line); } p_vpi_error_info getError() { if (m_flag) return &m_errorInfo; - return NULL; + return nullptr; } void resetError() { m_flag = false; } static void vpi_unsupported() { @@ -598,7 +598,7 @@ public: //====================================================================== VerilatedVpiImp VerilatedVpiImp::s_s; // Singleton -VL_THREAD_LOCAL vluint8_t* VerilatedVpio::t_freeHead = NULL; +VL_THREAD_LOCAL vluint8_t* VerilatedVpio::t_freeHead = nullptr; //====================================================================== // VerilatedVpi implementation @@ -1020,7 +1020,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) { // cppcheck-suppress nullPointer if (VL_UNLIKELY(!cb_data_p)) { _VL_VPI_WARNING(__FILE__, __LINE__, "%s : callback data pointer is null", VL_FUNC); - return NULL; + return nullptr; } switch (cb_data_p->reason) { case cbAfterDelay: { @@ -1050,7 +1050,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) { default: _VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported callback type %s", VL_FUNC, VerilatedVpiError::strFromVpiCallbackReason(cb_data_p->reason)); - return NULL; + return nullptr; } } @@ -1082,9 +1082,9 @@ void vpi_get_systf_info(vpiHandle /*object*/, p_vpi_systf_data /*systf_data_p*/) vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) { VerilatedVpiImp::assertOneCheck(); _VL_VPI_ERROR_RESET(); - if (VL_UNLIKELY(!namep)) return NULL; + if (VL_UNLIKELY(!namep)) return nullptr; VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_handle_by_name %s %p\n", namep, scope);); - const VerilatedVar* varp = NULL; + const VerilatedVar* varp = nullptr; const VerilatedScope* scopep; VerilatedVpioScope* voScopep = VerilatedVpioScope::castp(scope); std::string scopeAndName = namep; @@ -1117,11 +1117,11 @@ vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) { } if (!varp) { scopep = Verilated::scopeFind(scopename.c_str()); - if (!scopep) return NULL; + if (!scopep) return nullptr; varp = scopep->varFind(baseNamep); } } - if (!varp) return NULL; + if (!varp) return nullptr; if (varp->isParam()) { return (new VerilatedVpioParam(varp, scopep))->castVpiHandle(); @@ -1256,7 +1256,7 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) { case vpiModule: { VerilatedVpioModule* vop = VerilatedVpioModule::castp(object); const VerilatedHierarchyMap* map = VerilatedImp::hierarchyMap(); - const VerilatedScope* mod = vop ? vop->scopep() : NULL; + const VerilatedScope* mod = vop ? vop->scopep() : nullptr; VerilatedHierarchyMap::const_iterator it = map->find(const_cast(mod)); if (it == map->end()) return 0; return ((new VerilatedVpioModuleIter(it->second))->castVpiHandle()); @@ -1272,7 +1272,7 @@ vpiHandle vpi_scan(vpiHandle object) { VerilatedVpiImp::assertOneCheck(); _VL_VPI_ERROR_RESET(); VerilatedVpio* vop = VerilatedVpio::castp(object); - if (VL_UNLIKELY(!vop)) return NULL; + if (VL_UNLIKELY(!vop)) return nullptr; return vop->dovpi_scan(); } @@ -1331,7 +1331,7 @@ PLI_BYTE8* vpi_get_str(PLI_INT32 property, vpiHandle object) { VerilatedVpiImp::assertOneCheck(); VerilatedVpio* vop = VerilatedVpio::castp(object); _VL_VPI_ERROR_RESET(); - if (VL_UNLIKELY(!vop)) return NULL; + if (VL_UNLIKELY(!vop)) return nullptr; switch (property) { case vpiName: { return const_cast(vop->name()); @@ -1521,7 +1521,7 @@ void vl_get_value(const VerilatedVar* varp, void* varDatap, p_vpi_value valuep, return; } else if (valuep->format == vpiDecStrVal) { valuep->value.str = outStr; - // outStrSz does not include NULL termination so add one + // outStrSz does not include nullptr termination so add one if (varp->vltype() == VLVT_UINT8) { VL_SNPRINTF(outStr, outStrSz + 1, "%hhu", static_cast(*(reinterpret_cast(varDatap)))); @@ -1645,7 +1645,7 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_ VerilatedVpiImp::assertOneCheck(); _VL_VPI_ERROR_RESET(); if (VL_UNLIKELY(!valuep)) { - _VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_put_value with NULL value pointer"); + _VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_put_value with nullptr value pointer"); return 0; } if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) { @@ -1663,7 +1663,7 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_ } if (!vl_check_format(vop->varp(), valuep, vop->fullname(), false)) return 0; if (valuep->format == vpiVectorVal) { - if (VL_UNLIKELY(!valuep->value.vector)) return NULL; + if (VL_UNLIKELY(!valuep->value.vector)) return nullptr; if (vop->varp()->vltype() == VLVT_UINT8) { *(reinterpret_cast(vop->varDatap())) = valuep->value.vector[0].aval & vop->mask(); @@ -1847,7 +1847,7 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_ } _VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported format (%s) as requested for %s", VL_FUNC, VerilatedVpiError::strFromVpiVal(valuep->format), vop->fullname()); - return NULL; + return nullptr; } else if (VerilatedVpioParam* vop = VerilatedVpioParam::castp(object)) { _VL_VPI_WARNING(__FILE__, __LINE__, "%s: Ignoring vpi_put_value to vpiParameter: %s", VL_FUNC, vop->fullname()); @@ -1858,7 +1858,7 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_ return 0; } _VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported vpiHandle (%p)", VL_FUNC, object); - return NULL; + return nullptr; } void vpi_get_value_array(vpiHandle /*object*/, p_vpi_arrayvalue /*arrayvalue_p*/, @@ -1877,7 +1877,7 @@ void vpi_get_time(vpiHandle object, p_vpi_time time_p) { _VL_VPI_ERROR_RESET(); // cppcheck-suppress nullPointer if (VL_UNLIKELY(!time_p)) { - _VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_get_time with NULL value pointer"); + _VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_get_time with nullptr value pointer"); return; } if (time_p->type == vpiSimTime) { @@ -1980,7 +1980,7 @@ PLI_INT32 vpi_compare_objects(vpiHandle /*object1*/, vpiHandle /*object2*/) { } PLI_INT32 vpi_chk_error(p_vpi_error_info error_info_p) { // executing vpi_chk_error does not reset error - // error_info_p can be NULL, so only return level in that case + // error_info_p can be nullptr, so only return level in that case VerilatedVpiImp::assertOneCheck(); p_vpi_error_info _error_info_p = VerilatedVpiImp::error_info()->getError(); if (error_info_p && _error_info_p) *error_info_p = *_error_info_p; diff --git a/include/verilatedos.h b/include/verilatedos.h index d71de904c..536fa224a 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -152,14 +152,14 @@ #if defined(VL_CPPCHECK) || defined(__clang_analyzer__) || __cplusplus < 201103L # define VL_DANGLING(var) #else -/// After e.g. delete, set variable to NULL to indicate must not use later +/// After e.g. delete, set variable to nullptr to indicate must not use later # define VL_DANGLING(var) \ do { \ - *const_cast(reinterpret_cast(&var)) = NULL; \ + *const_cast(reinterpret_cast(&var)) = nullptr; \ } while (false) #endif -/// Perform an e.g. delete, then set variable to NULL to indicate must not use later. +/// Perform an e.g. delete, then set variable to nullptr to indicate must not use later. /// Unlike VL_DO_CLEAR the setting of the variable is only for debug reasons. #define VL_DO_DANGLING(stmt, var) \ do { \ @@ -169,7 +169,7 @@ VL_DANGLING(var); \ } while (false) -/// Perform an e.g. delete, then set variable to NULL as a requirement +/// Perform an e.g. delete, then set variable to nullptr as a requirement #define VL_DO_CLEAR(stmt, stmt2) \ do { \ do { \ diff --git a/src/V3Active.cpp b/src/V3Active.cpp index f8753e191..71dfc1d5a 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -61,14 +61,14 @@ private: // METHODS void addActive(AstActive* nodep) { - UASSERT_OBJ(m_scopep, nodep, "NULL scope"); + UASSERT_OBJ(m_scopep, nodep, "nullptr scope"); m_scopep->addActivep(nodep); } // VISITORS virtual void visit(AstScope* nodep) override { m_scopep = nodep; - m_iActivep = NULL; - m_cActivep = NULL; + m_iActivep = nullptr; + m_cActivep = nullptr; m_activeSens.clear(); m_activeMap.clear(); iterateChildren(nodep); @@ -106,7 +106,7 @@ public: AstActive* getActive(FileLine* fl, AstSenTree* sensesp) { // Return a sentree in this scope that matches given sense list. - AstActive* activep = NULL; + AstActive* activep = nullptr; AstSenTree* activeSenp = m_activeSens.find(sensesp); if (activeSenp) { ActiveMap::iterator it = m_activeMap.find(activeSenp); @@ -132,9 +132,9 @@ public: public: // CONSTRUCTORS ActiveNamer() { - m_scopep = NULL; - m_iActivep = NULL; - m_cActivep = NULL; + m_scopep = nullptr; + m_iActivep = nullptr; + m_cActivep = nullptr; } virtual ~ActiveNamer() {} void main(AstScope* nodep) { iterate(nodep); } @@ -208,7 +208,7 @@ public: ActiveDlyVisitor(AstNode* nodep, CheckType check) { m_alwaysp = nodep; m_check = check; - m_assignp = NULL; + m_assignp = nullptr; iterate(nodep); } virtual ~ActiveDlyVisitor() {} @@ -235,7 +235,7 @@ private: UINFO(4, " SCOPE " << nodep << endl); // Clear last scope's names, and collect this scope's existing names m_namer.main(nodep); - m_scopeFinalp = NULL; + m_scopeFinalp = nullptr; iterateChildren(nodep); } virtual void visit(AstActive* nodep) override { @@ -321,7 +321,7 @@ private: sequent = false; } - AstActive* wantactivep = NULL; + AstActive* wantactivep = nullptr; if (combo && !sequent) { // Combo: Relink to ACTIVE(combo) wantactivep = m_namer.getCActive(nodep->fileline()); @@ -412,7 +412,7 @@ private: public: // CONSTRUCTORS explicit ActiveVisitor(AstNetlist* nodep) - : m_scopeFinalp(NULL) + : m_scopeFinalp(nullptr) , m_itemCombo(false) , m_itemSequent(false) { iterate(nodep); diff --git a/src/V3ActiveTop.cpp b/src/V3ActiveTop.cpp index 8a51b610b..3e2a4224c 100644 --- a/src/V3ActiveTop.cpp +++ b/src/V3ActiveTop.cpp @@ -56,7 +56,7 @@ private: m_topscopep = nodep; m_finder.init(m_topscopep); iterateChildren(nodep); - m_topscopep = NULL; + m_topscopep = nullptr; } virtual void visit(AstNodeModule* nodep) override { // Create required actives and add to module @@ -69,7 +69,7 @@ private: // Remove duplicate clocks and such; sensesp() may change! V3Const::constifyExpensiveEdit(nodep); AstSenTree* sensesp = nodep->sensesp(); - UASSERT_OBJ(sensesp, nodep, "NULL"); + UASSERT_OBJ(sensesp, nodep, "nullptr"); if (sensesp->sensesp() && VN_IS(sensesp->sensesp(), SenItem) && VN_CAST(sensesp->sensesp(), SenItem)->isNever()) { // Never executing. Kill it. @@ -128,7 +128,7 @@ private: public: // CONSTRUCTORS explicit ActiveTopVisitor(AstNetlist* nodep) - : m_topscopep(NULL) { + : m_topscopep(nullptr) { iterate(nodep); } virtual ~ActiveTopVisitor() {} diff --git a/src/V3Assert.cpp b/src/V3Assert.cpp index 0ff3485da..78950f699 100644 --- a/src/V3Assert.cpp +++ b/src/V3Assert.cpp @@ -74,15 +74,15 @@ private: (v3Global.opt.assertOn() ? static_cast(new AstCMath(fl, "Verilated::assertOn()", 1)) : static_cast(new AstConst(fl, AstConst::LogicFalse()))), - nodep, NULL); + nodep, nullptr); newp->user1(true); // Don't assert/cover this if return newp; } AstNode* newFireAssertUnchecked(AstNode* nodep, const string& message) { // Like newFireAssert() but omits the asserts-on check - AstDisplay* dispp - = new AstDisplay(nodep->fileline(), AstDisplayType::DT_ERROR, message, NULL, NULL); + AstDisplay* dispp = new AstDisplay(nodep->fileline(), AstDisplayType::DT_ERROR, message, + nullptr, nullptr); AstNode* bodysp = dispp; replaceDisplay(dispp, "%%Error"); // Convert to standard DISPLAY format bodysp->addNext(new AstStop(nodep->fileline(), true)); @@ -112,9 +112,9 @@ private: sentreep->unlinkFrBack(); } // - AstNode* bodysp = NULL; + AstNode* bodysp = nullptr; bool selfDestruct = false; - AstIf* ifp = NULL; + AstIf* ifp = nullptr; if (AstCover* snodep = VN_CAST(nodep, Cover)) { ++m_statCover; if (!v3Global.opt.coverageUser()) { @@ -129,7 +129,7 @@ private: } if (bodysp && passsp) bodysp = bodysp->addNext(passsp); - ifp = new AstIf(nodep->fileline(), propp, bodysp, NULL); + ifp = new AstIf(nodep->fileline(), propp, bodysp, nullptr); bodysp = ifp; } else if (VN_IS(nodep, Assert)) { if (nodep->immediate()) { @@ -141,7 +141,7 @@ private: if (failsp) failsp = newIfAssertOn(failsp); if (!failsp) failsp = newFireAssertUnchecked(nodep, "'assert' failed."); ifp = new AstIf(nodep->fileline(), propp, passsp, failsp); - // It's more LIKELY that we'll take the NULL if clause + // It's more LIKELY that we'll take the nullptr if clause // than the sim-killing else clause: ifp->branchPred(VBranchPred::BP_LIKELY); bodysp = newIfAssertOn(ifp); @@ -173,7 +173,7 @@ private: if (nodep->user1SetOnce()) return; if (nodep->uniquePragma() || nodep->unique0Pragma()) { AstNodeIf* ifp = nodep; - AstNode* propp = NULL; + AstNode* propp = nullptr; bool hasDefaultElse = false; do { // If this statement ends with 'else if', then nextIf will point to the @@ -239,7 +239,7 @@ private: ++m_statAsFull; if (!has_default) { nodep->addItemsp(new AstCaseItem( - nodep->fileline(), NULL /*DEFAULT*/, + nodep->fileline(), nullptr /*DEFAULT*/, newFireAssert(nodep, "synthesis full_case, but non-match found"))); } } @@ -250,7 +250,7 @@ private: if (!has_default && !nodep->itemsp()) { // Not parallel, but harmlessly so. } else { - AstNode* propp = NULL; + AstNode* propp = nullptr; for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp = VN_CAST(itemp->nextp(), CaseItem)) { for (AstNode* icondp = itemp->condsp(); icondp; icondp = icondp->nextp()) { @@ -287,7 +287,7 @@ private: nodep->fileline(), new AstLogNot(nodep->fileline(), ohot), newFireAssert(nodep, "synthesis parallel_case, but multiple matches found"), - NULL); + nullptr); ifp->branchPred(VBranchPred::BP_UNLIKELY); nodep->addNotParallelp(ifp); } @@ -306,10 +306,11 @@ private: } UASSERT_OBJ(ticks >= 1, nodep, "0 tick should have been checked in V3Width"); AstNode* inp = nodep->exprp()->unlinkFrBack(); - AstVar* invarp = NULL; + AstVar* invarp = nullptr; AstSenTree* sentreep = nodep->sentreep(); sentreep->unlinkFrBack(); - AstAlways* alwaysp = new AstAlways(nodep->fileline(), VAlwaysKwd::ALWAYS, sentreep, NULL); + AstAlways* alwaysp + = new AstAlways(nodep->fileline(), VAlwaysKwd::ALWAYS, sentreep, nullptr); m_modp->addStmtp(alwaysp); for (uint32_t i = 0; i < ticks; ++i) { AstVar* outvarp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP, @@ -350,7 +351,7 @@ private: } virtual void visit(AstCover* nodep) override { iterateChildren(nodep); - newPslAssertion(nodep, NULL); + newPslAssertion(nodep, nullptr); } virtual void visit(AstRestrict* nodep) override { iterateChildren(nodep); @@ -385,8 +386,8 @@ private: public: // CONSTRUCTORS explicit AssertVisitor(AstNetlist* nodep) { - m_beginp = NULL; - m_modp = NULL; + m_beginp = nullptr; + m_modp = nullptr; m_modPastNum = 0; // Process iterate(nodep); diff --git a/src/V3AssertPre.cpp b/src/V3AssertPre.cpp index 8aaa633a5..d082d6385 100644 --- a/src/V3AssertPre.cpp +++ b/src/V3AssertPre.cpp @@ -45,20 +45,20 @@ private: AstSenTree* newSenTree(AstNode* nodep) { // Create sentree based on clocked or default clock - // Return NULL for always - AstSenTree* newp = NULL; + // Return nullptr for always + AstSenTree* newp = nullptr; AstSenItem* senip = m_senip; if (!senip) senip = m_seniDefaultp; if (!senip) senip = m_seniAlwaysp; if (!senip) { nodep->v3warn(E_UNSUPPORTED, "Unsupported: Unclocked assertion"); - newp = new AstSenTree(nodep->fileline(), NULL); + newp = new AstSenTree(nodep->fileline(), nullptr); } else { newp = new AstSenTree(nodep->fileline(), senip->cloneTree(true)); } return newp; } - void clearAssertInfo() { m_senip = NULL; } + void clearAssertInfo() { m_senip = nullptr; } // VISITORS //========== Statements @@ -78,7 +78,7 @@ private: iterateAndNextNull(nodep->sensesp()); if (nodep->sensesp()) m_seniAlwaysp = nodep->sensesp()->sensesp(); iterateAndNextNull(nodep->bodysp()); - m_seniAlwaysp = NULL; + m_seniAlwaysp = nullptr; } virtual void visit(AstNodeCoverOrAssert* nodep) override { @@ -95,7 +95,7 @@ private: FileLine* fl = nodep->fileline(); AstNode* exprp = nodep->exprp()->unlinkFrBack(); if (exprp->width() > 1) exprp = new AstSel(fl, exprp, 0, 1); - AstNode* past = new AstPast(fl, exprp, NULL); + AstNode* past = new AstPast(fl, exprp, nullptr); past->dtypeFrom(exprp); exprp = new AstAnd(fl, past, new AstNot(fl, exprp->cloneTree(false))); exprp->dtypeSetLogicBool(); @@ -114,7 +114,7 @@ private: FileLine* fl = nodep->fileline(); AstNode* exprp = nodep->exprp()->unlinkFrBack(); if (exprp->width() > 1) exprp = new AstSel(fl, exprp, 0, 1); - AstNode* past = new AstPast(fl, exprp, NULL); + AstNode* past = new AstPast(fl, exprp, nullptr); past->dtypeFrom(exprp); exprp = new AstAnd(fl, new AstNot(fl, past), exprp->cloneTree(false)); exprp->dtypeSetLogicBool(); @@ -127,7 +127,7 @@ private: iterateChildren(nodep); FileLine* fl = nodep->fileline(); AstNode* exprp = nodep->exprp()->unlinkFrBack(); - AstNode* past = new AstPast(fl, exprp, NULL); + AstNode* past = new AstPast(fl, exprp, nullptr); past->dtypeFrom(exprp); exprp = new AstEq(fl, past, exprp->cloneTree(false)); // new AstVarRef(fl, exprp, true) @@ -163,15 +163,15 @@ private: virtual void visit(AstNodeModule* nodep) override { iterateChildren(nodep); // Reset defaults - m_seniDefaultp = NULL; + m_seniDefaultp = nullptr; } virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit AssertPreVisitor(AstNetlist* nodep) { - m_seniDefaultp = NULL; - m_seniAlwaysp = NULL; + m_seniDefaultp = nullptr; + m_seniAlwaysp = nullptr; clearAssertInfo(); // Process iterate(nodep); diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 685d6284e..b222d87eb 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -60,17 +60,17 @@ std::ostream& operator<<(std::ostream& os, AstType rhs); void AstNode::init() { editCountInc(); - m_fileline = NULL; - m_nextp = NULL; - m_backp = NULL; + m_fileline = nullptr; + m_nextp = nullptr; + m_backp = nullptr; m_headtailp = this; // When made, we're a list of only a single element - m_op1p = NULL; - m_op2p = NULL; - m_op3p = NULL; - m_op4p = NULL; - m_iterpp = NULL; - m_dtypep = NULL; - m_clonep = NULL; + m_op1p = nullptr; + m_op2p = nullptr; + m_op3p = nullptr; + m_op4p = nullptr; + m_iterpp = nullptr; + m_dtypep = nullptr; + m_clonep = nullptr; m_cloneCnt = 0; // Attributes m_didWidth = false; @@ -275,8 +275,8 @@ AstNode* AstNode::addNext(AstNode* nodep, AstNode* newp) { // New tail needs the head AstNode* newtailp = newp->m_headtailp; AstNode* headp = oldtailp->m_headtailp; - oldtailp->m_headtailp = NULL; // May be written again as new head - newp->m_headtailp = NULL; // May be written again as new tail + oldtailp->m_headtailp = nullptr; // May be written again as new head + newp->m_headtailp = nullptr; // May be written again as new tail newtailp->m_headtailp = headp; headp->m_headtailp = newtailp; newp->editCountInc(); @@ -321,17 +321,17 @@ void AstNode::addNextHere(AstNode* newp) { // tail (oldheadtailp && !oldnextp) // this was tail of list, might also // be head of one-node list // - newp->m_headtailp = NULL; // Not at head any longer - addlastp->m_headtailp = NULL; // Presume middle of list + newp->m_headtailp = nullptr; // Not at head any longer + addlastp->m_headtailp = nullptr; // Presume middle of list // newp might happen to be head/tail after all, if so will be set again below if (oldheadtailp) { // else in middle of list, no change if (oldheadtailp == this) { // this was one node this->m_headtailp = addlastp; // Was head/tail, now a tail - addlastp->m_headtailp = oldheadtailp; // Tail needs to remember head (or NULL) + addlastp->m_headtailp = oldheadtailp; // Tail needs to remember head (or nullptr) } else if (!oldnextp) { // this was tail - this->m_headtailp = NULL; // No longer a tail + this->m_headtailp = nullptr; // No longer a tail oldheadtailp->m_headtailp = addlastp; // Head gets new tail - addlastp->m_headtailp = oldheadtailp; // Tail needs to remember head (or NULL) + addlastp->m_headtailp = oldheadtailp; // Tail needs to remember head (or nullptr) } // else is head, and we're inserting into the middle, so no other change } @@ -470,7 +470,7 @@ AstNode* AstNode::unlinkFrBackWithNext(AstNRelinker* linkerp) { } } if (backp->m_nextp == oldp) { - backp->m_nextp = NULL; + backp->m_nextp = nullptr; // Old list gets truncated // New list becomes a list upon itself // Most common case is unlinking a entire operand tree @@ -486,21 +486,21 @@ AstNode* AstNode::unlinkFrBackWithNext(AstNRelinker* linkerp) { oldp->m_headtailp = oldtailp; oldp->m_headtailp->m_headtailp = oldp; } else if (backp->m_op1p == oldp) { - backp->m_op1p = NULL; + backp->m_op1p = nullptr; } else if (backp->m_op2p == oldp) { - backp->m_op2p = NULL; + backp->m_op2p = nullptr; } else if (backp->m_op3p == oldp) { - backp->m_op3p = NULL; + backp->m_op3p = nullptr; } else if (backp->m_op4p == oldp) { - backp->m_op4p = NULL; + backp->m_op4p = nullptr; } else { this->v3fatalSrc("Unlink of node with back not pointing to it."); } // Relink - oldp->m_backp = NULL; + oldp->m_backp = nullptr; // Iterator fixup - if (oldp->m_iterpp) *(oldp->m_iterpp) = NULL; - oldp->m_iterpp = NULL; + if (oldp->m_iterpp) *(oldp->m_iterpp) = nullptr; + oldp->m_iterpp = nullptr; oldp->debugTreeChange("-unlinkWNextOut: ", __LINE__, true); return oldp; } @@ -561,10 +561,10 @@ AstNode* AstNode::unlinkFrBack(AstNRelinker* linkerp) { // Iterator fixup if (oldp->m_iterpp) *(oldp->m_iterpp) = oldp->m_nextp; // Relink - oldp->m_nextp = NULL; - oldp->m_backp = NULL; + oldp->m_nextp = nullptr; + oldp->m_backp = nullptr; oldp->m_headtailp = this; - oldp->m_iterpp = NULL; + oldp->m_iterpp = nullptr; oldp->debugTreeChange("-unlinkFrBkOut: ", __LINE__, true); return oldp; } @@ -598,7 +598,7 @@ void AstNode::relink(AstNRelinker* linkerp) { } // Relink newp->m_backp = backp; - linkerp->m_backp = NULL; + linkerp->m_backp = nullptr; // Iterator fixup if (linkerp->m_iterpp) { // If we're iterating over a next() link, we need to follow links off the @@ -610,7 +610,7 @@ void AstNode::relink(AstNRelinker* linkerp) { newp->m_iterpp = linkerp->m_iterpp; } // Empty the linker so not used twice accidentally - linkerp->m_backp = NULL; + linkerp->m_backp = nullptr; this->debugTreeChange("-relinkOut: ", __LINE__, true); } @@ -633,8 +633,8 @@ void AstNode::relinkOneLink(AstNode*& pointpr, // Ref to pointer that gets set newlistlastp->m_nextp = pointpr; pointpr->m_backp = newlistlastp; // Head/tail - pointpr->m_headtailp = NULL; // Old head - newlistlastp->m_headtailp = NULL; // Old tail + pointpr->m_headtailp = nullptr; // Old head + newlistlastp->m_headtailp = nullptr; // Old tail newp->m_headtailp = oldlistlastp; // Head points to tail oldlistlastp->m_headtailp = newp; // Tail points to head } @@ -668,7 +668,7 @@ AstNode* AstNode::cloneTreeIter() { if (this->m_op2p) newp->op2p(this->m_op2p->cloneTreeIterList()); if (this->m_op3p) newp->op3p(this->m_op3p->cloneTreeIterList()); if (this->m_op4p) newp->op4p(this->m_op4p->cloneTreeIterList()); - newp->m_iterpp = NULL; + newp->m_iterpp = nullptr; newp->clonep(this); // Save pointers to/from both to simplify relinking. this->clonep(newp); // Save pointers to/from both to simplify relinking. return newp; @@ -676,12 +676,12 @@ AstNode* AstNode::cloneTreeIter() { AstNode* AstNode::cloneTreeIterList() { // private: Clone list of nodes, set m_headtailp - AstNode* newheadp = NULL; - AstNode* newtailp = NULL; - // Audited to make sure this is never NULL + AstNode* newheadp = nullptr; + AstNode* newtailp = nullptr; + // Audited to make sure this is never nullptr for (AstNode* oldp = this; oldp; oldp = oldp->m_nextp) { AstNode* newp = oldp->cloneTreeIter(); - newp->m_headtailp = NULL; + newp->m_headtailp = nullptr; newp->m_backp = newtailp; if (newtailp) newtailp->m_nextp = newp; if (!newheadp) newheadp = newp; @@ -700,10 +700,10 @@ AstNode* AstNode::cloneTree(bool cloneNextLink) { newp = cloneTreeIterList(); } else { newp = cloneTreeIter(); - newp->m_nextp = NULL; + newp->m_nextp = nullptr; newp->m_headtailp = newp; } - newp->m_backp = NULL; + newp->m_backp = nullptr; newp->cloneRelinkTree(); newp->debugTreeChange("-cloneOut: ", __LINE__, true); return newp; @@ -739,7 +739,7 @@ void AstNode::deleteNode() { void AstNode::deleteTreeIter() { // private: Delete list of nodes. Publicly call deleteTree() instead. - // Audited to make sure this is never NULL + // Audited to make sure this is never nullptr for (AstNode *nodep = this, *nnextp; nodep; nodep = nnextp) { nnextp = nodep->m_nextp; // MUST be depth first! @@ -747,8 +747,8 @@ void AstNode::deleteTreeIter() { if (nodep->m_op2p) nodep->m_op2p->deleteTreeIter(); if (nodep->m_op3p) nodep->m_op3p->deleteTreeIter(); if (nodep->m_op4p) nodep->m_op4p->deleteTreeIter(); - nodep->m_nextp = NULL; - nodep->m_backp = NULL; + nodep->m_nextp = nullptr; + nodep->m_backp = nullptr; nodep->deleteNode(); } } @@ -831,11 +831,11 @@ void AstNode::iterateAndNext(AstNVisitor& v) { niterp->m_iterpp = &niterp; niterp->accept(v); // accept may do a replaceNode and change niterp on us... - // niterp maybe NULL, so need cast if printing + // niterp maybe nullptr, so need cast if printing // if (niterp != nodep) UINFO(1,"iterateAndNext edited "<m_iterpp = NULL; + niterp->m_iterpp = nullptr; if (VL_UNLIKELY(niterp != nodep)) { // Edited node inside accept nodep = niterp; } else { // Unchanged node, just continue loop @@ -853,7 +853,7 @@ void AstNode::iterateListBackwards(AstNVisitor& v) { if (nodep->backp()->m_nextp == nodep) { nodep = nodep->backp(); } else { - nodep = NULL; + nodep = nullptr; } // else: backp points up the tree. } } @@ -900,7 +900,7 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) { } else { // Use back to determine who's pointing at us (IE assume new node // grafts into same place as old one) - AstNode** nextnodepp = NULL; + AstNode** nextnodepp = nullptr; if (this->m_backp->m_op1p == this) { nextnodepp = &(this->m_backp->m_op1p); } else if (this->m_backp->m_op2p == this) { @@ -999,7 +999,7 @@ void AstNode::checkTreeIter(AstNode* backp) { void AstNode::checkTreeIterList(AstNode* backp) { // private: Check a (possible) list of nodes, this is always the head of the list - // Audited to make sure this is never NULL + // Audited to make sure this is never nullptr AstNode* headp = this; AstNode* tailp = this; for (AstNode* nodep = headp; nodep; nodep = nodep->nextp()) { @@ -1052,7 +1052,7 @@ void AstNode::checkIter() const { if (m_iterpp) { dumpPtrs(cout); // Perhaps something forgot to clear m_iterpp? - this->v3fatalSrc("Iteration link should be NULL"); + this->v3fatalSrc("Iteration link should be nullptr"); } } @@ -1108,7 +1108,7 @@ void AstNode::dumpTree(std::ostream& os, const string& indent, int maxDepth) con } void AstNode::dumpTreeAndNext(std::ostream& os, const string& indent, int maxDepth) const { - // Audited to make sure this is never NULL + // Audited to make sure this is never nullptr for (const AstNode* nodep = this; nodep; nodep = nodep->nextp()) { nodep->dumpTree(os, indent, maxDepth); } diff --git a/src/V3Ast.h b/src/V3Ast.h index 82e4685b6..160d5e85e 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1242,9 +1242,9 @@ public: void iterateChildrenBackwards(AstNode* nodep); /// Call visit()s on const nodep's children void iterateChildrenConst(AstNode* nodep); - /// Call visit()s on nodep (maybe NULL) and nodep's nextp() list + /// Call visit()s on nodep (maybe nullptr) and nodep's nextp() list void iterateAndNextNull(AstNode* nodep); - /// Call visit()s on const nodep (maybe NULL) and nodep's nextp() list + /// Call visit()s on const nodep (maybe nullptr) and nodep's nextp() list void iterateAndNextConstNull(AstNode* nodep); /// Return edited nodep; see comments in V3Ast.cpp AstNode* iterateSubtreeReturnEdits(AstNode* nodep); @@ -1270,10 +1270,10 @@ protected: public: AstNRelinker() { - m_oldp = NULL; - m_backp = NULL; + m_oldp = nullptr; + m_backp = nullptr; m_chg = RELINK_BAD; - m_iterpp = NULL; + m_iterpp = nullptr; } void relink(AstNode* newp); AstNode* oldp() const { return m_oldp; } @@ -1498,9 +1498,9 @@ public: AstNode* op3p() const { return m_op3p; } AstNode* op4p() const { return m_op4p; } AstNodeDType* dtypep() const { return m_dtypep; } - AstNode* clonep() const { return ((m_cloneCnt == s_cloneCntGbl) ? m_clonep : NULL); } - AstNode* firstAbovep() const { // Returns NULL when second or later in list - return ((backp() && backp()->nextp() != this) ? backp() : NULL); + AstNode* clonep() const { return ((m_cloneCnt == s_cloneCntGbl) ? m_clonep : nullptr); } + AstNode* firstAbovep() const { // Returns nullptr when second or later in list + return ((backp() && backp()->nextp() != this) ? backp() : nullptr); } bool brokeExists() const; bool brokeExistsAbove() const; @@ -1664,7 +1664,7 @@ public: static void editCountSetLast() { s_editCntLast = editCountGbl(); } // ACCESSORS for specific types - // Alas these can't be virtual or they break when passed a NULL + // Alas these can't be virtual or they break when passed a nullptr bool isZero() const; bool isOne() const; bool isNeqZero() const; @@ -1735,7 +1735,7 @@ public: // METHODS - Tree modifications // Returns nodep, adds newp to end of nodep's list static AstNode* addNext(AstNode* nodep, AstNode* newp); - // Returns nodep, adds newp (maybe NULL) to end of nodep's list + // Returns nodep, adds newp (maybe nullptr) to end of nodep's list static AstNode* addNextNull(AstNode* nodep, AstNode* newp); inline AstNode* addNext(AstNode* newp) { return addNext(this, newp); } inline AstNode* addNextNull(AstNode* newp) { return addNextNull(this, newp); } @@ -1746,9 +1746,10 @@ public: } void addHereThisAsNext(AstNode* newp); // Adds at old place of this, this becomes next void replaceWith(AstNode* newp); // Replace current node in tree with new node - AstNode* unlinkFrBack(AstNRelinker* linkerp = NULL); // Unlink this from whoever points to it. + AstNode* unlinkFrBack(AstNRelinker* linkerp + = nullptr); // Unlink this from whoever points to it. // Unlink this from whoever points to it, keep entire next list with unlinked node - AstNode* unlinkFrBackWithNext(AstNRelinker* linkerp = NULL); + AstNode* unlinkFrBackWithNext(AstNRelinker* linkerp = nullptr); void swapWith(AstNode* bp); void relink(AstNRelinker* linkerp); // Generally use linker->relink() instead void cloneRelinkNode() { cloneRelink(); } @@ -1759,9 +1760,9 @@ public: AstNode* belowp); // When calling, "this" is second argument // METHODS - Iterate on a tree - // Clone or return NULL if NULL + // Clone or return nullptr if nullptr static AstNode* cloneTreeNull(AstNode* nodep, bool cloneNextLink) { - return nodep ? nodep->cloneTree(cloneNextLink) : NULL; + return nodep ? nodep->cloneTree(cloneNextLink) : nullptr; } AstNode* cloneTree(bool cloneNextLink); // Not const, as sets clonep() on original nodep bool gateTree() { return gateTreeIter(); } // Is tree isGateOptimizable? @@ -1771,7 +1772,7 @@ public: void deleteTree(); // Always deletes the next link void checkTree(); // User Interface version void checkIter() const; - void clearIter() { m_iterpp = NULL; } + void clearIter() { m_iterpp = nullptr; } void dumpPtrs(std::ostream& os = std::cout) const; void dumpTree(std::ostream& os = std::cout, const string& indent = " ", int maxDepth = 0) const; @@ -1782,7 +1783,7 @@ public: void dumpTreeAndNext(std::ostream& os = std::cout, const string& indent = " ", int maxDepth = 0) const; void dumpTreeFile(const string& filename, bool append = false, bool doDump = true); - static void dumpTreeFileGdb(const char* filenamep = NULL); + static void dumpTreeFileGdb(const char* filenamep = nullptr); // METHODS - queries // Changes control flow, disable some optimizations @@ -1812,12 +1813,12 @@ public: // Iff has a data type; dtype() must be non null virtual bool hasDType() const { return false; } // Iff has a non-null childDTypep(), as generic node function - virtual AstNodeDType* getChildDTypep() const { return NULL; } + virtual AstNodeDType* getChildDTypep() const { return nullptr; } // Iff has a non-null child2DTypep(), as generic node function - virtual AstNodeDType* getChild2DTypep() const { return NULL; } + virtual AstNodeDType* getChild2DTypep() const { return nullptr; } // Another AstNode* may have a pointer into this node, other then normal front/back/etc. virtual bool maybePointedTo() const { return false; } - virtual const char* broken() const { return NULL; } + virtual const char* broken() const { return nullptr; } // INVOKERS virtual void accept(AstNVisitor& v) = 0; @@ -1858,7 +1859,7 @@ public: inline std::ostream& operator<<(std::ostream& os, const AstNode* rhs) { if (!rhs) { - os << "NULL"; + os << "nullptr"; } else { rhs->dump(os); } @@ -1873,7 +1874,7 @@ inline void AstNRelinker::relink(AstNode* newp) { newp->AstNode::relink(this); } #define ASTNODE_BASE_FUNCS(name) \ virtual ~Ast##name() {} \ static Ast##name* cloneTreeNull(Ast##name* nodep, bool cloneNextLink) { \ - return nodep ? nodep->cloneTree(cloneNextLink) : NULL; \ + return nodep ? nodep->cloneTree(cloneNextLink) : nullptr; \ } \ Ast##name* cloneTree(bool cloneNext) { \ return static_cast(AstNode::cloneTree(cloneNext)); \ @@ -2263,20 +2264,20 @@ public: AstNodeVarRef(AstType t, FileLine* fl, const string& name, bool lvalue) : AstNodeMath(t, fl) , m_lvalue(lvalue) - , m_varScopep(NULL) - , m_packagep(NULL) + , m_varScopep(nullptr) + , m_packagep(nullptr) , m_name(name) , m_hierThis(false) { - this->varp(NULL); + this->varp(nullptr); } AstNodeVarRef(AstType t, FileLine* fl, const string& name, AstVar* varp, bool lvalue) : AstNodeMath(t, fl) , m_lvalue(lvalue) - , m_varScopep(NULL) - , m_packagep(NULL) + , m_varScopep(nullptr) + , m_packagep(nullptr) , m_name(name) , m_hierThis(false) { - // May have varp==NULL + // May have varp==nullptr this->varp(varp); } ASTNODE_BASE_FUNCS(NodeVarRef) @@ -2364,17 +2365,17 @@ public: virtual int widthTotalBytes() const = 0; virtual bool maybePointedTo() const { return true; } // Iff has a non-null refDTypep(), as generic node function - virtual AstNodeDType* virtRefDTypep() const { return NULL; } + virtual AstNodeDType* virtRefDTypep() const { return nullptr; } // Iff has refDTypep(), set as generic node function virtual void virtRefDTypep(AstNodeDType* nodep) {} // Iff has a non-null second dtypep, as generic node function - virtual AstNodeDType* virtRefDType2p() const { return NULL; } + virtual AstNodeDType* virtRefDType2p() const { return nullptr; } // Iff has second dtype, set as generic node function virtual void virtRefDType2p(AstNodeDType* nodep) {} // Assignable equivalence. Call skipRefp() on this and samep before calling virtual bool similarDType(AstNodeDType* samep) const = 0; // Iff has a non-null subDTypep(), as generic node function - virtual AstNodeDType* subDTypep() const { return NULL; } + virtual AstNodeDType* subDTypep() const { return nullptr; } virtual bool isFourstate() const; // Ideally an IEEE $typename virtual string prettyDTypeName() const { return prettyTypeName(); } @@ -2473,7 +2474,7 @@ public: void repairMemberCache(); AstMemberDType* findMember(const string& name) const { MemberNameMap::const_iterator it = m_members.find(name); - return (it == m_members.end()) ? NULL : it->second; + return (it == m_members.end()) ? nullptr : it->second; } static int lsb() { return 0; } int msb() const { return dtypep()->width() - 1; } // Packed classes look like arrays @@ -2490,7 +2491,7 @@ private: public: AstNodeArrayDType(AstType t, FileLine* fl) : AstNodeDType(t, fl) { - m_refDTypep = NULL; + m_refDTypep = nullptr; } ASTNODE_BASE_FUNCS(NodeArrayDType) virtual void dump(std::ostream& str) const; @@ -2498,7 +2499,7 @@ public: virtual const char* broken() const { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { m_refDTypep = m_refDTypep->clonep(); } @@ -2549,7 +2550,9 @@ public: AstNodeSel(AstType t, FileLine* fl, AstNode* fromp, AstNode* bitp) : AstNodeBiop(t, fl, fromp, bitp) {} ASTNODE_BASE_FUNCS(NodeSel) - AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing) + AstNode* fromp() const { + return op1p(); + } // op1 = Extracting what (nullptr=TBD during parsing) void fromp(AstNode* nodep) { setOp1p(nodep); } AstNode* bitp() const { return op2p(); } // op2 = Msb selection expression void bitp(AstNode* nodep) { setOp2p(nodep); } @@ -2578,7 +2581,7 @@ class AstNodeCCall : public AstNodeStmt { string m_argTypes; public: - AstNodeCCall(AstType t, FileLine* fl, AstCFunc* funcp, AstNode* argsp = NULL) + AstNodeCCall(AstType t, FileLine* fl, AstCFunc* funcp, AstNode* argsp = nullptr) : AstNodeStmt(t, fl, true) , m_funcp(funcp) { addNOp2p(argsp); @@ -2670,10 +2673,10 @@ public: virtual void name(const string& name) { m_name = name; } string cname() const { return m_cname; } void cname(const string& cname) { m_cname = cname; } - // op1 = Output variable (functions only, NULL for tasks) + // op1 = Output variable (functions only, nullptr for tasks) AstNode* fvarp() const { return op1p(); } void addFvarp(AstNode* nodep) { addNOp1p(nodep); } - bool isFunction() const { return fvarp() != NULL; } + bool isFunction() const { return fvarp() != nullptr; } // op3 = Statements/Ports/Vars AstNode* stmtsp() const { return op3p(); } // op3 = List of statements void addStmtsp(AstNode* nodep) { addNOp3p(nodep); } @@ -2729,24 +2732,24 @@ private: public: AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, AstNode* namep, AstNode* pinsp) : AstNodeStmt(t, fl, statement) - , m_taskp(NULL) - , m_packagep(NULL) + , m_taskp(nullptr) + , m_packagep(nullptr) , m_pli(false) { setOp1p(namep); addNOp3p(pinsp); } AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, const string& name, AstNode* pinsp) : AstNodeStmt(t, fl, statement) - , m_taskp(NULL) + , m_taskp(nullptr) , m_name(name) - , m_packagep(NULL) + , m_packagep(nullptr) , m_pli(false) { addNOp3p(pinsp); } ASTNODE_BASE_FUNCS(NodeFTaskRef) virtual const char* broken() const { BROKEN_RTN(m_taskp && !m_taskp->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_taskp && m_taskp->clonep()) { m_taskp = m_taskp->clonep(); } @@ -2792,7 +2795,7 @@ private: bool m_hierBlock : 1; // Hiearchical Block marked by HIER_BLOCK pragma bool m_internal : 1; // Internally created bool m_recursive : 1; // Recursive module - bool m_recursiveClone : 1; // If recursive, what module it clones, otherwise NULL + bool m_recursiveClone : 1; // If recursive, what module it clones, otherwise nullptr int m_level; // 1=top module, 2=cell off top module, ... int m_varNum; // Incrementing variable number int m_typeNum; // Incrementing implicit type number diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 29a12358d..d6e3eb0f5 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -36,7 +36,7 @@ const char* AstIfaceRefDType::broken() const { BROKEN_RTN(m_ifacep && !m_ifacep->brokeExists()); BROKEN_RTN(m_cellp && !m_cellp->brokeExists()); BROKEN_RTN(m_modportp && !m_modportp->brokeExists()); - return NULL; + return nullptr; } AstIface* AstIfaceRefDType::ifaceViaCellp() const { @@ -46,7 +46,7 @@ AstIface* AstIfaceRefDType::ifaceViaCellp() const { const char* AstNodeVarRef::broken() const { BROKEN_RTN(m_varScopep && !m_varScopep->brokeExists()); BROKEN_RTN(m_varp && !m_varp->brokeExists()); - return NULL; + return nullptr; } void AstNodeVarRef::cloneRelink() { @@ -84,7 +84,7 @@ const char* AstNodeUOrStructDType::broken() const { return "member broken"; } } - return NULL; + return nullptr; } void AstNodeCCall::dump(std::ostream& str) const { @@ -101,7 +101,7 @@ void AstNodeCCall::cloneRelink() { } const char* AstNodeCCall::broken() const { BROKEN_RTN(m_funcp && !m_funcp->brokeExists()); - return NULL; + return nullptr; } bool AstNodeCCall::isPure() const { return funcp()->pure(); } string AstNodeCCall::hiernameProtect() const { @@ -253,7 +253,7 @@ AstConst* AstConst::parseParamLiteral(FileLine* fl, const string& literal) { return new AstConst(fl, AstConst::StringToParse(), literal.c_str()); } } - return NULL; + return nullptr; } void AstNetlist::timeprecisionMerge(FileLine*, const VTimescale& value) { @@ -604,13 +604,13 @@ AstVar* AstVar::scVarRecurse(AstNode* nodep) { if (anodep->isSc()) { return anodep; } else { - return NULL; + return nullptr; } } else if (VN_IS(nodep, VarRef)) { if (VN_CAST(nodep, VarRef)->varp()->isSc()) { return VN_CAST(nodep, VarRef)->varp(); } else { - return NULL; + return nullptr; } } else if (VN_IS(nodep, ArraySel)) { if (nodep->op1p()) { @@ -626,7 +626,7 @@ AstVar* AstVar::scVarRecurse(AstNode* nodep) { if (AstVar* p = scVarRecurse(nodep->op4p())) return p; } } - return NULL; + return nullptr; } string AstVar::mtasksString() const { @@ -664,17 +664,17 @@ AstNodeDType* AstNodeDType::dtypeDimensionp(int dimension) { if (adtypep->isRanged()) { if ((dim++) == dimension) return adtypep; } - return NULL; + return nullptr; } else if (AstNodeUOrStructDType* adtypep = VN_CAST(dtypep, NodeUOrStructDType)) { if (adtypep->packed()) { if ((dim++) == dimension) return adtypep; } - return NULL; + return nullptr; } // Node no ->next in loop; use continue where necessary break; } - return NULL; + return nullptr; } uint32_t AstNodeDType::arrayUnpackedElements() { @@ -761,7 +761,7 @@ AstNode* AstArraySel::baseFromp(AstNode* nodep) { const char* AstJumpBlock::broken() const { BROKEN_RTN(!labelp()->brokeExistsBelow()); - return NULL; + return nullptr; } void AstJumpBlock::cloneRelink() { if (m_labelp->clonep()) m_labelp = m_labelp->clonep(); @@ -772,7 +772,7 @@ const char* AstScope::broken() const { BROKEN_RTN(m_aboveCellp && !m_aboveCellp->brokeExists()); BROKEN_RTN(!m_modp); BROKEN_RTN(m_modp && !m_modp->brokeExists()); - return NULL; + return nullptr; } void AstScope::cloneRelink() { if (m_aboveScopep && m_aboveScopep->clonep()) m_aboveScopep->clonep(); @@ -846,7 +846,7 @@ void AstTypeTable::clearCache() { // When we mass-change widthMin in V3WidthCommit, we need to correct the table. // Just clear out the maps; the search functions will be used to rebuild the map for (int i = 0; i < static_cast(AstBasicDTypeKwd::_ENUM_MAX); ++i) { - m_basicps[i] = NULL; + m_basicps[i] = nullptr; } m_detailedMap.clear(); // Clear generic()'s so dead detection will work @@ -1079,7 +1079,7 @@ void AstCellInline::dump(std::ostream& str) const { const char* AstClassPackage::broken() const { BROKEN_BASE_RTN(AstNodeModule::broken()); BROKEN_RTN(m_classp && !m_classp->brokeExists()); - return NULL; + return nullptr; } void AstClass::insertCache(AstNode* nodep) { if (VN_IS(nodep, Var) || VN_IS(nodep, NodeFTask) || VN_IS(nodep, EnumItemRef)) { diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index bdff51c16..580d1ada6 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -28,7 +28,7 @@ virtual void accept(AstNVisitor& v) { v.visit(this); } \ virtual AstNode* clone() { return new Ast##name(*this); } \ static Ast##name* cloneTreeNull(Ast##name* nodep, bool cloneNextLink) { \ - return nodep ? nodep->cloneTree(cloneNextLink) : NULL; \ + return nodep ? nodep->cloneTree(cloneNextLink) : nullptr; \ } \ Ast##name* cloneTree(bool cloneNext) { \ return static_cast(AstNode::cloneTree(cloneNext)); \ @@ -171,7 +171,7 @@ public: bool isEqAllOnes() const { return num().isEqAllOnes(width()); } bool isEqAllOnesV() const { return num().isEqAllOnes(widthMinV()); } // Parse string and create appropriate type of AstConst. - // May return NULL on parse failure. + // May return nullptr on parse failure. static AstConst* parseParamLiteral(FileLine* fl, const string& literal); }; @@ -290,7 +290,7 @@ class AstClassPackage : public AstNodeModule { public: AstClassPackage(FileLine* fl, const string& name) : ASTGEN_SUPER(fl, name) - , m_classp(NULL) {} + , m_classp(nullptr) {} ASTNODE_NODE_FUNCS(ClassPackage) virtual string verilogKwd() const { return "/*class*/package"; } virtual const char* broken() const; @@ -310,7 +310,7 @@ class AstClass : public AstNodeModule { public: AstClass(FileLine* fl, const string& name) : ASTGEN_SUPER(fl, name) - , m_packagep(NULL) {} + , m_packagep(nullptr) {} ASTNODE_NODE_FUNCS(Class) virtual string verilogKwd() const { return "class"; } virtual bool isHeavy() const { return true; } @@ -319,7 +319,7 @@ public: virtual const char* broken() const { BROKEN_BASE_RTN(AstNodeModule::broken()); BROKEN_RTN(m_packagep && !m_packagep->brokeExists()); - return NULL; + return nullptr; } // op1/op2/op3 in AstNodeModule AstClassPackage* packagep() const { return m_packagep; } @@ -335,7 +335,7 @@ public: void repairCache(); AstNode* findMember(const string& name) const { MemberNameMap::const_iterator it = m_members.find(name); - return (it == m_members.end()) ? NULL : it->second; + return (it == m_members.end()) ? nullptr : it->second; } bool isVirtual() const { return m_virtual; } void isVirtual(bool flag) { m_virtual = flag; } @@ -373,7 +373,7 @@ public: , m_varType(type) , m_name(name) { childDTypep(dtp); // Only for parser - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve } ASTNODE_NODE_FUNCS(ParamTypeDType) AstNodeDType* getChildDTypep() const { return childDTypep(); } @@ -413,7 +413,7 @@ public: , m_name(name) { childDTypep(dtp); // Only for parser addAttrsp(attrsp); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve m_attrPublic = false; } ASTNODE_NODE_FUNCS(Typedef) @@ -468,7 +468,7 @@ public: , m_name(name) , m_containerp(containerp) { childDTypep(dtp); // Only for parser - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve m_uniqueNum = uniqueNumInc(); } ASTNODE_NODE_FUNCS(DefImplicitDType) @@ -511,9 +511,9 @@ public: : ASTGEN_SUPER(fl) { childDTypep(dtp); // Only for parser keyChildDTypep(keyDtp); // Only for parser - refDTypep(NULL); - keyDTypep(NULL); - dtypep(NULL); // V3Width will resolve + refDTypep(nullptr); + keyDTypep(nullptr); + dtypep(nullptr); // V3Width will resolve } ASTNODE_NODE_FUNCS(AssocArrayDType) virtual const char* broken() const { @@ -521,7 +521,7 @@ public: || (!m_refDTypep && childDTypep()))); BROKEN_RTN(!((m_keyDTypep && !childDTypep() && m_keyDTypep->brokeExists()) || (!m_keyDTypep && childDTypep()))); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { m_refDTypep = m_refDTypep->clonep(); } @@ -557,7 +557,7 @@ public: AstNodeDType* keyChildDTypep() const { return VN_CAST(op2p(), NodeDType); } void keyChildDTypep(AstNodeDType* nodep) { setOp2p(nodep); } // METHODS - virtual AstBasicDType* basicp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToConstp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToEnump() const { return (AstNodeDType*)this; } @@ -587,7 +587,7 @@ public: // Will be removed in V3Width, which relies on this // being a child not a dtype pointed node virtual bool maybePointedTo() const { return false; } - virtual AstBasicDType* basicp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToConstp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToEnump() const { return (AstNodeDType*)this; } @@ -604,19 +604,19 @@ public: AstDynArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp) : ASTGEN_SUPER(fl) { childDTypep(dtp); // Only for parser - refDTypep(NULL); - dtypep(NULL); // V3Width will resolve + refDTypep(nullptr); + dtypep(nullptr); // V3Width will resolve } AstDynArrayDType(FileLine* fl, AstNodeDType* dtp) : ASTGEN_SUPER(fl) { refDTypep(dtp); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve } ASTNODE_NODE_FUNCS(DynArrayDType) virtual const char* broken() const { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { m_refDTypep = m_refDTypep->clonep(); } @@ -642,7 +642,7 @@ public: virtual AstNodeDType* virtRefDTypep() const { return m_refDTypep; } virtual void virtRefDTypep(AstNodeDType* nodep) { refDTypep(nodep); } // METHODS - virtual AstBasicDType* basicp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToConstp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToEnump() const { return (AstNodeDType*)this; } @@ -658,9 +658,9 @@ public: AstPackArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstRange* rangep) : ASTGEN_SUPER(fl) { childDTypep(dtp); // Only for parser - refDTypep(NULL); + refDTypep(nullptr); setOp2p(rangep); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve int width = subDTypep()->width() * rangep->elementsConst(); widthForce(width, width); } @@ -684,9 +684,9 @@ public: AstUnpackArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstRange* rangep) : ASTGEN_SUPER(fl) { childDTypep(dtp); // Only for parser - refDTypep(NULL); + refDTypep(nullptr); setOp2p(rangep); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve // For backward compatibility AstNodeArrayDType and others inherit // width and signing from the subDType/base type widthFromSub(subDTypep()); @@ -713,14 +713,14 @@ public: AstUnsizedArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp) : ASTGEN_SUPER(fl) { childDTypep(dtp); // Only for parser - refDTypep(NULL); - dtypep(NULL); // V3Width will resolve + refDTypep(nullptr); + dtypep(nullptr); // V3Width will resolve } ASTNODE_NODE_FUNCS(UnsizedArrayDType) virtual const char* broken() const { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { m_refDTypep = m_refDTypep->clonep(); } @@ -767,24 +767,24 @@ private: public: AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, const VSigning& signst = VSigning::NOSIGN) : ASTGEN_SUPER(fl) { - init(kwd, signst, 0, -1, NULL); + init(kwd, signst, 0, -1, nullptr); } AstBasicDType(FileLine* fl, VFlagLogicPacked, int wantwidth) : ASTGEN_SUPER(fl) { - init(AstBasicDTypeKwd::LOGIC, VSigning::NOSIGN, wantwidth, -1, NULL); + init(AstBasicDTypeKwd::LOGIC, VSigning::NOSIGN, wantwidth, -1, nullptr); } AstBasicDType(FileLine* fl, VFlagBitPacked, int wantwidth) : ASTGEN_SUPER(fl) { - init(AstBasicDTypeKwd::BIT, VSigning::NOSIGN, wantwidth, -1, NULL); + init(AstBasicDTypeKwd::BIT, VSigning::NOSIGN, wantwidth, -1, nullptr); } AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, VSigning numer, int wantwidth, int widthmin) : ASTGEN_SUPER(fl) { - init(kwd, numer, wantwidth, widthmin, NULL); + init(kwd, numer, wantwidth, widthmin, nullptr); } AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, VSigning numer, VNumRange range, int widthmin) : ASTGEN_SUPER(fl) { - init(kwd, numer, range.elements(), widthmin, NULL); + init(kwd, numer, range.elements(), widthmin, nullptr); m.m_nrange = range; // as init() presumes lsb==0, but range.lsb() might not be } // See also addRange in verilog.y @@ -843,7 +843,7 @@ public: virtual string prettyDTypeName() const; virtual const char* broken() const { BROKEN_RTN(dtypep() != this); - return NULL; + return nullptr; } virtual bool isHeavy() const { return keyword() == AstBasicDTypeKwd::STRING; } AstRange* rangep() const { return VN_CAST(op1p(), Range); } // op1 = Range of variable @@ -903,7 +903,7 @@ public: if (rangep() && VN_IS(rangep()->msbp(), Const) && VN_IS(rangep()->lsbp(), Const)) { m.m_nrange.init(rangep()->msbConst(), rangep()->lsbConst(), rangep()->littleEndian()); rangep()->unlinkFrBackWithNext()->deleteTree(); - rangep(NULL); + rangep(nullptr); } } }; @@ -918,15 +918,15 @@ public: AstConstDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp) : ASTGEN_SUPER(fl) { childDTypep(dtp); // Only for parser - refDTypep(NULL); // V3Width will resolve - dtypep(NULL); // V3Width will resolve + refDTypep(nullptr); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve widthFromSub(subDTypep()); } ASTNODE_NODE_FUNCS(ConstDType) virtual const char* broken() const { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { m_refDTypep = m_refDTypep->clonep(); } @@ -967,14 +967,14 @@ public: AstClassRefDType(FileLine* fl, AstClass* classp) : ASTGEN_SUPER(fl) , m_classp(classp) - , m_packagep(NULL) { + , m_packagep(nullptr) { dtypep(this); } ASTNODE_NODE_FUNCS(ClassRefDType) // METHODS virtual const char* broken() const { BROKEN_RTN(m_classp && !m_classp->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_classp && m_classp->clonep()) m_classp = m_classp->clonep(); @@ -988,15 +988,15 @@ public: virtual void dump(std::ostream& str = std::cout) const; virtual void dumpSmall(std::ostream& str) const; virtual string name() const { return classp() ? classp()->name() : ""; } - virtual AstBasicDType* basicp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToConstp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToEnump() const { return (AstNodeDType*)this; } virtual int widthAlignBytes() const { return 0; } virtual int widthTotalBytes() const { return 0; } - virtual AstNodeDType* virtRefDTypep() const { return NULL; } + virtual AstNodeDType* virtRefDTypep() const { return nullptr; } virtual void virtRefDTypep(AstNodeDType* nodep) {} - virtual AstNodeDType* subDTypep() const { return NULL; } + virtual AstNodeDType* subDTypep() const { return nullptr; } AstNodeModule* packagep() const { return m_packagep; } void packagep(AstNodeModule* nodep) { m_packagep = nodep; } AstClass* classp() const { return m_classp; } @@ -1012,17 +1012,17 @@ private: string m_modportName; // "" = no modport AstIface* m_ifacep; // Pointer to interface; note cellp() should override AstCell* m_cellp; // When exact parent cell known; not a guess - AstModport* m_modportp; // NULL = unlinked or no modport + AstModport* m_modportp; // nullptr = unlinked or no modport public: AstIfaceRefDType(FileLine* fl, const string& cellName, const string& ifaceName) : ASTGEN_SUPER(fl) - , m_modportFileline(NULL) + , m_modportFileline(nullptr) , m_cellName(cellName) , m_ifaceName(ifaceName) , m_modportName("") - , m_ifacep(NULL) - , m_cellp(NULL) - , m_modportp(NULL) {} + , m_ifacep(nullptr) + , m_cellp(nullptr) + , m_modportp(nullptr) {} AstIfaceRefDType(FileLine* fl, FileLine* modportFl, const string& cellName, const string& ifaceName, const string& modport) : ASTGEN_SUPER(fl) @@ -1030,16 +1030,16 @@ public: , m_cellName(cellName) , m_ifaceName(ifaceName) , m_modportName(modport) - , m_ifacep(NULL) - , m_cellp(NULL) - , m_modportp(NULL) {} + , m_ifacep(nullptr) + , m_cellp(nullptr) + , m_modportp(nullptr) {} ASTNODE_NODE_FUNCS(IfaceRefDType) // METHODS virtual const char* broken() const; virtual void dump(std::ostream& str = std::cout) const; virtual void dumpSmall(std::ostream& str) const; virtual void cloneRelink(); - virtual AstBasicDType* basicp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToConstp() const { return (AstNodeDType*)this; } virtual AstNodeDType* skipRefToEnump() const { return (AstNodeDType*)this; } @@ -1074,14 +1074,14 @@ public: : ASTGEN_SUPER(fl) { setNOp2p(boundp); childDTypep(dtp); // Only for parser - refDTypep(NULL); - dtypep(NULL); // V3Width will resolve + refDTypep(nullptr); + dtypep(nullptr); // V3Width will resolve } ASTNODE_NODE_FUNCS(QueueDType) virtual const char* broken() const { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { m_refDTypep = m_refDTypep->clonep(); } @@ -1104,7 +1104,7 @@ public: void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } virtual AstNodeDType* subDTypep() const { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - AstNode* boundp() const { return op2p(); } // op2 = Bound, NULL = none + AstNode* boundp() const { return op2p(); } // op2 = Bound, nullptr = none void boundp(AstNode* nodep) { setNOp2p(nodep); } int boundConst() const { AstConst* constp = VN_CAST(boundp(), Const); @@ -1113,7 +1113,7 @@ public: virtual AstNodeDType* virtRefDTypep() const { return m_refDTypep; } virtual void virtRefDTypep(AstNodeDType* nodep) { refDTypep(nodep); } // METHODS - virtual AstBasicDType* basicp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } // cppcheck-suppress csyleCast virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast @@ -1136,25 +1136,25 @@ private: public: AstRefDType(FileLine* fl, const string& name) : ASTGEN_SUPER(fl) - , m_typedefp(NULL) - , m_refDTypep(NULL) + , m_typedefp(nullptr) + , m_refDTypep(nullptr) , m_name(name) - , m_packagep(NULL) {} + , m_packagep(nullptr) {} AstRefDType(FileLine* fl, const string& name, AstNode* classOrPackagep, AstNode* paramsp) : ASTGEN_SUPER(fl) - , m_typedefp(NULL) - , m_refDTypep(NULL) + , m_typedefp(nullptr) + , m_refDTypep(nullptr) , m_name(name) - , m_packagep(NULL) { + , m_packagep(nullptr) { setNOp3p(classOrPackagep); addNOp4p(paramsp); } class FlagTypeOfExpr {}; // type(expr) for parser only AstRefDType(FileLine* fl, FlagTypeOfExpr, AstNode* typeofp) : ASTGEN_SUPER(fl) - , m_typedefp(NULL) - , m_refDTypep(NULL) - , m_packagep(NULL) { + , m_typedefp(nullptr) + , m_refDTypep(nullptr) + , m_packagep(nullptr) { setOp2p(typeofp); } ASTNODE_NODE_FUNCS(RefDType) @@ -1162,7 +1162,7 @@ public: virtual const char* broken() const { BROKEN_RTN(m_typedefp && !m_typedefp->brokeExists()); BROKEN_RTN(m_refDTypep && !m_refDTypep->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_typedefp && m_typedefp->clonep()) { m_typedefp = m_typedefp->clonep(); } @@ -1182,10 +1182,10 @@ public: virtual string prettyDTypeName() const { return subDTypep() ? subDTypep()->name() : prettyName(); } - virtual AstBasicDType* basicp() const { return subDTypep() ? subDTypep()->basicp() : NULL; } + virtual AstBasicDType* basicp() const { return subDTypep() ? subDTypep()->basicp() : nullptr; } AstNodeDType* subDTypep() const { if (typedefp()) return typedefp()->subDTypep(); - return refDTypep(); // Maybe NULL + return refDTypep(); // Maybe nullptr } virtual AstNodeDType* skipRefp() const { // Skip past both the Ref and the Typedef @@ -1193,7 +1193,7 @@ public: return subDTypep()->skipRefp(); } else { v3fatalSrc("Typedef not linked"); - return NULL; + return nullptr; } } virtual AstNodeDType* skipRefToConstp() const { @@ -1201,7 +1201,7 @@ public: return subDTypep()->skipRefToConstp(); } else { v3fatalSrc("Typedef not linked"); - return NULL; + return nullptr; } } virtual AstNodeDType* skipRefToEnump() const { @@ -1209,7 +1209,7 @@ public: return subDTypep()->skipRefToEnump(); } else { v3fatalSrc("Typedef not linked"); - return NULL; + return nullptr; } } virtual int widthAlignBytes() const { return dtypeSkipRefp()->widthAlignBytes(); } @@ -1264,8 +1264,8 @@ public: , m_name(name) , m_lsb(-1) { childDTypep(dtp); // Only for parser - dtypep(NULL); // V3Width will resolve - refDTypep(NULL); + dtypep(nullptr); // V3Width will resolve + refDTypep(nullptr); } AstMemberDType(FileLine* fl, const string& name, AstNodeDType* dtp) : ASTGEN_SUPER(fl) @@ -1321,11 +1321,11 @@ public: virtual void dumpSmall(std::ostream& str) const; virtual bool hasDType() const { return true; } virtual bool maybePointedTo() const { return true; } - virtual AstNodeDType* subDTypep() const { return NULL; } - virtual AstNodeDType* virtRefDTypep() const { return NULL; } + virtual AstNodeDType* subDTypep() const { return nullptr; } + virtual AstNodeDType* virtRefDTypep() const { return nullptr; } virtual void virtRefDTypep(AstNodeDType* nodep) {} virtual bool similarDType(AstNodeDType* samep) const { return this == samep; } - virtual AstBasicDType* basicp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } // cppcheck-suppress csyleCast virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast @@ -1376,7 +1376,7 @@ public: virtual string name() const { return itemp()->name(); } virtual const char* broken() const { BROKEN_RTN(!VN_IS(itemp(), EnumItem)); - return NULL; + return nullptr; } virtual int instrCount() const { return 0; } virtual void cloneRelink() { @@ -1406,9 +1406,9 @@ public: AstEnumDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstNode* itemsp) : ASTGEN_SUPER(fl) { childDTypep(dtp); // Only for parser - refDTypep(NULL); + refDTypep(nullptr); addNOp2p(itemsp); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve widthFromSub(subDTypep()); m_uniqueNum = uniqueNumInc(); } @@ -1416,7 +1416,7 @@ public: virtual const char* broken() const { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { m_refDTypep = m_refDTypep->clonep(); } @@ -1457,11 +1457,11 @@ public: explicit AstParseTypeDType(FileLine* fl) : ASTGEN_SUPER(fl) {} ASTNODE_NODE_FUNCS(ParseTypeDType) - AstNodeDType* dtypep() const { return NULL; } + AstNodeDType* dtypep() const { return nullptr; } // METHODS virtual bool similarDType(AstNodeDType* samep) const { return this == samep; } - virtual AstBasicDType* basicp() const { return NULL; } - virtual AstNodeDType* skipRefp() const { return NULL; } + virtual AstBasicDType* basicp() const { return nullptr; } + virtual AstNodeDType* skipRefp() const { return nullptr; } // cppcheck-suppress csyleCast virtual AstNodeDType* skipRefToConstp() const { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast @@ -1612,7 +1612,7 @@ class AstSelBit : public AstNodePreSel { // Gets replaced during link with AstArraySel or AstSel public: AstSelBit(FileLine* fl, AstNode* fromp, AstNode* bitp) - : ASTGEN_SUPER(fl, fromp, bitp, NULL) { + : ASTGEN_SUPER(fl, fromp, bitp, nullptr) { UASSERT_OBJ(!v3Global.assertDTypesResolved(), this, "not coded to create after dtypes resolved"); } @@ -1685,7 +1685,9 @@ public: virtual V3Hash sameHash() const { return V3Hash(); } virtual bool same(const AstNode*) const { return true; } virtual int instrCount() const { return widthInstrs() * (VN_CAST(lsbp(), Const) ? 3 : 10); } - AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing) + AstNode* fromp() const { + return op1p(); + } // op1 = Extracting what (nullptr=TBD during parsing) AstNode* lsbp() const { return op2p(); } // op2 = Msb selection expression AstNode* widthp() const { return op3p(); } // op3 = Width int widthConst() const { return VN_CAST(widthp(), Const)->toSInt(); } @@ -1727,7 +1729,9 @@ public: virtual V3Hash sameHash() const { return V3Hash(); } virtual bool same(const AstNode*) const { return true; } virtual int instrCount() const { return 10; } // Removed before matters - AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing) + AstNode* fromp() const { + return op1p(); + } // op1 = Extracting what (nullptr=TBD during parsing) // For widthConst()/loConst etc, see declRange().elements() and other VNumRange methods VNumRange& declRange() { return m_declRange; } const VNumRange& declRange() const { return m_declRange; } @@ -1744,7 +1748,7 @@ public: AstNode* pinsp) : ASTGEN_SUPER(fl, false, name, pinsp) { setOp2p(fromp); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve } AstMethodCall(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp) : ASTGEN_SUPER(fl, false, name, pinsp) { @@ -1754,7 +1758,7 @@ public: virtual const char* broken() const { BROKEN_BASE_RTN(AstNodeFTaskRef::broken()); BROKEN_RTN(!fromp()); - return NULL; + return nullptr; } virtual void dump(std::ostream& str) const; virtual bool hasDType() const { return true; } @@ -1762,7 +1766,9 @@ public: statement(true); dtypeSetVoid(); } - AstNode* fromp() const { return op2p(); } // op2 = Extracting what (NULL=TBD during parsing) + AstNode* fromp() const { + return op2p(); + } // op2 = Extracting what (nullptr=TBD during parsing) void fromp(AstNode* nodep) { setOp2p(nodep); } }; @@ -1780,7 +1786,7 @@ public: , m_name(name) , m_pure(false) { setOp1p(fromp); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve addNOp2p(pinsp); } AstCMethodHard(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp) @@ -1805,7 +1811,9 @@ public: statement(true); dtypeSetVoid(); } - AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing) + AstNode* fromp() const { + return op1p(); + } // op1 = Extracting what (nullptr=TBD during parsing) void fromp(AstNode* nodep) { setOp1p(nodep); } AstNode* pinsp() const { return op2p(); } // op2 = Pin interconnection list void addPinsp(AstNode* nodep) { addOp2p(nodep); } @@ -1901,7 +1909,7 @@ public: init(); combineType(type); childDTypep(dtp); // Only for parser - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve if (dtp->basicp()) { m_declKwd = dtp->basicp()->keyword(); } else { @@ -2191,8 +2199,8 @@ class AstScope : public AstNode { private: // An AstScope->name() is special: . indicates an uninlined scope, __DOT__ an inlined scope string m_name; // Name - AstScope* m_aboveScopep; // Scope above this one in the hierarchy (NULL if top) - AstCell* m_aboveCellp; // Cell above this in the hierarchy (NULL if top) + AstScope* m_aboveScopep; // Scope above this one in the hierarchy (nullptr if top) + AstCell* m_aboveCellp; // Cell above this in the hierarchy (nullptr if top) AstNodeModule* m_modp; // Module scope corresponds to public: AstScope(FileLine* fl, AstNodeModule* modp, const string& name, AstScope* aboveScopep, @@ -2219,7 +2227,7 @@ public: AstNode* finalClksp() const { return op3p(); } // op3 = Final assigns for clock correction AstScope* aboveScopep() const { return m_aboveScopep; } AstCell* aboveCellp() const { return m_aboveCellp; } - bool isTop() const { return aboveScopep() == NULL; } // At top of hierarchy + bool isTop() const { return aboveScopep() == nullptr; } // At top of hierarchy }; class AstTopScope : public AstNode { @@ -2269,7 +2277,7 @@ public: virtual const char* broken() const { BROKEN_RTN(m_varp && !m_varp->brokeExists()); BROKEN_RTN(m_scopep && !m_scopep->brokeExists()); - return NULL; + return nullptr; } virtual bool maybePointedTo() const { return true; } virtual string name() const { return scopep()->name() + "->" + varp()->name(); } @@ -2277,7 +2285,7 @@ public: virtual bool hasDType() const { return true; } AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable AstScope* scopep() const { return m_scopep; } // Pointer to scope it's under - // op1 = Calculation of value of variable, NULL=complicated + // op1 = Calculation of value of variable, nullptr=complicated AstNode* valuep() const { return op1p(); } void valuep(AstNode* valuep) { addOp1p(valuep); } bool isCircular() const { return m_circular; } @@ -2290,7 +2298,7 @@ class AstVarRef : public AstNodeVarRef { // A reference to a variable (lvalue or rvalue) public: AstVarRef(FileLine* fl, const string& name, bool lvalue) - : ASTGEN_SUPER(fl, name, NULL, lvalue) {} + : ASTGEN_SUPER(fl, name, nullptr, lvalue) {} // This form only allowed post-link because output/wire compression may // lead to deletion of AstVar's AstVarRef(FileLine* fl, AstVar* varp, bool lvalue) @@ -2335,7 +2343,7 @@ private: string m_inlinedDots; // Dotted hierarchy flattened out public: AstVarXRef(FileLine* fl, const string& name, const string& dotted, bool lvalue) - : ASTGEN_SUPER(fl, name, NULL, lvalue) + : ASTGEN_SUPER(fl, name, nullptr, lvalue) , m_dotted(dotted) {} AstVarXRef(FileLine* fl, AstVar* varp, const string& dotted, bool lvalue) : ASTGEN_SUPER(fl, varp->name(), varp, lvalue) @@ -2377,8 +2385,8 @@ public: , m_param(false) , m_svImplicit(false) { m_pinNum = pinNum; - m_modVarp = NULL; - m_modPTypep = NULL; + m_modVarp = nullptr; + m_modPTypep = nullptr; setNOp1p(exprp); } AstPin(FileLine* fl, int pinNum, AstVarRef* varname, AstNode* exprp) @@ -2387,8 +2395,8 @@ public: , m_svImplicit(false) { m_name = varname->name(); m_pinNum = pinNum; - m_modVarp = NULL; - m_modPTypep = NULL; + m_modVarp = nullptr; + m_modPTypep = nullptr; setNOp1p(exprp); } ASTNODE_NODE_FUNCS(Pin) @@ -2396,7 +2404,7 @@ public: virtual const char* broken() const { BROKEN_RTN(m_modVarp && !m_modVarp->brokeExists()); BROKEN_RTN(m_modPTypep && !m_modPTypep->brokeExists()); - return NULL; + return nullptr; } virtual string name() const { return m_name; } // * = Pin name, ""=go by number virtual void name(const string& name) { m_name = name; } @@ -2410,7 +2418,7 @@ public: bool dotStar() const { return name() == ".*"; } // Fake name for .* connections until linked int pinNum() const { return m_pinNum; } void exprp(AstNode* nodep) { addOp1p(nodep); } - // op1 = Expression connected to pin, NULL if unconnected + // op1 = Expression connected to pin, nullptr if unconnected AstNode* exprp() const { return op1p(); } AstVar* modVarp() const { return m_modVarp; } // [After Link] Pointer to variable void modVarp(AstVar* nodep) { m_modVarp = nodep; } @@ -2438,7 +2446,7 @@ public: virtual void name(const string& name) { m_name = name; } virtual V3Hash sameHash() const { return V3Hash(); } void exprp(AstNode* nodep) { addOp1p(nodep); } - // op1 = Expression connected to pin, NULL if unconnected + // op1 = Expression connected to pin, nullptr if unconnected AstNode* exprp() const { return op1p(); } bool emptyConnectNoNext() const { return !exprp() && name() == "" && !nextp(); } }; @@ -2506,7 +2514,7 @@ public: ASTNODE_NODE_FUNCS(PackageExport) virtual const char* broken() const { BROKEN_RTN(!m_packagep || !m_packagep->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_packagep && m_packagep->clonep()) m_packagep = m_packagep->clonep(); @@ -2530,7 +2538,7 @@ public: ASTNODE_NODE_FUNCS(PackageImport) virtual const char* broken() const { BROKEN_RTN(!m_packagep || !m_packagep->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_packagep && m_packagep->clonep()) m_packagep = m_packagep->clonep(); @@ -2560,14 +2568,14 @@ public: AstMemberSel(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name) : ASTGEN_SUPER(fl) , m_name(name) - , m_varp(NULL) { + , m_varp(nullptr) { setOp1p(fromp); - dtypep(NULL); // V3Width will resolve + dtypep(nullptr); // V3Width will resolve } AstMemberSel(FileLine* fl, AstNode* fromp, AstNodeDType* dtp) : ASTGEN_SUPER(fl) , m_name(dtp->name()) - , m_varp(NULL) { + , m_varp(nullptr) { setOp1p(fromp); dtypep(dtp); } @@ -2577,7 +2585,7 @@ public: } virtual const char* broken() const { BROKEN_RTN(m_varp && !m_varp->brokeExists()); - return NULL; + return nullptr; } virtual void dump(std::ostream& str) const; virtual string name() const { return m_name; } @@ -2590,7 +2598,9 @@ public: virtual bool cleanOut() const { return false; } virtual bool same(const AstNode* samep) const { return true; } // dtype comparison does it virtual int instrCount() const { return widthInstrs(); } - AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing) + AstNode* fromp() const { + return op1p(); + } // op1 = Extracting what (nullptr=TBD during parsing) void fromp(AstNode* nodep) { setOp1p(nodep); } AstVar* varp() const { return m_varp; } void varp(AstVar* nodep) { m_varp = nodep; } @@ -2610,11 +2620,11 @@ public: : ASTGEN_SUPER(fl) , m_name(name) , m_export(isExport) - , m_ftaskp(NULL) {} + , m_ftaskp(nullptr) {} ASTNODE_NODE_FUNCS(ModportFTaskRef) virtual const char* broken() const { BROKEN_RTN(m_ftaskp && !m_ftaskp->brokeExists()); - return NULL; + return nullptr; } virtual void dump(std::ostream& str) const; virtual string name() const { return m_name; } @@ -2640,11 +2650,11 @@ public: : ASTGEN_SUPER(fl) , m_name(name) , m_direction(direction) - , m_varp(NULL) {} + , m_varp(nullptr) {} ASTNODE_NODE_FUNCS(ModportVarRef) virtual const char* broken() const { BROKEN_RTN(m_varp && !m_varp->brokeExists()); - return NULL; + return nullptr; } virtual void dump(std::ostream& str) const; virtual void cloneRelink() { @@ -2704,7 +2714,7 @@ public: , m_name(instName) , m_origName(instName) , m_modName(modName) - , m_modp(NULL) + , m_modp(nullptr) , m_hasIfaceVar(false) , m_recursive(false) , m_trace(true) { @@ -2717,7 +2727,7 @@ public: virtual void dump(std::ostream& str) const; virtual const char* broken() const { BROKEN_RTN(m_modp && !m_modp->brokeExists()); - return NULL; + return nullptr; } virtual bool maybePointedTo() const { return true; } // ACCESSORS @@ -2731,7 +2741,7 @@ public: AstPin* pinsp() const { return VN_CAST(op1p(), Pin); } // op1 = List of cell ports // op2 = List of parameter #(##) values AstPin* paramsp() const { return VN_CAST(op2p(), Pin); } - // op3 = Range of arrayed instants (NULL=not ranged) + // op3 = Range of arrayed instants (nullptr=not ranged) AstRange* rangep() const { return VN_CAST(op3p(), Range); } // op4 = List of interface references AstIntfRef* intfRefp() const { return VN_CAST(op4p(), IntfRef); } @@ -2765,13 +2775,13 @@ public: : ASTGEN_SUPER(fl) , m_name(name) , m_origModName(origModName) - , m_scopep(NULL) + , m_scopep(nullptr) , m_timeunit(timeunit) {} ASTNODE_NODE_FUNCS(CellInline) virtual void dump(std::ostream& str) const; virtual const char* broken() const { BROKEN_RTN(m_scopep && !m_scopep->brokeExists()); - return NULL; + return nullptr; } // ACCESSORS virtual string name() const { return m_name; } // * = Cell name @@ -2883,8 +2893,8 @@ private: string m_name; public: - AstParseRef(FileLine* fl, VParseRefExp expect, const string& name, AstNode* lhsp = NULL, - AstNodeFTaskRef* ftaskrefp = NULL) + AstParseRef(FileLine* fl, VParseRefExp expect, const string& name, AstNode* lhsp = nullptr, + AstNodeFTaskRef* ftaskrefp = nullptr) : ASTGEN_SUPER(fl) , m_expect(expect) , m_name(name) { @@ -2926,7 +2936,7 @@ public: // METHODS virtual const char* broken() const { BROKEN_RTN(m_classOrPackagep && !m_classOrPackagep->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_classOrPackagep && m_classOrPackagep->clonep()) { @@ -3239,7 +3249,7 @@ public: AstAssignAlias(FileLine* fl, AstVarRef* lhsp, AstVarRef* rhsp) : ASTGEN_SUPER(fl, lhsp, rhsp) {} ASTNODE_NODE_FUNCS(AssignAlias) - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) { V3ERROR_NA_RETURN(NULL); } + virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) { V3ERROR_NA_RETURN(nullptr); } virtual bool brokeLhsMustBeLvalue() const { return false; } }; @@ -3269,7 +3279,7 @@ public: AstAlways* convertToAlways() { AstNode* lhs1p = lhsp()->unlinkFrBack(); AstNode* rhs1p = rhsp()->unlinkFrBack(); - AstAlways* newp = new AstAlways(fileline(), VAlwaysKwd::ALWAYS, NULL, + AstAlways* newp = new AstAlways(fileline(), VAlwaysKwd::ALWAYS, nullptr, new AstAssign(fileline(), lhs1p, rhs1p)); replaceWith(newp); // User expected to then deleteTree(); return newp; @@ -3400,7 +3410,7 @@ public: m_linescov = linescov; m_offset = offset; m_binNum = 0; - m_dataDeclp = NULL; + m_dataDeclp = nullptr; } ASTNODE_NODE_FUNCS(CoverDecl) virtual const char* broken() const { @@ -3408,7 +3418,7 @@ public: if (m_dataDeclp && m_dataDeclp->m_dataDeclp) { // Avoid O(n^2) accessing v3fatalSrc("dataDeclp should point to real data, not be a list"); } - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_dataDeclp && m_dataDeclp->clonep()) m_dataDeclp = m_dataDeclp->clonep(); @@ -3433,7 +3443,7 @@ public: } virtual bool isPredictOptimizable() const { return false; } void dataDeclp(AstCoverDecl* nodep) { m_dataDeclp = nodep; } - // dataDecl NULL means "use this one", but often you want "this" to + // dataDecl nullptr means "use this one", but often you want "this" to // indicate to get data from here AstCoverDecl* dataDeclNullp() const { return m_dataDeclp; } AstCoverDecl* dataDeclThisp() { return dataDeclNullp() ? dataDeclNullp() : this; } @@ -3453,7 +3463,7 @@ public: ASTNODE_NODE_FUNCS(CoverInc) virtual const char* broken() const { BROKEN_RTN(!declp()->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_declp->clonep()) m_declp = m_declp->clonep(); @@ -3588,7 +3598,7 @@ public: AstNode* bodysp() const { return op2p(); } // op2 = what to do void condsp(AstNode* nodep) { setOp1p(nodep); } void addBodysp(AstNode* newp) { addOp2p(newp); } - bool isDefault() const { return condsp() == NULL; } + bool isDefault() const { return condsp() == nullptr; } bool ignoreOverlap() const { return m_ignoreOverlap; } void ignoreOverlap(bool flag) { m_ignoreOverlap = flag; } }; @@ -3612,7 +3622,7 @@ public: , m_missingArgChar(missingArgChar) { dtypeSetString(); addNOp1p(exprsp); - addNOp2p(NULL); + addNOp2p(nullptr); } AstSFormatF(FileLine* fl, NoFormat, AstNode* exprsp, char missingArgChar = 'd', bool hidden = true) @@ -3623,7 +3633,7 @@ public: , m_missingArgChar(missingArgChar) { dtypeSetString(); addNOp1p(exprsp); - addNOp2p(NULL); + addNOp2p(nullptr); } ASTNODE_NODE_FUNCS(SFormatF) virtual string name() const { return m_text; } @@ -3677,7 +3687,7 @@ public: virtual void dump(std::ostream& str) const; virtual const char* broken() const { BROKEN_RTN(!fmtp()); - return NULL; + return nullptr; } virtual string verilogKwd() const { return (filep() ? string("$f") + string(displayType().ascii()) @@ -3709,7 +3719,7 @@ class AstDumpCtl : public AstNodeStmt { // Child: expr based on type of control statement VDumpCtlType m_ctlType; // Type of operation public: - AstDumpCtl(FileLine* fl, VDumpCtlType ctlType, AstNode* exprp = NULL) + AstDumpCtl(FileLine* fl, VDumpCtlType ctlType, AstNode* exprp = nullptr) : ASTGEN_SUPER(fl) , m_ctlType(ctlType) { setNOp1p(exprp); @@ -3745,7 +3755,7 @@ public: ASTNODE_NODE_FUNCS(ElabDisplay) virtual const char* broken() const { BROKEN_RTN(!fmtp()); - return NULL; + return nullptr; } virtual string verilogKwd() const { return (string("$") + string(displayType().ascii())); } virtual bool isGateOptimizable() const { return false; } @@ -3783,7 +3793,7 @@ public: ASTNODE_NODE_FUNCS(SFormat) virtual const char* broken() const { BROKEN_RTN(!fmtp()); - return NULL; + return nullptr; } virtual string verilogKwd() const { return "$sformat"; } virtual string emitVerilog() { V3ERROR_NA_RETURN(""); } @@ -4211,7 +4221,7 @@ public: class AstValuePlusArgs : public AstNodeMath { // Parents: expr - // Child: variable to set. If NULL then this is a $test$plusargs instead of $value$plusargs + // Child: variable to set. If nullptr then this is a $test$plusargs instead of $value$plusargs public: AstValuePlusArgs(FileLine* fl, AstNode* searchp, AstNode* outp) : ASTGEN_SUPER(fl) { @@ -4236,7 +4246,7 @@ public: class AstTestPlusArgs : public AstNodeMath { // Parents: expr - // Child: variable to set. If NULL then this is a $test$plusargs instead of $value$plusargs + // Child: variable to set. If nullptr then this is a $test$plusargs instead of $value$plusargs private: string m_text; @@ -4248,7 +4258,7 @@ public: virtual string name() const { return m_text; } virtual string verilogKwd() const { return "$test$plusargs"; } virtual string emitVerilog() { return verilogKwd(); } - virtual string emitC() { return "VL_VALUEPLUSARGS_%nq(%lw, %P, NULL)"; } + virtual string emitC() { return "VL_VALUEPLUSARGS_%nq(%lw, %P, nullptr)"; } virtual bool isGateOptimizable() const { return false; } virtual bool isPredictOptimizable() const { return false; } virtual bool cleanOut() const { return true; } @@ -4312,7 +4322,7 @@ public: class AstWhile : public AstNodeStmt { public: - AstWhile(FileLine* fl, AstNode* condp, AstNode* bodysp, AstNode* incsp = NULL) + AstWhile(FileLine* fl, AstNode* condp, AstNode* bodysp, AstNode* incsp = nullptr) : ASTGEN_SUPER(fl) { setOp2p(condp); addNOp3p(bodysp); @@ -4392,7 +4402,7 @@ public: class AstReturn : public AstNodeStmt { public: - explicit AstReturn(FileLine* fl, AstNode* lhsp = NULL) + explicit AstReturn(FileLine* fl, AstNode* lhsp = nullptr) : ASTGEN_SUPER(fl) { setNOp1p(lhsp); } @@ -4418,7 +4428,7 @@ private: bool m_unique0Pragma; // unique0 case bool m_priorityPragma; // priority case public: - AstIf(FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp = NULL) + AstIf(FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp = nullptr) : ASTGEN_SUPER(fl, condp, ifsp, elsesp) { m_uniquePragma = false; m_unique0Pragma = false; @@ -4480,7 +4490,7 @@ public: virtual const char* broken() const { BROKEN_RTN(!blockp()->brokeExistsAbove()); BROKEN_RTN(blockp()->labelp() != this); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_blockp->clonep()) m_blockp = m_blockp->clonep(); @@ -4508,7 +4518,7 @@ public: ASTNODE_NODE_FUNCS(JumpGo); virtual const char* broken() const { BROKEN_RTN(!labelp()->brokeExistsBelow()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_labelp->clonep()) m_labelp = m_labelp->clonep(); @@ -4696,7 +4706,7 @@ public: BROKEN_RTN(!VN_IS(it->second, InitItem)); BROKEN_RTN(!it->second->brokeExists()); } - return NULL; + return nullptr; } virtual void cloneRelink() { for (KeyItemMap::iterator it = m_map.begin(); it != m_map.end(); ++it) { @@ -4717,7 +4727,7 @@ public: const KeyItemMap& map() const { return m_map; } AstNode* addIndexValuep(uint32_t index, AstNode* newp) { // Returns old value, caller must garbage collect - AstNode* oldp = NULL; + AstNode* oldp = nullptr; KeyItemMap::iterator it = m_map.find(index); if (it != m_map.end()) { oldp = it->second->valuep(); @@ -4732,7 +4742,7 @@ public: AstNode* getIndexValuep(uint32_t index) const { KeyItemMap::const_iterator it = m_map.find(index); if (it == m_map.end()) { - return NULL; + return nullptr; } else { return it->second->valuep(); } @@ -5016,7 +5026,7 @@ public: ASTNODE_NODE_FUNCS(TraceInc) virtual const char* broken() const { BROKEN_RTN(!declp()->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_declp->clonep()) m_declp = m_declp->clonep(); @@ -5060,7 +5070,7 @@ public: virtual string name() const { return m_name; } virtual const char* broken() const { BROKEN_RTN(m_sensesp && !m_sensesp->brokeExists()); - return NULL; + return nullptr; } virtual void cloneRelink() { if (m_sensesp->clonep()) { @@ -5088,7 +5098,8 @@ private: // Return a value of a attribute, for example a LSB or array LSB of a signal AstAttrType m_attrType; // What sort of extraction public: - AstAttrOf(FileLine* fl, AstAttrType attrtype, AstNode* fromp = NULL, AstNode* dimp = NULL) + AstAttrOf(FileLine* fl, AstAttrType attrtype, AstNode* fromp = nullptr, + AstNode* dimp = nullptr) : ASTGEN_SUPER(fl) { setNOp1p(fromp); setNOp2p(dimp); @@ -8040,7 +8051,7 @@ public: virtual bool cleanOut() const { V3ERROR_NA_RETURN(""); } virtual int instrCount() const { return widthInstrs(); } AstNode* exprp() const { return op1p(); } // op1 = expression - AstNode* ticksp() const { return op2p(); } // op2 = ticks or NULL means 1 + AstNode* ticksp() const { return op2p(); } // op2 = ticks or nullptr means 1 AstSenTree* sentreep() const { return VN_CAST(op4p(), SenTree); } // op4 = clock domain void sentreep(AstSenTree* sentreep) { addOp4p(sentreep); } // op4 = clock domain virtual V3Hash sameHash() const { return V3Hash(); } @@ -8167,7 +8178,7 @@ public: // op1 = expression to assign or another AstPattern (list if replicated) AstNode* lhssp() const { return op1p(); } AstNode* keyp() const { return op2p(); } // op2 = assignment key (Const, id Text) - AstNode* repp() const { return op3p(); } // op3 = replication count, or NULL for count 1 + AstNode* repp() const { return op3p(); } // op3 = replication count, or nullptr for count 1 bool isDefault() const { return m_default; } void isDefault(bool flag) { m_default = flag; } }; @@ -8267,7 +8278,7 @@ class AstRestrict : public AstNodeCoverOrAssert { public: ASTNODE_NODE_FUNCS(Restrict) AstRestrict(FileLine* fl, AstNode* propp) - : ASTGEN_SUPER(fl, propp, NULL, false, "") {} + : ASTGEN_SUPER(fl, propp, nullptr, false, "") {} }; //====================================================================== @@ -8507,7 +8518,7 @@ public: virtual string name() const { return m_name; } virtual const char* broken() const { BROKEN_RTN((m_scopep && !m_scopep->brokeExists())); - return NULL; + return nullptr; } virtual bool maybePointedTo() const { return true; } virtual void dump(std::ostream& str = std::cout) const; @@ -8587,7 +8598,8 @@ public: void addFinalsp(AstNode* nodep) { addOp4p(nodep); } // Special methods bool emptyBody() const { - return argsp() == NULL && initsp() == NULL && stmtsp() == NULL && finalsp() == NULL; + return argsp() == nullptr && initsp() == nullptr && stmtsp() == nullptr + && finalsp() == nullptr; } }; @@ -8596,7 +8608,7 @@ class AstCCall : public AstNodeCCall { // Parents: Anything above a statement // Children: Args to the function public: - AstCCall(FileLine* fl, AstCFunc* funcp, AstNode* argsp = NULL) + AstCCall(FileLine* fl, AstCFunc* funcp, AstNode* argsp = nullptr) : ASTGEN_SUPER(fl, funcp, argsp) {} // Replacement form for V3Combine // Note this removes old attachments from the oldp @@ -8610,7 +8622,7 @@ class AstCMethodCall : public AstNodeCCall { // Parents: Anything above a statement // Children: Args to the function public: - AstCMethodCall(FileLine* fl, AstNode* fromp, AstCFunc* funcp, AstNode* argsp = NULL) + AstCMethodCall(FileLine* fl, AstNode* fromp, AstCFunc* funcp, AstNode* argsp = nullptr) : ASTGEN_SUPER(fl, funcp, argsp) { setOp1p(fromp); } @@ -8618,9 +8630,11 @@ public: virtual const char* broken() const { BROKEN_BASE_RTN(AstNodeCCall::broken()); BROKEN_RTN(!fromp()); - return NULL; + return nullptr; } - AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing) + AstNode* fromp() const { + return op1p(); + } // op1 = Extracting what (nullptr=TBD during parsing) void fromp(AstNode* nodep) { setOp1p(nodep); } }; @@ -8629,7 +8643,7 @@ class AstCNew : public AstNodeCCall { // Parents: Anything above an expression // Children: Args to the function public: - AstCNew(FileLine* fl, AstCFunc* funcp, AstNode* argsp = NULL) + AstCNew(FileLine* fl, AstCFunc* funcp, AstNode* argsp = nullptr) : ASTGEN_SUPER(fl, funcp, argsp) { statement(false); } @@ -8754,11 +8768,11 @@ private: public: explicit AstMTaskBody(FileLine* fl) : ASTGEN_SUPER(fl) - , m_execMTaskp(NULL) {} + , m_execMTaskp(nullptr) {} ASTNODE_NODE_FUNCS(MTaskBody); virtual const char* broken() const { BROKEN_RTN(!m_execMTaskp); - return NULL; + return nullptr; } AstNode* stmtsp() const { return op1p(); } void addStmtsp(AstNode* nodep) { addOp1p(nodep); } @@ -8784,7 +8798,7 @@ public: virtual ~AstExecGraph(); virtual const char* broken() const { BROKEN_RTN(!m_depGraphp); - return NULL; + return nullptr; } const V3Graph* depGraphp() const { return m_depGraphp; } V3Graph* mutableDepGraphp() { return m_depGraphp; } @@ -8814,8 +8828,8 @@ class AstTypeTable : public AstNode { public: explicit AstTypeTable(FileLine* fl) : ASTGEN_SUPER(fl) - , m_voidp(NULL) { - for (int i = 0; i < AstBasicDTypeKwd::_ENUM_MAX; ++i) m_basicps[i] = NULL; + , m_voidp(nullptr) { + for (int i = 0; i < AstBasicDTypeKwd::_ENUM_MAX; ++i) m_basicps[i] = nullptr; } ASTNODE_NODE_FUNCS(TypeTable) AstNodeDType* typesp() const { return VN_CAST(op1p(), NodeDType); } // op1 = List of dtypes @@ -8849,15 +8863,15 @@ private: public: AstNetlist() : ASTGEN_SUPER(new FileLine(FileLine::builtInFilename())) - , m_typeTablep(NULL) - , m_dollarUnitPkgp(NULL) - , m_evalp(NULL) - , m_execGraphp(NULL) {} + , m_typeTablep(nullptr) + , m_dollarUnitPkgp(nullptr) + , m_evalp(nullptr) + , m_execGraphp(nullptr) {} ASTNODE_NODE_FUNCS(Netlist) virtual const char* broken() const { BROKEN_RTN(m_dollarUnitPkgp && !m_dollarUnitPkgp->brokeExists()); BROKEN_RTN(m_evalp && !m_evalp->brokeExists()); - return NULL; + return nullptr; } virtual string name() const { return "$root"; } virtual void dump(std::ostream& str) const; diff --git a/src/V3Begin.cpp b/src/V3Begin.cpp index 5ef5991ac..f27269546 100644 --- a/src/V3Begin.cpp +++ b/src/V3Begin.cpp @@ -99,7 +99,7 @@ private: m_unnamedScope = ""; m_ftaskp = nodep; iterateChildren(nodep); - m_ftaskp = NULL; + m_ftaskp = nullptr; } m_namedScope = oldScope; m_unnamedScope = oldUnnamed; @@ -147,7 +147,7 @@ private: m_unnamedScope = oldUnnamed; // Cleanup - AstNode* addsp = NULL; + AstNode* addsp = nullptr; if (AstNode* stmtsp = nodep->stmtsp()) { stmtsp->unlinkFrBackWithNext(); if (addsp) { @@ -252,8 +252,8 @@ public: // CONSTRUCTORS BeginVisitor(AstNetlist* nodep, BeginState* statep) { m_statep = statep; - m_modp = NULL; - m_ftaskp = NULL; + m_modp = nullptr; + m_ftaskp = nullptr; m_ifDepth = 0; iterate(nodep); } diff --git a/src/V3CCtors.cpp b/src/V3CCtors.cpp index a08f0dd5b..14d99fc86 100644 --- a/src/V3CCtors.cpp +++ b/src/V3CCtors.cpp @@ -48,11 +48,11 @@ private: public: void add(AstNode* nodep) { if (v3Global.opt.outputSplitCFuncs() && v3Global.opt.outputSplitCFuncs() < m_numStmts) { - m_funcp = NULL; + m_funcp = nullptr; } if (!m_funcp) { m_funcp = new AstCFunc(m_modp->fileline(), m_basename + "_" + cvtToStr(++m_funcNum), - NULL, "void"); + nullptr, "void"); m_funcp->isStatic(false); m_funcp->declPrivate(true); m_funcp->slow(!VN_IS(m_modp, Class)); // Only classes construct on fast path @@ -78,7 +78,7 @@ public: m_modp = nodep; m_numStmts = 0; m_funcNum = 0; - m_tlFuncp = new AstCFunc(nodep->fileline(), basename, NULL, "void"); + m_tlFuncp = new AstCFunc(nodep->fileline(), basename, nullptr, "void"); m_tlFuncp->declPrivate(true); m_tlFuncp->isStatic(false); m_tlFuncp->slow(!VN_IS(m_modp, Class)); // Only classes construct on fast path @@ -97,7 +97,7 @@ private: void V3CCtors::evalAsserts() { AstNodeModule* modp = v3Global.rootp()->modulesp(); // Top module wrapper - AstCFunc* funcp = new AstCFunc(modp->fileline(), "_eval_debug_assertions", NULL, "void"); + AstCFunc* funcp = new AstCFunc(modp->fileline(), "_eval_debug_assertions", nullptr, "void"); funcp->declPrivate(true); funcp->isStatic(false); funcp->slow(false); @@ -171,7 +171,7 @@ void V3CCtors::cctorsAll() { } } if (VN_IS(modp, Class)) { - AstCFunc* funcp = new AstCFunc(modp->fileline(), "~", NULL, ""); + AstCFunc* funcp = new AstCFunc(modp->fileline(), "~", nullptr, ""); funcp->isDestructor(true); funcp->isStatic(false); funcp->slow(false); diff --git a/src/V3CUse.cpp b/src/V3CUse.cpp index 8f900b0cd..0b7247fcc 100644 --- a/src/V3CUse.cpp +++ b/src/V3CUse.cpp @@ -132,7 +132,7 @@ class CUseVisitor : public AstNVisitor { } } void makeVlToString(AstClass* nodep) { - AstCFunc* funcp = new AstCFunc(nodep->fileline(), "VL_TO_STRING", NULL, "std::string"); + AstCFunc* funcp = new AstCFunc(nodep->fileline(), "VL_TO_STRING", nullptr, "std::string"); funcp->argTypes("const VlClassRef<" + EmitCBaseVisitor::prefixNameProtect(nodep) + ">& obj"); funcp->isMethod(false); @@ -145,7 +145,7 @@ class CUseVisitor : public AstNVisitor { nodep->addStmtp(funcp); } void makeToString(AstClass* nodep) { - AstCFunc* funcp = new AstCFunc(nodep->fileline(), "to_string", NULL, "std::string"); + AstCFunc* funcp = new AstCFunc(nodep->fileline(), "to_string", nullptr, "std::string"); funcp->isConst(true); funcp->isStatic(false); funcp->protect(false); @@ -156,7 +156,8 @@ class CUseVisitor : public AstNVisitor { nodep->addStmtp(funcp); } void makeToStringMiddle(AstClass* nodep) { - AstCFunc* funcp = new AstCFunc(nodep->fileline(), "to_string_middle", NULL, "std::string"); + AstCFunc* funcp + = new AstCFunc(nodep->fileline(), "to_string_middle", nullptr, "std::string"); funcp->isConst(true); funcp->isStatic(false); funcp->protect(false); diff --git a/src/V3Case.cpp b/src/V3Case.cpp index 489cc1d09..a96837fbb 100644 --- a/src/V3Case.cpp +++ b/src/V3Case.cpp @@ -81,7 +81,7 @@ private: itemp = VN_CAST(itemp->nextp(), CaseItem)) { iterateAndNextNull(itemp->condsp()); } - m_caseExprp = NULL; + m_caseExprp = nullptr; } } virtual void visit(AstConst* nodep) override { @@ -110,7 +110,7 @@ private: public: // CONSTRUCTORS explicit CaseLintVisitor(AstNodeCase* nodep) { - m_caseExprp = NULL; + m_caseExprp = nullptr; iterate(nodep); } virtual ~CaseLintVisitor() {} @@ -161,7 +161,7 @@ private: } UINFO(8, "Simple case statement: " << nodep << endl); // Zero list of items for each value - for (uint32_t i = 0; i < (1UL << m_caseWidth); ++i) m_valueItem[i] = NULL; + for (uint32_t i = 0; i < (1UL << m_caseWidth); ++i) m_valueItem[i] = nullptr; // Now pick up the values for each assignment // We can cheat and use uint32_t's because we only support narrow case's bool bitched = false; @@ -218,7 +218,7 @@ private: } // Convert valueItem from AstCaseItem* to the expression - // Not done earlier, as we may now have a NULL because it's just a ";" NOP branch + // Not done earlier, as we may now have a nullptr because it's just a ";" NOP branch for (uint32_t i = 0; i < (1UL << m_caseWidth); ++i) { m_valueItem[i] = VN_CAST(m_valueItem[i], CaseItem)->bodysp(); } @@ -324,13 +324,13 @@ private: hadDefault = true; } else { // Expressioned clause - AstNode* icondNextp = NULL; - AstNode* ifexprp = NULL; // If expression to test + AstNode* icondNextp = nullptr; + AstNode* ifexprp = nullptr; // If expression to test for (AstNode* icondp = itemp->condsp(); icondp; icondp = icondNextp) { icondNextp = icondp->nextp(); icondp->unlinkFrBack(); - AstNode* condp = NULL; // Default is to use and1p/and2p + AstNode* condp = nullptr; // Default is to use and1p/and2p AstConst* iconstp = VN_CAST(icondp, Const); if (iconstp && neverItem(nodep, iconstp)) { // X in casez can't ever be executed @@ -377,8 +377,9 @@ private: if (!hadDefault) { // If there was no default, add a empty one, this greatly simplifies below code // and constant propagation will just eliminate it for us later. - nodep->addItemsp(new AstCaseItem( - nodep->fileline(), new AstConst(nodep->fileline(), AstConst::LogicTrue()), NULL)); + nodep->addItemsp( + new AstCaseItem(nodep->fileline(), + new AstConst(nodep->fileline(), AstConst::LogicTrue()), nullptr)); } if (debug() >= 9) nodep->dumpTree(cout, " _comp_COND: "); // Now build the IF statement tree @@ -388,9 +389,9 @@ private: // should pull out the most common item from here and instead make // it the first IF branch. int depth = 0; - AstNode* grouprootp = NULL; - AstIf* groupnextp = NULL; - AstIf* itemnextp = NULL; + AstNode* grouprootp = nullptr; + AstIf* groupnextp = nullptr; + AstIf* itemnextp = nullptr; for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp = VN_CAST(itemp->nextp(), CaseItem)) { AstNode* istmtsp = itemp->bodysp(); // Maybe null -- no action. @@ -400,9 +401,9 @@ private: { // Prepare for next group if (++depth > CASE_ENCODER_GROUP_DEPTH) depth = 1; if (depth == 1) { // First group or starting new group - itemnextp = NULL; + itemnextp = nullptr; AstIf* newp - = new AstIf(itemp->fileline(), ifexprp->cloneTree(true), NULL, NULL); + = new AstIf(itemp->fileline(), ifexprp->cloneTree(true), nullptr, nullptr); if (groupnextp) { groupnextp->addElsesp(newp); } else { @@ -422,7 +423,7 @@ private: VL_DO_DANGLING(itemexprp->deleteTree(), itemexprp); itemexprp = new AstConst(itemp->fileline(), AstConst::LogicTrue()); } - AstIf* newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, NULL); + AstIf* newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, nullptr); if (itemnextp) { itemnextp->addElsesp(newp); } else { @@ -490,7 +491,7 @@ public: m_caseWidth = 0; m_caseItems = 0; m_caseNoOverlapsAllCovered = false; - for (uint32_t i = 0; i < (1UL << CASE_OVERLAP_WIDTH); ++i) m_valueItem[i] = NULL; + for (uint32_t i = 0; i < (1UL << CASE_OVERLAP_WIDTH); ++i) m_valueItem[i] = nullptr; iterate(nodep); } virtual ~CaseVisitor() { diff --git a/src/V3Cdc.cpp b/src/V3Cdc.cpp index f7522c219..0d8c0668c 100644 --- a/src/V3Cdc.cpp +++ b/src/V3Cdc.cpp @@ -63,8 +63,8 @@ public: : V3GraphVertex(graphp) , m_scopep(scopep) , m_nodep(nodep) - , m_srcDomainp(NULL) - , m_dstDomainp(NULL) + , m_srcDomainp(nullptr) + , m_dstDomainp(nullptr) , m_srcDomainSet(false) , m_dstDomainSet(false) , m_asyncPath(false) {} @@ -229,7 +229,7 @@ private: // STATE V3Graph m_graph; // Scoreboard of var usages/dependencies - CdcLogicVertex* m_logicVertexp; // Current statement being tracked, NULL=ignored + CdcLogicVertex* m_logicVertexp; // Current statement being tracked, nullptr=ignored AstScope* m_scopep; // Current scope being processed AstNodeModule* m_modp; // Current module AstSenTree* m_domainp; // Current sentree @@ -253,7 +253,7 @@ private: m_logicVertexp->dstDomainSet(true); } iterateChildren(nodep); - m_logicVertexp = NULL; + m_logicVertexp = nullptr; if (false && debug() >= 9) { UINFO(9, "Trace Logic:\n"); @@ -273,7 +273,7 @@ private: // Create IO vertex - note it's relative to the pointed to var, not where we are // now This allows reporting to easily print the input statement CdcLogicVertex* ioVertexp - = new CdcLogicVertex(&m_graph, varscp->scopep(), varscp->varp(), NULL); + = new CdcLogicVertex(&m_graph, varscp->scopep(), varscp->varp(), nullptr); if (varscp->varp()->isWritable()) { new V3GraphEdge(&m_graph, vertexp, ioVertexp, 1); } else { @@ -364,7 +364,7 @@ private: UINFO(8, " Trace One async: " << vvertexp << endl); // Twice, as we need to detect, then propagate CdcEitherVertex* markp = traceAsyncRecurse(vvertexp, false); - if (markp) { // Mark is non-NULL if something bad on this path + if (markp) { // Mark is non-nullptr if something bad on this path UINFO(9, " Trace One bad! " << vvertexp << endl); m_userGeneration++; // Effectively a userClearVertices() traceAsyncRecurse(vvertexp, true); @@ -377,12 +377,12 @@ private: } CdcEitherVertex* traceAsyncRecurse(CdcEitherVertex* vertexp, bool mark) { - // First pass: Return vertex of any hazardous stuff attached, or NULL if OK + // First pass: Return vertex of any hazardous stuff attached, or nullptr if OK // If first pass returns true, second pass calls asyncPath() on appropriate nodes - if (vertexp->user() >= m_userGeneration) return NULL; // Processed - prevent loop + if (vertexp->user() >= m_userGeneration) return nullptr; // Processed - prevent loop vertexp->user(m_userGeneration); - CdcEitherVertex* mark_outp = NULL; + CdcEitherVertex* mark_outp = nullptr; UINFO(9, " Trace: " << vertexp << endl); // Clear out in prep for marking next path @@ -401,7 +401,7 @@ private: CdcEitherVertex* eFromVertexp = static_cast(edgep->fromp()); eFromVertexp->asyncPath(true); } - return NULL; + return nullptr; } // Also ok if from flop, but partially trace the flop so more obvious to users if (vvertexp->fromFlop()) { @@ -409,7 +409,7 @@ private: CdcEitherVertex* eFromVertexp = static_cast(edgep->fromp()); eFromVertexp->asyncPath(true); } - return NULL; + return nullptr; } } @@ -594,7 +594,7 @@ private: } // Convert list of senses into one sense node - AstSenTree* senoutp = NULL; + AstSenTree* senoutp = nullptr; bool senedited = false; for (SenSet::iterator it = senouts.begin(); it != senouts.end(); ++it) { if (!senoutp) { @@ -644,9 +644,9 @@ private: virtual void visit(AstScope* nodep) override { UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; - m_logicVertexp = NULL; + m_logicVertexp = nullptr; iterateChildren(nodep); - m_scopep = NULL; + m_scopep = nullptr; } virtual void visit(AstActive* nodep) override { // Create required blocks and add to module @@ -657,7 +657,7 @@ private: || m_domainp->hasClocked()) { // IE not hasSettle/hasInitial iterateNewStmt(nodep); } - m_domainp = NULL; + m_domainp = nullptr; AstNode::user2ClearTree(); } virtual void visit(AstNodeVarRef* nodep) override { @@ -737,10 +737,10 @@ private: public: // CONSTRUCTORS explicit CdcVisitor(AstNode* nodep) { - m_logicVertexp = NULL; - m_scopep = NULL; - m_modp = NULL; - m_domainp = NULL; + m_logicVertexp = nullptr; + m_scopep = nullptr; + m_modp = nullptr; + m_domainp = nullptr; m_inDly = false; m_inSenItem = 0; m_userGeneration = 0; @@ -763,12 +763,12 @@ public: if (debug() >= 1) edgeReport(); // Not useful to users at the moment if (false) { *m_ofp << "\nDBG-test-dumper\n"; - V3EmitV::verilogPrefixedTree(nodep, *m_ofp, "DBG ", 40, NULL, true); + V3EmitV::verilogPrefixedTree(nodep, *m_ofp, "DBG ", 40, nullptr, true); *m_ofp << endl; } } virtual ~CdcVisitor() { - if (m_ofp) VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + if (m_ofp) VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } }; diff --git a/src/V3Changed.cpp b/src/V3Changed.cpp index e82a61e27..d290fd5be 100644 --- a/src/V3Changed.cpp +++ b/src/V3Changed.cpp @@ -49,10 +49,10 @@ public: int m_funcNum; // Number of change functions emitted ChangedState() { - m_topModp = NULL; - m_chgFuncp = NULL; - m_scopetopp = NULL; - m_tlChgFuncp = NULL; + m_topModp = nullptr; + m_chgFuncp = nullptr; + m_scopetopp = nullptr; + m_tlChgFuncp = nullptr; m_numStmts = 0; m_funcNum = 0; } @@ -267,7 +267,8 @@ private: // Each change detection function needs at least one AstChangeDet // to ensure that V3EmitC outputs the necessary code. m_statep->maybeCreateChgFuncp(); - m_statep->m_chgFuncp->addStmtsp(new AstChangeDet(nodep->fileline(), NULL, NULL, false)); + m_statep->m_chgFuncp->addStmtsp( + new AstChangeDet(nodep->fileline(), nullptr, nullptr, false)); iterateChildren(nodep); } diff --git a/src/V3Class.cpp b/src/V3Class.cpp index a6e8db039..96c125bb4 100644 --- a/src/V3Class.cpp +++ b/src/V3Class.cpp @@ -59,12 +59,12 @@ private: v3Global.rootp()->addModulep(packagep); // Add package to hierarchy AstCell* cellp = new AstCell(packagep->fileline(), packagep->fileline(), packagep->name(), - packagep->name(), NULL, NULL, NULL); + packagep->name(), nullptr, nullptr, nullptr); cellp->modp(packagep); v3Global.rootp()->topModulep()->addStmtp(cellp); // Find class's scope // Alternative would be to move this and related to V3Scope - AstScope* classScopep = NULL; + AstScope* classScopep = nullptr; for (AstNode* itp = nodep->stmtsp(); itp; itp = itp->nextp()) { if ((classScopep = VN_CAST(itp, Scope))) break; } @@ -82,7 +82,7 @@ private: iterateChildren(nodep); } m_prefix = prevPrefix; - m_classScopep = NULL; + m_classScopep = nullptr; } virtual void visit(AstPackage* nodep) override { string prevPrefix = m_prefix; @@ -117,7 +117,7 @@ private: public: // CONSTRUCTORS explicit ClassVisitor(AstNetlist* nodep) - : m_classScopep(NULL) { + : m_classScopep(nullptr) { iterate(nodep); } virtual ~ClassVisitor() { diff --git a/src/V3Clean.cpp b/src/V3Clean.cpp index 52d7ebd19..22fcdf336 100644 --- a/src/V3Clean.cpp +++ b/src/V3Clean.cpp @@ -301,7 +301,7 @@ private: public: // CONSTRUCTORS explicit CleanVisitor(AstNetlist* nodep) { - m_modp = NULL; + m_modp = nullptr; iterate(nodep); } virtual ~CleanVisitor() {} diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index 72f0d0472..5fe6f51c0 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -101,11 +101,11 @@ private: // BOTHEDGE: var ^ var_last // HIGHEDGE: var // LOWEDGE: ~var - AstNode* newp = NULL; + AstNode* newp = nullptr; if (nodep->edgeType() == VEdgeType::ET_ILLEGAL) { nodep->v3warn(E_UNSUPPORTED, "Unsupported: Complicated event expression in sensitive activity list"); - return NULL; + return nullptr; } AstVarScope* clkvscp = nodep->varrefp()->varScopep(); if (nodep->edgeType() == VEdgeType::ET_POSEDGE) { @@ -138,7 +138,7 @@ private: } AstNode* createSenseEquation(AstSenItem* nodesp) { // Nodep may be a list of elements; we need to walk it - AstNode* senEqnp = NULL; + AstNode* senEqnp = nullptr; for (AstSenItem* senp = nodesp; senp; senp = VN_CAST(senp->nextp(), SenItem)) { AstNode* const senOnep = createSenItemEquation(senp); if (senEqnp) { @@ -153,12 +153,12 @@ private: AstIf* makeActiveIf(AstSenTree* sensesp) { AstNode* senEqnp = createSenseEquation(sensesp->sensesp()); UASSERT_OBJ(senEqnp, sensesp, "No sense equation, shouldn't be in sequent activation."); - AstIf* newifp = new AstIf(sensesp->fileline(), senEqnp, NULL, NULL); + AstIf* newifp = new AstIf(sensesp->fileline(), senEqnp, nullptr, nullptr); return newifp; } void clearLastSen() { - m_lastSenp = NULL; - m_lastIfp = NULL; + m_lastSenp = nullptr; + m_lastIfp = nullptr; } // VISITORS @@ -223,8 +223,8 @@ private: // Done, clear so we can detect errors UINFO(4, " TOPSCOPEDONE " << nodep << endl); clearLastSen(); - m_topScopep = NULL; - m_scopep = NULL; + m_topScopep = nullptr; + m_scopep = nullptr; } virtual void visit(AstNodeModule* nodep) override { // UINFO(4, " MOD " << nodep << endl); @@ -244,7 +244,7 @@ private: movep->unlinkFrBackWithNext(); m_evalFuncp->addFinalsp(movep); } - m_scopep = NULL; + m_scopep = nullptr; } virtual void visit(AstAlways* nodep) override { AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true); @@ -272,7 +272,7 @@ private: AstNode* origp = nodep->origp()->unlinkFrBack(); AstNode* changep = nodep->changep()->unlinkFrBack(); AstIf* newp = new AstIf(nodep->fileline(), new AstXor(nodep->fileline(), origp, changep), - incp, NULL); + incp, nullptr); // We could add another IF to detect posedges, and only increment if so. // It's another whole branch though versus a potential memory miss. // We'll go with the miss. @@ -402,16 +402,16 @@ private: public: // CONSTRUCTORS explicit ClockVisitor(AstNetlist* nodep) { - m_modp = NULL; - m_evalFuncp = NULL; - m_initFuncp = NULL; - m_finalFuncp = NULL; - m_settleFuncp = NULL; - m_topScopep = NULL; - m_lastSenp = NULL; - m_lastIfp = NULL; - m_scopep = NULL; - m_mtaskBodyp = NULL; + m_modp = nullptr; + m_evalFuncp = nullptr; + m_initFuncp = nullptr; + m_finalFuncp = nullptr; + m_settleFuncp = nullptr; + m_topScopep = nullptr; + m_lastSenp = nullptr; + m_lastIfp = nullptr; + m_scopep = nullptr; + m_mtaskBodyp = nullptr; // iterate(nodep); // Allow downstream modules to find _eval() diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index 48b3eef39..b713b7b39 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -208,7 +208,7 @@ private: << oldfuncp << endl); // Mark user3p on entire old tree, so we don't process it more CombMarkVisitor visitor(oldfuncp); - m_call.replaceFunc(oldfuncp, NULL); + m_call.replaceFunc(oldfuncp, nullptr); oldfuncp->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(oldfuncp), oldfuncp); } @@ -251,8 +251,8 @@ private: void replaceOnlyCallFunc(AstCCall* nodep) { if (AstCFunc* oldfuncp = VN_CAST(nodep->backp(), CFunc)) { // oldfuncp->dumpTree(cout, "MAYDEL: "); - if (nodep->nextp() == NULL && oldfuncp->initsp() == NULL && oldfuncp->stmtsp() == nodep - && oldfuncp->finalsp() == NULL) { + if (nodep->nextp() == nullptr && oldfuncp->initsp() == nullptr + && oldfuncp->stmtsp() == nodep && oldfuncp->finalsp() == nullptr) { UINFO(9, " Function only has call " << oldfuncp << endl); m_call.deleteCall(nodep); CombMarkVisitor visitor(oldfuncp); @@ -266,9 +266,9 @@ private: // UINFO(4," STMT " << hashval << " " << node1p << endl); // int bestDepth = 0; // Best substitution found in the search - AstNode* bestNode2p = NULL; - AstNode* bestLast1p = NULL; - AstNode* bestLast2p = NULL; + AstNode* bestNode2p = nullptr; + AstNode* bestLast1p = nullptr; + AstNode* bestLast2p = nullptr; // std::pair eqrange = m_hashed.mmap().equal_range(hashval); @@ -279,8 +279,8 @@ private: // We need to mark iteration to prevent matching code inside // code (abab matching in ababab) AstNode::user1ClearTree(); // user1p() used on entire tree - m_walkLast1p = NULL; - m_walkLast2p = NULL; + m_walkLast1p = nullptr; + m_walkLast2p = nullptr; int depth = walkDupCodeNext(node1p, node2p, 1); if (depth > COMBINE_MIN_STATEMENTS && depth > bestDepth) { bestDepth = depth; @@ -332,7 +332,7 @@ private: if ((pos = oldname.find("_common")) != string::npos) oldname.erase(pos); if ((pos = oldname.find("__")) != string::npos) oldname.erase(pos); AstCFunc* newfuncp = new AstCFunc(node1p->fileline(), - oldname + "_common" + cvtToStr(++m_modNFuncs), NULL); + oldname + "_common" + cvtToStr(++m_modNFuncs), nullptr); m_modp->addStmtp(newfuncp); // Create calls AstCCall* call1p = new AstCCall(node1p->fileline(), newfuncp); @@ -394,7 +394,7 @@ private: UINFO(4, " MOD " << nodep << endl); m_modp = nodep; m_modNFuncs = 0; - m_walkLast2p = NULL; + m_walkLast2p = nullptr; m_hashed.clear(); // Compute hash of all statement trees in the function m_state = STATE_HASH; @@ -417,7 +417,7 @@ private: m_state = STATE_IDLE; } #endif - m_modp = NULL; + m_modp = nullptr; } virtual void visit(AstCFunc* nodep) override { m_funcp = nodep; @@ -431,7 +431,7 @@ private: } #endif } - m_funcp = NULL; + m_funcp = nullptr; } virtual void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { @@ -459,11 +459,11 @@ public: // CONSTRUCTORS explicit CombineVisitor(AstNetlist* nodep) { m_state = STATE_IDLE; - m_modp = NULL; - m_funcp = NULL; + m_modp = nullptr; + m_funcp = nullptr; m_modNFuncs = 0; - m_walkLast1p = NULL; - m_walkLast2p = NULL; + m_walkLast1p = nullptr; + m_walkLast2p = nullptr; iterate(nodep); } virtual ~CombineVisitor() { // diff --git a/src/V3Config.cpp b/src/V3Config.cpp index 365cb3131..29755d912 100644 --- a/src/V3Config.cpp +++ b/src/V3Config.cpp @@ -63,7 +63,7 @@ public: typename Map::iterator it = m_mapResolved.find(name); if (VL_UNLIKELY(it != m_mapResolved.end())) { return &it->second; } - T* newp = NULL; + T* newp = nullptr; // Cannot be resolved, create if matched // Update this entity with all matches in the wildcards @@ -105,7 +105,7 @@ public: AstNode* newp = new AstAttrOf(varp->fileline(), it->m_type); varp->addAttrsp(newp); if (it->m_type == AstAttrType::VAR_PUBLIC_FLAT_RW && it->m_sentreep) { - newp->addNext(new AstAlwaysPublic(varp->fileline(), it->m_sentreep, NULL)); + newp->addNext(new AstAlwaysPublic(varp->fileline(), it->m_sentreep, nullptr)); } } } diff --git a/src/V3Const.cpp b/src/V3Const.cpp index eca626950..04e059036 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1115,7 +1115,7 @@ private: AstSel* sel2p = new AstSel(conp->fileline(), rhs2p, lsb2, msb2 - lsb2 + 1); // Make new assigns of same flavor as old one //*** Not cloneTree; just one node. - AstNode* newp = NULL; + AstNode* newp = nullptr; if (!need_temp) { AstNodeAssign* asn1ap = VN_CAST(nodep->cloneType(lc1p, sel1p), NodeAssign); AstNodeAssign* asn2ap = VN_CAST(nodep->cloneType(lc2p, sel2p), NodeAssign); @@ -1307,7 +1307,7 @@ private: m_wremove = false; iterateChildren(nodep); m_wremove = true; - m_scopep = NULL; + m_scopep = nullptr; } void swapSides(AstNodeBiCom* nodep) { @@ -1594,7 +1594,7 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); } } - m_selp = NULL; + m_selp = nullptr; } virtual void visit(AstNodeVarRef* nodep) override { iterateChildren(nodep); @@ -1784,7 +1784,7 @@ private: SenItemCmp cmp; if (nextp && !cmp(senp, nextp)) { // Something's out of order, sort it - senp = NULL; + senp = nullptr; std::vector vec; for (AstSenItem* senp = VN_CAST(nodep->sensesp(), SenItem); senp; senp = VN_CAST(senp->nextp(), SenItem)) { @@ -1883,7 +1883,7 @@ private: iterateChildren(nodep); if (m_doNConst) { if (const AstConst* constp = VN_CAST(nodep->condp(), Const)) { - AstNode* keepp = NULL; + AstNode* keepp = nullptr; if (constp->isZero()) { UINFO(4, "IF(0,{any},{x}) => {x}: " << nodep << endl); keepp = nodep->elsesp(); @@ -1907,7 +1907,7 @@ private: // effects in the condition itself VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } else if (!afterComment(nodep->ifsp())) { - UINFO(4, "IF({x}) NULL {...} => IF(NOT{x}}: " << nodep << endl); + UINFO(4, "IF({x}) nullptr {...} => IF(NOT{x}}: " << nodep << endl); AstNode* condp = nodep->condp(); AstNode* elsesp = nodep->elsesp(); condp->unlinkFrBackWithNext(); @@ -2173,7 +2173,7 @@ private: // AstJumpGo's below here that point to this node will set user4 if (m_doExpensive && !nodep->user4()) { UINFO(4, "JUMPLABEL => unused " << nodep << endl); - AstNode* underp = NULL; + AstNode* underp = nullptr; if (nodep->stmtsp()) underp = nodep->stmtsp()->unlinkFrBackWithNext(); if (underp) { nodep->replaceWith(underp); @@ -2559,10 +2559,10 @@ public: m_hasJumpDelay = false; m_warn = false; m_wremove = true; // Overridden in visitors - m_modp = NULL; - m_selp = NULL; - m_scopep = NULL; - m_attrp = NULL; + m_modp = nullptr; + m_selp = nullptr; + m_scopep = nullptr; + m_attrp = nullptr; // // clang-format off switch (pmode) { diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index c3a7826fc..90a91952d 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -54,8 +54,8 @@ private: , m_chgRefp(cp) {} ~ToggleEnt() {} void cleanup() { - VL_DO_CLEAR(m_varRefp->deleteTree(), m_varRefp = NULL); - VL_DO_CLEAR(m_chgRefp->deleteTree(), m_chgRefp = NULL); + VL_DO_CLEAR(m_varRefp->deleteTree(), m_varRefp = nullptr); + VL_DO_CLEAR(m_chgRefp->deleteTree(), m_chgRefp = nullptr); } }; @@ -68,7 +68,7 @@ private: : m_on(false) , m_inModOff(false) , m_handle(0) - , m_nodep(NULL) {} + , m_nodep(nullptr) {} bool lineCoverageOn(const AstNode* nodep) { return m_on && !m_inModOff && nodep->fileline()->coverageOn() && v3Global.opt.coverageLine(); @@ -106,7 +106,7 @@ private: } // We allow this, though tracing doesn't // if (nodep->arrayp(1)) return "Unsupported: Multi-dimensional array"; - return NULL; + return nullptr; } AstCoverInc* newCoverInc(FileLine* fl, const string& hier, const string& page_prefix, @@ -546,7 +546,7 @@ public: explicit CoverageVisitor(AstNetlist* rootp) { // Operate on all modules m_nextHandle = 0; - m_modp = NULL; + m_modp = nullptr; m_beginHier = ""; m_inToggleOff = false; iterateChildren(rootp); diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index 275b70ced..e4704b67f 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -170,7 +170,7 @@ private: if (nodep->varp()) nodep->varp()->user1Inc(); if (nodep->packagep()) { if (m_elimCells) { - nodep->packagep(NULL); + nodep->packagep(nullptr); } else { nodep->packagep()->user1Inc(); } @@ -181,7 +181,7 @@ private: checkAll(nodep); if (nodep->packagep()) { if (m_elimCells) { - nodep->packagep(NULL); + nodep->packagep(nullptr); } else { nodep->packagep()->user1Inc(); } @@ -199,7 +199,7 @@ private: "RefDType should point to data type before typedefs removed"); if (nodep->packagep()) { if (m_elimCells) { - nodep->packagep(NULL); + nodep->packagep(nullptr); } else { nodep->packagep()->user1Inc(); } @@ -211,7 +211,7 @@ private: checkAll(nodep); if (nodep->packagep()) { if (m_elimCells) { - nodep->packagep(NULL); + nodep->packagep(nullptr); } else { nodep->packagep()->user1Inc(); } @@ -228,7 +228,7 @@ private: checkAll(nodep); if (nodep->packagep()) { if (m_elimCells) { - nodep->packagep(NULL); + nodep->packagep(nullptr); } else { nodep->packagep()->user1Inc(); } @@ -350,7 +350,7 @@ private: scp->aboveScopep()->user1Inc(-1); if (scp->dtypep()) scp->dtypep()->user1Inc(-1); VL_DO_DANGLING(scp->unlinkFrBack()->deleteTree(), scp); - *it = NULL; + *it = nullptr; retry = true; } } @@ -371,12 +371,12 @@ private: retry = false; for (std::vector::iterator it = m_classesp.begin(); it != m_classesp.end(); ++it) { - if (AstClass* nodep = *it) { // NULL if deleted earlier + if (AstClass* nodep = *it) { // nullptr if deleted earlier if (nodep->user1() == 0) { if (nodep->extendsp()) nodep->extendsp()->user1Inc(-1); if (nodep->packagep()) nodep->packagep()->user1Inc(-1); VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); - *it = NULL; + *it = nullptr; retry = true; } } @@ -412,7 +412,7 @@ private: UINFO(4, " Dead " << varp << endl); if (varp->dtypep()) varp->dtypep()->user1Inc(-1); VL_DO_DANGLING(varp->unlinkFrBack()->deleteTree(), varp); - *it = NULL; + *it = nullptr; retry = true; } } @@ -443,7 +443,7 @@ public: // CONSTRUCTORS DeadVisitor(AstNetlist* nodep, bool elimUserVars, bool elimDTypes, bool elimScopes, bool elimCells) { - m_modp = NULL; + m_modp = nullptr; m_elimCells = elimCells; m_elimUserVars = elimUserVars; m_elimDTypes = elimDTypes; diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index 16eecba49..0aee58150 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -189,9 +189,9 @@ private: // See top of this file for transformation // Return the new LHS for the assignment, Null = unlink // Find selects - AstNode* newlhsp = NULL; // NULL = unlink old assign - AstSel* bitselp = NULL; - AstArraySel* arrayselp = NULL; + AstNode* newlhsp = nullptr; // nullptr = unlink old assign + AstSel* bitselp = nullptr; + AstArraySel* arrayselp = nullptr; if (VN_IS(lhsp, Sel)) { bitselp = VN_CAST(lhsp, Sel); arrayselp = VN_CAST(bitselp->fromp(), ArraySel); @@ -226,7 +226,7 @@ private: string bitvarname = (string("__Vdlyvdim") + cvtToStr(dimension) + "__" + oldvarp->shortName() + "__v" + cvtToStr(modVecNum)); AstVarScope* bitvscp - = createVarSc(varrefp->varScopep(), bitvarname, dimp->width(), NULL); + = createVarSc(varrefp->varScopep(), bitvarname, dimp->width(), nullptr); AstAssign* bitassignp = new AstAssign( nodep->fileline(), new AstVarRef(nodep->fileline(), bitvscp, true), dimp); nodep->addNextHere(bitassignp); @@ -235,7 +235,7 @@ private: } // //=== Bitselect: __Vdlyvlsb__ - AstNode* bitreadp = NULL; // Code to read Vdlyvlsb + AstNode* bitreadp = nullptr; // Code to read Vdlyvlsb if (bitselp) { AstNode* lsbvaluep = bitselp->lsbp()->unlinkFrBack(); if (VN_IS(bitselp->fromp(), Const)) { @@ -245,7 +245,7 @@ private: string bitvarname = (string("__Vdlyvlsb__") + oldvarp->shortName() + "__v" + cvtToStr(modVecNum)); AstVarScope* bitvscp - = createVarSc(varrefp->varScopep(), bitvarname, lsbvaluep->width(), NULL); + = createVarSc(varrefp->varScopep(), bitvarname, lsbvaluep->width(), nullptr); AstAssign* bitassignp = new AstAssign( nodep->fileline(), new AstVarRef(nodep->fileline(), bitvscp, true), lsbvaluep); nodep->addNextHere(bitassignp); @@ -269,7 +269,7 @@ private: // //=== Setting/not setting boolean: __Vdlyvset__ AstVarScope* setvscp; - AstAssignPre* setinitp = NULL; + AstAssignPre* setinitp = nullptr; if (nodep->user3p()) { // Simplistic optimization. If the previous statement in same scope was also a =>, @@ -281,7 +281,7 @@ private: } else { // Create new one string setvarname = (string("__Vdlyvset__") + oldvarp->shortName() + "__v" + cvtToStr(modVecNum)); - setvscp = createVarSc(varrefp->varScopep(), setvarname, 1, NULL); + setvscp = createVarSc(varrefp->varScopep(), setvarname, 1, nullptr); setinitp = new AstAssignPre(nodep->fileline(), new AstVarRef(nodep->fileline(), setvscp, true), new AstConst(nodep->fileline(), 0)); @@ -316,7 +316,7 @@ private: checkActivePost(varrefp, oldactivep); if (setinitp) oldactivep->addStmtsp(setinitp); } else { // first time we've dealt with this memory - finalp = new AstAlwaysPost(nodep->fileline(), NULL /*sens*/, NULL /*body*/); + finalp = new AstAlwaysPost(nodep->fileline(), nullptr /*sens*/, nullptr /*body*/); UINFO(9, " Created " << finalp << endl); AstActive* newactp = createActivePost(varrefp); newactp->addStmtsp(finalp); @@ -332,8 +332,9 @@ private: UASSERT_OBJ(postLogicp, nodep, "Delayed assignment misoptimized; prev var found w/o associated IF"); } else { - postLogicp = new AstIf(nodep->fileline(), - new AstVarRef(nodep->fileline(), setvscp, false), NULL, NULL); + postLogicp + = new AstIf(nodep->fileline(), new AstVarRef(nodep->fileline(), setvscp, false), + nullptr, nullptr); UINFO(9, " Created " << postLogicp << endl); finalp->addBodysp(postLogicp); finalp->user3p(setvscp); // Remember IF's vset variable @@ -357,7 +358,7 @@ private: virtual void visit(AstCFunc* nodep) override { m_cfuncp = nodep; iterateChildren(nodep); - m_cfuncp = NULL; + m_cfuncp = nullptr; } virtual void visit(AstActive* nodep) override { m_activep = nodep; @@ -371,7 +372,7 @@ private: virtual void visit(AstAssignDly* nodep) override { m_inDly = true; m_nextDlyp - = VN_CAST(nodep->nextp(), AssignDly); // Next assignment in same block, maybe NULL. + = VN_CAST(nodep->nextp(), AssignDly); // Next assignment in same block, maybe nullptr. if (m_cfuncp) { nodep->v3warn(E_UNSUPPORTED, "Unsupported: Delayed assignment inside public function/task"); @@ -399,7 +400,7 @@ private: iterateChildren(nodep); } m_inDly = false; - m_nextDlyp = NULL; + m_nextDlyp = nullptr; } virtual void visit(AstVarRef* nodep) override { @@ -421,7 +422,7 @@ private: } if (!dlyvscp) { // First use of this delayed variable string newvarname = (string("__Vdly__") + nodep->varp()->shortName()); - dlyvscp = createVarSc(oldvscp, newvarname, 0, NULL); + dlyvscp = createVarSc(oldvscp, newvarname, 0, nullptr); AstNodeAssign* prep; AstBasicDType* basicp = oldvscp->dtypep()->basicp(); if (basicp && basicp->isEventValue()) { @@ -477,9 +478,9 @@ public: // CONSTRUCTORS explicit DelayedVisitor(AstNetlist* nodep) { m_inDly = false; - m_activep = NULL; - m_cfuncp = NULL; - m_nextDlyp = NULL; + m_activep = nullptr; + m_cfuncp = nullptr; + m_nextDlyp = nullptr; m_inLoop = false; m_inInitial = false; diff --git a/src/V3Depth.cpp b/src/V3Depth.cpp index 19c9ebb40..96a9d4f3c 100644 --- a/src/V3Depth.cpp +++ b/src/V3Depth.cpp @@ -81,7 +81,7 @@ private: AstNodeModule* origModp = m_modp; { m_modp = nodep; - m_funcp = NULL; + m_funcp = nullptr; iterateChildren(nodep); } m_modp = origModp; @@ -91,14 +91,14 @@ private: m_depth = 0; m_maxdepth = 0; iterateChildren(nodep); - m_funcp = NULL; + m_funcp = nullptr; } void visitStmt(AstNodeStmt* nodep) { m_depth = 0; m_maxdepth = 0; m_stmtp = nodep; iterateChildren(nodep); - m_stmtp = NULL; + m_stmtp = nullptr; } virtual void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { @@ -152,9 +152,9 @@ private: public: // CONSTRUCTORS explicit DepthVisitor(AstNetlist* nodep) { - m_modp = NULL; - m_funcp = NULL; - m_stmtp = NULL; + m_modp = nullptr; + m_funcp = nullptr; + m_stmtp = nullptr; m_depth = 0; m_maxdepth = 0; // diff --git a/src/V3DepthBlock.cpp b/src/V3DepthBlock.cpp index 666733803..fd5572a43 100644 --- a/src/V3DepthBlock.cpp +++ b/src/V3DepthBlock.cpp @@ -50,7 +50,7 @@ private: nodep->unlinkFrBack(&relinkHandle); // Create function string name = m_funcp->name() + "__deep" + cvtToStr(++m_deepNum); - AstCFunc* funcp = new AstCFunc(nodep->fileline(), name, NULL); + AstCFunc* funcp = new AstCFunc(nodep->fileline(), name, nullptr); funcp->argTypes(EmitCBaseVisitor::symClassVar()); funcp->symProlog(true); funcp->slow(m_funcp->slow()); @@ -120,8 +120,8 @@ private: public: // CONSTRUCTORS explicit DepthBlockVisitor(AstNetlist* nodep) { - m_modp = NULL; - m_funcp = NULL; + m_modp = nullptr; + m_funcp = nullptr; m_depth = 0; m_deepNum = 0; // diff --git a/src/V3Descope.cpp b/src/V3Descope.cpp index c49c31078..3bf522614 100644 --- a/src/V3Descope.cpp +++ b/src/V3Descope.cpp @@ -76,7 +76,7 @@ private: // Sets 'hierThisr' true if the object is local to this scope // (and could be made into a function-local later in V3Localize), // false if the object is in another scope. - string descopedName(const AstScope* scopep, bool& hierThisr, const AstVar* varp = NULL) { + string descopedName(const AstScope* scopep, bool& hierThisr, const AstVar* varp = nullptr) { UASSERT(scopep, "Var/Func not scoped"); hierThisr = (scopep == m_scopep); @@ -180,7 +180,7 @@ private: UINFO(6, " at " << newfuncp->argTypes() << " und " << funcp->argTypes() << endl); funcp->declPrivate(true); - AstNode* argsp = NULL; + AstNode* argsp = nullptr; for (AstNode* stmtp = newfuncp->argsp(); stmtp; stmtp = stmtp->nextp()) { if (AstVar* portp = VN_CAST(stmtp, Var)) { if (portp->isIO() && !portp->isFuncReturn()) { @@ -202,7 +202,7 @@ private: new AstCMath(funcp->fileline(), string("&(") + funcp->scopep()->nameVlSym() + ")", 64)), - returnp, NULL); + returnp, nullptr); newfuncp->addStmtsp(ifp); } else { newfuncp->addStmtsp(returnp); @@ -213,7 +213,7 @@ private: // newfuncp->addStmtsp(new AstDisplay(newfuncp->fileline(), // AstDisplayType::DT_WARNING, // string("%%Error: ")+name+"() called with bad - // scope", NULL)); + // scope", nullptr)); // newfuncp->addStmtsp(new AstStop(newfuncp->fileline())); if (debug() >= 9) newfuncp->dumpTree(cout, " newfunc: "); } else { @@ -239,7 +239,7 @@ private: virtual void visit(AstScope* nodep) override { m_scopep = nodep; iterateChildren(nodep); - m_scopep = NULL; + m_scopep = nullptr; } virtual void visit(AstVarScope* nodep) override { // Delete the varscope when we're finished @@ -254,7 +254,7 @@ private: nodep->hiername(descopedName(nodep->varScopep()->scopep(), hierThis /*ref*/, nodep->varScopep()->varp())); nodep->hierThis(hierThis); - nodep->varScopep(NULL); + nodep->varScopep(nullptr); } virtual void visit(AstNodeCCall* nodep) override { // UINFO(9, " " << nodep << endl); @@ -265,7 +265,7 @@ private: bool hierThis; nodep->hiername(descopedName(nodep->funcp()->scopep(), hierThis /*ref*/)); // Can't do this, as we may have more calls later - // nodep->funcp()->scopep(NULL); + // nodep->funcp()->scopep(nullptr); } virtual void visit(AstCFunc* nodep) override { if (!nodep->user1()) { @@ -294,8 +294,8 @@ private: public: // CONSTRUCTORS explicit DescopeVisitor(AstNetlist* nodep) - : m_modp(NULL) - , m_scopep(NULL) + : m_modp(nullptr) + , m_scopep(nullptr) , m_modSingleton(false) , m_allowThis(false) , m_needThis(false) { diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index b61986f0b..434257412 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -539,10 +539,10 @@ public: displayNode(nodep, nodep->scopeNamep(), nodep->text(), nodep->exprsp(), false); } virtual void visit(AstFScanF* nodep) override { - displayNode(nodep, NULL, nodep->text(), nodep->exprsp(), true); + displayNode(nodep, nullptr, nodep->text(), nodep->exprsp(), true); } virtual void visit(AstSScanF* nodep) override { - displayNode(nodep, NULL, nodep->text(), nodep->exprsp(), true); + displayNode(nodep, nullptr, nodep->text(), nodep->exprsp(), true); } virtual void visit(AstValuePlusArgs* nodep) override { puts("VL_VALUEPLUSARGS_IN"); @@ -570,7 +570,7 @@ public: } virtual void visit(AstFGetS* nodep) override { checkMaxWords(nodep); - emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL); + emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), nullptr); } void checkMaxWords(AstNode* nodep) { @@ -874,7 +874,7 @@ public: // Operators virtual void visit(AstNodeTermop* nodep) override { - emitOpName(nodep, nodep->emitC(), NULL, NULL, NULL); + emitOpName(nodep, nodep->emitC(), nullptr, nullptr, nullptr); } virtual void visit(AstNodeUniop* nodep) override { if (nodep->emitCheckMaxWords() @@ -893,7 +893,7 @@ public: iterateAndNextNull(nodep->lhsp()); puts(")"); } else { - emitOpName(nodep, nodep->emitC(), nodep->lhsp(), NULL, NULL); + emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nullptr, nullptr); } } virtual void visit(AstNodeBiop* nodep) override { @@ -913,7 +913,7 @@ public: iterateAndNextNull(nodep->rhsp()); puts(")"); } else { - emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL); + emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), nullptr); } } virtual void visit(AstNodeTriop* nodep) override { @@ -1004,7 +1004,7 @@ public: iterateAndNextNull(nodep->rhsp()); puts(")"); } else { - emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL); + emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), nullptr); } } virtual void visit(AstStreamL* nodep) override { @@ -1029,7 +1029,7 @@ public: } } emitOpName(nodep, "VL_STREAML_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)", nodep->lhsp(), - nodep->rhsp(), NULL); + nodep->rhsp(), nullptr); } virtual void visit(AstCountBits* nodep) override { putbs("VL_COUNTBITS_"); @@ -1187,16 +1187,16 @@ public: puts(assignString); puts(" = "); } - emitConstant(constp, NULL, assignString); + emitConstant(constp, nullptr, assignString); puts(";\n"); } virtual void visit(AstConst* nodep) override { if (nodep->isWide()) { UASSERT_OBJ(m_wideTempRefp, nodep, "Wide Constant w/ no temp"); emitConstant(nodep, m_wideTempRefp, ""); - m_wideTempRefp = NULL; // We used it, barf if set it a second time + m_wideTempRefp = nullptr; // We used it, barf if set it a second time } else { - emitConstant(nodep, NULL, ""); + emitConstant(nodep, nullptr, ""); } } @@ -1224,7 +1224,7 @@ public: void init() { m_suppressSemi = false; - m_wideTempRefp = NULL; + m_wideTempRefp = nullptr; m_labelNum = 0; m_splitSize = 0; m_splitFilenum = 0; @@ -1340,7 +1340,7 @@ class EmitCImp : EmitCStmts { string filenameNoExt = v3Global.opt.makeDir() + "/" + prefixNameProtect(modp); if (filenum) filenameNoExt += "__" + cvtToStr(filenum); filenameNoExt += (slow ? "__Slow" : ""); - V3OutCFile* ofp = NULL; + V3OutCFile* ofp = nullptr; if (v3Global.opt.lintOnly()) { // Unfortunately we have some lint checks here, so we can't just skip processing. // We should move them to a different stage. @@ -1401,7 +1401,7 @@ class EmitCImp : EmitCStmts { string recName; if (v3Global.opt.profThreads()) { recName = "__Vprfthr_" + cvtToStr(curExecMTaskp->id()); - puts("VlProfileRec* " + recName + " = NULL;\n"); + puts("VlProfileRec* " + recName + " = nullptr;\n"); // Leave this if() here, as don't want to call VL_RDTSC_Q unless profiling puts("if (VL_UNLIKELY(vlTOPp->__Vm_profile_cycle_start)) {\n"); puts(recName + " = vlTOPp->__Vm_threadPoolp->profileAppend();\n"); @@ -1772,7 +1772,7 @@ class EmitCImp : EmitCStmts { public: EmitCImp() { - m_modp = NULL; + m_modp = nullptr; m_slow = false; m_fast = false; } @@ -1934,7 +1934,7 @@ void EmitCStmts::emitOpName(AstNode* nodep, const string& format, AstNode* lhsp, } else if (pos[0] == '%') { ++pos; bool detail = false; - AstNode* detailp = NULL; + AstNode* detailp = nullptr; switch (pos[0]) { case '%': puts("%"); break; case 'k': putbs(""); break; @@ -1961,7 +1961,7 @@ void EmitCStmts::emitOpName(AstNode* nodep, const string& format, AstNode* lhsp, COMMA; puts(m_wideTempRefp->hiernameProtect()); puts(m_wideTempRefp->varp()->nameProtect()); - m_wideTempRefp = NULL; + m_wideTempRefp = nullptr; needComma = true; } break; @@ -2125,7 +2125,7 @@ void EmitCStmts::displayEmit(AstNode* nodep, bool isScan) { void EmitCStmts::displayArg(AstNode* dispp, AstNode** elistp, bool isScan, const string& vfmt, bool ignore, char fmtLetter) { // Print display argument, edits elistp - AstNode* argp = NULL; + AstNode* argp = nullptr; if (!ignore) { argp = *elistp; // Prep for next parameter @@ -2161,10 +2161,10 @@ void EmitCStmts::displayArg(AstNode* dispp, AstNode** elistp, bool isScan, const } emitDispState.pushFormat(pfmt); if (!ignore) { - emitDispState.pushArg(' ', NULL, cvtToStr(argp->widthMin())); + emitDispState.pushArg(' ', nullptr, cvtToStr(argp->widthMin())); emitDispState.pushArg(fmtLetter, argp, ""); } else { - emitDispState.pushArg(fmtLetter, NULL, ""); + emitDispState.pushArg(fmtLetter, nullptr, ""); } } @@ -2247,7 +2247,7 @@ void EmitCStmts::displayNode(AstNode* nodep, AstScopeName* scopenamep, const str } else { emitDispState.pushFormat("%N"); // Add a . when needed } - emitDispState.pushArg(' ', NULL, "vlSymsp->name()"); + emitDispState.pushArg(' ', nullptr, "vlSymsp->name()"); emitDispState.pushFormat(suffix); break; } @@ -2307,7 +2307,7 @@ void EmitCImp::emitMTaskVertexCtors(bool* firstp) { // This will flip to 'true' before the start of the 0th cycle. emitCtorSep(firstp); - puts("__Vm_threadPoolp(NULL)"); + puts("__Vm_threadPoolp(nullptr)"); if (v3Global.opt.profThreads()) { emitCtorSep(firstp); puts("__Vm_profile_cycle_start(0)"); @@ -2438,7 +2438,7 @@ void EmitCImp::emitDestructorImp(AstNodeModule* modp) { puts(prefixNameProtect(modp) + "::~" + prefixNameProtect(modp) + "() {\n"); if (modp->isTop()) { if (v3Global.opt.mtasks()) { - puts("VL_DO_CLEAR(delete __Vm_threadPoolp, __Vm_threadPoolp = NULL);\n"); + puts("VL_DO_CLEAR(delete __Vm_threadPoolp, __Vm_threadPoolp = nullptr);\n"); } // Call via function in __Trace.cpp as this .cpp file does not have trace header if (v3Global.needTraceDumper()) { @@ -2448,7 +2448,7 @@ void EmitCImp::emitDestructorImp(AstNodeModule* modp) { } } emitTextSection(AstType::atScDtor); - if (modp->isTop()) puts("VL_DO_CLEAR(delete __VlSymsp, __VlSymsp = NULL);\n"); + if (modp->isTop()) puts("VL_DO_CLEAR(delete __VlSymsp, __VlSymsp = nullptr);\n"); puts("}\n"); splitSizeInc(10); } @@ -3252,7 +3252,7 @@ void EmitCImp::maybeSplit(AstNodeModule* fileModp) { // Splitting file, so using parallel build. v3Global.useParallelBuild(true); // Close old file - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); // Open a new file m_ofp = newOutCFile(fileModp, !m_fast, true /*source*/, splitFilenumInc()); emitImpTop(fileModp); @@ -3278,7 +3278,7 @@ void EmitCImp::mainInt(AstNodeModule* modp) { m_modp = modp; } ofp()->putsEndGuard(); - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } void EmitCImp::mainImp(AstNodeModule* modp, bool slow) { @@ -3321,7 +3321,7 @@ void EmitCImp::mainImp(AstNodeModule* modp, bool slow) { } } } - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } //###################################################################### @@ -3375,7 +3375,7 @@ class EmitCTrace : EmitCStmts { if (v3Global.needTraceDumper() && !optSystemC()) { puts("void " + topClassName() + "::_traceDump() {\n"); - // Caller checked for __Vm_dumperp non-NULL + // Caller checked for __Vm_dumperp non-nullptr puts("const VerilatedLockGuard lock(__VlSymsp->__Vm_dumperMutex);\n"); puts("__VlSymsp->__Vm_dumperp->dump(VL_TIME_Q());\n"); puts("}\n"); @@ -3399,7 +3399,8 @@ class EmitCTrace : EmitCStmts { puts("void " + topClassName() + "::_traceDumpClose() {\n"); puts("const VerilatedLockGuard lock(__VlSymsp->__Vm_dumperMutex);\n"); puts("__VlSymsp->__Vm_dumping = false;\n"); - puts("VL_DO_CLEAR(delete __VlSymsp->__Vm_dumperp, __VlSymsp->__Vm_dumperp = NULL);\n"); + puts("VL_DO_CLEAR(delete __VlSymsp->__Vm_dumperp, __VlSymsp->__Vm_dumperp = " + "nullptr);\n"); puts("}\n"); splitSizeInc(10); } @@ -3672,7 +3673,7 @@ class EmitCTrace : EmitCStmts { // Splitting file, so using parallel build. v3Global.useParallelBuild(true); // Close old file - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); // Open a new file newOutCFile(splitFilenumInc()); } @@ -3736,7 +3737,7 @@ class EmitCTrace : EmitCStmts { } puts("}\n"); } - m_funcp = NULL; + m_funcp = nullptr; } virtual void visit(AstTraceDecl* nodep) override { int enumNum = emitTraceDeclDType(nodep->dtypep()); @@ -3764,7 +3765,7 @@ class EmitCTrace : EmitCStmts { public: explicit EmitCTrace(bool slow) { - m_funcp = NULL; + m_funcp = nullptr; m_slow = slow; m_enumNum = 0; } @@ -3777,7 +3778,7 @@ public: iterate(v3Global.rootp()); - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } }; diff --git a/src/V3EmitCBase.h b/src/V3EmitCBase.h index 247a82d54..85872e465 100644 --- a/src/V3EmitCBase.h +++ b/src/V3EmitCBase.h @@ -107,7 +107,7 @@ public: // CONSTRUCTORS EmitCBaseVisitor() { - m_ofp = NULL; + m_ofp = nullptr; m_trackText = false; } virtual ~EmitCBaseVisitor() {} diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index 65a7e8d4a..f774f01c9 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -345,7 +345,7 @@ class EmitCSyms : EmitCBaseVisitor { if (nodep->dpiImport() || nodep->dpiExportWrapper()) m_dpis.push_back(nodep); m_funcp = nodep; iterateChildren(nodep); - m_funcp = NULL; + m_funcp = nullptr; } //--------------------------------------- @@ -355,12 +355,12 @@ class EmitCSyms : EmitCBaseVisitor { public: explicit EmitCSyms(AstNetlist* nodep, bool dpiHdrOnly) : m_dpiHdrOnly(dpiHdrOnly) { - m_funcp = NULL; - m_modp = NULL; + m_funcp = nullptr; + m_modp = nullptr; m_coverBins = 0; m_numStmts = 0; m_funcNum = 0; - m_ofpBase = NULL; + m_ofpBase = nullptr; iterate(nodep); } }; @@ -496,14 +496,14 @@ void EmitCSyms::emitSymHdr() { puts("} VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES);\n"); ofp()->putsEndGuard(); - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } void EmitCSyms::closeSplit() { if (!m_ofp || m_ofp == m_ofpBase) return; puts("}\n"); - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } void EmitCSyms::checkSplit(bool usesVfinal) { @@ -617,7 +617,7 @@ void EmitCSyms::emitSymImp() { puts(" : __Vm_namep(namep)\n"); // No leak, as gets destroyed when the top is destroyed if (v3Global.needTraceDumper()) { puts(" , __Vm_dumping(false)\n"); - puts(" , __Vm_dumperp(NULL)\n"); + puts(" , __Vm_dumperp(nullptr)\n"); } if (v3Global.opt.trace()) { puts(" , __Vm_activity(false)\n"); @@ -835,7 +835,7 @@ void EmitCSyms::emitSymImp() { m_ofpBase->puts("}\n"); closeSplit(); - VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); + VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } //###################################################################### diff --git a/src/V3EmitV.cpp b/src/V3EmitV.cpp index a87c17522..0c7ecd86b 100644 --- a/src/V3EmitV.cpp +++ b/src/V3EmitV.cpp @@ -229,7 +229,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { visitNodeDisplay(nodep, nodep->filep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp()); } virtual void visit(AstElabDisplay* nodep) override { - visitNodeDisplay(nodep, NULL, nodep->fmtp()->text(), nodep->fmtp()->exprsp()); + visitNodeDisplay(nodep, nullptr, nodep->fmtp()->text(), nodep->fmtp()->exprsp()); } virtual void visit(AstFScanF* nodep) override { visitNodeDisplay(nodep, nodep->filep(), nodep->text(), nodep->exprsp()); @@ -241,7 +241,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { visitNodeDisplay(nodep, nodep->lhsp(), nodep->fmtp()->text(), nodep->fmtp()->exprsp()); } virtual void visit(AstSFormatF* nodep) override { - visitNodeDisplay(nodep, NULL, nodep->text(), nodep->exprsp()); + visitNodeDisplay(nodep, nullptr, nodep->text(), nodep->exprsp()); } virtual void visit(AstFOpen* nodep) override { putfs(nodep, nodep->verilogKwd()); @@ -407,9 +407,9 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { } // Operators - virtual void emitVerilogFormat(AstNode* nodep, const string& format, AstNode* lhsp = NULL, - AstNode* rhsp = NULL, AstNode* thsp = NULL, - AstNode* fhsp = NULL) { + virtual void emitVerilogFormat(AstNode* nodep, const string& format, AstNode* lhsp = nullptr, + AstNode* rhsp = nullptr, AstNode* thsp = nullptr, + AstNode* fhsp = nullptr) { // Look at emitVerilog() format for term/uni/dual/triops, // and write out appropriate text. // %f Potential fileline-if-change and line break @@ -640,7 +640,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { virtual void visit(AstActive* nodep) override { m_sensesp = nodep->sensesp(); iterateAndNextNull(nodep->stmtsp()); - m_sensesp = NULL; + m_sensesp = nullptr; } virtual void visit(AstVarScope*) override {} virtual void visit(AstNodeText*) override {} @@ -659,7 +659,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { public: bool m_suppressVarSemi; // Suppress emitting semicolon for AstVars - explicit EmitVBaseVisitor(AstSenTree* domainp = NULL) { + explicit EmitVBaseVisitor(AstSenTree* domainp = nullptr) { // Domain for printing one a ALWAYS under a ACTIVE m_suppressSemi = false; m_suppressVarSemi = false; @@ -751,8 +751,9 @@ public: , m_prefix(prefix) , m_flWidth(flWidth) { m_column = 0; - m_prefixFl = v3Global.rootp() - ->fileline(); // NETLIST's fileline instead of NULL to avoid NULL checks + m_prefixFl + = v3Global.rootp() + ->fileline(); // NETLIST's fileline instead of nullptr to avoid nullptr checks } virtual ~EmitVPrefixedFormatter() { if (m_column) puts("\n"); diff --git a/src/V3Error.cpp b/src/V3Error.cpp index 8c617d294..14f2cd41d 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -40,7 +40,7 @@ bool V3Error::s_describedEachWarn[V3ErrorCode::_ENUM_MAX]; bool V3Error::s_describedWarnings = false; bool V3Error::s_pretendError[V3ErrorCode::_ENUM_MAX]; V3Error::MessagesSet V3Error::s_messages; -V3Error::ErrorExitCb V3Error::s_errorExitCb = NULL; +V3Error::ErrorExitCb V3Error::s_errorExitCb = nullptr; struct v3errorIniter { v3errorIniter() { V3Error::init(); } diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index 0a9aed65a..7aa4f6ad0 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -341,7 +341,7 @@ private: AstNode* lowp = new AstShiftR(nodep->fileline(), lowwordp, newSelBitBit(nodep->lsbp()), nodep->width()); // If > 1 bit, we might be crossing the word boundary - AstNode* midp = NULL; + AstNode* midp = nullptr; V3Number zero(nodep, longOrQuadWidth(nodep)); if (nodep->widthConst() > 1) { AstNode* midwordp = // SEL(from,[1+wordnum]) @@ -378,7 +378,7 @@ private: } } // If > 32 bits, we might be crossing the second word boundary - AstNode* hip = NULL; + AstNode* hip = nullptr; if (nodep->widthConst() > VL_EDATASIZE) { AstNode* hiwordp = // SEL(from,[2+wordnum]) newWordSel(nodep->fromp()->fileline(), nodep->fromp()->cloneTree(true), @@ -710,11 +710,11 @@ private: iterateChildren(nodep); UINFO(8, " Wordize ChangeXor " << nodep << endl); // -> (0=={or{for each_word{WORDSEL(lhs,#)^WORDSEL(rhs,#)}}} - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int w = 0; w < nodep->lhsp()->widthWords(); w++) { AstNode* eqp = new AstXor(nodep->fileline(), newAstWordSelClone(nodep->lhsp(), w), newAstWordSelClone(nodep->rhsp(), w)); - newp = (newp == NULL) ? eqp : (new AstOr(nodep->fileline(), newp, eqp)); + newp = (newp == nullptr) ? eqp : (new AstOr(nodep->fileline(), newp, eqp)); } VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep); } @@ -725,11 +725,11 @@ private: if (nodep->lhsp()->isWide()) { UINFO(8, " Wordize EQ/NEQ " << nodep << endl); // -> (0=={or{for each_word{WORDSEL(lhs,#)^WORDSEL(rhs,#)}}} - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int w = 0; w < nodep->lhsp()->widthWords(); w++) { AstNode* eqp = new AstXor(nodep->fileline(), newAstWordSelClone(nodep->lhsp(), w), newAstWordSelClone(nodep->rhsp(), w)); - newp = (newp == NULL) ? eqp : (new AstOr(nodep->fileline(), newp, eqp)); + newp = (newp == nullptr) ? eqp : (new AstOr(nodep->fileline(), newp, eqp)); } if (VN_IS(nodep, Neq)) { newp @@ -751,10 +751,10 @@ private: if (nodep->lhsp()->isWide()) { UINFO(8, " Wordize REDOR " << nodep << endl); // -> (0!={or{for each_word{WORDSEL(lhs,#)}}} - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int w = 0; w < nodep->lhsp()->widthWords(); w++) { AstNode* eqp = newAstWordSelClone(nodep->lhsp(), w); - newp = (newp == NULL) ? eqp : (new AstOr(nodep->fileline(), newp, eqp)); + newp = (newp == nullptr) ? eqp : (new AstOr(nodep->fileline(), newp, eqp)); } newp = new AstNeq(nodep->fileline(), new AstConst(nodep->fileline(), AstConst::SizedEData(), 0), newp); @@ -775,7 +775,7 @@ private: if (nodep->lhsp()->isWide()) { UINFO(8, " Wordize REDAND " << nodep << endl); // -> (0!={and{for each_word{WORDSEL(lhs,#)}}} - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int w = 0; w < nodep->lhsp()->widthWords(); w++) { AstNode* eqp = newAstWordSelClone(nodep->lhsp(), w); if (w == nodep->lhsp()->widthWords() - 1) { @@ -787,7 +787,7 @@ private: // cppcheck-suppress memleak eqp); } - newp = (newp == NULL) ? eqp : (new AstAnd(nodep->fileline(), newp, eqp)); + newp = (newp == nullptr) ? eqp : (new AstAnd(nodep->fileline(), newp, eqp)); } newp = new AstEq( nodep->fileline(), @@ -808,10 +808,10 @@ private: if (nodep->lhsp()->isWide()) { UINFO(8, " Wordize REDXOR " << nodep << endl); // -> (0!={redxor{for each_word{XOR(WORDSEL(lhs,#))}}} - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int w = 0; w < nodep->lhsp()->widthWords(); w++) { AstNode* eqp = newAstWordSelClone(nodep->lhsp(), w); - newp = (newp == NULL) ? eqp : (new AstXor(nodep->fileline(), newp, eqp)); + newp = (newp == nullptr) ? eqp : (new AstXor(nodep->fileline(), newp, eqp)); } newp = new AstRedXor(nodep->fileline(), newp); UINFO(8, " Wordize REDXORnew " << newp << endl); @@ -829,7 +829,7 @@ private: } m_stmtp = nodep; iterateChildren(nodep); - m_stmtp = NULL; + m_stmtp = nullptr; } virtual void visit(AstNodeAssign* nodep) override { if (nodep->user1SetOnce()) return; // Process once @@ -869,7 +869,7 @@ private: } // Cleanup common code if (did) VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); - m_stmtp = NULL; + m_stmtp = nullptr; } //-------------------- @@ -879,7 +879,7 @@ private: public: // CONSTRUCTORS explicit ExpandVisitor(AstNetlist* nodep) { - m_stmtp = NULL; + m_stmtp = nullptr; iterate(nodep); } virtual ~ExpandVisitor() {} diff --git a/src/V3File.cpp b/src/V3File.cpp index fdd822113..483030212 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -523,7 +523,7 @@ private: dup2(fd_stdout[P_WR], 1); // And stderr comes from parent - execl("/bin/sh", "sh", "-c", command.c_str(), static_cast(NULL)); + execl("/bin/sh", "sh", "-c", command.c_str(), static_cast(nullptr)); // Don't use v3fatal, we don't share the common structures any more fprintf(stderr, "--pipe-filter: exec failed: %s\n", strerror(errno)); _exit(1); @@ -619,7 +619,7 @@ protected: VInFilter::VInFilter(const string& command) { m_impp = new VInFilterImp(command); } VInFilter::~VInFilter() { - if (m_impp) VL_DO_CLEAR(delete m_impp, m_impp = NULL); + if (m_impp) VL_DO_CLEAR(delete m_impp, m_impp = nullptr); } bool VInFilter::readWholefile(const string& filename, VInFilter::StrList& outl) { @@ -942,12 +942,14 @@ void V3OutFormatter::printf(const char* fmt...) { V3OutFile::V3OutFile(const string& filename, V3OutFormatter::Language lang) : V3OutFormatter(filename, lang) { - if ((m_fp = V3File::new_fopen_w(filename)) == NULL) { v3fatal("Cannot write " << filename); } + if ((m_fp = V3File::new_fopen_w(filename)) == nullptr) { + v3fatal("Cannot write " << filename); + } } V3OutFile::~V3OutFile() { if (m_fp) fclose(m_fp); - m_fp = NULL; + m_fp = nullptr; } void V3OutFile::putsForceIncs() { diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index 6dcd53788..ce03e701e 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -149,9 +149,9 @@ FileLine::FileLine(FileLine::EmptySecret) { m_firstColumn = 0; m_lastColumn = 0; m_filenameno = singleton().nameToNumber(FileLine::builtInFilename()); - m_contentp = NULL; + m_contentp = nullptr; m_contentLineno = 0; - m_parent = NULL; + m_parent = nullptr; m_warnOn = 0; for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { @@ -250,7 +250,7 @@ FileLine* FileLine::copyOrSameFileLine() { #ifndef _V3ERROR_NO_GLOBAL_ V3Config::applyIgnores(this); // Toggle warnings based on global config file #endif - static FileLine* lastNewp = NULL; + static FileLine* lastNewp = nullptr; if (lastNewp && *lastNewp == *this) { // Compares lineno, filename, etc return lastNewp; } diff --git a/src/V3FileLine.h b/src/V3FileLine.h index 4cc568886..a2888c950 100644 --- a/src/V3FileLine.h +++ b/src/V3FileLine.h @@ -132,8 +132,8 @@ public: , m_lastColumn(0) , m_filenameno(singleton().nameToNumber(filename)) , m_contentLineno(0) - , m_contentp(NULL) - , m_parent(NULL) + , m_contentp(nullptr) + , m_parent(nullptr) , m_warnOn(defaultFileLine().m_warnOn) , m_waive(false) {} explicit FileLine(FileLine* fromp) diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 44d0388bf..09ef06951 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -116,7 +116,7 @@ public: // iterateInEdges() will stop traversing edges if one is deleted VNUser iterateCurrentOutEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) { VNUser ret = VNUser(0); - V3GraphEdge* next_edgep = NULL; + V3GraphEdge* next_edgep = nullptr; for (V3GraphEdge* edgep = outBeginp(); edgep; edgep = next_edgep) { // Need to find the next edge before visiting in case the edge is deleted next_edgep = edgep->outNextp(); @@ -138,8 +138,8 @@ public: , m_varScp(varScp) , m_isTop(false) , m_isClock(false) - , m_rstSyncNodep(NULL) - , m_rstAsyncNodep(NULL) {} + , m_rstSyncNodep(nullptr) + , m_rstAsyncNodep(nullptr) {} virtual ~GateVarVertex() {} // ACCESSORS AstVarScope* varScp() const { return m_varScp; } @@ -170,7 +170,7 @@ public: class GateLogicVertex : public GateEitherVertex { AstNode* m_nodep; - AstActive* m_activep; // Under what active; NULL is ok (under cfunc or such) + AstActive* m_activep; // Under what active; nullptr is ok (under cfunc or such) bool m_slow; // In slow block public: GateLogicVertex(V3Graph* graphp, AstScope* scopep, AstNode* nodep, AstActive* activep, @@ -277,9 +277,9 @@ public: // CONSTRUCTORS GateOkVisitor(AstNode* nodep, bool buffersOnly, bool dedupe) { m_isSimple = true; - m_substTreep = NULL; + m_substTreep = nullptr; m_buffersOnly = buffersOnly; - m_lhsVarRef = NULL; + m_lhsVarRef = nullptr; m_dedupe = dedupe; m_ops = 0; // Iterate @@ -318,7 +318,7 @@ private: // STATE V3Graph m_graph; // Scoreboard of var usages/dependencies - GateLogicVertex* m_logicVertexp; // Current statement being tracked, NULL=ignored + GateLogicVertex* m_logicVertexp; // Current statement being tracked, nullptr=ignored AstScope* m_scopep; // Current scope being processed AstNodeModule* m_modp; // Current module AstActive* m_activep; // Current active @@ -346,7 +346,7 @@ private: if (consumeReason) m_logicVertexp->setConsumed(consumeReason); if (VN_IS(nodep, SenItem)) m_logicVertexp->setConsumed("senItem"); iterateChildren(nodep); - m_logicVertexp = NULL; + m_logicVertexp = nullptr; } } @@ -428,9 +428,9 @@ private: virtual void visit(AstScope* nodep) override { UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; - m_logicVertexp = NULL; + m_logicVertexp = nullptr; iterateChildren(nodep); - m_scopep = NULL; + m_scopep = nullptr; } virtual void visit(AstActive* nodep) override { // Create required blocks and add to module @@ -440,7 +440,7 @@ private: AstNode::user2ClearTree(); iterateChildren(nodep); AstNode::user2ClearTree(); - m_activep = NULL; + m_activep = nullptr; m_activeReducible = true; } virtual void visit(AstNodeVarRef* nodep) override { @@ -471,12 +471,12 @@ private: } } virtual void visit(AstAlways* nodep) override { - iterateNewStmt(nodep, (nodep->isJustOneBodyStmt() ? NULL : "Multiple Stmts"), NULL); + iterateNewStmt(nodep, (nodep->isJustOneBodyStmt() ? nullptr : "Multiple Stmts"), nullptr); } virtual void visit(AstAlwaysPublic* nodep) override { bool lastslow = m_inSlow; m_inSlow = true; - iterateNewStmt(nodep, "AlwaysPublic", NULL); + iterateNewStmt(nodep, "AlwaysPublic", nullptr); m_inSlow = lastslow; } virtual void visit(AstCFunc* nodep) override { @@ -487,21 +487,21 @@ private: if (m_logicVertexp) { // Already under logic; presumably a SenGate iterateChildren(nodep); } else { // Standalone item, probably right under a SenTree - iterateNewStmt(nodep, NULL, NULL); + iterateNewStmt(nodep, nullptr, nullptr); } m_inSenItem = false; } virtual void visit(AstInitial* nodep) override { bool lastslow = m_inSlow; m_inSlow = true; - iterateNewStmt(nodep, (nodep->isJustOneBodyStmt() ? NULL : "Multiple Stmts"), NULL); + iterateNewStmt(nodep, (nodep->isJustOneBodyStmt() ? nullptr : "Multiple Stmts"), nullptr); m_inSlow = lastslow; } virtual void visit(AstAssignAlias* nodep) override { // - iterateNewStmt(nodep, NULL, NULL); + iterateNewStmt(nodep, nullptr, nullptr); } virtual void visit(AstAssignW* nodep) override { // - iterateNewStmt(nodep, NULL, NULL); + iterateNewStmt(nodep, nullptr, nullptr); } virtual void visit(AstCoverToggle* nodep) override { iterateNewStmt(nodep, "CoverToggle", "CoverToggle"); @@ -529,10 +529,10 @@ public: // CONSTRUCTORS explicit GateVisitor(AstNode* nodep) { AstNode::user1ClearTree(); - m_logicVertexp = NULL; - m_scopep = NULL; - m_modp = NULL; - m_activep = NULL; + m_logicVertexp = nullptr; + m_scopep = nullptr; + m_modp = nullptr; + m_activep = nullptr; m_activeReducible = true; m_inSenItem = false; m_inSlow = false; @@ -675,7 +675,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) { // optimize it further logicp->unlinkFrBack(); vvertexp->varScp()->valuep(logicp); - logicp = NULL; + logicp = nullptr; // Mark the vertex so we don't mark it as being // unconsumed in the next step vvertexp->user(true); @@ -787,7 +787,7 @@ void GateVisitor::consumedMove() { } if (GateLogicVertex* lvertexp = dynamic_cast(vertexp)) { AstNode* nodep = lvertexp->nodep(); - AstActive* oldactp = lvertexp->activep(); // NULL under cfunc + AstActive* oldactp = lvertexp->activep(); // nullptr under cfunc if (!lvertexp->consumed() && oldactp) { // Eventually: Move the statement to a new active block // with "tracing-on" sensitivity @@ -895,7 +895,7 @@ public: void GateVisitor::optimizeElimVar(AstVarScope* varscp, AstNode* substp, AstNode* consumerp) { if (debug() >= 5) consumerp->dumpTree(cout, " elimUsePre: "); - GateElimVisitor elimVisitor(consumerp, varscp, substp, NULL); + GateElimVisitor elimVisitor(consumerp, varscp, substp, nullptr); if (elimVisitor.didReplace()) { if (debug() >= 9) consumerp->dumpTree(cout, " elimUseCns: "); // Caution: Can't let V3Const change our handle to consumerp, such as by @@ -920,9 +920,9 @@ private: // NODE STATE // Ast*::user2p -> parent AstNodeAssign* for this rhsp // Ast*::user3p -> AstActive* of assign, for isSame() in test for duplicate - // Set to NULL if this assign's tree was later replaced + // Set to nullptr if this assign's tree was later replaced // Ast*::user5p -> AstNode* of assign if condition, for isSame() in test for duplicate - // Set to NULL if this assign's tree was later replaced + // Set to nullptr if this assign's tree was later replaced // AstUser1InUse m_inuser1; (Allocated for use in GateVisitor) // AstUser2InUse m_inuser2; (Allocated for use in GateVisitor) AstUser3InUse m_inuser3; @@ -935,7 +935,7 @@ private: VL_DEBUG_FUNC; // Declare debug() void hash(AstNode* nodep) { - // !NULL && the object is hashable + // !nullptr && the object is hashable if (nodep && !nodep->sameHash().isIllegal()) m_hashed.hash(nodep); } bool sameHash(AstNode* node1p, AstNode* node2p) { @@ -985,7 +985,8 @@ public: } AstNodeAssign* hashAndFindDupe(AstNodeAssign* assignp, AstNode* extra1p, AstNode* extra2p) { - // Legal for extra1p/2p to be NULL, we'll compare with other assigns with extras also NULL + // Legal for extra1p/2p to be nullptr, we'll compare with other assigns with extras also + // nullptr AstNode* rhsp = assignp->rhsp(); rhsp->user2p(assignp); rhsp->user3p(extra1p); @@ -1004,7 +1005,7 @@ public: return VN_CAST(m_hashed.iteratorNodep(dupit)->user2p(), NodeAssign); } // Retain new inserted information - return NULL; + return nullptr; } void check() { @@ -1094,16 +1095,16 @@ private: public: // CONSTRUCTORS GateDedupeVarVisitor() { - m_assignp = NULL; - m_ifCondp = NULL; + m_assignp = nullptr; + m_ifCondp = nullptr; m_always = false; m_dedupable = true; } ~GateDedupeVarVisitor() {} // PUBLIC METHODS AstNodeVarRef* findDupe(AstNode* nodep, AstVarScope* consumerVarScopep, AstActive* activep) { - m_assignp = NULL; - m_ifCondp = NULL; + m_assignp = nullptr; + m_ifCondp = nullptr; m_always = false; m_dedupable = true; iterate(nodep); @@ -1118,7 +1119,7 @@ public: } } } - return NULL; + return nullptr; } void hashReplace(AstNode* oldp, AstNode* newp) { m_ghash.hashReplace(oldp, newp); } }; @@ -1157,7 +1158,7 @@ private: V3GraphEdge* edgep = vvertexp->inBeginp(); GateLogicVertex* lvertexp = static_cast(edgep->fromp()); UASSERT_OBJ(vvertexp->dedupable(), vvertexp->varScp(), - "GateLogicVertex* visit should have returned NULL " + "GateLogicVertex* visit should have returned nullptr " "if consumer var vertex is not dedupable."); GateOkVisitor okVisitor(lvertexp->nodep(), false, true); if (okVisitor.isSimple()) { @@ -1197,7 +1198,7 @@ private: AstNode* lvertexNodep = lvertexp->nodep(); lvertexNodep->unlinkFrBack(); vvertexp->varScp()->valuep(lvertexNodep); - lvertexNodep = NULL; + lvertexNodep = nullptr; vvertexp->user(true); lvertexp->user(true); } @@ -1208,7 +1209,7 @@ private: } // Given iterated logic, starting at vu which was consumer's GateVarVertex - // Returns a varref that has the same logic input; or NULL if none + // Returns a varref that has the same logic input; or nullptr if none virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) { lvertexp->iterateInEdges(*this); @@ -1274,18 +1275,18 @@ private: AstVarRef* preVarRefp = VN_CAST(pre->fromp(), VarRef); AstVarRef* curVarRefp = VN_CAST(cur->fromp(), VarRef); if (!preVarRefp || !curVarRefp || !curVarRefp->same(preVarRefp)) { - return NULL; // not the same var + return nullptr; // not the same var } const AstConst* pstart = VN_CAST(pre->lsbp(), Const); const AstConst* pwidth = VN_CAST(pre->widthp(), Const); const AstConst* cstart = VN_CAST(cur->lsbp(), Const); const AstConst* cwidth = VN_CAST(cur->widthp(), Const); - if (!pstart || !pwidth || !cstart || !cwidth) return NULL; // too complicated + if (!pstart || !pwidth || !cstart || !cwidth) return nullptr; // too complicated if (cur->lsbConst() + cur->widthConst() == pre->lsbConst()) { return new AstSel(curVarRefp->fileline(), curVarRefp->cloneTree(false), cur->lsbConst(), pre->widthConst() + cur->widthConst()); } else { - return NULL; + return nullptr; } } @@ -1369,9 +1370,9 @@ private: public: explicit GateMergeAssignsGraphVisitor(V3Graph* graphp) : GateGraphBaseVisitor(graphp) { - m_assignp = NULL; - m_activep = NULL; - m_logicvp = NULL; + m_assignp = nullptr; + m_activep = nullptr; + m_logicvp = nullptr; m_numMergedAssigns = 0; m_graphp = graphp; } @@ -1427,7 +1428,7 @@ private: public: // CONSTRUCTORS GateConcatVisitor() { - m_vscp = NULL; + m_vscp = nullptr; m_offset = 0; m_found_offset = 0; m_found = false; @@ -1558,8 +1559,8 @@ public: explicit GateClkDecompGraphVisitor(V3Graph* graphp) : GateGraphBaseVisitor(graphp) { m_seen_clk_vectors = 0; - m_clk_vsp = NULL; - m_clk_vvertexp = NULL; + m_clk_vsp = nullptr; + m_clk_vvertexp = nullptr; m_total_seen_clk_vectors = 0; m_total_decomposed_clk_vectors = 0; } diff --git a/src/V3GenClk.cpp b/src/V3GenClk.cpp index 53a4ec03c..ccf8535e4 100644 --- a/src/V3GenClk.cpp +++ b/src/V3GenClk.cpp @@ -108,7 +108,7 @@ private: m_activep = nodep; UASSERT_OBJ(nodep->sensesp(), nodep, "Unlinked"); iterateChildren(nodep->sensesp()); // iterateAndNext? - m_activep = NULL; + m_activep = nullptr; iterateChildren(nodep); } virtual void visit(AstCFunc* nodep) override { iterateChildren(nodep); } @@ -120,8 +120,8 @@ public: // CONSTRUCTORS GenClkRenameVisitor(AstTopScope* nodep, AstNodeModule* topModp) { m_topModp = topModp; - m_scopetopp = NULL; - m_activep = NULL; + m_scopetopp = nullptr; + m_activep = nullptr; iterate(nodep); } virtual ~GenClkRenameVisitor() {} @@ -199,14 +199,14 @@ private: // UINFO(8, "ASS " << nodep << endl); m_assignp = nodep; iterateChildren(nodep); - m_assignp = NULL; + m_assignp = nullptr; } virtual void visit(AstActive* nodep) override { UINFO(8, "ACTIVE " << nodep << endl); m_activep = nodep; UASSERT_OBJ(nodep->sensesp(), nodep, "Unlinked"); iterateChildren(nodep->sensesp()); // iterateAndNext? - m_activep = NULL; + m_activep = nullptr; iterateChildren(nodep); } @@ -217,10 +217,10 @@ private: public: // CONSTRUCTORS explicit GenClkReadVisitor(AstNetlist* nodep) - : m_activep(NULL) + : m_activep(nullptr) , m_tracingCall(false) - , m_assignp(NULL) - , m_topModp(NULL) { + , m_assignp(nullptr) + , m_topModp(nullptr) { iterate(nodep); } virtual ~GenClkReadVisitor() {} diff --git a/src/V3Global.cpp b/src/V3Global.cpp index 15009aedc..d18a26c2e 100644 --- a/src/V3Global.cpp +++ b/src/V3Global.cpp @@ -36,7 +36,7 @@ AstNetlist* V3Global::makeNetlist() { } void V3Global::shutdown() { - VL_DO_CLEAR(delete m_hierPlanp, m_hierPlanp = NULL); // delete nullptr is safe + VL_DO_CLEAR(delete m_hierPlanp, m_hierPlanp = nullptr); // delete nullptr is safe } void V3Global::checkTree() { rootp()->checkTree(); } diff --git a/src/V3Global.h b/src/V3Global.h index e52b62f73..012414d71 100644 --- a/src/V3Global.h +++ b/src/V3Global.h @@ -70,7 +70,7 @@ inline bool operator==(VWidthMinUsage::en lhs, const VWidthMinUsage& rhs) { class V3Global { // Globals AstNetlist* m_rootp; // Root of entire netlist - V3HierBlockPlan* m_hierPlanp; // Hierarchical verilation plan, NULL unless hier_block + V3HierBlockPlan* m_hierPlanp; // Hierarchical verilation plan, nullptr unless hier_block VWidthMinUsage m_widthMinUsage; // What AstNode::widthMin() is used for int m_debugFileNumber; // Number to append to debug files created @@ -92,8 +92,8 @@ public: // CONSTRUCTORS V3Global() - : m_rootp(NULL) // created by makeInitNetlist() so static constructors run first - , m_hierPlanp(NULL) // Set via hierPlanp(V3HierBlockPlan*) when use hier_block + : m_rootp(nullptr) // created by makeInitNetlist() so static constructors run first + , m_hierPlanp(nullptr) // Set via hierPlanp(V3HierBlockPlan*) when use hier_block , m_widthMinUsage(VWidthMinUsage::LINT_WIDTH) , m_debugFileNumber(0) , m_assertDTypesResolved(false) diff --git a/src/V3Graph.cpp b/src/V3Graph.cpp index 7d47d747f..1ff942f34 100644 --- a/src/V3Graph.cpp +++ b/src/V3Graph.cpp @@ -36,7 +36,7 @@ V3GraphVertex::V3GraphVertex(V3Graph* graphp, const V3GraphVertex& old) : m_fanout(old.m_fanout) , m_color(old.m_color) , m_rank(old.m_rank) { - m_userp = NULL; + m_userp = nullptr; verticesPushBack(graphp); } @@ -44,7 +44,7 @@ V3GraphVertex::V3GraphVertex(V3Graph* graphp) : m_fanout(0) , m_color(0) , m_rank(0) { - m_userp = NULL; + m_userp = nullptr; verticesPushBack(graphp); } @@ -71,7 +71,7 @@ void V3GraphVertex::unlinkDelete(V3Graph* graphp) { // Unlink from vertex list m_vertices.unlink(graphp->m_vertices, this); // Delete - delete this; // this=NULL; + delete this; // this=nullptr; } void V3GraphVertex::rerouteEdges(V3Graph* graphp) { @@ -123,7 +123,7 @@ V3GraphEdge* V3GraphVertex::findConnectingEdgep(GraphWay way, const V3GraphVerte aedgep = aedgep->nextp(way); bedgep = bedgep->nextp(inv); } - return NULL; + return nullptr; } void V3GraphVertex::v3errorEnd(std::ostringstream& str) const { @@ -165,7 +165,7 @@ void V3GraphEdge::init(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top m_top = top; m_weight = weight; m_cutable = cutable; - m_userp = NULL; + m_userp = nullptr; // Link vertices to this edge outPushBack(); inPushBack(); @@ -185,7 +185,7 @@ void V3GraphEdge::unlinkDelete() { // Unlink to side m_ins.unlink(m_top->m_ins, this); // Delete - delete this; // this=NULL; + delete this; // this=nullptr; } void V3GraphEdge::outPushBack() { @@ -239,7 +239,7 @@ void V3Graph::userClearVertices() { // down more than help. for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp = vertexp->verticesNextp()) { vertexp->user(0); - vertexp->userp(NULL); // Its a union, but might be different size than user() + vertexp->userp(nullptr); // Its a union, but might be different size than user() } } @@ -248,7 +248,7 @@ void V3Graph::userClearEdges() { for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp = vertexp->verticesNextp()) { for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) { edgep->user(0); - edgep->userp(NULL); // Its a union, but might be different size than user() + edgep->userp(nullptr); // Its a union, but might be different size than user() } } } diff --git a/src/V3Graph.h b/src/V3Graph.h index c30f12618..b07022890 100644 --- a/src/V3Graph.h +++ b/src/V3Graph.h @@ -229,7 +229,7 @@ public: virtual string dotStyle() const { return ""; } virtual string dotName() const { return ""; } virtual uint32_t rankAdder() const { return 1; } - virtual FileLine* fileline() const { return NULL; } // NULL for unknown + virtual FileLine* fileline() const { return nullptr; } // nullptr for unknown virtual int sortCmp(const V3GraphVertex* rhsp) const { // LHS goes first if of lower rank, or lower fanout if (m_rank < rhsp->m_rank) return -1; @@ -250,11 +250,11 @@ public: // ITERATORS V3GraphVertex* verticesNextp() const { return m_vertices.nextp(); } V3GraphEdge* inBeginp() const { return m_ins.begin(); } - bool inEmpty() const { return inBeginp() == NULL; } + bool inEmpty() const { return inBeginp() == nullptr; } bool inSize1() const; uint32_t inHash() const; V3GraphEdge* outBeginp() const { return m_outs.begin(); } - bool outEmpty() const { return outBeginp() == NULL; } + bool outEmpty() const { return outBeginp() == nullptr; } bool outSize1() const; uint32_t outHash() const; V3GraphEdge* beginp(GraphWay way) const { return way.forward() ? outBeginp() : inBeginp(); } @@ -265,7 +265,7 @@ public: /// Edges are routed around this vertex to point from "from" directly to "to" void rerouteEdges(V3Graph* graphp); /// Find the edge connecting ap and bp, where bp is wayward from ap. - /// If edge is not found returns NULL. O(edges) performance. + /// If edge is not found returns nullptr. O(edges) performance. V3GraphEdge* findConnectingEdgep(GraphWay way, const V3GraphVertex* waywardp); }; diff --git a/src/V3GraphAcyc.cpp b/src/V3GraphAcyc.cpp index da07309ca..1360f0b0c 100644 --- a/src/V3GraphAcyc.cpp +++ b/src/V3GraphAcyc.cpp @@ -136,7 +136,7 @@ private: void addOrigEdgep(V3GraphEdge* toEdgep, V3GraphEdge* addEdgep) { // Add addEdge (or it's list) to list of edges that break edge represents // Note addEdge may already have a bunch of similar linked edge representations. Yuk. - UASSERT(addEdgep, "Adding NULL"); + UASSERT(addEdgep, "Adding nullptr"); if (!toEdgep->userp()) { OrigEdgeList* oep = new OrigEdgeList; m_origEdgeDelp.push_back(oep); @@ -382,7 +382,7 @@ void GraphAcyc::simplifyDup(GraphAcycVertex* avertexp) { if (avertexp->isDelete()) return; // Clear marks for (V3GraphEdge* edgep = avertexp->outBeginp(); edgep; edgep = edgep->outNextp()) { - edgep->top()->userp(NULL); + edgep->top()->userp(nullptr); } // Mark edges and detect duplications for (V3GraphEdge *nextp, *edgep = avertexp->outBeginp(); edgep; edgep = nextp) { diff --git a/src/V3GraphAlg.cpp b/src/V3GraphAlg.cpp index d82babee4..d721237a3 100644 --- a/src/V3GraphAlg.cpp +++ b/src/V3GraphAlg.cpp @@ -81,7 +81,7 @@ private: void vertexIterate(V3GraphVertex* vertexp) { // Clear marks for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) { - edgep->top()->userp(NULL); + edgep->top()->userp(nullptr); } // Mark edges and detect duplications for (V3GraphEdge *nextp, *edgep = vertexp->outBeginp(); edgep; edgep = nextp) { @@ -140,13 +140,13 @@ void V3Graph::removeRedundantEdgesSum(V3EdgeFuncP edgeFuncp) { class GraphAlgRemoveTransitiveEdges : GraphAlg<> { public: explicit GraphAlgRemoveTransitiveEdges(V3Graph* graphp) - : GraphAlg<>(graphp, NULL) {} + : GraphAlg<>(graphp, nullptr) {} void go() { GraphPathChecker checker(m_graphp); for (V3GraphVertex* vxp = m_graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { - V3GraphEdge* deletep = NULL; + V3GraphEdge* deletep = nullptr; for (V3GraphEdge* edgep = vxp->outBeginp(); edgep; edgep = edgep->outNextp()) { - if (deletep) VL_DO_CLEAR(deletep->unlinkDelete(), deletep = NULL); + if (deletep) VL_DO_CLEAR(deletep->unlinkDelete(), deletep = nullptr); // It should be safe to modify the graph, despite using // the GraphPathChecker, as none of the modifications will // change what can be reached from what, nor should they diff --git a/src/V3GraphDfa.cpp b/src/V3GraphDfa.cpp index 084f628e9..cff104908 100644 --- a/src/V3GraphDfa.cpp +++ b/src/V3GraphDfa.cpp @@ -30,7 +30,7 @@ // Algorithms - find starting node DfaVertex* DfaGraph::findStart() { - DfaVertex* startp = NULL; + DfaVertex* startp = nullptr; for (V3GraphVertex* vertexp = this->verticesBeginp(); vertexp; vertexp = vertexp->verticesNextp()) { if (DfaVertex* vvertexp = dynamic_cast(vertexp)) { @@ -83,7 +83,7 @@ private: return (nfaState(vertexp) && !(vertexp->user() == m_step)); } - DfaVertex* newDfaVertex(DfaVertex* nfaTemplatep = NULL) { + DfaVertex* newDfaVertex(DfaVertex* nfaTemplatep = nullptr) { DfaVertex* vertexp = new DfaVertex(graphp()); vertexp->color(1); // Mark as dfa if (nfaTemplatep && nfaTemplatep->start()) vertexp->start(true); @@ -190,7 +190,7 @@ private: return testp; // Identical } } - return NULL; // No match + return nullptr; // No match } void findNfasWithInput(DfaVertex* dfaStatep, const DfaInput& input, DfaStates& nfasWithInput) { @@ -545,7 +545,7 @@ private: void add_complement_edges() { // Find accepting vertex - DfaVertex* acceptp = NULL; + DfaVertex* acceptp = nullptr; for (V3GraphVertex* vertexp = m_graphp->verticesBeginp(); vertexp; vertexp = vertexp->verticesNextp()) { if (DfaVertex* vvertexp = dynamic_cast(vertexp)) { @@ -602,7 +602,7 @@ public: add_complement_edges(); if (debug() >= 6) m_graphp->dumpDotFilePrefixed("comp_preswap"); - VL_DO_CLEAR(m_tempNewerReject->unlinkDelete(graphp()), m_tempNewerReject = NULL); + VL_DO_CLEAR(m_tempNewerReject->unlinkDelete(graphp()), m_tempNewerReject = nullptr); if (debug() >= 6) m_graphp->dumpDotFilePrefixed("comp_out"); } ~DfaGraphComplement() {} diff --git a/src/V3GraphPathChecker.cpp b/src/V3GraphPathChecker.cpp index 611ed8fe2..b985d5877 100644 --- a/src/V3GraphPathChecker.cpp +++ b/src/V3GraphPathChecker.cpp @@ -69,7 +69,7 @@ GraphPathChecker::~GraphPathChecker() { for (V3GraphVertex* vxp = m_graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { GraphPCNode* nodep = static_cast(vxp->userp()); VL_DO_DANGLING(delete nodep, nodep); - vxp->userp(NULL); + vxp->userp(nullptr); } } diff --git a/src/V3GraphPathChecker.h b/src/V3GraphPathChecker.h index 2f6675460..e50daf064 100644 --- a/src/V3GraphPathChecker.h +++ b/src/V3GraphPathChecker.h @@ -52,7 +52,7 @@ public: private: bool pathExistsInternal(const V3GraphVertex* ap, const V3GraphVertex* bp, - unsigned* costp = NULL); + unsigned* costp = nullptr); void initHalfCriticalPaths(GraphWay way, bool checkOnly); void incGeneration() { ++m_generation; } diff --git a/src/V3GraphStream.h b/src/V3GraphStream.h index 756ca921b..ba593baa0 100644 --- a/src/V3GraphStream.h +++ b/src/V3GraphStream.h @@ -160,7 +160,7 @@ public: // good locality.) V3Order.cpp relies on this to order the logic // vertices within a given mtask without jumping over domains too much. const V3GraphVertex* nextp() { - const V3GraphVertex* resultp = NULL; + const V3GraphVertex* resultp = nullptr; typename ReadyVertices::iterator curIt; if (m_last == m_readyVertices.end()) { diff --git a/src/V3Hashed.cpp b/src/V3Hashed.cpp index 622478d70..c834c2e73 100644 --- a/src/V3Hashed.cpp +++ b/src/V3Hashed.cpp @@ -136,7 +136,7 @@ void V3Hashed::erase(iterator it) { UINFO(8, " erase " << nodep << endl); UASSERT_OBJ(nodep->user4p(), nodep, "Called removeNode on non-hashed node"); m_hashMmap.erase(it); - nodep->user4p(NULL); // So we don't allow removeNode again + nodep->user4p(nullptr); // So we don't allow removeNode again } void V3Hashed::check() { diff --git a/src/V3Hashed.h b/src/V3Hashed.h index 0ea3ee10d..fd538cadd 100644 --- a/src/V3Hashed.h +++ b/src/V3Hashed.h @@ -79,7 +79,7 @@ public: bool sameNodes(AstNode* node1p, AstNode* node2p); // After hashing, and tell if identical 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 = NULL); + iterator findDuplicate(AstNode* nodep, V3HashedUserSame* checkp = nullptr); AstNode* iteratorNodep(iterator it) { return it->second; } void dumpFile(const string& filename, bool tree); void dumpFilePrefixed(const string& nameComment, bool tree = false); diff --git a/src/V3HierBlock.cpp b/src/V3HierBlock.cpp index 0c101d2fa..4eebb0ebc 100644 --- a/src/V3HierBlock.cpp +++ b/src/V3HierBlock.cpp @@ -294,8 +294,8 @@ class HierBlockUsageCollectVisitor : public AstNVisitor { public: HierBlockUsageCollectVisitor(V3HierBlockPlan* planp, AstNetlist* netlist) : m_planp(planp) - , m_modp(NULL) - , m_hierBlockp(NULL) { + , m_modp(nullptr) + , m_hierBlockp(nullptr) { iterateChildren(netlist); } diff --git a/src/V3Inline.cpp b/src/V3Inline.cpp index 3d78b7c83..adffa74af 100644 --- a/src/V3Inline.cpp +++ b/src/V3Inline.cpp @@ -111,7 +111,7 @@ private: if (m_modp->modPublic()) cantInline("modPublic", false); iterateChildren(nodep); - m_modp = NULL; + m_modp = nullptr; } virtual void visit(AstClass* nodep) override { // TODO allow inlining of modules that have classes @@ -148,12 +148,12 @@ private: } virtual void visit(AstVarXRef* nodep) override { // Cleanup link until V3LinkDot can correct it - nodep->varp(NULL); + nodep->varp(nullptr); } virtual void visit(AstNodeFTaskRef* nodep) override { // Cleanup link until V3LinkDot can correct it // MethodCalls not currently supported by inliner, so keep linked - if (!nodep->packagep() && !VN_IS(nodep, MethodCall)) nodep->taskp(NULL); + if (!nodep->packagep() && !VN_IS(nodep, MethodCall)) nodep->taskp(nullptr); iterateChildren(nodep); } virtual void visit(AstAlways* nodep) override { @@ -220,7 +220,7 @@ private: public: // CONSTRUCTORS explicit InlineMarkVisitor(AstNode* nodep) { - m_modp = NULL; + m_modp = nullptr; iterate(nodep); } virtual ~InlineMarkVisitor() { @@ -517,7 +517,7 @@ private: // The cell has been removed so let's make sure we don't leave a reference to it // This dtype may still be in use by the AstAssignVarScope created earlier // but that'll get cleared up later - nodep->cellp(NULL); + nodep->cellp(nullptr); } } virtual void visit(AstNodeModule* nodep) override { @@ -615,7 +615,7 @@ private: public: // CONSTRUCTORS explicit InlineVisitor(AstNode* nodep) { - m_modp = NULL; + m_modp = nullptr; iterate(nodep); } virtual ~InlineVisitor() { // diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index caca4865f..3ad65819c 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -54,7 +54,7 @@ private: // VV***** We reset user1p() on each cell!!! AstNode::user1ClearTree(); iterateChildren(nodep); - m_cellp = NULL; + m_cellp = nullptr; } virtual void visit(AstPin* nodep) override { // PIN(p,expr) -> ASSIGNW(VARXREF(p),expr) (if sub's input) @@ -132,7 +132,7 @@ private: public: // CONSTRUCTORS explicit InstVisitor(AstNetlist* nodep) { - m_cellp = NULL; + m_cellp = nullptr; // iterate(nodep); } @@ -172,7 +172,7 @@ public: if (it != m_modVarNameMap.end()) { return it->second; } else { - return NULL; + return nullptr; } } void dump() { @@ -199,7 +199,7 @@ class InstDeVisitor : public AstNVisitor { // Find all cells with arrays, and convert to non-arrayed private: // STATE - AstRange* m_cellRangep; // Range for arrayed instantiations, NULL for normal instantiations + AstRange* m_cellRangep; // Range for arrayed instantiations, nullptr for normal instantiations int m_instSelNum; // Current instantiation count 0..N-1 InstDeModVarVisitor m_deModVars; // State of variables for current cell module @@ -211,7 +211,7 @@ private: && VN_IS(VN_CAST(nodep->dtypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType)) { UINFO(8, " dv-vec-VAR " << nodep << endl); AstUnpackArrayDType* arrdtype = VN_CAST(nodep->dtypep(), UnpackArrayDType); - AstNode* prevp = NULL; + AstNode* prevp = nullptr; for (int i = arrdtype->lsb(); i <= arrdtype->msb(); ++i) { string varNewName = nodep->name() + "__BRA__" + cvtToStr(i) + "__KET__"; UINFO(8, "VAR name insert " << varNewName << " " << nodep << endl); @@ -219,7 +219,7 @@ private: AstIfaceRefDType* ifaceRefp = VN_CAST(arrdtype->subDTypep(), IfaceRefDType)->cloneTree(false); arrdtype->addNextHere(ifaceRefp); - ifaceRefp->cellp(NULL); + ifaceRefp->cellp(nullptr); AstVar* varNewp = nodep->cloneTree(false); varNewp->name(varNewName); @@ -279,7 +279,7 @@ private: AstUnpackArrayDType* arrdtype = VN_CAST(ifaceVarp->dtypep(), UnpackArrayDType); AstIfaceRefDType* origIfaceRefp = VN_CAST(arrdtype->subDTypep(), IfaceRefDType); - origIfaceRefp->cellp(NULL); + origIfaceRefp->cellp(nullptr); AstVar* varNewp = ifaceVarp->cloneTree(false); AstIfaceRefDType* ifaceRefp = VN_CAST(arrdtype->subDTypep(), IfaceRefDType)->cloneTree(false); @@ -305,7 +305,7 @@ private: } // Done. Delete original - m_cellRangep = NULL; + m_cellRangep = nullptr; if (isIface) { ifaceVarp->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(ifaceVarp), ifaceVarp); @@ -313,7 +313,7 @@ private: nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else { - m_cellRangep = NULL; + m_cellRangep = nullptr; iterateChildren(nodep); } } @@ -394,20 +394,20 @@ private: AstUnpackArrayDType* pinArrp = VN_CAST(pinVarp->dtypep(), UnpackArrayDType); if (!pinArrp || !VN_IS(pinArrp->subDTypep(), IfaceRefDType)) return; // Arrayed pin/var attaches to arrayed submodule lower port/var, expand it - AstNode* prevp = NULL; - AstNode* prevPinp = NULL; + AstNode* prevp = nullptr; + AstNode* prevPinp = nullptr; // Clone the var referenced by the pin, and clone each var referenced by the varref // Clone pin varp: for (int i = pinArrp->lsb(); i <= pinArrp->msb(); ++i) { string varNewName = pinVarp->name() + "__BRA__" + cvtToStr(i) + "__KET__"; - AstVar* varNewp = NULL; + AstVar* varNewp = nullptr; // Only clone the var once for all usages of a given child module if (!pinVarp->backp()) { varNewp = m_deModVars.find(varNewName); } else { AstIfaceRefDType* ifaceRefp = VN_CAST(pinArrp->subDTypep(), IfaceRefDType); - ifaceRefp->cellp(NULL); + ifaceRefp->cellp(nullptr); varNewp = pinVarp->cloneTree(false); varNewp->name(varNewName); varNewp->origName(varNewp->origName() + "__BRA__" + cvtToStr(i) + "__KET__"); @@ -467,7 +467,7 @@ private: public: // CONSTRUCTORS explicit InstDeVisitor(AstNetlist* nodep) { - m_cellRangep = NULL; + m_cellRangep = nullptr; m_instSelNum = 0; // iterate(nodep); @@ -516,14 +516,14 @@ public: && cellp->modp()->unconnectedDrive().isSetFalse()) { pinp->exprp(new AstConst(pinp->fileline(), AstConst::StringToParse(), "'0")); } else { - return NULL; + return nullptr; } } AstVarRef* connectRefp = VN_CAST(pinp->exprp(), VarRef); AstVarXRef* connectXRefp = VN_CAST(pinp->exprp(), VarXRef); - AstBasicDType* pinBasicp = VN_CAST(pinVarp->dtypep(), BasicDType); // Maybe NULL - AstBasicDType* connBasicp = NULL; - AstAssignW* assignp = NULL; + AstBasicDType* pinBasicp = VN_CAST(pinVarp->dtypep(), BasicDType); // Maybe nullptr + AstBasicDType* connBasicp = nullptr; + AstAssignW* assignp = nullptr; if (connectRefp) connBasicp = VN_CAST(connectRefp->varp()->dtypep(), BasicDType); // if (!alwaysCvt && connectRefp && connectRefp->varp()->dtypep()->sameTree(pinVarp->dtypep()) diff --git a/src/V3InstrCount.cpp b/src/V3InstrCount.cpp index 01d079fdb..ff777e4f9 100644 --- a/src/V3InstrCount.cpp +++ b/src/V3InstrCount.cpp @@ -276,7 +276,7 @@ public: InstrCountDumpVisitor(AstNode* nodep, std::ostream* osp) : m_osp(osp) , m_depth(0) { - // No check for NULL output, so... + // No check for nullptr output, so... UASSERT_OBJ(osp, nodep, "Don't call if not dumping"); if (nodep) iterate(nodep); } diff --git a/src/V3InstrCount.h b/src/V3InstrCount.h index 8f3bcf1b8..697a69cb6 100644 --- a/src/V3InstrCount.h +++ b/src/V3InstrCount.h @@ -38,7 +38,7 @@ public: // if we see the same node twice (across more than one call to count, // potentially) raises an error. // Optional osp is stream to dump critical path to. - static uint32_t count(AstNode* nodep, bool assertNoDups, std::ostream* osp = NULL); + static uint32_t count(AstNode* nodep, bool assertNoDups, std::ostream* osp = nullptr); }; #endif // guard diff --git a/src/V3LanguageWords.h b/src/V3LanguageWords.h index ecccfe693..3e571e3b2 100644 --- a/src/V3LanguageWords.h +++ b/src/V3LanguageWords.h @@ -56,7 +56,7 @@ private: inline void V3LanguageWords::Singleton::init() { // C++ keywords // clang-format off - addKwd("NULL", "C++ common word"); + addKwd("nullptr", "C++ common word"); addKwd("abort", "C++ common word"); addKwd("alignas", "C++11 keyword"); addKwd("alignof", "C++11 keyword"); diff --git a/src/V3Life.cpp b/src/V3Life.cpp index e6ab413b6..4e2bb6471 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -69,7 +69,7 @@ public: // Structure for each variable encountered class LifeVarEntry { - AstNodeAssign* m_assignp; // Last assignment to this varscope, NULL if no longer relevant + AstNodeAssign* m_assignp; // Last assignment to this varscope, nullptr if no longer relevant AstConst* m_constp; // Known constant value // First access was a set (and thus block above may have a set that can be deleted bool m_setBeforeUse; @@ -77,8 +77,8 @@ class LifeVarEntry { bool m_everSet; inline void init(bool setBeforeUse) { - m_assignp = NULL; - m_constp = NULL; + m_assignp = nullptr; + m_constp = nullptr; m_setBeforeUse = setBeforeUse; m_everSet = false; } @@ -103,17 +103,17 @@ public: ~LifeVarEntry() {} inline void simpleAssign(AstNodeAssign* assp) { // New simple A=.... assignment m_assignp = assp; - m_constp = NULL; + m_constp = nullptr; m_everSet = true; if (VN_IS(assp->rhsp(), Const)) m_constp = VN_CAST(assp->rhsp(), Const); } inline void complexAssign() { // A[x]=... or some complicated assignment - m_assignp = NULL; - m_constp = NULL; + m_assignp = nullptr; + m_constp = nullptr; m_everSet = true; } inline void consumed() { // Rvalue read of A - m_assignp = NULL; + m_assignp = nullptr; } AstNodeAssign* assignp() const { return m_assignp; } AstConst* constNodep() const { return m_constp; } @@ -133,7 +133,7 @@ class LifeBlock { // For each basic block, we'll make a new map of what variables that if/else is changing typedef std::map LifeMap; LifeMap m_map; // Current active lifetime map for current scope - LifeBlock* m_aboveLifep; // Upper life, or NULL + LifeBlock* m_aboveLifep; // Upper life, or nullptr LifeState* m_statep; // Current global state VL_DEBUG_FUNC; // Declare debug() @@ -297,7 +297,7 @@ private: virtual void visit(AstVarRef* nodep) override { // Consumption/generation of a variable, // it's used so can't elim assignment before this use. - UASSERT_OBJ(nodep->varScopep(), nodep, "NULL"); + UASSERT_OBJ(nodep->varScopep(), nodep, "nullptr"); // AstVarScope* vscp = nodep->varScopep(); UASSERT_OBJ(vscp, nodep, "Scope not assigned"); @@ -448,13 +448,13 @@ public: m_noopt = false; m_tracingCall = false; { - m_lifep = new LifeBlock(NULL, m_statep); + m_lifep = new LifeBlock(nullptr, m_statep); iterate(nodep); - if (m_lifep) VL_DO_CLEAR(delete m_lifep, m_lifep = NULL); + if (m_lifep) VL_DO_CLEAR(delete m_lifep, m_lifep = nullptr); } } virtual ~LifeVisitor() { - if (m_lifep) VL_DO_CLEAR(delete m_lifep, m_lifep = NULL); + if (m_lifep) VL_DO_CLEAR(delete m_lifep, m_lifep = nullptr); } VL_UNCOPYABLE(LifeVisitor); }; diff --git a/src/V3LifePost.cpp b/src/V3LifePost.cpp index 00a016cbb..7da2e5f7d 100644 --- a/src/V3LifePost.cpp +++ b/src/V3LifePost.cpp @@ -107,7 +107,7 @@ struct LifeLocation { public: LifeLocation() - : mtaskp(NULL) + : mtaskp(nullptr) , sequence(0) {} LifeLocation(const ExecMTask* mtaskp_, uint32_t sequence_) : mtaskp(mtaskp_) @@ -125,7 +125,7 @@ struct LifePostLocation { LifeLocation loc; AstAssignPost* nodep; LifePostLocation() - : nodep(NULL) {} + : nodep(nullptr) {} LifePostLocation(LifeLocation loc_, AstAssignPost* nodep_) : loc(loc_) , nodep(nodep_) {} @@ -145,7 +145,7 @@ private: uint32_t m_sequence; // Sequence number of assigns/varrefs, // // local to the current MTask. const ExecMTask* m_execMTaskp; // Current ExecMTask being processed, - // // or NULL for serial code. + // // or nullptr for serial code. VDouble0 m_statAssnDel; // Statistic tracking bool m_tracingCall; // Currently tracing a CCall to a CFunc @@ -334,7 +334,7 @@ private: m_sequence = 0; iterate(mtaskp->bodyp()); } - m_execMTaskp = NULL; + m_execMTaskp = nullptr; } virtual void visit(AstCFunc* nodep) override { if (!m_tracingCall && !nodep->entryPoint()) return; @@ -349,9 +349,9 @@ public: // CONSTRUCTORS explicit LifePostDlyVisitor(AstNetlist* nodep) : m_sequence(0) - , m_execMTaskp(NULL) + , m_execMTaskp(nullptr) , m_tracingCall(false) - , m_mtasksGraphp(NULL) { + , m_mtasksGraphp(nullptr) { iterate(nodep); } virtual ~LifePostDlyVisitor() { diff --git a/src/V3LinkCells.cpp b/src/V3LinkCells.cpp index 5d43405f6..335c60190 100644 --- a/src/V3LinkCells.cpp +++ b/src/V3LinkCells.cpp @@ -129,7 +129,7 @@ private: AstNodeModule* findModuleSym(const string& modName) { VSymEnt* foundp = m_mods.rootp()->findIdFallback(modName); if (!foundp) { - return NULL; + return nullptr; } else { return VN_CAST(foundp->nodep(), NodeModule); } @@ -174,7 +174,7 @@ private: AstNodeModule* modp = vvertexp->modp(); modp->level(vvertexp->rank() + 1); if (vvertexp == m_topVertexp && modp->level() != 2) { - AstNodeModule* abovep = NULL; + AstNodeModule* abovep = nullptr; if (V3GraphEdge* edgep = vvertexp->inBeginp()) { if (LinkCellsVertex* eFromVertexp = dynamic_cast(edgep->fromp())) { @@ -325,7 +325,7 @@ private: if (!otherModp) { otherModp = cellmodp->cloneTree(false); otherModp->name(otherModp->name() + "__Vrcm"); - otherModp->user1p(NULL); // Need new vertex + otherModp->user1p(nullptr); // Need new vertex otherModp->user2p(cellmodp); otherModp->recursiveClone(true); // user1 etc will retain its pre-clone value @@ -349,7 +349,7 @@ private: } } } - // Remove AstCell(AstPin("",NULL)), it's a side effect of how we parse "()" + // Remove AstCell(AstPin("",nullptr)), it's a side effect of how we parse "()" // the empty middle is identical to the empty rule that must find pins in "(,)". if (nodep->pinsp() && !nodep->pinsp()->nextp() && nodep->pinsp()->name() == "" && !nodep->pinsp()->exprp()) { @@ -407,16 +407,17 @@ private: if (pinStar) { UINFO(9, " need .* PORT " << portp << endl); // Create any not already connected - AstPin* newp = new AstPin(nodep->fileline(), 0, portp->name(), - new AstParseRef(nodep->fileline(), - VParseRefExp::PX_TEXT, - portp->name(), NULL, NULL)); + AstPin* newp = new AstPin( + nodep->fileline(), 0, portp->name(), + new AstParseRef(nodep->fileline(), VParseRefExp::PX_TEXT, + portp->name(), nullptr, nullptr)); newp->svImplicit(true); nodep->addPinsp(newp); } else { // warn on the CELL that needs it, not the port nodep->v3warn(PINMISSING, "Cell has missing pin: " << portp->prettyNameQ()); - AstPin* newp = new AstPin(nodep->fileline(), 0, portp->name(), NULL); + AstPin* newp + = new AstPin(nodep->fileline(), 0, portp->name(), nullptr); nodep->addPinsp(newp); } } @@ -434,7 +435,7 @@ private: string varName = nodep->name() + "__Viftop"; // V3LinkDot looks for this naming AstIfaceRefDType* idtypep = new AstIfaceRefDType(nodep->fileline(), nodep->name(), nodep->modp()->name()); - idtypep->ifacep(NULL); // cellp overrides + idtypep->ifacep(nullptr); // cellp overrides // In the case of arrayed interfaces, we replace cellp when de-arraying in V3Inst idtypep->cellp(nodep); // Only set when real parent cell known. AstVar* varp; @@ -503,9 +504,9 @@ public: : m_mods(nodep) { m_filterp = filterp; m_parseSymp = parseSymp; - m_modp = NULL; - m_libVertexp = NULL; - m_topVertexp = NULL; + m_modp = nullptr; + m_libVertexp = nullptr; + m_topVertexp = nullptr; if (v3Global.opt.hierChild()) { const V3HierBlockOptSet& hierBlocks = v3Global.opt.hierBlocks(); UASSERT(!v3Global.opt.topModule().empty(), diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index c257f0a1e..c39915a9a 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -203,13 +203,13 @@ public: m_forPrimary = (step == LDS_PRIMARY); m_forPrearray = (step == LDS_PARAMED || step == LDS_PRIMARY); m_forScopeCreation = (step == LDS_SCOPED); - m_dunitEntp = NULL; + m_dunitEntp = nullptr; s_errorThisp = this; V3Error::errorExitCb(preErrorDumpHandler); // If get error, dump self } ~LinkDotState() { - V3Error::errorExitCb(NULL); - s_errorThisp = NULL; + V3Error::errorExitCb(nullptr); + s_errorThisp = nullptr; } // ACCESSORS @@ -249,7 +249,7 @@ public: // Note we only check for conflicts at the same level; it's ok if one block hides another // We also wouldn't want to not insert it even though it's lower down VSymEnt* foundp = lookupSymp->findIdFlat(name); - AstNode* fnodep = foundp ? foundp->nodep() : NULL; + AstNode* fnodep = foundp ? foundp->nodep() : nullptr; if (!fnodep) { // Not found, will add in a moment. } else if (nodep == fnodep) { // Already inserted. @@ -286,7 +286,7 @@ public: VSymEnt* symp = new VSymEnt(&m_syms, nodep); UINFO(9, " INSERTdunit se" << cvtToHex(symp) << endl); symp->parentp(rootEntp()); // Needed so backward search can find name of top module - symp->fallbackp(NULL); + symp->fallbackp(nullptr); rootEntp()->insert("$unit ", symp); // Space so can never name conflict with user code // UASSERT_OBJ(!m_dunitEntp, nodep, "Call insertDUnit only once"); @@ -387,7 +387,7 @@ public: abovep->reinsert(name, symp); return symp; } - static bool existsModScope(AstNodeModule* nodep) { return nodep->user1p() != NULL; } + static bool existsModScope(AstNodeModule* nodep) { return nodep->user1p() != nullptr; } static VSymEnt* getNodeSym(AstNode* nodep) { // Don't use this in ResolveVisitor, as we need to pick up the proper // reference under each SCOPE @@ -441,7 +441,7 @@ public: for (IfaceVarSyms::iterator it = m_ifaceVarSyms.begin(); it != m_ifaceVarSyms.end(); ++it) { VSymEnt* varSymp = *it; - AstVar* varp = varSymp ? VN_CAST(varSymp->nodep(), Var) : NULL; + AstVar* varp = varSymp ? VN_CAST(varSymp->nodep(), Var) : nullptr; UINFO(9, " insAllIface se" << cvtToHex(varSymp) << " " << varp << endl); AstIfaceRefDType* ifacerefp = ifaceRefFromArray(varp->subDTypep()); UASSERT_OBJ(ifacerefp, varp, "Non-ifacerefs on list!"); @@ -576,10 +576,10 @@ public: // then look up (inst name or modname) if (firstId) { // Check this module - subcellnames - AstCell* cellp - = lookupSymp ? VN_CAST(lookupSymp->nodep(), Cell) : NULL; // Replicated below + AstCell* cellp = lookupSymp ? VN_CAST(lookupSymp->nodep(), Cell) + : nullptr; // Replicated below AstCellInline* inlinep = lookupSymp ? VN_CAST(lookupSymp->nodep(), CellInline) - : NULL; // Replicated below + : nullptr; // Replicated below if (VSymEnt* findSymp = findWithAltFallback(lookupSymp, ident, altIdent)) { lookupSymp = findSymp; } @@ -605,9 +605,9 @@ public: while (lookupSymp) { lookupSymp = lookupSymp->parentp(); cellp = lookupSymp ? VN_CAST(lookupSymp->nodep(), Cell) - : NULL; // Replicated above + : nullptr; // Replicated above inlinep = lookupSymp ? VN_CAST(lookupSymp->nodep(), CellInline) - : NULL; // Replicated above + : nullptr; // Replicated above if (lookupSymp) { UINFO(9, " Up to " << lookupSymp << endl); if (cellp || inlinep) crossedCell = true; @@ -620,20 +620,20 @@ public: if (crossedCell && VN_IS(lookupSymp->nodep(), Var)) { UINFO(9, " Not found but matches var name in parent " << lookupSymp << endl); - return NULL; + return nullptr; } break; } } else break; } - if (!lookupSymp) return NULL; // Not found + if (!lookupSymp) return nullptr; // Not found } } else { // Searching for middle submodule, must be a cell name if (VSymEnt* findSymp = findWithAltFallback(lookupSymp, ident, altIdent)) { lookupSymp = findSymp; } else { - return NULL; // Not found + return nullptr; // Not found } } if (lookupSymp) { @@ -663,17 +663,17 @@ public: VSymEnt* findSymPrefixed(VSymEnt* lookupSymp, const string& dotname, string& baddot) { // Find symbol in given point in hierarchy, allowing prefix (post-Inline) - // For simplicity lookupSymp may be passed NULL result from findDotted - if (!lookupSymp) return NULL; + // For simplicity lookupSymp may be passed nullptr result from findDotted + if (!lookupSymp) return nullptr; UINFO(8, " findSymPrefixed " << dotname << " under se" << cvtToHex(lookupSymp) << ((lookupSymp->symPrefix() == "") ? "" : " as ") << ((lookupSymp->symPrefix() == "") ? "" : lookupSymp->symPrefix() + dotname) << " at se" << lookupSymp << endl); string prefix = lookupSymp->symPrefix(); - VSymEnt* foundp = NULL; + VSymEnt* foundp = nullptr; while (!foundp) { - foundp = lookupSymp->findIdFallback(prefix + dotname); // Might be NULL + foundp = lookupSymp->findIdFallback(prefix + dotname); // Might be nullptr if (prefix.empty()) break; string nextPrefix = removeLastInlineScope(prefix); if (prefix == nextPrefix) break; @@ -685,7 +685,7 @@ public: const VNodeMatcher& matcher) { // Suggest alternative symbol in given point in hierarchy // Does not support inline, as we find user-level errors before inlining - // For simplicity lookupSymp may be passed NULL result from findDotted + // For simplicity lookupSymp may be passed nullptr result from findDotted if (!lookupSymp) return ""; VSpellCheck speller; lookupSymp->candidateIdFallback(&speller, &matcher); @@ -699,7 +699,7 @@ public: } }; -LinkDotState* LinkDotState::s_errorThisp = NULL; +LinkDotState* LinkDotState::s_errorThisp = nullptr; //====================================================================== @@ -722,7 +722,7 @@ class LinkDotFindVisitor : public AstNVisitor { int debug() { return LinkDotState::debug(); } void makeImplicitNew(AstClass* nodep) { - AstFunc* newp = new AstFunc(nodep->fileline(), "new", NULL, NULL); + AstFunc* newp = new AstFunc(nodep->fileline(), "new", nullptr, nullptr); newp->isConstructor(true); nodep->addMembersp(newp); UINFO(8, "Made implicit new for " << nodep->name() << ": " << nodep << endl); @@ -760,7 +760,7 @@ class LinkDotFindVisitor : public AstNVisitor { m_curSymp = m_modSymp = m_statep->insertTopCell(modp, m_scope); { iterate(modp); } m_scope = ""; - m_curSymp = m_modSymp = NULL; + m_curSymp = m_modSymp = nullptr; } } virtual void visit(AstTypeTable*) override {} @@ -768,7 +768,7 @@ class LinkDotFindVisitor : public AstNVisitor { // Called on top module from Netlist, other modules from the cell creating them, // and packages UINFO(8, " " << nodep << endl); - // m_curSymp/m_modSymp maybe NULL for packages and non-top modules + // m_curSymp/m_modSymp maybe nullptr for packages and non-top modules // Packages will be under top after the initial phases, but until then // need separate handling bool standalonePkg = !m_modSymp && (m_statep->forPrearray() && VN_IS(nodep, Package)); @@ -835,7 +835,7 @@ class LinkDotFindVisitor : public AstNVisitor { m_blockNum = oldBlockNum; m_modBlockNum = oldModBlockNum; // Prep for next - m_packagep = NULL; + m_packagep = nullptr; } virtual void visit(AstClass* nodep) override { UASSERT_OBJ(m_curSymp, nodep, "Class not under module/package/$unit"); @@ -907,7 +907,7 @@ class LinkDotFindVisitor : public AstNVisitor { { m_scope = m_scope + "." + nodep->name(); m_curSymp = m_modSymp = m_statep->insertCell(aboveSymp, m_modSymp, nodep, m_scope); - m_blockp = NULL; + m_blockp = nullptr; m_inRecursion = nodep->recursive(); // We don't report NotFoundModule, as may be a unused module in a generate if (nodep->modp()) iterate(nodep->modp()); @@ -1018,11 +1018,11 @@ class LinkDotFindVisitor : public AstNVisitor { newvarp->attrIsolateAssign(nodep->attrIsolateAssign()); nodep->addFvarp(newvarp); // Explicit insert required, as the var name shadows the upper level's task name - m_statep->insertSym(m_curSymp, newvarp->name(), newvarp, NULL /*packagep*/); + m_statep->insertSym(m_curSymp, newvarp->name(), newvarp, nullptr /*packagep*/); } m_ftaskp = nodep; iterateChildren(nodep); - m_ftaskp = NULL; + m_ftaskp = nullptr; } m_curSymp = oldCurSymp; } @@ -1041,7 +1041,7 @@ class LinkDotFindVisitor : public AstNVisitor { if (!foundp && m_modSymp && nodep->name() == m_modSymp->nodep()->name()) { foundp = m_modSymp; // Conflicts with modname? } - AstVar* findvarp = foundp ? VN_CAST(foundp->nodep(), Var) : NULL; + AstVar* findvarp = foundp ? VN_CAST(foundp->nodep(), Var) : nullptr; bool ins = false; if (!foundp) { ins = true; @@ -1179,7 +1179,7 @@ class LinkDotFindVisitor : public AstNVisitor { if (!foundp && m_modSymp && nodep->name() == m_modSymp->nodep()->name()) { foundp = m_modSymp; // Conflicts with modname? } - AstEnumItem* findvarp = foundp ? VN_CAST(foundp->nodep(), EnumItem) : NULL; + AstEnumItem* findvarp = foundp ? VN_CAST(foundp->nodep(), EnumItem) : nullptr; bool ins = false; if (!foundp) { ins = true; @@ -1254,11 +1254,11 @@ public: // CONSTRUCTORS LinkDotFindVisitor(AstNetlist* rootp, LinkDotState* statep) { UINFO(4, __FUNCTION__ << ": " << endl); - m_packagep = NULL; - m_curSymp = m_modSymp = NULL; + m_packagep = nullptr; + m_curSymp = m_modSymp = nullptr; m_statep = statep; - m_blockp = NULL; - m_ftaskp = NULL; + m_blockp = nullptr; + m_ftaskp = nullptr; m_inRecursion = false; m_paramNum = 0; m_blockNum = 0; @@ -1324,7 +1324,7 @@ private: } else { m_modp = nodep; iterateChildren(nodep); - m_modp = NULL; + m_modp = nullptr; } } virtual void visit(AstPin* nodep) override { @@ -1341,7 +1341,7 @@ private: nodep->v3warn(DEFPARAM, "Suggest replace defparam assignment with Verilog 2001 #(." << nodep->prettyName() << "(...etc...))"); VSymEnt* foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->path()); - AstCell* cellp = foundp ? VN_CAST(foundp->nodep(), Cell) : NULL; + AstCell* cellp = foundp ? VN_CAST(foundp->nodep(), Cell) : nullptr; if (!cellp) { nodep->v3error("In defparam, cell " << nodep->path() << " never declared"); } else { @@ -1361,7 +1361,7 @@ private: // Need to set pin numbers after varnames are created // But before we do the final resolution based on names VSymEnt* foundp = m_statep->getNodeSym(m_modp)->findIdFlat(nodep->name()); - AstVar* refp = foundp ? VN_CAST(foundp->nodep(), Var) : NULL; + AstVar* refp = foundp ? VN_CAST(foundp->nodep(), Var) : nullptr; if (!refp) { nodep->v3error( "Input/output/inout declaration not found for port: " << nodep->prettyNameQ()); @@ -1378,7 +1378,7 @@ private: refp->user4(true); VSymEnt* symp = m_statep->insertSym(m_statep->getNodeSym(m_modp), "__pinNumber" + cvtToStr(nodep->pinNum()), refp, - NULL /*packagep*/); + nullptr /*packagep*/); symp->exported(false); } // Ports not needed any more @@ -1430,7 +1430,7 @@ public: LinkDotParamVisitor(AstNetlist* rootp, LinkDotState* statep) { UINFO(4, __FUNCTION__ << ": " << endl); m_statep = statep; - m_modp = NULL; + m_modp = nullptr; // iterate(rootp); } @@ -1462,12 +1462,13 @@ class LinkDotScopeVisitor : public AstNVisitor { m_modSymp = m_statep->getScopeSym(nodep); m_scopep = nodep; iterateChildren(nodep); - m_modSymp = NULL; - m_scopep = NULL; + m_modSymp = nullptr; + m_scopep = nullptr; } virtual void visit(AstVarScope* nodep) override { if (!nodep->varp()->isFuncLocal() && !nodep->varp()->isClassMember()) { - VSymEnt* varSymp = m_statep->insertSym(m_modSymp, nodep->varp()->name(), nodep, NULL); + VSymEnt* varSymp + = m_statep->insertSym(m_modSymp, nodep->varp()->name(), nodep, nullptr); if (nodep->varp()->isIfaceRef() && nodep->varp()->isIfaceParent()) { UINFO(9, "Iface parent ref var " << nodep->varp()->name() << " " << nodep << endl); // Find the interface cell the var references @@ -1502,7 +1503,7 @@ class LinkDotScopeVisitor : public AstNVisitor { } } virtual void visit(AstNodeFTask* nodep) override { - VSymEnt* symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, NULL); + VSymEnt* symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, nullptr); symp->fallbackp(m_modSymp); // No recursion, we don't want to pick up variables } @@ -1528,7 +1529,7 @@ class LinkDotScopeVisitor : public AstNVisitor { string inl = ((xrefp && xrefp->inlinedDots().size()) ? (xrefp->inlinedDots() + "__DOT__") : ""); - VSymEnt* symp = NULL; + VSymEnt* symp = nullptr; string scopename; while (!symp) { scopename @@ -1583,8 +1584,8 @@ public: // CONSTRUCTORS LinkDotScopeVisitor(AstNetlist* rootp, LinkDotState* statep) { UINFO(4, __FUNCTION__ << ": " << endl); - m_modSymp = NULL; - m_scopep = NULL; + m_modSymp = nullptr; + m_scopep = nullptr; m_statep = statep; // iterate(rootp); @@ -1610,7 +1611,7 @@ class LinkDotIfaceVisitor : public AstNVisitor { VSymEnt* oldCurSymp = m_curSymp; { // Create symbol table for the vars - m_curSymp = m_statep->insertBlock(m_curSymp, nodep->name(), nodep, NULL); + m_curSymp = m_statep->insertBlock(m_curSymp, nodep->name(), nodep, nullptr); m_curSymp->fallbackp(oldCurSymp); iterateChildren(nodep); } @@ -1627,7 +1628,7 @@ class LinkDotIfaceVisitor : public AstNVisitor { // Make symbol under modport that points at the _interface_'s var, not the modport. nodep->ftaskp(ftaskp); VSymEnt* subSymp - = m_statep->insertSym(m_curSymp, nodep->name(), ftaskp, NULL /*package*/); + = m_statep->insertSym(m_curSymp, nodep->name(), ftaskp, nullptr /*package*/); m_statep->insertScopeAlias(LinkDotState::SAMN_MODPORT, subSymp, symp); } else { nodep->v3error("Modport item is not a function/task: " << nodep->prettyNameQ()); @@ -1649,11 +1650,11 @@ class LinkDotIfaceVisitor : public AstNVisitor { // Make symbol under modport that points at the _interface_'s var via the modport. // (Need modport still to test input/output markings) nodep->varp(varp); - m_statep->insertSym(m_curSymp, nodep->name(), nodep, NULL /*package*/); + m_statep->insertSym(m_curSymp, nodep->name(), nodep, nullptr /*package*/); } else if (AstVarScope* vscp = VN_CAST(symp->nodep(), VarScope)) { // Make symbol under modport that points at the _interface_'s var, not the modport. nodep->varp(vscp->varp()); - m_statep->insertSym(m_curSymp, nodep->name(), vscp, NULL /*package*/); + m_statep->insertSym(m_curSymp, nodep->name(), vscp, nullptr /*package*/); } else { nodep->v3error("Modport item is not a variable: " << nodep->prettyNameQ()); } @@ -1728,16 +1729,16 @@ private: AstNode* m_unlinkedScope; // Unresolved scope, needs corresponding VarXRef bool m_dotErr; // Error found in dotted resolution, ignore upwards string m_dotText; // String of dotted names found in below parseref - DotStates() { init(NULL); } + DotStates() { init(nullptr); } ~DotStates() {} void init(VSymEnt* curSymp) { m_dotPos = DP_NONE; m_dotSymp = curSymp; - m_dotp = NULL; + m_dotp = nullptr; m_dotErr = false; m_dotText = ""; m_unresolved = false; - m_unlinkedScope = NULL; + m_unlinkedScope = nullptr; } string ascii() const { static const char* const names[] = {"NONE", "PACKAGE", "SCOPE", "FINAL", "MEMBER"}; @@ -1785,13 +1786,13 @@ private: modp->addStmtp(newp); // Link it to signal list, must add the variable under the module; // current scope might be lower now - m_statep->insertSym(moduleSymp, newp->name(), newp, NULL /*packagep*/); + m_statep->insertSym(moduleSymp, newp->name(), newp, nullptr /*packagep*/); } } AstVar* foundToVarp(const VSymEnt* symp, AstNode* nodep, bool lvalue) { // Return a variable if possible, auto converting a modport to variable if (!symp) { - return NULL; + return nullptr; } else if (VN_IS(symp->nodep(), Var)) { return VN_CAST(symp->nodep(), Var); } else if (VN_IS(symp->nodep(), ModportVarRef)) { @@ -1802,7 +1803,7 @@ private: } // else other simulators don't warn about reading, and IEEE doesn't say illegal return varp; } else { - return NULL; + return nullptr; } } void taskFuncSwapCheck(AstNodeFTaskRef* nodep) { @@ -1857,12 +1858,12 @@ private: m_ds.init(m_curSymp); m_ds.m_dotSymp = m_curSymp = m_modSymp = m_statep->getNodeSym(nodep); // Until overridden by a SCOPE - m_cellp = NULL; + m_cellp = nullptr; m_modp = nodep; m_modportNum = 0; iterateChildren(nodep); - m_modp = NULL; - m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL; + m_modp = nullptr; + m_ds.m_dotSymp = m_curSymp = m_modSymp = nullptr; } virtual void visit(AstScope* nodep) override { UINFO(8, " " << nodep << endl); @@ -1871,7 +1872,7 @@ private: checkNoDot(nodep); m_ds.m_dotSymp = m_curSymp = m_modSymp = m_statep->getScopeSym(nodep); iterateChildren(nodep); - m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL; + m_ds.m_dotSymp = m_curSymp = m_modSymp = nullptr; m_modSymp = oldModSymp; m_curSymp = oldCurSymp; } @@ -1904,10 +1905,10 @@ private: // if (debug()) nodep->dumpTree(cout, "linkcell:"); // if (debug()) nodep->modp()->dumpTree(cout, "linkcemd:"); iterateChildren(nodep); - m_pinSymp = NULL; + m_pinSymp = nullptr; } } - m_cellp = NULL; + m_cellp = nullptr; // Parent module inherits child's publicity // This is done bottom up in the LinkBotupVisitor stage } @@ -2022,7 +2023,7 @@ private: UINFO(9, " linkPARSEREF " << m_ds.ascii() << " n=" << nodep << endl); // m_curSymp is symbol table of outer expression // m_ds.m_dotSymp is symbol table relative to "."'s above now - UASSERT_OBJ(m_ds.m_dotSymp, nodep, "NULL lookup symbol table"); + UASSERT_OBJ(m_ds.m_dotSymp, nodep, "nullptr lookup symbol table"); // Generally resolved during Primay, but might be at param time under AstUnlinkedRef UASSERT_OBJ(m_statep->forPrimary() || m_statep->forPrearray(), nodep, "ParseRefs should no longer exist"); @@ -2035,7 +2036,7 @@ private: bool start = (m_ds.m_dotPos == DP_NONE); // Save, as m_dotp will be changed if (start) { m_ds.init(m_curSymp); - // Note m_ds.m_dot remains NULL; this is a reference not under a dot + // Note m_ds.m_dot remains nullptr; this is a reference not under a dot } if (nodep->name() == "this") { nodep->v3warn(E_UNSUPPORTED, "Unsupported: this"); @@ -2061,7 +2062,7 @@ private: bool allowVar = false; if (m_ds.m_dotPos == DP_PACKAGE) { // {package}::{a} - AstNodeModule* packagep = NULL; + AstNodeModule* packagep = nullptr; expectWhat = "scope/variable"; allowScope = true; allowVar = true; @@ -2094,10 +2095,10 @@ private: // Lookup VSymEnt* foundp; string baddot; - VSymEnt* okSymp = NULL; + VSymEnt* okSymp = nullptr; if (allowScope) { foundp = m_statep->findDotted(nodep->fileline(), m_ds.m_dotSymp, nodep->name(), - baddot, okSymp); // Maybe NULL + baddot, okSymp); // Maybe nullptr } else { foundp = m_ds.m_dotSymp->findIdFallback(nodep->name()); } @@ -2128,7 +2129,8 @@ private: // generate begin string findName = nodep->name() + "__Viftop"; VSymEnt* ifaceSymp = parentEntp->findIdFallback(findName); - AstVar* ifaceRefVarp = ifaceSymp ? VN_CAST(ifaceSymp->nodep(), Var) : NULL; + AstVar* ifaceRefVarp + = ifaceSymp ? VN_CAST(ifaceSymp->nodep(), Var) : nullptr; UASSERT_OBJ(ifaceRefVarp, nodep, "Can't find interface var ref: " << findName); // @@ -2187,7 +2189,7 @@ private: newp = new AstUnlinkedRef(nodep->fileline(), VN_CAST(refp, VarXRef), refp->name(), m_ds.m_unlinkedScope->unlinkFrBack()); - m_ds.m_unlinkedScope = NULL; + m_ds.m_unlinkedScope = nullptr; m_ds.m_unresolved = false; } } else { @@ -2297,9 +2299,9 @@ private: iterateChildren(nodep); if (!nodep->varp()) { UINFO(9, " linkVarRef se" << cvtToHex(m_curSymp) << " n=" << nodep << endl); - UASSERT_OBJ(m_curSymp, nodep, "NULL lookup symbol table"); + UASSERT_OBJ(m_curSymp, nodep, "nullptr lookup symbol table"); VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name()); - if (AstVar* varp = foundp ? foundToVarp(foundp, nodep, nodep->lvalue()) : NULL) { + if (AstVar* varp = foundp ? foundToVarp(foundp, nodep, nodep->lvalue()) : nullptr) { nodep->varp(varp); // Generally set by parse, but might be an import nodep->packagep(foundp->packagep()); @@ -2319,7 +2321,7 @@ private: if (!m_modSymp) { // Module that is not in hierarchy. We'll be dead code eliminating it later. UINFO(9, "Dead module for " << nodep << endl); - nodep->varp(NULL); + nodep->varp(nullptr); } else { string baddot; VSymEnt* okSymp; @@ -2336,10 +2338,10 @@ private: << " in: " << nodep->inlinedDots()); } dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, nodep->dotted(), baddot, - okSymp); // Maybe NULL + okSymp); // Maybe nullptr if (!m_statep->forScopeCreation()) { VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot); - AstVar* varp = foundp ? foundToVarp(foundp, nodep, nodep->lvalue()) : NULL; + AstVar* varp = foundp ? foundToVarp(foundp, nodep, nodep->lvalue()) : nullptr; nodep->varp(varp); UINFO(7, " Resolved " << nodep << endl); // Also prints varp if (!nodep->varp()) { @@ -2362,7 +2364,7 @@ private: } } else { VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot); - AstVarScope* vscp = foundp ? VN_CAST(foundp->nodep(), VarScope) : NULL; + AstVarScope* vscp = foundp ? VN_CAST(foundp->nodep(), VarScope) : nullptr; if (!vscp) { nodep->v3error("Can't find varpin scope of " << AstNode::prettyNameQ(baddot) << " in dotted signal: '" @@ -2438,14 +2440,14 @@ private: m_ds.m_dotp->lhsp(), "Bad package link"); nodep->packagep(VN_CAST(m_ds.m_dotp->lhsp(), ClassOrPackageRef)->packagep()); m_ds.m_dotPos = DP_SCOPE; - m_ds.m_dotp = NULL; + m_ds.m_dotp = nullptr; } else if (m_ds.m_dotp && m_ds.m_dotPos == DP_FINAL) { if (m_ds.m_unresolved && m_ds.m_unlinkedScope) { AstNodeFTaskRef* newftaskp = nodep->cloneTree(false); newftaskp->dotted(m_ds.m_dotText); AstNode* newp = new AstUnlinkedRef(nodep->fileline(), newftaskp, nodep->name(), m_ds.m_unlinkedScope->unlinkFrBack()); - m_ds.m_unlinkedScope = NULL; + m_ds.m_unlinkedScope = nullptr; m_ds.m_unresolved = false; nodep->replaceWith(newp); return; @@ -2456,7 +2458,7 @@ private: // Found a Var, everything following is method call. // {scope}.{var}.HERE {method} ( ARGS ) AstNode* varEtcp = m_ds.m_dotp->lhsp()->unlinkFrBack(); - AstNode* argsp = NULL; + AstNode* argsp = nullptr; if (nodep->pinsp()) argsp = nodep->pinsp()->unlinkFrBackWithNext(); AstNode* newp = new AstMethodCall(nodep->fileline(), varEtcp, VFlagChildDType(), nodep->name(), argsp); @@ -2471,13 +2473,13 @@ private: } else if (!m_modSymp) { // Module that is not in hierarchy. We'll be dead code eliminating it later. UINFO(9, "Dead module for " << nodep << endl); - nodep->taskp(NULL); + nodep->taskp(nullptr); } else if (nodep->dotted() == "" && nodep->taskp()) { // Earlier should have setup the links // Might be under a BEGIN we're not processing, so don't relink it } else { string baddot; - VSymEnt* okSymp = NULL; + VSymEnt* okSymp = nullptr; VSymEnt* dotSymp = m_curSymp; // Start search at module, as a variable // of same name under a subtask isn't a relevant hit however a // function under a begin/end is. So we want begins, but not @@ -2502,11 +2504,11 @@ private: } } dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, nodep->dotted(), baddot, - okSymp); // Maybe NULL + okSymp); // Maybe nullptr } VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot); AstNodeFTask* taskp - = foundp ? VN_CAST(foundp->nodep(), NodeFTask) : NULL; // Maybe NULL + = foundp ? VN_CAST(foundp->nodep(), NodeFTask) : nullptr; // Maybe nullptr if (taskp) { nodep->taskp(taskp); nodep->packagep(foundp->packagep()); @@ -2531,7 +2533,7 @@ private: newp = new AstConst(nodep->fileline(), AstConst::StringToParse(), "'0"); } else { - AstNode* outp = NULL; + AstNode* outp = nullptr; while (nodep->pinsp()) { AstNode* pinp = nodep->pinsp()->unlinkFrBack(); AstNode* addp = pinp; @@ -2657,7 +2659,7 @@ private: iterateChildren(nodep); } m_ds.m_dotSymp = m_curSymp = oldCurSymp; - m_ftaskp = NULL; + m_ftaskp = nullptr; } virtual void visit(AstClass* nodep) override { UINFO(5, " " << nodep << endl); @@ -2725,7 +2727,7 @@ private: m_ds.m_dotp->lhsp(), "Bad package link"); nodep->packagep(VN_CAST(m_ds.m_dotp->lhsp(), ClassOrPackageRef)->packagep()); m_ds.m_dotPos = DP_SCOPE; - m_ds.m_dotp = NULL; + m_ds.m_dotp = nullptr; } else { checkNoDot(nodep); } @@ -2737,14 +2739,14 @@ private: } else { foundp = m_curSymp->findIdFallback(nodep->name()); } - if (AstTypedef* defp = foundp ? VN_CAST(foundp->nodep(), Typedef) : NULL) { + if (AstTypedef* defp = foundp ? VN_CAST(foundp->nodep(), Typedef) : nullptr) { nodep->typedefp(defp); nodep->packagep(foundp->packagep()); } else if (AstParamTypeDType* defp - = foundp ? VN_CAST(foundp->nodep(), ParamTypeDType) : NULL) { + = foundp ? VN_CAST(foundp->nodep(), ParamTypeDType) : nullptr) { nodep->refDTypep(defp); nodep->packagep(foundp->packagep()); - } else if (AstClass* defp = foundp ? VN_CAST(foundp->nodep(), Class) : NULL) { + } else if (AstClass* defp = foundp ? VN_CAST(foundp->nodep(), Class) : nullptr) { AstClassRefDType* newp = new AstClassRefDType(nodep->fileline(), defp); newp->packagep(foundp->packagep()); nodep->replaceWith(newp); @@ -2762,7 +2764,7 @@ private: iterateChildren(nodep); checkNoDot(nodep); VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name()); - AstNodeFTask* taskp = foundp ? VN_CAST(foundp->nodep(), NodeFTask) : NULL; + AstNodeFTask* taskp = foundp ? VN_CAST(foundp->nodep(), NodeFTask) : nullptr; if (!taskp) { nodep->v3error( "Can't find definition of exported task/function: " << nodep->prettyNameQ()); @@ -2813,12 +2815,12 @@ public: LinkDotResolveVisitor(AstNetlist* rootp, LinkDotState* statep) { UINFO(4, __FUNCTION__ << ": " << endl); m_statep = statep; - m_modSymp = NULL; - m_curSymp = NULL; - m_pinSymp = NULL; - m_cellp = NULL; - m_modp = NULL; - m_ftaskp = NULL; + m_modSymp = nullptr; + m_curSymp = nullptr; + m_pinSymp = nullptr; + m_cellp = nullptr; + m_modp = nullptr; + m_ftaskp = nullptr; m_modportNum = 0; // iterate(rootp); diff --git a/src/V3LinkInc.cpp b/src/V3LinkInc.cpp index fa2c747f8..e9db2bf74 100644 --- a/src/V3LinkInc.cpp +++ b/src/V3LinkInc.cpp @@ -95,26 +95,26 @@ private: // Special, as statements need to be put in different places // Preconditions insert first just before themselves (the normal // rule for other statement types) - m_insStmtp = NULL; // First thing should be new statement + m_insStmtp = nullptr; // First thing should be new statement iterateAndNextNull(nodep->precondsp()); // Conditions insert first at end of precondsp. m_insMode = IM_WHILE_PRECOND; m_insStmtp = nodep; iterateAndNextNull(nodep->condp()); // Body insert just before themselves - m_insStmtp = NULL; // First thing should be new statement + m_insStmtp = nullptr; // First thing should be new statement iterateAndNextNull(nodep->bodysp()); iterateAndNextNull(nodep->incsp()); // Done the loop - m_insStmtp = NULL; // Next thing should be new statement + m_insStmtp = nullptr; // Next thing should be new statement } virtual void visit(AstNodeIf* nodep) override { m_insStmtp = nodep; iterateAndNextNull(nodep->condp()); - m_insStmtp = NULL; + m_insStmtp = nullptr; iterateAndNextNull(nodep->ifsp()); iterateAndNextNull(nodep->elsesp()); - m_insStmtp = NULL; + m_insStmtp = nullptr; } virtual void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc( @@ -128,7 +128,7 @@ private: m_insMode = IM_BEFORE; m_insStmtp = nodep; iterateChildren(nodep); - m_insStmtp = NULL; // Next thing should be new statement + m_insStmtp = nullptr; // Next thing should be new statement } void unsupported_visit(AstNode* nodep) { m_unsupportedHere = true; @@ -237,7 +237,7 @@ public: explicit LinkIncVisitor(AstNetlist* nodep) { m_modIncrementsNum = 0; m_insMode = IM_BEFORE; - m_insStmtp = NULL; + m_insStmtp = nullptr; m_unsupportedHere = false; iterate(nodep); } diff --git a/src/V3LinkJump.cpp b/src/V3LinkJump.cpp index 7b23e48ca..4ca10cb79 100644 --- a/src/V3LinkJump.cpp +++ b/src/V3LinkJump.cpp @@ -63,7 +63,7 @@ private: UINFO(4, "Create label for " << nodep << endl); if (VN_IS(nodep, JumpLabel)) return VN_CAST(nodep, JumpLabel); // Done - AstNode* underp = NULL; + AstNode* underp = nullptr; bool under_and_next = true; if (VN_IS(nodep, NodeBlock)) { underp = VN_CAST(nodep, NodeBlock)->stmtsp(); @@ -80,7 +80,7 @@ private: } } else { nodep->v3fatalSrc("Unknown jump point for break/disable/continue"); - return NULL; + return nullptr; } // Skip over variables as we'll just move them in a moment // Also this would otherwise prevent us from using a label twice @@ -92,7 +92,7 @@ private: if (VN_IS(underp, JumpLabel)) { return VN_CAST(underp, JumpLabel); } else { // Move underp stuff to be under a new label - AstJumpBlock* blockp = new AstJumpBlock(nodep->fileline(), NULL); + AstJumpBlock* blockp = new AstJumpBlock(nodep->fileline(), nullptr); AstJumpLabel* labelp = new AstJumpLabel(nodep->fileline(), blockp); blockp->labelp(labelp); @@ -132,7 +132,7 @@ private: virtual void visit(AstNodeFTask* nodep) override { m_ftaskp = nodep; iterateChildren(nodep); - m_ftaskp = NULL; + m_ftaskp = nullptr; } virtual void visit(AstNodeBlock* nodep) override { UINFO(8, " " << nodep << endl); @@ -254,7 +254,7 @@ private: virtual void visit(AstDisable* nodep) override { UINFO(8, " DISABLE " << nodep << endl); iterateChildren(nodep); - AstNodeBlock* blockp = NULL; + AstNodeBlock* blockp = nullptr; for (BlockStack::reverse_iterator it = m_blockStack.rbegin(); it != m_blockStack.rend(); ++it) { UINFO(9, " UNDERBLK " << *it << endl); @@ -286,10 +286,10 @@ private: public: // CONSTRUCTORS explicit LinkJumpVisitor(AstNetlist* nodep) { - m_modp = NULL; - m_ftaskp = NULL; + m_modp = nullptr; + m_ftaskp = nullptr; m_inFork = false; - m_loopp = NULL; + m_loopp = nullptr; m_loopInc = false; m_modRepeatNum = 0; iterate(nodep); diff --git a/src/V3LinkLValue.cpp b/src/V3LinkLValue.cpp index ddfd4c98b..8f5cc6d66 100644 --- a/src/V3LinkLValue.cpp +++ b/src/V3LinkLValue.cpp @@ -270,7 +270,7 @@ private: virtual void visit(AstNodeFTask* nodep) override { m_ftaskp = nodep; iterateChildren(nodep); - m_ftaskp = NULL; + m_ftaskp = nullptr; } virtual void visit(AstNodeFTaskRef* nodep) override { AstNode* pinp = nodep->pinsp(); @@ -300,7 +300,7 @@ public: // CONSTRUCTORS LinkLValueVisitor(AstNode* nodep, bool start) { m_setRefLvalue = start; - m_ftaskp = NULL; + m_ftaskp = nullptr; iterate(nodep); } virtual ~LinkLValueVisitor() {} diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index dd8ef3d50..410e87229 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -91,7 +91,7 @@ void V3LinkLevel::modSortByLevel() { void V3LinkLevel::timescaling(const ModVec& mods) { // Timescale determination - AstNodeModule* modTimedp = NULL; + AstNodeModule* modTimedp = nullptr; VTimescale unit(VTimescale::NONE); // Use highest level module as default unit - already sorted in proper order for (ModVec::const_iterator it = mods.begin(); it != mods.end(); ++it) { @@ -160,7 +160,7 @@ void V3LinkLevel::wrapTop(AstNetlist* rootp) { AstCell* cellp = new AstCell(modp->fileline(), modp->fileline(), // Could add __03a__03a="::" to prevent conflict // with module names/"v" - modp->name(), modp->name(), NULL, NULL, NULL); + modp->name(), modp->name(), nullptr, nullptr, nullptr); cellp->modp(modp); newmodp->addStmtp(cellp); } @@ -203,7 +203,7 @@ void V3LinkLevel::wrapTopCell(AstNetlist* rootp) { AstCell* cellp = new AstCell( newmodp->fileline(), newmodp->fileline(), (!v3Global.opt.l2Name().empty() ? v3Global.opt.l2Name() : oldmodp->name()), - oldmodp->name(), NULL, NULL, NULL); + oldmodp->name(), nullptr, nullptr, nullptr); cellp->modp(oldmodp); newmodp->addStmtp(cellp); diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index efcfaf596..e0a71f901 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -109,7 +109,7 @@ private: cleanFileline(nodep); m_ftaskp = nodep; iterateChildren(nodep); - m_ftaskp = NULL; + m_ftaskp = nullptr; } } virtual void visit(AstNodeFTaskRef* nodep) override { @@ -117,7 +117,7 @@ private: cleanFileline(nodep); UINFO(5, " " << nodep << endl); AstNodeModule* upperValueModp = m_valueModp; - m_valueModp = NULL; + m_valueModp = nullptr; iterateChildren(nodep); m_valueModp = upperValueModp; } @@ -148,15 +148,15 @@ private: int lsb = nodep->rangep()->lsbConst(); int increment = (msb > lsb) ? -1 : 1; int offset_from_init = 0; - AstNode* addp = NULL; + AstNode* addp = nullptr; for (int i = msb; i != (lsb + increment); i += increment, offset_from_init++) { string name = nodep->name() + cvtToStr(i); - AstNode* valuep = NULL; + AstNode* valuep = nullptr; if (nodep->valuep()) valuep = new AstAdd( nodep->fileline(), nodep->valuep()->cloneTree(true), new AstConst(nodep->fileline(), AstConst::Unsized32(), offset_from_init)); - AstNode* newp = new AstEnumItem(nodep->fileline(), name, NULL, valuep); + AstNode* newp = new AstEnumItem(nodep->fileline(), name, nullptr, valuep); if (addp) { addp = addp->addNextNull(newp); } else { @@ -213,7 +213,7 @@ private: m_varp = nodep; iterateChildren(nodep); - m_varp = NULL; + m_varp = nullptr; // temporaries under an always aren't expected to be blocking if (m_inAlways) nodep->fileline()->modifyWarnOff(V3ErrorCode::BLKSEQ, true); if (nodep->valuep()) { @@ -347,7 +347,7 @@ private: // so that for "var enum {...} a,b" a & b will share a common typedef // Unique name space under each containerp() so that an addition of // a new type won't change every verilated module. - AstTypedef* defp = NULL; + AstTypedef* defp = nullptr; ImplTypedefMap::iterator it = m_implTypedef.find(make_pair(nodep->containerp(), nodep->name())); if (it != m_implTypedef.end()) { @@ -370,7 +370,7 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); return; } else { - defp = new AstTypedef(nodep->fileline(), nodep->name(), NULL, VFlagChildDType(), + defp = new AstTypedef(nodep->fileline(), nodep->name(), nullptr, VFlagChildDType(), dtypep); m_implTypedef.insert( make_pair(make_pair(nodep->containerp(), defp->name()), defp)); @@ -402,7 +402,7 @@ private: // 3. ASTSELLOOPVARS(first, var0..var1)) // 4. DOT(DOT(first, second), ASTSELBIT(third, var0)) AstNode* bracketp = nodep->arrayp(); - AstNode* firstVarsp = NULL; + AstNode* firstVarsp = nullptr; while (AstDot* dotp = VN_CAST(bracketp, Dot)) { bracketp = dotp->rhsp(); } if (AstSelBit* selp = VN_CAST(bracketp, SelBit)) { firstVarsp = selp->rhsp()->unlinkFrBackWithNext(); @@ -499,7 +499,7 @@ private: cleanFileline(nodep); // AstNodeModule* upperValueModp = m_valueModp; - m_valueModp = NULL; + m_valueModp = nullptr; iterateChildren(nodep); m_valueModp = upperValueModp; } @@ -596,12 +596,12 @@ private: public: // CONSTRUCTORS explicit LinkParseVisitor(AstNetlist* rootp) { - m_varp = NULL; - m_modp = NULL; - m_ftaskp = NULL; - m_dtypep = NULL; + m_varp = nullptr; + m_modp = nullptr; + m_ftaskp = nullptr; + m_dtypep = nullptr; m_inAlways = false; - m_valueModp = NULL; + m_valueModp = nullptr; iterate(rootp); } virtual ~LinkParseVisitor() {} diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index e2ff22660..99d7401da 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -103,7 +103,7 @@ private: if (m_assertp) nodep->v3error("Assert not allowed under another assert"); m_assertp = nodep; iterateChildren(nodep); - m_assertp = NULL; + m_assertp = nullptr; } virtual void visit(AstVar* nodep) override { iterateChildren(nodep); @@ -141,7 +141,7 @@ private: m_ftaskp = nodep; iterateChildren(nodep); } - m_ftaskp = NULL; + m_ftaskp = nullptr; m_lifetime = origLifetime; if (nodep->dpiExport()) { nodep->scopeNamep(new AstScopeName(nodep->fileline())); } } @@ -245,7 +245,7 @@ private: // From {...}[...] syntax in IEEE 2017 if (basefromp) { UINFO(1, " Related node: " << basefromp << endl); } nodep->v3warn(E_UNSUPPORTED, "Unsupported: Select of concatenation"); - nodep = NULL; + nodep = nullptr; } else { if (basefromp) { UINFO(1, " Related node: " << basefromp << endl); } nodep->v3fatalSrc("Illegal bit select; no signal/member being extracted from"); @@ -478,7 +478,7 @@ private: // never used won't result in any warnings. } else { // Massive hack, just tie off all outputs so our analysis can proceed - AstVar* varoutp = NULL; + AstVar* varoutp = nullptr; for (AstNode* stmtp = m_modp->stmtsp(); stmtp; stmtp = stmtp->nextp()) { if (AstVar* varp = VN_CAST(stmtp, Var)) { if (varp->isReadOnly()) { @@ -523,10 +523,10 @@ public: // CONSTRUCTORS explicit LinkResolveVisitor(AstNetlist* rootp) : m_lifetime(VLifetime::STATIC) { // Static outside a module/class - m_classp = NULL; - m_ftaskp = NULL; - m_modp = NULL; - m_assertp = NULL; + m_classp = nullptr; + m_ftaskp = nullptr; + m_modp = nullptr; + m_assertp = nullptr; m_senitemCvtNum = 0; iterate(rootp); } @@ -570,7 +570,7 @@ private: public: // CONSTRUCTORS explicit LinkBotupVisitor(AstNetlist* rootp) { - m_modp = NULL; + m_modp = nullptr; // iterate(rootp); } diff --git a/src/V3List.h b/src/V3List.h index 62de0d093..54c652a4e 100644 --- a/src/V3List.h +++ b/src/V3List.h @@ -37,16 +37,16 @@ private: public: V3List() - : m_headp(NULL) - , m_tailp(NULL) {} + : m_headp(nullptr) + , m_tailp(nullptr) {} ~V3List() {} // METHODS T begin() const { return m_headp; } - T end() const { return NULL; } - bool empty() const { return m_headp == NULL; } + T end() const { return nullptr; } + bool empty() const { return m_headp == nullptr; } void reset() { // clear() without walking the list - m_headp = NULL; - m_tailp = NULL; + m_headp = nullptr; + m_tailp = nullptr; } }; @@ -56,8 +56,8 @@ template class V3ListEnt { // List entry for linked list of elements of type *T (T is a pointer type) private: // MEMBERS - T m_nextp; // Pointer to next element, NULL=end - T m_prevp; // Pointer to previous element, NULL=beginning + T m_nextp; // Pointer to next element, nullptr=end + T m_prevp; // Pointer to previous element, nullptr=beginning friend class V3List; static V3ListEnt* baseToListEnt(void* newbasep, size_t offset) { // "this" must be a element inside of *basep @@ -68,8 +68,8 @@ private: public: V3ListEnt() - : m_nextp(NULL) - , m_prevp(NULL) {} + : m_nextp(nullptr) + , m_prevp(nullptr) {} ~V3ListEnt() { #ifdef VL_DEBUG // Load bogus pointers so we can catch deletion bugs @@ -83,7 +83,7 @@ public: // "this" must be a element inside of *newp // cppcheck-suppress thisSubtraction size_t offset = (size_t)(vluint8_t*)(this) - (size_t)(vluint8_t*)(newp); - m_nextp = NULL; + m_nextp = nullptr; if (!listr.m_headp) listr.m_headp = newp; m_prevp = listr.m_tailp; if (m_prevp) baseToListEnt(m_prevp, offset)->m_nextp = newp; @@ -96,7 +96,7 @@ public: m_nextp = listr.m_headp; if (m_nextp) baseToListEnt(m_nextp, offset)->m_prevp = newp; listr.m_headp = newp; - m_prevp = NULL; + m_prevp = nullptr; if (!listr.m_tailp) listr.m_tailp = newp; } // Unlink from side @@ -114,7 +114,7 @@ public: } else { listr.m_headp = m_nextp; } - m_prevp = m_nextp = NULL; + m_prevp = m_nextp = nullptr; } }; diff --git a/src/V3Localize.cpp b/src/V3Localize.cpp index bfdd49705..3f8641ae0 100644 --- a/src/V3Localize.cpp +++ b/src/V3Localize.cpp @@ -157,7 +157,7 @@ private: searchFuncStmts(nodep->stmtsp()); searchFuncStmts(nodep->finalsp()); iterateChildren(nodep); - m_cfuncp = NULL; + m_cfuncp = nullptr; } void searchFuncStmts(AstNode* nodep) { // Search for basic assignments to allow moving non-blocktemps @@ -211,7 +211,7 @@ private: AstVarRef* firstasn = static_cast(nodep->varp()->user4p()); if (firstasn && nodep != firstasn) { clearStdOptimizable(nodep->varp(), "notFirstAsn"); - nodep->varp()->user4p(NULL); + nodep->varp()->user4p(nullptr); } } } @@ -222,7 +222,7 @@ private: public: // CONSTRUCTORS explicit LocalizeVisitor(AstNetlist* nodep) { - m_cfuncp = NULL; + m_cfuncp = nullptr; iterate(nodep); } virtual ~LocalizeVisitor() { diff --git a/src/V3MergeCond.cpp b/src/V3MergeCond.cpp index 98d7f6bad..5bc0b177a 100644 --- a/src/V3MergeCond.cpp +++ b/src/V3MergeCond.cpp @@ -150,7 +150,7 @@ private: if (VN_IS(andp->lhsp(), Const)) { return condp; } } } - return NULL; + return nullptr; } // Apply (_ & 1'b1). This is necessary because this pass is after V3Clean, @@ -204,7 +204,7 @@ private: // Create equivalent 'if' statement and insert it before the first node AstIf* const ifp - = new AstIf(m_mgCondp->fileline(), m_mgCondp->unlinkFrBack(), NULL, NULL); + = new AstIf(m_mgCondp->fileline(), m_mgCondp->unlinkFrBack(), nullptr, nullptr); m_mgFirstp->replaceWith(ifp); ifp->addNextHere(m_mgFirstp); // Unzip the list and insert under branches @@ -212,7 +212,7 @@ private: do { // Grab next pointer and unlink AstNode* const currp = nextp; - nextp = currp != m_mgLastp ? currp->nextp() : NULL; + nextp = currp != m_mgLastp ? currp->nextp() : nullptr; currp->unlinkFrBack(); // Skip over comments if (VN_IS(currp, Comment)) { @@ -235,10 +235,10 @@ private: } while (nextp); } // Reset state - m_mgFirstp = NULL; - m_mgCondp = NULL; - m_mgLastp = NULL; - m_mgNextp = NULL; + m_mgFirstp = nullptr; + m_mgCondp = nullptr; + m_mgLastp = nullptr; + m_mgNextp = nullptr; m_markVars.clear(); } @@ -292,13 +292,13 @@ private: // Is it a 'lhs = cond & value' or 'lhs = value & cond'? if (AstAnd* const andp = VN_CAST(rhsp, And)) { if (andp->lhsp()->sameTree(m_mgCondp) || andp->rhsp()->sameTree(m_mgCondp)) { - addToList(nodep, NULL); + addToList(nodep, nullptr); return; } } // Is it simply 'lhs = cond'? if (rhsp->sameTree(m_mgCondp)) { - addToList(nodep, NULL); + addToList(nodep, nullptr); return; } } @@ -321,10 +321,10 @@ private: public: // CONSTRUCTORS explicit MergeCondVisitor(AstNetlist* nodep) { - m_mgFirstp = NULL; - m_mgCondp = NULL; - m_mgLastp = NULL; - m_mgNextp = NULL; + m_mgFirstp = nullptr; + m_mgCondp = nullptr; + m_mgLastp = nullptr; + m_mgNextp = nullptr; m_listLenght = 0; m_markVars.clear(); iterate(nodep); diff --git a/src/V3Name.cpp b/src/V3Name.cpp index f68790964..45cfb2b61 100644 --- a/src/V3Name.cpp +++ b/src/V3Name.cpp @@ -137,7 +137,7 @@ private: public: // CONSTRUCTORS explicit NameVisitor(AstNetlist* nodep) { - m_modp = NULL; + m_modp = nullptr; iterate(nodep); } virtual ~NameVisitor() {} diff --git a/src/V3Number.cpp b/src/V3Number.cpp index d684b9ed5..ebe50b49e 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -1451,7 +1451,7 @@ V3Number& V3Number::opAtoN(const V3Number& lhs, int base) { str.erase(std::remove(str.begin(), str.end(), '_'), str.end()); errno = 0; - long v = std::strtol(str.c_str(), NULL, base); + long v = std::strtol(str.c_str(), nullptr, base); if (errno != 0) v = 0; return setLongS(static_cast(v)); } diff --git a/src/V3Number.h b/src/V3Number.h index 1426cfd6e..e19f4a767 100644 --- a/src/V3Number.h +++ b/src/V3Number.h @@ -164,9 +164,11 @@ public: opCleanThis(); } // Create from a verilog 32'hxxxx number. - V3Number(AstNode* nodep, const char* sourcep) { V3NumberCreate(nodep, sourcep, NULL); } + V3Number(AstNode* nodep, const char* sourcep) { V3NumberCreate(nodep, sourcep, nullptr); } class FileLined {}; // Fileline based errors, for parsing only, otherwise pass nodep - V3Number(FileLined, FileLine* fl, const char* sourcep) { V3NumberCreate(NULL, sourcep, fl); } + V3Number(FileLined, FileLine* fl, const char* sourcep) { + V3NumberCreate(nullptr, sourcep, fl); + } class VerilogStringLiteral {}; // For creator type-overload selection V3Number(VerilogStringLiteral, AstNode* nodep, const string& str); class String {}; @@ -175,11 +177,11 @@ public: setString(value); } explicit V3Number(const V3Number* nump, int width = 1) { - init(NULL, width); + init(nullptr, width); m_fileline = nump->fileline(); } V3Number(const V3Number* nump, int width, uint32_t value) { - init(NULL, width); + init(nullptr, width); m_value[0] = value; opCleanThis(); m_fileline = nump->fileline(); diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 4f37c6202..e00f543e3 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -827,7 +827,7 @@ string V3Options::protectKeyDefaulted() { void V3Options::throwSigsegv() { // LCOV_EXCL_START #if !(defined(VL_CPPCHECK) || defined(__clang_analyzer__)) // clang-format off - { char* zp = NULL; *zp = 0; } // Intentional core dump, ignore warnings here + { char* zp = nullptr; *zp = 0; } // Intentional core dump, ignore warnings here // clang-format on #endif } // LCOV_EXCL_STOP @@ -1711,7 +1711,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) { for (std::vector::const_iterator it = args.begin(); it != args.end(); ++it) { argv.push_back(const_cast(it->c_str())); } - argv.push_back(NULL); // argv is NULL-terminated + argv.push_back(nullptr); // argv is nullptr-terminated parseOptsList(fl, optdir, static_cast(argv.size() - 1), argv.data()); } @@ -1904,7 +1904,7 @@ V3Options::V3Options() { addIncDirFallback("."); // Looks better than {long_cwd_path}/... } -V3Options::~V3Options() { VL_DO_CLEAR(delete m_impp, m_impp = NULL); } +V3Options::~V3Options() { VL_DO_CLEAR(delete m_impp, m_impp = nullptr); } void V3Options::setDebugMode(int level) { V3Error::debugDefault(level); diff --git a/src/V3Order.cpp b/src/V3Order.cpp index d1b197728..966e34771 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -189,11 +189,11 @@ class OrderUser { // Stored in AstVarScope::user1p, a list of all the various vertices // that can exist for one given variable private: - OrderVarVertex* m_vertexp[WV_MAX]; // Vertex of each type (if non NULL) + OrderVarVertex* m_vertexp[WV_MAX]; // Vertex of each type (if non nullptr) public: // METHODS OrderVarVertex* newVarUserVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varscp, - WhichVertex type, bool* createdp = NULL) { + WhichVertex type, bool* createdp = nullptr) { UASSERT_OBJ(type < WV_MAX, varscp, "Bad case"); OrderVarVertex* vertexp = m_vertexp[type]; if (!vertexp) { @@ -217,7 +217,7 @@ public: public: // CONSTRUCTORS OrderUser() { - for (int i = 0; i < WV_MAX; i++) m_vertexp[i] = NULL; + for (int i = 0; i < WV_MAX; i++) m_vertexp[i] = nullptr; } ~OrderUser() {} }; @@ -441,7 +441,7 @@ public: public: // Clients of ProcessMoveBuildGraph must supply MoveVertexMaker // which creates new T_MoveVertex's. Each new vertex wraps lvertexp - // (which may be NULL.) + // (which may be nullptr.) virtual T_MoveVertex* makeVertexp( // OrderLogicVertex* lvertexp, const OrderEitherVertex* varVertexp, const AstScope* scopep, const AstSenTree* domainp) @@ -484,8 +484,8 @@ public: // For each logic node, make a T_MoveVertex for (V3GraphVertex* itp = m_graphp->verticesBeginp(); itp; itp = itp->verticesNextp()) { if (OrderLogicVertex* lvertexp = dynamic_cast(itp)) { - T_MoveVertex* moveVxp = m_vxMakerp->makeVertexp(lvertexp, NULL, lvertexp->scopep(), - lvertexp->domainp()); + T_MoveVertex* moveVxp = m_vxMakerp->makeVertexp( + lvertexp, nullptr, lvertexp->scopep(), lvertexp->domainp()); if (moveVxp) { // Cross link so we can find it later m_logic2move[lvertexp] = moveVxp; @@ -532,14 +532,14 @@ private: const OrderEitherVertex* eithp = dynamic_cast(nonLogicVxp); T_MoveVertex* newMoveVxp - = m_vxMakerp->makeVertexp(NULL, eithp, eithp->scopep(), domainp); + = m_vxMakerp->makeVertexp(nullptr, eithp, eithp->scopep(), domainp); m_var2move[key] = newMoveVxp; // Find downstream logics that depend on (var, domain) if (!iterate(newMoveVxp, edgep->top(), domainp)) { // No downstream dependencies, so remove this // intermediate vertex. - m_var2move[key] = NULL; + m_var2move[key] = nullptr; m_vxMakerp->freeVertexp(newMoveVxp); continue; } @@ -596,7 +596,7 @@ public: const AstScope* scopep, const AstSenTree* domainp) { // Exclude initial/settle logic from the mtasks graph. // We'll output time-zero logic separately. - if (domainp->hasInitial() || domainp->hasSettle()) return NULL; + if (domainp->hasInitial() || domainp->hasSettle()) return nullptr; return new MTaskMoveVertex(m_pomGraphp, lvertexp, varVertexp, scopep, domainp); } void freeVertexp(MTaskMoveVertex* freeMep) { freeMep->unlinkDelete(m_pomGraphp); } @@ -664,7 +664,7 @@ private: AstSenTree* m_comboDomainp; // Combo activation tree AstSenTree* m_deleteDomainp; // Delete this from tree OrderInputsVertex* m_inputsVxp; // Top level vertex all inputs point from - OrderLogicVertex* m_logicVxp; // Current statement being tracked, NULL=ignored + OrderLogicVertex* m_logicVxp; // Current statement being tracked, nullptr=ignored AstTopScope* m_topScopep; // Current top scope being processed AstScope* m_scopetopp; // Scope under TOPSCOPE AstNodeModule* m_modp; // Current module @@ -702,10 +702,10 @@ private: UINFO(4, " STMT " << nodep << endl); // VV***** We reset user4p() AstNode::user4ClearTree(); - UASSERT_OBJ(m_activep && m_activep->sensesp(), nodep, "NULL"); + UASSERT_OBJ(m_activep && m_activep->sensesp(), nodep, "nullptr"); // If inside combo logic, ignore the domain, we'll assign one based on interconnect AstSenTree* startDomainp = m_activep->sensesp(); - if (startDomainp->hasCombo()) startDomainp = NULL; + if (startDomainp->hasCombo()) startDomainp = nullptr; m_logicVxp = new OrderLogicVertex(&m_graph, m_scopep, startDomainp, nodep); if (m_activeSenVxp) { // If in a clocked activation, add a link from the sensitivity to this block @@ -714,12 +714,12 @@ private: } nodep->user1p(m_modp); iterateChildren(nodep); - m_logicVxp = NULL; + m_logicVxp = nullptr; } } OrderVarVertex* newVarUserVertex(AstVarScope* varscp, WhichVertex type, - bool* createdp = NULL) { + bool* createdp = nullptr) { if (!varscp->user1p()) { OrderUser* newup = new OrderUser(); m_orderUserps.push_back(newup); @@ -759,8 +759,8 @@ private: Logics m_logics; ExecMTask* m_execMTaskp; MTaskState() - : m_mtaskBodyp(NULL) - , m_execMTaskp(NULL) {} + : m_mtaskBodyp(nullptr) + , m_execMTaskp(nullptr) {} }; void processMTasks(); typedef enum { LOGIC_INITIAL, LOGIC_SETTLE } InitialLogicE; @@ -786,8 +786,8 @@ private: void nodeMarkCircular(OrderVarVertex* vertexp, OrderEdge* edgep) { AstVarScope* nodep = vertexp->varScp(); - OrderLogicVertex* fromLVtxp = NULL; - OrderLogicVertex* toLVtxp = NULL; + OrderLogicVertex* fromLVtxp = nullptr; + OrderLogicVertex* toLVtxp = nullptr; if (edgep) { fromLVtxp = dynamic_cast(edgep->fromp()); toLVtxp = dynamic_cast(edgep->top()); @@ -951,7 +951,7 @@ private: // We're finished, complete the topscopes if (m_topScopep) { process(); - m_topScopep = NULL; + m_topScopep = nullptr; } } virtual void visit(AstTopScope* nodep) override { @@ -962,7 +962,7 @@ private: AstNode::user1ClearTree(); AstNode::user3ClearTree(); m_graph.clear(); - m_activep = NULL; + m_activep = nullptr; m_topScopep = nodep; m_scopetopp = nodep->scopep(); // Find global SenTrees @@ -980,8 +980,8 @@ private: pushDeletep(m_deleteDomainp); // Cleanup when done UINFO(5, " DeleteDomain = " << m_deleteDomainp << endl); // Base vertices - m_activeSenVxp = NULL; - m_inputsVxp = new OrderInputsVertex(&m_graph, NULL); + m_activeSenVxp = nullptr; + m_inputsVxp = new OrderInputsVertex(&m_graph, nullptr); // iterateChildren(nodep); // Done topscope, erase extra user information @@ -1001,18 +1001,18 @@ private: virtual void visit(AstScope* nodep) override { UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; - m_logicVxp = NULL; - m_activeSenVxp = NULL; + m_logicVxp = nullptr; + m_activeSenVxp = nullptr; nodep->user1p(m_modp); // Iterate iterateChildren(nodep); - m_scopep = NULL; + m_scopep = nullptr; } virtual void visit(AstActive* nodep) override { // Create required activation blocks and add to module UINFO(4, " ACTIVE " << nodep << endl); m_activep = nodep; - m_activeSenVxp = NULL; + m_activeSenVxp = nullptr; m_inClocked = nodep->hasClocked(); // Grab the sensitivity list UASSERT_OBJ(!nodep->sensesStorep(), nodep, @@ -1020,8 +1020,8 @@ private: iterate(nodep->sensesp()); // Collect statements under it iterateChildren(nodep); - m_activep = NULL; - m_activeSenVxp = NULL; + m_activep = nullptr; + m_activeSenVxp = nullptr; m_inClocked = false; } virtual void visit(AstVarScope* nodep) override { @@ -1222,21 +1222,21 @@ private: public: // CONSTRUCTORS OrderVisitor() { - m_topScopep = NULL; - m_scopetopp = NULL; - m_modp = NULL; - m_scopep = NULL; - m_activep = NULL; + m_topScopep = nullptr; + m_scopetopp = nullptr; + m_modp = nullptr; + m_scopep = nullptr; + m_activep = nullptr; m_inSenTree = false; m_inClocked = false; m_inClkAss = false; m_inPre = m_inPost = false; - m_comboDomainp = NULL; - m_deleteDomainp = NULL; - m_inputsVxp = NULL; - m_activeSenVxp = NULL; - m_logicVxp = NULL; - m_pomNewFuncp = NULL; + m_comboDomainp = nullptr; + m_deleteDomainp = nullptr; + m_inputsVxp = nullptr; + m_activeSenVxp = nullptr; + m_logicVxp = nullptr; + m_pomNewFuncp = nullptr; m_pomNewStmts = 0; if (debug()) m_graph.debug(5); // 3 is default if global debug; we want acyc debugging } @@ -1423,10 +1423,10 @@ void OrderVisitor::processCircular() { // other tests such as t_gated_clk_1. if (!v3Global.opt.orderClockDly()) { UINFO(5, "Circular Clock, no-order-clock-delay " << vvertexp << endl); - nodeMarkCircular(vvertexp, NULL); + nodeMarkCircular(vvertexp, nullptr); } else if (vvertexp->isDelayed()) { UINFO(5, "Circular Clock, delayed " << vvertexp << endl); - nodeMarkCircular(vvertexp, NULL); + nodeMarkCircular(vvertexp, nullptr); } else { UINFO(5, "Circular Clock, not delayed " << vvertexp << endl); } @@ -1494,7 +1494,7 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) { if (vertexp->domainp()) return; // Already processed, or sequential logic UINFO(5, " pdi: " << vertexp << endl); OrderVarVertex* vvertexp = dynamic_cast(vertexp); - AstSenTree* domainp = NULL; + AstSenTree* domainp = nullptr; UASSERT(m_comboDomainp, "not preset"); if (vvertexp && vvertexp->varScp()->varp()->isNonOutput()) domainp = m_comboDomainp; if (vvertexp && vvertexp->varScp()->isCircular()) domainp = m_comboDomainp; @@ -1534,7 +1534,7 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) { UASSERT_OBJ(newtree2p, fromVertexp->domainp(), "No senitem found under clocked domain"); newtreep->addSensesp(newtree2p); - newtree2p = NULL; // Below edit may replace it + newtree2p = nullptr; // Below edit may replace it V3Const::constifyExpensiveEdit(newtreep); // Remove duplicates newtreep->multi(true); // Comment that it was made from 2 clock domains domainp = m_finder.getSenTree(newtreep); @@ -1617,7 +1617,7 @@ void OrderVisitor::processMoveBuildGraph() { UINFO(5, " MoveBuildGraph\n"); processMoveClear(); m_pomGraph - .userClearVertices(); // Vertex::user->OrderMoveVertex*, last edge added or NULL=none + .userClearVertices(); // Vertex::user->OrderMoveVertex*, last edge added or nullptr=none OrderMoveVertexMaker createOrderMoveVertex(&m_pomGraph, &m_pomWaiting); ProcessMoveBuildGraph serialPMBG(&m_graph, &m_pomGraph, @@ -1654,13 +1654,14 @@ void OrderVisitor::processMove() { while (domScopep) { UINFO(6, " MoveDomain l=" << domScopep->domainp() << endl); // Process all nodes ready under same domain & scope - m_pomNewFuncp = NULL; + m_pomNewFuncp = nullptr; while (OrderMoveVertex* vertexp = domScopep->readyVertices().begin()) { // lintok-begin-on-ref processMoveOne(vertexp, domScopep, 1); } - // Done with scope/domain pair, pick new scope under same domain, or NULL if none left - OrderMoveDomScope* domScopeNextp = NULL; + // Done with scope/domain pair, pick new scope under same domain, or nullptr if none + // left + OrderMoveDomScope* domScopeNextp = nullptr; for (OrderMoveDomScope* huntp = m_pomReadyDomScope.begin(); huntp; huntp = huntp->readyDomScopeNextp()) { if (huntp->domainp() == domScopep->domainp()) { @@ -1745,12 +1746,12 @@ void OrderVisitor::processMoveOne(OrderMoveVertex* vertexp, OrderMoveDomScope* d AstActive* OrderVisitor::processMoveOneLogic(const OrderLogicVertex* lvertexp, AstCFunc*& newFuncpr, int& newStmtsr) { - AstActive* activep = NULL; + AstActive* activep = nullptr; AstScope* scopep = lvertexp->scopep(); AstSenTree* domainp = lvertexp->domainp(); AstNode* nodep = lvertexp->nodep(); AstNodeModule* modp = VN_CAST(scopep->user1p(), NodeModule); // Stashed by visitor func - UASSERT(modp, "NULL"); + UASSERT(modp, "nullptr"); if (VN_IS(nodep, SenTree)) { // Just ignore sensitivities, we'll deal with them when we move statements that need them } else { // Normal logic @@ -1759,7 +1760,7 @@ AstActive* OrderVisitor::processMoveOneLogic(const OrderLogicVertex* lvertexp, || (v3Global.opt.outputSplitCFuncs() && v3Global.opt.outputSplitCFuncs() < newStmtsr)) { // Put every statement into a unique function to ease profiling or reduce function size - newFuncpr = NULL; + newFuncpr = nullptr; } if (!newFuncpr && domainp != m_deleteDomainp) { string name = cfuncName(modp, domainp, scopep, nodep); @@ -1800,8 +1801,8 @@ void OrderVisitor::processMTasksInitial(InitialLogicE logic_type) { // mtask partition, aren't eligible for parallelism. // int initStmts = 0; - AstCFunc* initCFunc = NULL; - AstScope* lastScopep = NULL; + AstCFunc* initCFunc = nullptr; + AstScope* lastScopep = nullptr; for (V3GraphVertex* initVxp = m_graph.verticesBeginp(); initVxp; initVxp = initVxp->verticesNextp()) { OrderLogicVertex* initp = dynamic_cast(initVxp); @@ -1810,7 +1811,7 @@ void OrderVisitor::processMTasksInitial(InitialLogicE logic_type) { if ((logic_type == LOGIC_SETTLE) && !initp->domainp()->hasSettle()) continue; if (initp->scopep() != lastScopep) { // Start new cfunc, don't let the cfunc cross scopes - initCFunc = NULL; + initCFunc = nullptr; lastScopep = initp->scopep(); } AstActive* newActivep = processMoveOneLogic(initp, initCFunc /*ref*/, initStmts /*ref*/); @@ -1911,15 +1912,15 @@ void OrderVisitor::processMTasks() { // Create leaf CFunc's to run this mtask's logic, // and create a set of AstActive's to call those CFuncs. // Add the AstActive's into the AstMTaskBody. - const AstSenTree* last_domainp = NULL; - AstCFunc* leafCFuncp = NULL; + const AstSenTree* last_domainp = nullptr; + AstCFunc* leafCFuncp = nullptr; int leafStmts = 0; for (MTaskState::Logics::iterator it = state.m_logics.begin(); it != state.m_logics.end(); ++it) { const OrderLogicVertex* logicp = *it; if (logicp->domainp() != last_domainp) { // Start a new leaf function. - leafCFuncp = NULL; + leafCFuncp = nullptr; } last_domainp = logicp->domainp(); diff --git a/src/V3OrderGraph.h b/src/V3OrderGraph.h index ecc889c47..3ef3a183b 100644 --- a/src/V3OrderGraph.h +++ b/src/V3OrderGraph.h @@ -123,7 +123,7 @@ public: class OrderEitherVertex : public V3GraphVertex { AstScope* m_scopep; // Scope the vertex is in - AstSenTree* m_domainp; // Clock domain (NULL = to be computed as we iterate) + AstSenTree* m_domainp; // Clock domain (nullptr = to be computed as we iterate) bool m_isFromInput; // From input, or derived therefrom (conservatively false) protected: OrderEitherVertex(V3Graph* graphp, const OrderEitherVertex& old) @@ -158,7 +158,7 @@ class OrderInputsVertex : public OrderEitherVertex { public: OrderInputsVertex(V3Graph* graphp, AstSenTree* domainp) - : OrderEitherVertex(graphp, NULL, domainp) { + : OrderEitherVertex(graphp, nullptr, domainp) { isFromInput(true); // By definition } virtual ~OrderInputsVertex() {} @@ -211,7 +211,7 @@ protected: public: OrderVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) - : OrderEitherVertex(graphp, scopep, NULL) + : OrderEitherVertex(graphp, scopep, nullptr) , m_varScp(varScp) , m_isClock(false) , m_isDelayed(false) {} @@ -331,11 +331,11 @@ public: : V3GraphVertex(graphp) , m_logicp(logicp) , m_state(POM_WAIT) - , m_domScopep(NULL) {} + , m_domScopep(nullptr) {} virtual ~OrderMoveVertex() {} virtual OrderMoveVertex* clone(V3Graph* graphp) const { v3fatalSrc("Unsupported"); - return NULL; + return nullptr; } // METHODS virtual OrderVEdgeType type() const { return OrderVEdgeType::VERTEX_MOVE; } @@ -350,7 +350,7 @@ public: if (logicp()) { return logicp()->fileline(); } else { - return NULL; + return nullptr; } } virtual string name() const { @@ -405,7 +405,7 @@ public: virtual ~MTaskMoveVertex() {} virtual MTaskMoveVertex* clone(V3Graph* graphp) const { v3fatalSrc("Unsupported"); - return NULL; + return nullptr; } virtual OrderVEdgeType type() const { return OrderVEdgeType::VERTEX_MOVE; } virtual string dotColor() const { diff --git a/src/V3Os.cpp b/src/V3Os.cpp index 97b1ce552..3d1ec31d7 100644 --- a/src/V3Os.cpp +++ b/src/V3Os.cpp @@ -259,7 +259,7 @@ string V3Os::trueRandom(size_t size) { // Note: std::string.data() returns a non-const Char* from C++17 onwards. // For pre-C++17, this cast is OK in practice, even though it's UB. #if defined(_WIN32) || defined(__MINGW32__) - NTSTATUS hr = BCryptGenRandom(NULL, reinterpret_cast(data), size, + NTSTATUS hr = BCryptGenRandom(nullptr, reinterpret_cast(data), size, BCRYPT_USE_SYSTEM_PREFERRED_RNG); if (!BCRYPT_SUCCESS(hr)) { v3fatal("Could not acquire random data."); } #else @@ -290,7 +290,7 @@ uint64_t V3Os::timeUsecs() { #else // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) timeval tv; - if (gettimeofday(&tv, NULL) < 0) return 0; + if (gettimeofday(&tv, nullptr) < 0) return 0; return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; #endif } diff --git a/src/V3Param.cpp b/src/V3Param.cpp index 927166e20..258eb00a2 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -150,7 +150,7 @@ public: AstNodeModule* findByParams(const string& origName, AstPin* firstPinp, const AstNodeModule* modp) { if (m_hierBlockOptsByOrigName.find(origName) == m_hierBlockOptsByOrigName.end()) { - return NULL; + return nullptr; } // This module is a hierarchical block. Need to replace it by the protect-lib wrapper. const std::pair candidates @@ -191,7 +191,7 @@ public: hierIt->second->mangledName() << " is not found"); HierBlockModMap::const_iterator it = m_hierBlockMod.find(hierIt->second->mangledName()); - if (it == m_hierBlockMod.end()) return NULL; + if (it == m_hierBlockMod.end()) return nullptr; return it->second; } }; @@ -332,7 +332,7 @@ private: if (AstBracketArrayDType* adtypep = VN_CAST(nodep, BracketArrayDType)) { return adtypep->subDTypep(); } - return NULL; + return nullptr; } void collectPins(CloneMap* clonemapp, AstNodeModule* modp) { // Grab all I/O so we can remap our pins later @@ -475,12 +475,12 @@ private: for (CellList::iterator it = m_cellps.begin(); it != m_cellps.end(); ++it) { AstCell* cellp = *it; if (string* genHierNamep = (string*)cellp->user5p()) { - cellp->user5p(NULL); + cellp->user5p(nullptr); VL_DO_DANGLING(delete genHierNamep, genHierNamep); } } m_cellps.clear(); - m_modp = NULL; + m_modp = nullptr; } } } @@ -519,7 +519,7 @@ private: virtual void visit(AstNodeFTask* nodep) override { m_ftaskp = nodep; iterateChildren(nodep); - m_ftaskp = NULL; + m_ftaskp = nullptr; } // Make sure all parameters are constantified @@ -621,7 +621,7 @@ private: } } } - nodep->varp(NULL); // Needs relink, as may remove pointed-to var + nodep->varp(nullptr); // Needs relink, as may remove pointed-to var } virtual void visit(AstUnlinkedRef* nodep) override { @@ -730,7 +730,7 @@ private: } virtual void visit(AstGenCase* nodep) override { UINFO(9, " GENCASE " << nodep << endl); - AstNode* keepp = NULL; + AstNode* keepp = nullptr; iterateAndNextNull(nodep->exprp()); V3Case::caseLint(nodep); V3Width::widthParamsEdit(nodep); // Param typed widthing will NOT recurse the body, @@ -786,8 +786,8 @@ public: explicit ParamVisitor(AstNetlist* nodep) : m_hierBlocks(v3Global.opt.hierBlocks(), nodep) { m_longId = 0; - m_ftaskp = NULL; - m_modp = NULL; + m_ftaskp = nullptr; + m_modp = nullptr; m_nextValue = 1; for (AstNodeModule* modp = nodep->modulesp(); modp; modp = VN_CAST(modp->nextp(), NodeModule)) { @@ -899,7 +899,7 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) { portIrefp = VN_CAST(arraySubDTypep(modvarp->subDTypep()), IfaceRefDType); } - AstIfaceRefDType* pinIrefp = NULL; + AstIfaceRefDType* pinIrefp = nullptr; AstNode* exprp = pinp->exprp(); if (exprp && VN_IS(exprp, VarRef) && VN_CAST(exprp, VarRef)->varp() && VN_CAST(exprp, VarRef)->varp()->subDTypep() @@ -989,7 +989,7 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) { // // Already made this flavor? - AstNodeModule* cellmodp = NULL; + AstNodeModule* cellmodp = nullptr; ModNameMap::iterator iter = m_modNameMap.find(newname); if (iter != m_modNameMap.end()) cellmodp = iter->second.m_modp; if (!cellmodp) { diff --git a/src/V3ParseGrammar.cpp b/src/V3ParseGrammar.cpp index 00c3f4f23..ae478171d 100644 --- a/src/V3ParseGrammar.cpp +++ b/src/V3ParseGrammar.cpp @@ -32,7 +32,7 @@ int V3ParseImp::bisonParse() { const char* V3ParseImp::tokenName(int token) { #if YYDEBUG || YYERROR_VERBOSE - static const char** nameTablep = NULL; + static const char** nameTablep = nullptr; if (!nameTablep) { int size; for (size = 0; yytname[size]; ++size) {} @@ -59,7 +59,7 @@ const char* V3ParseImp::tokenName(int token) { void V3ParseImp::parserClear() { // Clear up any dynamic memory V3Parser required - VARDTYPE(NULL); + VARDTYPE(nullptr); } //====================================================================== @@ -67,8 +67,8 @@ void V3ParseImp::parserClear() { AstNode* V3ParseGrammar::argWrapList(AstNode* nodep) { // Convert list of expressions to list of arguments - if (!nodep) return NULL; - AstNode* outp = NULL; + if (!nodep) return nullptr; + AstNode* outp = nullptr; AstBegin* tempp = new AstBegin(nodep->fileline(), "[EditWrapper]", nodep); while (nodep) { AstNode* nextp = nodep->nextp(); @@ -152,7 +152,7 @@ AstVar* V3ParseGrammar::createVariable(FileLine* fileline, const string& name, if (GRAMMARP->m_varIO == VDirection::NONE && GRAMMARP->m_varDecl == AstVarType::PORT) { // Just a port list with variable name (not v2k format); AstPort already created if (dtypep) fileline->v3warn(E_UNSUPPORTED, "Unsupported: Ranges ignored in port-lists"); - return NULL; + return nullptr; } if (GRAMMARP->m_varDecl == AstVarType::WREAL) { // dtypep might not be null, might be implicit LOGIC before we knew better diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index 72883e4e3..e53135a0e 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -41,7 +41,7 @@ //====================================================================== // Globals -V3ParseImp* V3ParseImp::s_parsep = NULL; +V3ParseImp* V3ParseImp::s_parsep = nullptr; int V3ParseSym::s_anonNum = 0; @@ -195,7 +195,7 @@ double V3ParseImp::lexParseTimenum(const char* textp) { if (*sp != '_') *dp++ = *sp; } *dp++ = '\0'; - double d = strtod(strgp, NULL); + double d = strtod(strgp, nullptr); string suffix(sp); double divisor = 1; @@ -293,7 +293,7 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i // Create output file with all the preprocessor output we buffered up string vppfilename = v3Global.opt.hierTopDataDir() + "/" + v3Global.opt.prefix() + "_" + modname + ".vpp"; - std::ofstream* ofp = NULL; + std::ofstream* ofp = nullptr; std::ostream* osp; if (v3Global.opt.preprocOnly()) { osp = &cout; @@ -489,7 +489,7 @@ void V3ParseImp::tokenPipelineSym() { // if (debug() >= 7) V3ParseImp::parsep()->symp()->dump(cout, " -symtree: "); foundp = look_underp->findIdFallback(*(yylval.strp)); // "consume" it. Must set again if want another token under temp scope - V3ParseImp::parsep()->symp()->nextId(NULL); + V3ParseImp::parsep()->symp()->nextId(nullptr); } else { UINFO(7, " tokenPipelineSym: find upward " << V3ParseImp::parsep()->symp()->symCurrentp() << " for '" @@ -519,10 +519,10 @@ void V3ParseImp::tokenPipelineSym() { && (*(yylval.strp) == "mailbox" // IEEE-standard class || *(yylval.strp) == "process" // IEEE-standard class || *(yylval.strp) == "semaphore")) { // IEEE-standard class - yylval.scp = NULL; + yylval.scp = nullptr; if (token == yaID__LEX) token = yaID__aTYPE; } else { // Not found - yylval.scp = NULL; + yylval.scp = nullptr; if (token == yaID__CC) { // IEEE does require this, but we may relax this as UVM breaks it, so allow bbox // for today @@ -550,7 +550,7 @@ int V3ParseImp::tokenToBison() { tokenPipelineSym(); // sets yylval m_bisonLastFileline = yylval.fl; - // yylval.scp = NULL; // Symbol table not yet needed - no packages + // yylval.scp = nullptr; // Symbol table not yet needed - no packages if (debugFlex() >= 6 || debugBison() >= 6) { // --debugi-flex and --debugi-bison cout << "tokenToBison " << yylval << endl; } @@ -579,7 +579,7 @@ V3Parse::V3Parse(AstNetlist* rootp, VInFilter* filterp, V3ParseSym* symp) { m_impp = new V3ParseImp(rootp, filterp, symp); } V3Parse::~V3Parse() { // - VL_DO_CLEAR(delete m_impp, m_impp = NULL); + VL_DO_CLEAR(delete m_impp, m_impp = nullptr); } void V3Parse::parseFile(FileLine* fileline, const string& modname, bool inLibrary, const string& errmsg) { diff --git a/src/V3ParseImp.h b/src/V3ParseImp.h index d9d5ae2f1..ac26a6ca3 100644 --- a/src/V3ParseImp.h +++ b/src/V3ParseImp.h @@ -180,7 +180,7 @@ class V3ParseImp { std::deque m_lexLintState; // Current lint state for save/restore std::deque m_ppBuffers; // Preprocessor->lex buffer of characters to process - AstNode* m_tagNodep; // Points to the node to set to m_tag or NULL to not set. + AstNode* m_tagNodep; // Points to the node to set to m_tag or nullptr to not set. VTimescale m_timeLastUnit; // Last `timescale's unit public: @@ -304,13 +304,13 @@ public: : m_rootp(rootp) , m_filterp(filterp) , m_symp(parserSymp) { - m_lexFileline = NULL; - m_lexerp = NULL; + m_lexFileline = nullptr; + m_lexerp = nullptr; m_inLibrary = false; m_lexKwdDepth = 0; m_lexKwdLast = stateVerilogRecent(); m_lexPrevToken = 0; - m_tagNodep = NULL; + m_tagNodep = nullptr; m_timeLastUnit = v3Global.opt.timeDefaultUnit(); } ~V3ParseImp(); diff --git a/src/V3ParseLex.cpp b/src/V3ParseLex.cpp index 06b2a4024..6b316ff18 100644 --- a/src/V3ParseLex.cpp +++ b/src/V3ParseLex.cpp @@ -36,7 +36,7 @@ class V3Lexer : public V3LexerBase { public: // CONSTRUCTORS V3Lexer() - : V3LexerBase(NULL) {} + : V3LexerBase(nullptr) {} ~V3Lexer() {} // METHODS void unputString(const char* textp, size_t length) { @@ -68,5 +68,5 @@ void V3ParseImp::lexNew() { } void V3ParseImp::lexDestroy() { - if (m_lexerp) VL_DO_CLEAR(delete m_lexerp, m_lexerp = NULL); + if (m_lexerp) VL_DO_CLEAR(delete m_lexerp, m_lexerp = nullptr); } diff --git a/src/V3ParseSym.h b/src/V3ParseSym.h index 2befc7669..4462a5c38 100644 --- a/src/V3ParseSym.h +++ b/src/V3ParseSym.h @@ -48,7 +48,7 @@ public: : m_syms(rootp) { s_anonNum = 0; // Number of next anonymous object pushScope(findNewTable(rootp)); - m_symTableNextId = NULL; + m_symTableNextId = nullptr; m_symCurrentp = symCurrentp(); } ~V3ParseSym() {} @@ -77,11 +77,11 @@ public: UINFO(9, "symTableNextId under " << entp << "-" << entp->type().ascii() << endl); m_symTableNextId = getTable(entp); } else { - UINFO(9, "symTableNextId under NULL" << endl); - m_symTableNextId = NULL; + UINFO(9, "symTableNextId under nullptr" << endl); + m_symTableNextId = nullptr; } } - void reinsert(AstNode* nodep, VSymEnt* parentp = NULL) { + void reinsert(AstNode* nodep, VSymEnt* parentp = nullptr) { reinsert(nodep, parentp, nodep->name()); } void reinsert(AstNode* nodep, VSymEnt* parentp, string name) { @@ -91,7 +91,7 @@ public: } parentp->reinsert(name, findNewTable(nodep)); } - void pushNew(AstNode* nodep) { pushNewUnder(nodep, NULL); } + void pushNew(AstNode* nodep) { pushNewUnder(nodep, nullptr); } void pushNewUnder(AstNode* nodep, VSymEnt* parentp) { if (!parentp) parentp = symCurrentp(); VSymEnt* symp @@ -104,7 +104,7 @@ public: if (parentp) { pushNewUnder(nodep, findNewTable(parentp)); } else { - pushNewUnder(nodep, NULL); + pushNewUnder(nodep, nullptr); } } void pushScope(VSymEnt* symp) { @@ -142,7 +142,7 @@ public: if (foundp) { return foundp->nodep(); } else { - return NULL; + return nullptr; } } void importExtends(AstNode* classp) { diff --git a/src/V3Partition.cpp b/src/V3Partition.cpp index b112dbff4..b69dced2e 100644 --- a/src/V3Partition.cpp +++ b/src/V3Partition.cpp @@ -628,7 +628,7 @@ private: followp = followp->outNextp()) { if (followp == excludedEdgep) continue; LogicMTask* nextp = dynamic_cast(followp->top()); - if (pathExistsFromInternal(nextp, top, NULL, generation)) return true; + if (pathExistsFromInternal(nextp, top, nullptr, generation)) return true; } return false; } @@ -636,8 +636,8 @@ private: // True if there's a path from 'fromp' to 'top' excluding // 'excludedEdgep', false otherwise. // - // 'excludedEdgep' may be NULL in which case no edge is excluded. If - // 'excludedEdgep' is non-NULL it must connect fromp and top. + // 'excludedEdgep' may be nullptr in which case no edge is excluded. If + // 'excludedEdgep' is non-nullptr it must connect fromp and top. // // TODO: consider changing this API to the 'isTransitiveEdge' API // used by GraphPathChecker @@ -655,7 +655,7 @@ public: if (osp->fail()) v3fatalStatic("Can't write " << filename); // Find start vertex with longest CP - const LogicMTask* startp = NULL; + const LogicMTask* startp = nullptr; for (const V3GraphVertex* vxp = graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { const LogicMTask* mtaskp = dynamic_cast(vxp); @@ -679,7 +679,7 @@ public: const EdgeSet& children = nextp->m_edges[GraphWay::FORWARD]; EdgeSet::const_reverse_iterator it = children.rbegin(); if (it == children.rend()) { - nextp = NULL; + nextp = nullptr; } else { nextp = (*it).key(); } @@ -773,8 +773,8 @@ public: LogicMTask* ap() const { return m_ap; } LogicMTask* bp() const { return m_bp; } bool mergeWouldCreateCycle() const { - return (LogicMTask::pathExistsFrom(m_ap, m_bp, NULL) - || LogicMTask::pathExistsFrom(m_bp, m_ap, NULL)); + return (LogicMTask::pathExistsFrom(m_ap, m_bp, nullptr) + || LogicMTask::pathExistsFrom(m_bp, m_ap, nullptr)); } bool operator<(const SiblingMC& other) const { if (m_ap->id() < other.m_ap->id()) { return true; } @@ -806,7 +806,7 @@ public: return LogicMTask::pathExistsFrom(fromMTaskp(), toMTaskp(), this); } static MTaskEdge* cast(V3GraphEdge* edgep) { - if (!edgep) return NULL; + if (!edgep) return nullptr; MTaskEdge* resultp = dynamic_cast(edgep); UASSERT(resultp, "Failed to cast in MTaskEdge::cast"); return resultp; @@ -1291,10 +1291,10 @@ private: } void contract(MergeCandidate* mergeCanp) { - LogicMTask* top = NULL; - LogicMTask* fromp = NULL; + LogicMTask* top = nullptr; + LogicMTask* fromp = nullptr; MTaskEdge* mergeEdgep = dynamic_cast(mergeCanp); - SiblingMC* mergeSibsp = NULL; + SiblingMC* mergeSibsp = nullptr; if (mergeEdgep) { top = dynamic_cast(mergeEdgep->top()); fromp = dynamic_cast(mergeEdgep->fromp()); @@ -1340,7 +1340,7 @@ private: // Remove and free the connecting edge. Must do this before // propagating CP's below. m_sb.removeElem(mergeCanp); - VL_DO_CLEAR(mergeEdgep->unlinkDelete(), mergeEdgep = NULL); + VL_DO_CLEAR(mergeEdgep->unlinkDelete(), mergeEdgep = nullptr); } // This also updates cost and stepCost on recipientp @@ -1390,7 +1390,7 @@ private: partMergeEdgesFrom(m_mtasksp, recipientp, donorp, &m_sb); // Delete the donorp mtask from the graph - VL_DO_CLEAR(donorp->unlinkDelete(m_mtasksp), donorp = NULL); + VL_DO_CLEAR(donorp->unlinkDelete(m_mtasksp), donorp = nullptr); m_mergesSinceRescore++; @@ -1564,9 +1564,9 @@ private: // NOTE: To get a dot file run with --debugi-V3Partition 4 or more. vluint64_t startUsecs = V3Os::timeUsecs(); V3Graph mtasks; - LogicMTask* lastp = NULL; + LogicMTask* lastp = nullptr; for (unsigned i = 0; i < chain_len; ++i) { - LogicMTask* mtp = new LogicMTask(&mtasks, NULL); + LogicMTask* mtp = new LogicMTask(&mtasks, nullptr); mtp->setCost(1); if (lastp) { new MTaskEdge(&mtasks, lastp, mtp, 1); } lastp = mtp; @@ -1615,17 +1615,17 @@ private: static void selfTestX() { // NOTE: To get a dot file run with --debugi-V3Partition 4 or more. V3Graph mtasks; - LogicMTask* center = new LogicMTask(&mtasks, NULL); + LogicMTask* center = new LogicMTask(&mtasks, nullptr); center->setCost(1); unsigned i; for (i = 0; i < 50; ++i) { - LogicMTask* mtp = new LogicMTask(&mtasks, NULL); + LogicMTask* mtp = new LogicMTask(&mtasks, nullptr); mtp->setCost(1); // Edge from every input -> center new MTaskEdge(&mtasks, mtp, center, 1); } for (i = 0; i < 50; ++i) { - LogicMTask* mtp = new LogicMTask(&mtasks, NULL); + LogicMTask* mtp = new LogicMTask(&mtasks, nullptr); mtp->setCost(1); // Edge from center -> every output new MTaskEdge(&mtasks, center, mtp, 1); @@ -1661,7 +1661,7 @@ private: VL_UNCOPYABLE(PartContraction); }; -const GraphWay* PartContraction::s_shortestWaywardCpInclusiveWay = NULL; +const GraphWay* PartContraction::s_shortestWaywardCpInclusiveWay = nullptr; //###################################################################### // DpiImportCallVisitor @@ -1830,13 +1830,13 @@ private: } } void mergeSameRankTasks(TasksByRank* tasksByRankp) { - LogicMTask* lastMergedp = NULL; + LogicMTask* lastMergedp = nullptr; for (TasksByRank::iterator rankIt = tasksByRankp->begin(); rankIt != tasksByRankp->end(); ++rankIt) { // Find the largest node at this rank, merge into it. (If we // happen to find a huge node, this saves time in // partMergeEdgesFrom() versus merging into an arbitrary node.) - LogicMTask* mergedp = NULL; + LogicMTask* mergedp = nullptr; for (LogicMTaskSet::iterator it = rankIt->second.begin(); it != rankIt->second.end(); ++it) { LogicMTask* mtaskp = *it; @@ -1864,7 +1864,7 @@ private: // Move all vertices from donorp to mergedp mergedp->moveAllVerticesFrom(donorp); // Move edges from donorp to recipientp - partMergeEdgesFrom(m_mtasksp, mergedp, donorp, NULL); + partMergeEdgesFrom(m_mtasksp, mergedp, donorp, nullptr); // Remove donorp from the graph VL_DO_DANGLING(donorp->unlinkDelete(m_mtasksp), donorp); m_mergesDone++; @@ -2146,7 +2146,7 @@ public: // on each thread (in that thread's local time frame.) uint32_t bestTime = 0xffffffff; uint32_t bestTh = 0; - ExecMTask* bestMtaskp = NULL; + ExecMTask* bestMtaskp = nullptr; for (uint32_t th = 0; th < m_nThreads; ++th) { for (ReadyMTasks::iterator taskIt = m_ready.begin(); taskIt != m_ready.end(); ++taskIt) { @@ -2230,13 +2230,13 @@ public: // SELF TEST static void selfTest() { V3Graph graph; - ExecMTask* t0 = new ExecMTask(&graph, NULL, 0); + ExecMTask* t0 = new ExecMTask(&graph, nullptr, 0); t0->cost(1000); t0->priority(1100); - ExecMTask* t1 = new ExecMTask(&graph, NULL, 1); + ExecMTask* t1 = new ExecMTask(&graph, nullptr, 1); t1->cost(100); t1->priority(100); - ExecMTask* t2 = new ExecMTask(&graph, NULL, 2); + ExecMTask* t2 = new ExecMTask(&graph, nullptr, 2); t2->cost(100); t2->priority(100); @@ -2255,11 +2255,11 @@ public: UASSERT_SELFTEST(uint32_t, t1->thread(), 0); UASSERT_SELFTEST(bool, t1->threadRoot(), false); - UASSERT_SELFTEST(const void*, t1->packNextp(), NULL); + UASSERT_SELFTEST(const void*, t1->packNextp(), nullptr); UASSERT_SELFTEST(uint32_t, t2->thread(), 1); UASSERT_SELFTEST(bool, t2->threadRoot(), true); - UASSERT_SELFTEST(const void*, t2->packNextp(), NULL); + UASSERT_SELFTEST(const void*, t2->packNextp(), nullptr); // On its native thread, we see the actual end time for t0: UASSERT_SELFTEST(uint32_t, packer.completionTime(t0, 0), 1000); @@ -2378,7 +2378,7 @@ void V3Partition::setupMTaskDeps(V3Graph* mtasksp, const Vx2MTaskMap* vx2mtaskp) Vx2MTaskMap::const_iterator it = vx2mtaskp->find(top); UASSERT(it != vx2mtaskp->end(), "MTask map can't find id"); LogicMTask* otherMTaskp = it->second; - UASSERT(otherMTaskp, "NULL other Mtask"); + UASSERT(otherMTaskp, "nullptr other Mtask"); UASSERT_OBJ(otherMTaskp != mtaskp, mtaskp, "Would create a cycle edge"); // Don't create redundant edges. diff --git a/src/V3PartitionGraph.h b/src/V3PartitionGraph.h index 1c2abd59b..32880b026 100644 --- a/src/V3PartitionGraph.h +++ b/src/V3PartitionGraph.h @@ -75,7 +75,7 @@ public: , m_priority(0) , m_cost(0) , m_thread(0xffffffff) - , m_packNextp(NULL) + , m_packNextp(nullptr) , m_threadRoot(false) {} AstMTaskBody* bodyp() const { return m_bodyp; } virtual uint32_t id() const { return m_id; } diff --git a/src/V3PreLex.h b/src/V3PreLex.h index 71e684412..92af2a7cf 100644 --- a/src/V3PreLex.h +++ b/src/V3PreLex.h @@ -195,7 +195,7 @@ public: // Used only by V3PreLex.cpp and V3PreProc.cpp delete m_streampStack.top(); m_streampStack.pop(); } - VL_DO_CLEAR(yy_delete_buffer(m_bufferState), m_bufferState = NULL); + VL_DO_CLEAR(yy_delete_buffer(m_bufferState), m_bufferState = nullptr); } // Called by V3PreLex.l from lexer diff --git a/src/V3PreLex.l b/src/V3PreLex.l index 42765edb7..d706fc07c 100644 --- a/src/V3PreLex.l +++ b/src/V3PreLex.l @@ -34,7 +34,7 @@ /* clang-format on */ -V3PreLex* V3PreLex::s_currentLexp = NULL; // Current lexing point +V3PreLex* V3PreLex::s_currentLexp = nullptr; // Current lexing point #define LEXP V3PreLex::s_currentLexp @@ -482,9 +482,9 @@ void V3PreLex::initFirstBuffer(FileLine* filelinep) { streamp->m_eof = true; m_streampStack.push(streamp); // - m_bufferState = yy_create_buffer(NULL, YY_BUF_SIZE); + m_bufferState = yy_create_buffer(nullptr, YY_BUF_SIZE); yy_switch_to_buffer(m_bufferState); - yyrestart(NULL); + yyrestart(nullptr); } void V3PreLex::scanNewFile(FileLine* filelinep) { @@ -522,7 +522,7 @@ void V3PreLex::scanBytes(const string& str) { void V3PreLex::scanSwitchStream(VPreStream* streamp) { curStreamp()->m_buffers.push_front(currentUnreadChars()); m_streampStack.push(streamp); - yyrestart(NULL); + yyrestart(nullptr); } void V3PreLex::scanBytesBack(const string& str) { diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index de42e8c02..6ee474814 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -118,7 +118,7 @@ public: // STATE V3PreProc* m_preprocp; ///< Object we're holding data for - V3PreLex* m_lexp; ///< Current lexer state (NULL = closed) + V3PreLex* m_lexp; ///< Current lexer state (nullptr = closed) std::stack m_includeStack; ///< Stack of includers above current m_lexp int m_lastLineno; // Last line number (stall detection) int m_tokensOnLine; // Number of tokens on line (stall detection) @@ -273,9 +273,9 @@ public: m_defDepth = 0; m_defPutJoin = false; m_finToken = 0; - m_finFilelinep = NULL; - m_lexp = NULL; - m_preprocp = NULL; + m_finFilelinep = nullptr; + m_lexp = nullptr; + m_preprocp = nullptr; m_lastLineno = 0; m_tokensOnLine = 0; } @@ -292,7 +292,7 @@ public: m_lexp->debug(debug() >= 5 ? debug() : 0); // See also V3PreProc::debug() method } ~V3PreProcImp() { - if (m_lexp) VL_DO_CLEAR(delete m_lexp, m_lexp = NULL); + if (m_lexp) VL_DO_CLEAR(delete m_lexp, m_lexp = nullptr); } }; @@ -338,7 +338,7 @@ string V3PreProcImp::defParams(const string& name) { } FileLine* V3PreProcImp::defFileline(const string& name) { DefinesMap::iterator iter = m_defines.find(name); - if (iter == m_defines.end()) return NULL; + if (iter == m_defines.end()) return nullptr; return iter->second.fileline(); } void V3PreProcImp::define(FileLine* fl, const string& name, const string& value, @@ -687,7 +687,7 @@ string V3PreProcImp::defineSubst(VDefineRef* refp) { string argName; bool quote = false; bool backslashesc = false; // In \.....{space} block - // Note we go through the loop once more at the NULL end-of-string + // Note we go through the loop once more at the nullptr end-of-string for (const char* cp = value.c_str(); (*cp) || argName != ""; cp = (*cp ? cp + 1 : cp)) { // UINFO(4, "CH "<<*cp<<" an "<= 5) { diff --git a/src/V3PreShell.cpp b/src/V3PreShell.cpp index 2695051a4..60f0f4df7 100644 --- a/src/V3PreShell.cpp +++ b/src/V3PreShell.cpp @@ -157,8 +157,8 @@ public: }; V3PreShellImp V3PreShellImp::s_preImp; -V3PreProc* V3PreShellImp::s_preprocp = NULL; -VInFilter* V3PreShellImp::s_filterp = NULL; +V3PreProc* V3PreShellImp::s_preprocp = nullptr; +VInFilter* V3PreShellImp::s_filterp = nullptr; //###################################################################### // Perl class functions diff --git a/src/V3Premit.cpp b/src/V3Premit.cpp index 99d2406fc..25de2b1bd 100644 --- a/src/V3Premit.cpp +++ b/src/V3Premit.cpp @@ -190,7 +190,7 @@ private: AstNodeModule* origModp = m_modp; { m_modp = nodep; - m_funcp = NULL; + m_funcp = nullptr; iterateChildren(nodep); } m_modp = origModp; @@ -198,7 +198,7 @@ private: virtual void visit(AstCFunc* nodep) override { m_funcp = nodep; iterateChildren(nodep); - m_funcp = NULL; + m_funcp = nullptr; } void startStatement(AstNode* nodep) { m_assignLhs = false; @@ -211,11 +211,11 @@ private: startStatement(nodep); m_inWhilep = nodep; iterateAndNextNull(nodep->condp()); - m_inWhilep = NULL; + m_inWhilep = nullptr; startStatement(nodep); iterateAndNextNull(nodep->bodysp()); iterateAndNextNull(nodep->incsp()); - m_stmtp = NULL; + m_stmtp = nullptr; } virtual void visit(AstNodeAssign* nodep) override { startStatement(nodep); @@ -231,7 +231,7 @@ private: m_assignLhs = true; iterateAndNextNull(nodep->lhsp()); m_assignLhs = false; - m_stmtp = NULL; + m_stmtp = nullptr; } virtual void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { @@ -241,14 +241,14 @@ private: UINFO(4, " STMT " << nodep << endl); startStatement(nodep); iterateChildren(nodep); - m_stmtp = NULL; + m_stmtp = nullptr; } virtual void visit(AstTraceInc* nodep) override { startStatement(nodep); m_inTracep = nodep; iterateChildren(nodep); - m_inTracep = NULL; - m_stmtp = NULL; + m_inTracep = nullptr; + m_stmtp = nullptr; } void visitShift(AstNodeBiop* nodep) { // Shifts of > 32/64 bits in C++ will wrap-around and generate non-0s @@ -366,7 +366,7 @@ private: virtual void visit(AstDisplay* nodep) override { startStatement(nodep); iterateChildren(nodep); - m_stmtp = NULL; + m_stmtp = nullptr; if (v3Global.opt.autoflush()) { AstNode* searchp = nodep->nextp(); while (searchp && VN_IS(searchp, Comment)) searchp = searchp->nextp(); @@ -400,11 +400,11 @@ private: public: // CONSTRUCTORS explicit PremitVisitor(AstNetlist* nodep) { - m_modp = NULL; - m_funcp = NULL; - m_stmtp = NULL; - m_inWhilep = NULL; - m_inTracep = NULL; + m_modp = nullptr; + m_funcp = nullptr; + m_stmtp = nullptr; + m_inWhilep = nullptr; + m_inTracep = nullptr; m_assignLhs = false; iterate(nodep); } diff --git a/src/V3ProtectLib.cpp b/src/V3ProtectLib.cpp index 8349d2dc0..74a76b881 100644 --- a/src/V3ProtectLib.cpp +++ b/src/V3ProtectLib.cpp @@ -486,31 +486,31 @@ private: public: explicit ProtectVisitor(AstNode* nodep) - : m_vfilep(NULL) - , m_cfilep(NULL) - , m_modPortsp(NULL) - , m_comboPortsp(NULL) - , m_seqPortsp(NULL) - , m_comboIgnorePortsp(NULL) - , m_comboDeclsp(NULL) - , m_seqDeclsp(NULL) - , m_tmpDeclsp(NULL) - , m_hashValuep(NULL) - , m_comboParamsp(NULL) - , m_clkSensp(NULL) - , m_comboIgnoreParamsp(NULL) - , m_seqParamsp(NULL) - , m_nbAssignsp(NULL) - , m_seqAssignsp(NULL) - , m_comboAssignsp(NULL) - , m_cHashValuep(NULL) - , m_cComboParamsp(NULL) - , m_cComboInsp(NULL) - , m_cComboOutsp(NULL) - , m_cSeqParamsp(NULL) - , m_cSeqClksp(NULL) - , m_cSeqOutsp(NULL) - , m_cIgnoreParamsp(NULL) + : m_vfilep(nullptr) + , m_cfilep(nullptr) + , m_modPortsp(nullptr) + , m_comboPortsp(nullptr) + , m_seqPortsp(nullptr) + , m_comboIgnorePortsp(nullptr) + , m_comboDeclsp(nullptr) + , m_seqDeclsp(nullptr) + , m_tmpDeclsp(nullptr) + , m_hashValuep(nullptr) + , m_comboParamsp(nullptr) + , m_clkSensp(nullptr) + , m_comboIgnoreParamsp(nullptr) + , m_seqParamsp(nullptr) + , m_nbAssignsp(nullptr) + , m_seqAssignsp(nullptr) + , m_comboAssignsp(nullptr) + , m_cHashValuep(nullptr) + , m_cComboParamsp(nullptr) + , m_cComboInsp(nullptr) + , m_cComboOutsp(nullptr) + , m_cSeqParamsp(nullptr) + , m_cSeqClksp(nullptr) + , m_cSeqOutsp(nullptr) + , m_cIgnoreParamsp(nullptr) , m_libName(v3Global.opt.protectLib()) , m_topName(v3Global.opt.prefix()) , m_foundTop(false) diff --git a/src/V3Reloop.cpp b/src/V3Reloop.cpp index cf00a0193..4af32d332 100644 --- a/src/V3Reloop.cpp +++ b/src/V3Reloop.cpp @@ -60,11 +60,11 @@ private: AssVec m_mgAssignps; // List of assignments merging AstCFunc* m_mgCfuncp; // Parent C function AstNode* m_mgNextp; // Next node - AstNodeSel* m_mgSelLp; // Parent select, NULL = idle - AstNodeSel* m_mgSelRp; // Parent select, NULL = constant + AstNodeSel* m_mgSelLp; // Parent select, nullptr = idle + AstNodeSel* m_mgSelRp; // Parent select, nullptr = constant AstNodeVarRef* m_mgVarrefLp; // Parent varref - AstNodeVarRef* m_mgVarrefRp; // Parent varref, NULL = constant - AstConst* m_mgConstRp; // Parent RHS constant, NULL = sel + AstNodeVarRef* m_mgVarrefRp; // Parent varref, nullptr = constant + AstConst* m_mgConstRp; // Parent RHS constant, nullptr = sel uint32_t m_mgIndexLo; // Merge range uint32_t m_mgIndexHi; // Merge range @@ -106,7 +106,7 @@ private: AstNode* incp = new AstAssign( fl, new AstVarRef(fl, itp, true), new AstAdd(fl, new AstConst(fl, 1), new AstVarRef(fl, itp, false))); - AstWhile* whilep = new AstWhile(fl, condp, NULL, incp); + AstWhile* whilep = new AstWhile(fl, condp, nullptr, incp); initp->addNext(whilep); bodyp->replaceWith(initp); whilep->addBodysp(bodyp); @@ -133,11 +133,11 @@ private: } // Setup for next merge m_mgAssignps.clear(); - m_mgSelLp = NULL; - m_mgSelRp = NULL; - m_mgVarrefLp = NULL; - m_mgVarrefRp = NULL; - m_mgConstRp = NULL; + m_mgSelLp = nullptr; + m_mgSelRp = nullptr; + m_mgVarrefLp = nullptr; + m_mgVarrefRp = nullptr; + m_mgConstRp = nullptr; } } @@ -145,7 +145,7 @@ private: virtual void visit(AstCFunc* nodep) override { m_cfuncp = nodep; iterateChildren(nodep); - m_cfuncp = NULL; + m_cfuncp = nullptr; } virtual void visit(AstNodeAssign* nodep) override { if (!m_cfuncp) return; @@ -177,7 +177,7 @@ private: // RHS is a constant or a select AstConst* rconstp = VN_CAST(nodep->rhsp(), Const); AstNodeSel* rselp = VN_CAST(nodep->rhsp(), NodeSel); - AstNodeVarRef* rvarrefp = NULL; + AstNodeVarRef* rvarrefp = nullptr; if (rconstp) { // Ok } else { if (!rselp) { @@ -239,14 +239,14 @@ private: public: // CONSTRUCTORS explicit ReloopVisitor(AstNetlist* nodep) { - m_cfuncp = NULL; - m_mgCfuncp = NULL; - m_mgNextp = NULL; - m_mgSelLp = NULL; - m_mgSelRp = NULL; - m_mgVarrefLp = NULL; - m_mgVarrefRp = NULL; - m_mgConstRp = NULL; + m_cfuncp = nullptr; + m_mgCfuncp = nullptr; + m_mgNextp = nullptr; + m_mgSelLp = nullptr; + m_mgSelRp = nullptr; + m_mgVarrefLp = nullptr; + m_mgVarrefRp = nullptr; + m_mgConstRp = nullptr; m_mgIndexLo = 0; m_mgIndexHi = 0; iterate(nodep); diff --git a/src/V3Scope.cpp b/src/V3Scope.cpp index e4ac81289..e64244044 100644 --- a/src/V3Scope.cpp +++ b/src/V3Scope.cpp @@ -89,8 +89,8 @@ private: return; } // Operate starting at the top of the hierarchy - m_aboveCellp = NULL; - m_aboveScopep = NULL; + m_aboveCellp = nullptr; + m_aboveScopep = nullptr; iterate(modp); cleanupVarRefs(); } @@ -287,7 +287,7 @@ private: // Make sure variable has made user1p. UASSERT_OBJ(nodep->varp(), nodep, "Unlinked"); if (nodep->varp()->isIfaceRef()) { - nodep->varScopep(NULL); + nodep->varScopep(nullptr); } else { // We may have not made the variable yet, and we can't make it now as // the var's referenced package etc might not be created yet. @@ -321,10 +321,10 @@ private: public: // CONSTRUCTORS explicit ScopeVisitor(AstNetlist* nodep) { - m_aboveCellp = NULL; - m_aboveScopep = NULL; - m_modp = NULL; - m_scopep = NULL; + m_aboveCellp = nullptr; + m_aboveScopep = nullptr; + m_modp = nullptr; + m_scopep = nullptr; // iterate(nodep); } @@ -347,7 +347,7 @@ private: // Want to ignore blocks under it m_scopep = nodep; iterateChildren(nodep); - m_scopep = NULL; + m_scopep = nullptr; } virtual void movedDeleteOrIterate(AstNode* nodep) { @@ -373,7 +373,7 @@ private: virtual void visit(AstVarXRef* nodep) override { // The crossrefs are dealt with in V3LinkDot - nodep->varp(NULL); + nodep->varp(nullptr); } virtual void visit(AstNodeFTaskRef* nodep) override { // The crossrefs are dealt with in V3LinkDot @@ -386,14 +386,14 @@ private: nodep->taskp(newp); UINFO(9, " New pkg-taskref " << nodep << endl); } else if (!VN_IS(nodep, MethodCall)) { - nodep->taskp(NULL); + nodep->taskp(nullptr); UINFO(9, " New pkg-taskref " << nodep << endl); } iterateChildren(nodep); } virtual void visit(AstModportFTaskRef* nodep) override { // The crossrefs are dealt with in V3LinkDot - nodep->ftaskp(NULL); + nodep->ftaskp(nullptr); iterateChildren(nodep); } @@ -403,7 +403,7 @@ private: public: // CONSTRUCTORS explicit ScopeCleanupVisitor(AstNetlist* nodep) { - m_scopep = NULL; + m_scopep = nullptr; iterate(nodep); } virtual ~ScopeCleanupVisitor() {} diff --git a/src/V3Scoreboard.cpp b/src/V3Scoreboard.cpp index e0813489f..1151b9079 100644 --- a/src/V3Scoreboard.cpp +++ b/src/V3Scoreboard.cpp @@ -52,7 +52,7 @@ void V3ScoreboardBase::selfTest() { UASSERT(sb.needsRescore(), "SelfTest: Newly filled sb should need a rescore."); UASSERT(sb.needsRescore(&e1), "SelfTest: Individual newly-added element should need rescore"); - UASSERT(NULL == sb.bestp(), + UASSERT(nullptr == sb.bestp(), "SelfTest: Newly filled sb should have nothing eligible for Bestp()"); sb.rescore(); diff --git a/src/V3Scoreboard.h b/src/V3Scoreboard.h index 1c918b26f..43ed4044f 100644 --- a/src/V3Scoreboard.h +++ b/src/V3Scoreboard.h @@ -408,7 +408,7 @@ public: } // Get the best element, with the lowest score (lower is better), among - // elements whose scores are known. Returns NULL if no elements with + // elements whose scores are known. Returns nullptr if no elements with // known scores exist. // // Note: This does not automatically rescore. Client must call @@ -417,7 +417,7 @@ public: // considers elements that aren't pending rescore. const T_Elem* bestp() { typename SortedMap::iterator result = m_sorted.begin(); - if (VL_UNLIKELY(result == m_sorted.end())) return NULL; + if (VL_UNLIKELY(result == m_sorted.end())) return nullptr; return (*result).key(); } diff --git a/src/V3SenTree.h b/src/V3SenTree.h index 93794ed21..699c9c63d 100644 --- a/src/V3SenTree.h +++ b/src/V3SenTree.h @@ -59,7 +59,7 @@ public: void add(AstSenTree* nodep) { m_trees.insert(nodep); } AstSenTree* find(AstSenTree* likep) { - AstSenTree* resultp = NULL; + AstSenTree* resultp = nullptr; Set::iterator it = m_trees.find(likep); if (it != m_trees.end()) resultp = *it; return resultp; @@ -82,7 +82,7 @@ private: public: // CONSTRUCTORS SenTreeFinder() - : m_topScopep(NULL) {} + : m_topScopep(nullptr) {} // METHODS AstSenTree* getSenTree(AstSenTree* senTreep) { diff --git a/src/V3Simulate.h b/src/V3Simulate.h index bde492f7e..0862a62ce 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -93,7 +93,7 @@ private: bool m_scoped; ///< Running with AstVarScopes instead of AstVars bool m_params; ///< Doing parameter propagation // Checking: - string m_whyNotOptimizable; ///< String explaining why not optimizable or NULL to optimize + string m_whyNotOptimizable; ///< String explaining why not optimizable or nullptr to optimize AstNode* m_whyNotNodep; ///< First node not optimizable bool m_anyAssignDly; ///< True if found a delayed assignment bool m_anyAssignComb; ///< True if found a non-delayed assignment @@ -198,7 +198,7 @@ public: m_whyNotOptimizable += stack.str(); } } - bool optimizable() const { return m_whyNotNodep == NULL; } + bool optimizable() const { return m_whyNotNodep == nullptr; } string whyNotMessage() const { return m_whyNotOptimizable; } AstNode* whyNotNodep() const { return m_whyNotNodep; } @@ -305,12 +305,12 @@ public: V3Number* fetchNumberNull(AstNode* nodep) { AstConst* constp = fetchConstNull(nodep); if (constp) return &constp->num(); - return NULL; + return nullptr; } V3Number* fetchOutNumberNull(AstNode* nodep) { AstConst* constp = fetchOutConstNull(nodep); if (constp) return &constp->num(); - return NULL; + return nullptr; } private: @@ -423,7 +423,7 @@ private: } vscp->user1(vscp->user1() | VU_RV); bool isConst = nodep->varp()->isParam() && nodep->varp()->valuep(); - AstNode* valuep = isConst ? fetchValueNull(nodep->varp()->valuep()) : NULL; + AstNode* valuep = isConst ? fetchValueNull(nodep->varp()->valuep()) : nullptr; if (isConst && valuep) { // Propagate PARAM constants for constant function analysis if (!m_checkOnly && optimizable()) newValue(vscp, valuep); @@ -647,7 +647,7 @@ private: } if (!m_checkOnly && optimizable()) { AstNode* vscp = varOrScope(varrefp); - AstInitArray* initp = NULL; + AstInitArray* initp = nullptr; if (AstInitArray* vscpnump = VN_CAST(fetchOutValueNull(vscp), InitArray)) { initp = vscpnump; } else if (AstInitArray* vscpnump = VN_CAST(fetchValueNull(vscp), InitArray)) { @@ -676,7 +676,7 @@ private: } } void handleAssignSel(AstNodeAssign* nodep, AstSel* selp) { - AstVarRef* varrefp = NULL; + AstVarRef* varrefp = nullptr; V3Number lsb(nodep); iterateAndNextNull(nodep->rhsp()); // Value to assign handleAssignSelRecurse(nodep, selp, varrefp /*ref*/, lsb /*ref*/, 0); @@ -684,7 +684,7 @@ private: UASSERT_OBJ(varrefp, nodep, "Indicated optimizable, but no variable found on RHS of select"); AstNode* vscp = varOrScope(varrefp); - AstConst* outconstp = NULL; + AstConst* outconstp = nullptr; if (AstConst* vscpnump = fetchOutConstNull(vscp)) { outconstp = vscpnump; } else if (AstConst* vscpnump = fetchConstNull(vscp)) { @@ -849,7 +849,7 @@ private: iterateChildren(nodep); if (m_jumpp && m_jumpp->labelp() == nodep) { UINFO(5, " JUMP DONE " << nodep << endl); - m_jumpp = NULL; + m_jumpp = nullptr; } } virtual void visit(AstStop* nodep) override { @@ -1100,13 +1100,13 @@ public: } void clear() { m_whyNotOptimizable = ""; - m_whyNotNodep = NULL; + m_whyNotNodep = nullptr; m_anyAssignComb = false; m_anyAssignDly = false; m_inDlyAssign = false; m_instrCount = 0; m_dataCount = 0; - m_jumpp = NULL; + m_jumpp = nullptr; AstNode::user1ClearTree(); AstNode::user2ClearTree(); diff --git a/src/V3Slice.cpp b/src/V3Slice.cpp index 3364af781..cd379d797 100644 --- a/src/V3Slice.cpp +++ b/src/V3Slice.cpp @@ -134,7 +134,7 @@ class SliceVisitor : public AstNVisitor { // Left and right could have different msb/lsbs/endianness, but #elements is common // and all variables are realigned to start at zero // Assign of a little endian'ed slice to a big endian one must reverse the elements - AstNode* newlistp = NULL; + AstNode* newlistp = nullptr; int elements = arrayp->rangep()->elementsConst(); for (int offset = 0; offset < elements; ++offset) { AstNode* newp = nodep->cloneType // AstNodeAssign @@ -152,7 +152,7 @@ class SliceVisitor : public AstNVisitor { } m_assignp = nodep; iterateChildren(nodep); - m_assignp = NULL; + m_assignp = nullptr; } } @@ -167,7 +167,7 @@ class SliceVisitor : public AstNVisitor { AstNodeDType* fromDtp = nodep->lhsp()->dtypep()->skipRefp(); UINFO(9, " Bi-Eq/Neq expansion " << nodep << endl); if (AstUnpackArrayDType* adtypep = VN_CAST(fromDtp, UnpackArrayDType)) { - AstNodeBiop* logp = NULL; + AstNodeBiop* logp = nullptr; if (!VN_IS(nodep->lhsp()->dtypep()->skipRefp(), NodeArrayDType)) { nodep->lhsp()->v3error( "Slice operator " @@ -225,7 +225,7 @@ class SliceVisitor : public AstNVisitor { public: // CONSTRUCTORS explicit SliceVisitor(AstNetlist* nodep) { - m_assignp = NULL; + m_assignp = nullptr; m_assignError = false; iterate(nodep); } diff --git a/src/V3Split.cpp b/src/V3Split.cpp index 72cb9b039..7ed0ca809 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -274,7 +274,7 @@ protected: m_inDly = false; m_graph.clear(); m_stmtStackps.clear(); - m_pliVertexp = NULL; + m_pliVertexp = nullptr; m_noReorderWhy = ""; AstNode::user1ClearTree(); AstNode::user2ClearTree(); @@ -546,7 +546,7 @@ protected: UINFO(6, " No changes\n"); } else { AstNRelinker replaceHandle; // Where to add the list - AstNode* newListp = NULL; + AstNode* newListp = nullptr; for (RankNodeMap::const_iterator it = rankMap.begin(); it != rankMap.end(); ++it) { AstNode* nextp = it->second; UINFO(6, " New order: " << nextp << endl); @@ -572,7 +572,7 @@ protected: // Save recursion state AstNode* firstp = nodep; // We may reorder, and nodep is no longer first. void* oldBlockUser3 = nodep->user3p(); // May be overloaded in below loop, save it - nodep->user3p(NULL); + nodep->user3p(nullptr); UASSERT_OBJ(nodep->firstAbovep(), nodep, "Node passed is in next list; should have processed all list at once"); // Process it @@ -716,7 +716,7 @@ public: // We don't need to clone m_origAlwaysp->sensesp() here; // V3Activate already moved it to a parent node. AstAlways* alwaysp - = new AstAlways(m_origAlwaysp->fileline(), VAlwaysKwd::ALWAYS, NULL, NULL); + = new AstAlways(m_origAlwaysp->fileline(), VAlwaysKwd::ALWAYS, nullptr, nullptr); // Put a placeholder node into stmtp to track our position. // We'll strip these out after the blocks are fully cloned. AstSplitPlaceholder* placeholderp = makePlaceholderp(); @@ -834,7 +834,7 @@ private: // CONSTRUCTORS public: explicit SplitVisitor(AstNetlist* nodep) - : m_curIfConditional(NULL) { + : m_curIfConditional(nullptr) { iterate(nodep); // Splice newly-split blocks into the tree. Remove placeholders @@ -968,7 +968,7 @@ protected: UINFO(4, " IF " << nodep << endl); m_curIfConditional = nodep; iterateAndNextNull(nodep->condp()); - m_curIfConditional = NULL; + m_curIfConditional = nullptr; scanBlock(nodep->ifsp()); scanBlock(nodep->elsesp()); } diff --git a/src/V3SplitAs.cpp b/src/V3SplitAs.cpp index 3d49e0d86..7247f9c10 100644 --- a/src/V3SplitAs.cpp +++ b/src/V3SplitAs.cpp @@ -58,7 +58,7 @@ private: public: // CONSTRUCTORS explicit SplitAsFindVisitor(AstAlways* nodep) { - m_splitVscp = NULL; + m_splitVscp = nullptr; iterate(nodep); } virtual ~SplitAsFindVisitor() {} @@ -161,7 +161,7 @@ private: virtual void visit(AstAlways* nodep) override { // Are there any lvalue references below this? // There could be more than one. So, we process the first one found first. - AstVarScope* lastSplitVscp = NULL; + AstVarScope* lastSplitVscp = nullptr; while (!nodep->user1()) { // Find any splittable variables SplitAsFindVisitor visitor(nodep); @@ -189,7 +189,7 @@ private: public: // CONSTRUCTORS explicit SplitAsVisitor(AstNetlist* nodep) { - m_splitVscp = NULL; + m_splitVscp = nullptr; AstNode::user1ClearTree(); // user1p() used on entire tree iterate(nodep); } diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index c2824a396..0f0c60283 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -142,28 +142,28 @@ struct SplitVarImpl { // Only SplitUnpackedVarVisitor can split WREAL. SplitPackedVarVisitor cannot. const bool ok = type == type.VAR || type == type.WIRE || type == type.PORT || type == type.WREAL; - if (ok) return NULL; + if (ok) return nullptr; return "it is not one of variable, net, port, nor wreal"; } static const char* cannotSplitVarDirectionReason(VDirection dir) { if (dir == VDirection::REF) return "it is a ref argument"; if (dir == VDirection::INOUT) return "it is an inout port"; - return NULL; + return nullptr; } static const char* cannotSplitConnectedPortReason(AstPin* pinp) { AstVar* varp = pinp->modVarp(); if (!varp) return "it is not connected"; if (const char* reason = cannotSplitVarDirectionReason(varp->direction())) return reason; - return NULL; + return nullptr; } static const char* cannotSplitTaskReason(const AstNodeFTask* taskp) { if (taskp->prototype()) return "the task is prototype declaration"; if (taskp->dpiImport()) return "the task is imported from DPI-C"; if (taskp->dpiOpenChild()) return "the task takes DPI-C open array"; - return NULL; + return nullptr; } static const char* cannotSplitVarCommonReason(const AstVar* varp) { @@ -174,7 +174,7 @@ struct SplitVarImpl { if (const char* reason = cannotSplitVarDirectionReason(varp->direction())) return reason; if (varp->isSigPublic()) return "it is public"; if (varp->isUsedLoopIdx()) return "it is used as a loop variable"; - return NULL; + return nullptr; } static const char* cannotSplitPackedVarReason(const AstVar* varp); @@ -405,7 +405,7 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { if (AstVarRef* refp = VN_CAST(nodep, VarRef)) { if (refp->varp()->attrSplitVar()) return refp; } - return NULL; + return nullptr; } static int outerMostSizeOfUnpackedArray(AstVar* nodep) { AstUnpackArrayDType* dtypep = VN_CAST(nodep->dtypep()->skipRefp(), UnpackArrayDType); @@ -430,19 +430,19 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { m_contextp = origContextp; } void pushDeletep(AstNode* nodep) { // overriding AstNVisitor::pusDeletep() - UASSERT_OBJ(m_modp, nodep, "Must not NULL"); + UASSERT_OBJ(m_modp, nodep, "Must not nullptr"); m_refsForPackedSplit[m_modp].remove(nodep); AstNVisitor::pushDeletep(nodep); } AstVar* newVar(FileLine* fl, AstVarType type, const std::string& name, AstNodeDType* dtp) { AstVar* varp = new AstVar(fl, type, name, dtp); - UASSERT_OBJ(m_modp, varp, "Must not NULL"); + UASSERT_OBJ(m_modp, varp, "Must not nullptr"); m_refsForPackedSplit[m_modp].add(varp); return varp; } AstVarRef* newVarRef(FileLine* fl, AstVar* varp, bool lvalue) { AstVarRef* refp = new AstVarRef(fl, varp, lvalue); - UASSERT_OBJ(m_modp, refp, "Must not NULL"); + UASSERT_OBJ(m_modp, refp, "Must not nullptr"); m_refsForPackedSplit[m_modp].add(refp); return refp; } @@ -459,7 +459,7 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { m_modp = nodep; iterateChildren(nodep); split(); - m_modp = NULL; + m_modp = nullptr; } virtual void visit(AstNodeStmt* nodep) override { setContextAndIterateChildren(nodep); } virtual void visit(AstCell* nodep) override { setContextAndIterateChildren(nodep); } @@ -483,9 +483,9 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { UASSERT_OBJ(ftaskp, nodep, "Unlinked"); // Iterate arguments of a function/task. for (AstNode *argp = nodep->pinsp(), *paramp = ftaskp->stmtsp(); argp; - argp = argp->nextp(), paramp = paramp ? paramp->nextp() : NULL) { - const char* reason = NULL; - AstVar* vparamp = NULL; + argp = argp->nextp(), paramp = paramp ? paramp->nextp() : nullptr) { + const char* reason = nullptr; + AstVar* vparamp = nullptr; while (paramp) { vparamp = VN_CAST(paramp, Var); if (vparamp && vparamp->isIO()) { @@ -493,7 +493,7 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { break; } paramp = paramp->nextp(); - vparamp = NULL; + vparamp = nullptr; } if (!reason && !vparamp) { reason = "the number of argument to the task/function mismatches"; @@ -534,7 +534,7 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { if (!cannotSplitTaskReason(nodep)) { m_inFTask = nodep; iterateChildren(nodep); - m_inFTask = NULL; + m_inFTask = nullptr; } } virtual void visit(AstVar* nodep) override { @@ -654,7 +654,7 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { } void connectPort(AstVar* varp, std::vector& vars, AstNode* insertp) { UASSERT_OBJ(varp->isIO(), varp, "must be port"); - insertp = insertp ? toInsertPoint(insertp) : NULL; + insertp = insertp ? toInsertPoint(insertp) : nullptr; const bool lvalue = varp->direction().isWritable(); for (size_t i = 0; i < vars.size(); ++i) { AstNode* nodes[] @@ -702,11 +702,11 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { insertp = newp; newp->attrSplitVar(needNext || !cannotSplitPackedVarReason(newp)); vars.push_back(newp); - setContextAndIterate(NULL, newp); + setContextAndIterate(nullptr, newp); } for (UnpackRefMap::SetIt sit = it->second.begin(), sit_end = it->second.end(); sit != sit_end; ++sit) { - AstNode* newp = NULL; + AstNode* newp = nullptr; if (sit->isSingleRef()) { newp = newVarRef(sit->nodep()->fileline(), vars.at(sit->index()), sit->lvalue()); @@ -741,7 +741,7 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { if (varp->isIO()) { // AssignW will be created, so just once if (!varp->isFuncLocal() && !varp->isFuncReturn()) { - connectPort(varp, vars, NULL); + connectPort(varp, vars, nullptr); } varp->attrSplitVar(!cannotSplitPackedVarReason(varp)); m_refsForPackedSplit[m_modp].add(varp); @@ -767,9 +767,9 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { public: explicit SplitUnpackedVarVisitor(AstNetlist* nodep) : m_refs() - , m_modp(NULL) - , m_contextp(NULL) - , m_inFTask(NULL) + , m_modp(nullptr) + , m_contextp(nullptr) + , m_inFTask(nullptr) , m_numSplit(0) { iterate(nodep); } @@ -788,7 +788,7 @@ public: UINFO(7, nodep->prettyNameQ() << " pub:" << nodep->isSigPublic() << " pri:" << nodep->isPrimaryIO() << " io:" << nodep->isInoutish() << " typ:" << nodep->varType() << "\n"); - const char* reason = NULL; + const char* reason = nullptr; // Public variable cannot be split. // at least one unpacked dimension must exist if (dim.second < 1 || !VN_IS(nodep->dtypep()->skipRefp(), UnpackArrayDType)) @@ -811,7 +811,7 @@ class SplitNewVar { int m_bitwidth; AstVar* m_varp; // The LSB of this variable is always 0, not m_lsb public: - SplitNewVar(int lsb, int bitwidth, AstVar* varp = NULL) + SplitNewVar(int lsb, int bitwidth, AstVar* varp = nullptr) : m_lsb(lsb) , m_bitwidth(bitwidth) , m_varp(varp) {} @@ -819,7 +819,7 @@ public: int msb() const { return m_lsb + m_bitwidth - 1; } int bitwidth() const { return m_bitwidth; } void varp(AstVar* vp) { - UASSERT_OBJ(!m_varp, m_varp, "must be NULL"); + UASSERT_OBJ(!m_varp, m_varp, "must be nullptr"); m_varp = vp; } AstVar* varp() const { return m_varp; } @@ -858,7 +858,7 @@ public: // return the sensitivity item AstSenItem* backSenItemp() const { if (AstVarRef* refp = VN_CAST(m_nodep, VarRef)) { return VN_CAST(refp->backp(), SenItem); } - return NULL; + return nullptr; } }; @@ -1187,7 +1187,7 @@ class SplitPackedVarVisitor : public AstNVisitor, public SplitVarImpl { if (varp->isIO()) { // port cannot be deleted // If varp is a port of a module, single AssignW is sufficient if (!(varp->isFuncLocal() || varp->isFuncReturn())) - connectPortAndVar(vars, varp, NULL); + connectPortAndVar(vars, varp, nullptr); } else if (varp->isTrace()) { // Let's reuse the original variable for tracing AstNode* rhsp @@ -1211,7 +1211,7 @@ public: // When reusing the information from SplitUnpackedVarVisitor SplitPackedVarVisitor(AstNetlist* nodep, SplitVarRefsMap& refs) : m_netp(nodep) - , m_modp(NULL) + , m_modp(nullptr) , m_numSplit(0) { // If you want ignore refs and walk the tne entire AST, // just call iterateChildren(m_modp) and split() for each module @@ -1220,7 +1220,7 @@ public: m_modp = it->first; it->second.visit(this); split(); - m_modp = NULL; + m_modp = nullptr; } } ~SplitPackedVarVisitor() { @@ -1232,7 +1232,7 @@ public: // Even if this function returns true, the variable may not be split // when the access to the variable cannot be determined statically. static const char* cannotSplitReason(const AstVar* nodep, bool checkUnpacked) { - const char* reason = NULL; + const char* reason = nullptr; if (AstBasicDType* const basicp = nodep->dtypep()->basicp()) { const std::pair dim = nodep->dtypep()->dimensions(false); // Unpacked array will be split in SplitUnpackedVarVisitor() beforehand diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 56aca4cc0..4c8c4636a 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -188,7 +188,7 @@ private: m_cfuncp = nodep; allNodes(nodep); iterateChildrenConst(nodep); - m_cfuncp = NULL; + m_cfuncp = nullptr; } virtual void visit(AstNode* nodep) override { allNodes(nodep); @@ -211,7 +211,7 @@ public: : m_stage(stage) , m_fast(fast) { UINFO(9, "Starting stats, fast=" << fast << endl); - m_cfuncp = NULL; + m_cfuncp = nullptr; m_counting = !m_fast; m_instrs = 0; m_tracingCall = false; diff --git a/src/V3StatsReport.cpp b/src/V3StatsReport.cpp index b1926664f..426709535 100644 --- a/src/V3StatsReport.cpp +++ b/src/V3StatsReport.cpp @@ -59,7 +59,7 @@ class StatsReport { } // Process duplicates - V3Statistic* lastp = NULL; + V3Statistic* lastp = nullptr; for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) { V3Statistic* repp = it->second; if (lastp && lastp->sumit() && lastp->printit() && lastp->name() == repp->name() diff --git a/src/V3Subst.cpp b/src/V3Subst.cpp index f0e8de8d8..9dc067eb2 100644 --- a/src/V3Subst.cpp +++ b/src/V3Subst.cpp @@ -54,7 +54,7 @@ protected: friend class SubstVarEntry; // METHODS void clear() { - m_assignp = NULL; + m_assignp = nullptr; m_step = 0; m_use = false; m_complex = false; @@ -90,7 +90,7 @@ private: bool wordNumOk(int word) const { return word < m_varp->widthWords(); } AstNodeAssign* getWordAssignp(int word) const { if (!wordNumOk(word)) { - return NULL; + return nullptr; } else { return m_words[word].m_assignp; } @@ -133,7 +133,7 @@ public: UASSERT_OBJ(assp, errp, "Reading whole that was never assigned"); return (assp->rhsp()); } else { - return NULL; + return nullptr; } } // Return what to substitute given word number for @@ -143,7 +143,7 @@ public: UASSERT_OBJ(assp, errp, "Reading a word that was never assigned, or bad word #"); return (assp->rhsp()); } else { - return NULL; + return nullptr; } } int getWholeStep() const { return m_whole.m_step; } @@ -161,12 +161,12 @@ public: void deleteUnusedAssign() { // If there are unused assignments in this var, kill them if (!m_whole.m_use && !m_wordUse && m_whole.m_assignp) { - VL_DO_CLEAR(deleteAssign(m_whole.m_assignp), m_whole.m_assignp = NULL); + VL_DO_CLEAR(deleteAssign(m_whole.m_assignp), m_whole.m_assignp = nullptr); } for (unsigned i = 0; i < m_words.size(); i++) { if (!m_whole.m_use && !m_words[i].m_use && m_words[i].m_assignp && !m_words[i].m_complex) { - VL_DO_CLEAR(deleteAssign(m_words[i].m_assignp), m_words[i].m_assignp = NULL); + VL_DO_CLEAR(deleteAssign(m_words[i].m_assignp), m_words[i].m_assignp = nullptr); } } } @@ -187,7 +187,7 @@ private: // METHODS SubstVarEntry* findEntryp(AstVarRef* nodep) { - return reinterpret_cast(nodep->varp()->user1p()); // Might be NULL + return reinterpret_cast(nodep->varp()->user1p()); // Might be nullptr } // VISITORS virtual void visit(AstVarRef* nodep) override { diff --git a/src/V3SymTable.h b/src/V3SymTable.h index 57fe9a40b..f29ad4f14 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -153,7 +153,7 @@ public: : "se" + cvtToHex(it->second) + " n=" + cvtToHex(it->second->nodep())) << endl); if (it != m_idNameMap.end()) return (it->second); - return NULL; + return nullptr; } VSymEnt* findIdFallback(const string& name) const { // Find identifier looking upward through symbol hierarchy @@ -161,7 +161,7 @@ public: if (VSymEnt* entp = findIdFlat(name)) return entp; // Then scan the upper begin/end block or module for the name if (m_fallbackp) return m_fallbackp->findIdFallback(name); - return NULL; + return nullptr; } void candidateIdFlat(VSpellCheck* spellerp, const VNodeMatcher* matcherp) const { // Suggest alternative symbol candidates without looking upward through symbol hierarchy @@ -335,9 +335,9 @@ inline VSymEnt::VSymEnt(VSymGraph* graphp, AstNode* nodep) // No argument to set fallbackp, as generally it's wrong to set it in the new call, // Instead it needs to be set on a "findOrNew()" return, as it may have been new'ed // by an earlier search insertion. - m_fallbackp = NULL; - m_parentp = NULL; - m_packagep = NULL; + m_fallbackp = nullptr; + m_parentp = nullptr; + m_packagep = nullptr; m_exported = true; m_imported = false; graphp->pushNewEnt(this); diff --git a/src/V3Table.cpp b/src/V3Table.cpp index d074f7195..13f54fad2 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -187,7 +187,7 @@ private: AstVar* chgVarp = new AstVar(fl, AstVarType::MODULETEMP, "__Vtablechg" + cvtToStr(m_modTables), dtypep); chgVarp->isConst(true); - chgVarp->valuep(new AstInitArray(nodep->fileline(), dtypep, NULL)); + chgVarp->valuep(new AstInitArray(nodep->fileline(), dtypep, nullptr)); m_modp->addStmtp(chgVarp); AstVarScope* chgVscp = new AstVarScope(chgVarp->fileline(), m_scopep, chgVarp); m_scopep->addVarp(chgVscp); @@ -243,7 +243,7 @@ private: AstVar* tablevarp = new AstVar(fl, AstVarType::MODULETEMP, name, dtypep); tablevarp->isConst(true); tablevarp->isStatic(true); - tablevarp->valuep(new AstInitArray(nodep->fileline(), dtypep, NULL)); + tablevarp->valuep(new AstInitArray(nodep->fileline(), dtypep, nullptr)); m_modp->addStmtp(tablevarp); AstVarScope* tablevscp = new AstVarScope(tablevarp->fileline(), m_scopep, tablevarp); m_scopep->addVarp(tablevscp); @@ -254,7 +254,7 @@ private: AstNode* createLookupInput(AstNode* nodep, AstVarScope* indexVscp) { // Concat inputs into a single temp variable (inside always) // First var in inVars becomes the LSB of the concat - AstNode* concatp = NULL; + AstNode* concatp = nullptr; for (std::deque::iterator it = m_inVarps.begin(); it != m_inVarps.end(); ++it) { AstVarScope* invscp = *it; @@ -287,7 +287,7 @@ private: UINFO(8, " Simulating " << std::hex << inValue << endl); // Above simulateVisitor clears user 3, so - // all outputs default to NULL to mean 'recirculating'. + // all outputs default to nullptr to mean 'recirculating'. simvis.clear(); // Set all inputs to the constant @@ -404,7 +404,7 @@ private: new AstVarRef(nodep->fileline(), chgVscp, false), new AstVarRef(nodep->fileline(), indexVscp, false)), new AstConst(nodep->fileline(), outputChgMask)), - outsetp, NULL); + outsetp, nullptr); } stmtsp->addNext(outsetp); @@ -432,7 +432,7 @@ private: UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; iterateChildren(nodep); - m_scopep = NULL; + m_scopep = nullptr; } virtual void visit(AstAlways* nodep) override { UINFO(4, " ALWAYS " << nodep << endl); @@ -452,9 +452,9 @@ private: public: // CONSTRUCTORS explicit TableVisitor(AstNetlist* nodep) { - m_modp = NULL; + m_modp = nullptr; m_modTables = 0; - m_scopep = NULL; + m_scopep = nullptr; m_assignDly = 0; m_inWidth = 0; m_outWidth = 0; diff --git a/src/V3Task.cpp b/src/V3Task.cpp index bc80219b2..1342606d8 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -45,10 +45,10 @@ class TaskBaseVertex : public V3GraphVertex { public: explicit TaskBaseVertex(V3Graph* graphp) : V3GraphVertex(graphp) - , m_impurep(NULL) + , m_impurep(nullptr) , m_noInline(false) {} virtual ~TaskBaseVertex() {} - bool pure() const { return m_impurep == NULL; } + bool pure() const { return m_impurep == nullptr; } AstNode* impureNode() const { return m_impurep; } void impure(AstNode* nodep) { m_impurep = nodep; } bool noInline() const { return m_noInline; } @@ -64,7 +64,7 @@ public: TaskFTaskVertex(V3Graph* graphp, AstNodeFTask* nodep) : TaskBaseVertex(graphp) , m_nodep(nodep) { - m_cFuncp = NULL; + m_cFuncp = nullptr; } virtual ~TaskFTaskVertex() {} AstNodeFTask* nodep() const { return m_nodep; } @@ -182,7 +182,7 @@ private: virtual void visit(AstAssignW* nodep) override { m_assignwp = nodep; VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep. - m_assignwp = NULL; + m_assignwp = nullptr; } virtual void visit(AstNodeFTaskRef* nodep) override { // Includes handling AstMethodCall, AstNew @@ -191,7 +191,7 @@ private: // of multiple statements. Perhaps someday make all wassigns into always's? UINFO(5, " IM_WireRep " << m_assignwp << endl); m_assignwp->convertToAlways(); - VL_DO_CLEAR(pushDeletep(m_assignwp), m_assignwp = NULL); + VL_DO_CLEAR(pushDeletep(m_assignwp), m_assignwp = nullptr); } // We make multiple edges if a task is called multiple times from another task. UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked task"); @@ -232,7 +232,7 @@ private: virtual void visit(AstClass* nodep) override { // Move initial statements into the constructor m_initialps.clear(); - m_ctorp = NULL; + m_ctorp = nullptr; { // Find m_initialps, m_ctor iterateChildren(nodep); } @@ -250,7 +250,7 @@ private: VL_DO_DANGLING(pushDeletep(initialp->unlinkFrBack()), initialp); } m_initialps.clear(); - m_ctorp = NULL; + m_ctorp = nullptr; } virtual void visit(AstInitial* nodep) override { m_initialps.push_back(nodep); @@ -262,8 +262,8 @@ private: public: // CONSTRUCTORS explicit TaskStateVisitor(AstNetlist* nodep) - : m_assignwp(NULL) - , m_ctorp(NULL) { + : m_assignwp(nullptr) + , m_ctorp(nullptr) { m_curVxp = new TaskCodeVertex(&m_callGraph); AstNode::user3ClearTree(); AstNode::user4ClearTree(); @@ -382,9 +382,10 @@ private: AstNode* createInlinedFTask(AstNodeFTaskRef* refp, const string& namePrefix, AstVarScope* outvscp) { - // outvscp is the variable for functions only, if NULL, it's a task + // outvscp is the variable for functions only, if nullptr, it's a task UASSERT_OBJ(refp->taskp(), refp, "Unlinked?"); - AstNode* newbodysp = AstNode::cloneTreeNull(refp->taskp()->stmtsp(), true); // Maybe NULL + AstNode* newbodysp + = AstNode::cloneTreeNull(refp->taskp()->stmtsp(), true); // Maybe nullptr AstNode* beginp = new AstComment(refp->fileline(), string("Function: ") + refp->name(), true); if (newbodysp) beginp->addNext(newbodysp); @@ -502,7 +503,7 @@ private: AstNode* createNonInlinedFTask(AstNodeFTaskRef* refp, const string& namePrefix, AstVarScope* outvscp, AstCNew*& cnewpr) { - // outvscp is the variable for functions only, if NULL, it's a task + // outvscp is the variable for functions only, if nullptr, it's a task UASSERT_OBJ(refp->taskp(), refp, "Unlinked?"); AstCFunc* cfuncp = m_statep->ftaskCFuncp(refp->taskp()); UASSERT_OBJ(cfuncp, refp, "No non-inline task associated with this task call?"); @@ -716,7 +717,7 @@ private: string args; args += ("(" + EmitCBaseVisitor::symClassName() + "*)(__Vscopep->symsp())"); // Upcast w/o overhead - AstNode* argnodesp = NULL; + AstNode* argnodesp = nullptr; for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp = stmtp->nextp()) { if (AstVar* portp = VN_CAST(stmtp, Var)) { if (portp->isIO() && !portp->isFuncReturn() && portp != rtnvarp) { @@ -951,7 +952,7 @@ private: // Probably some of this work should be done later, but... // should the type of the function be bool/uint32/64 etc (based on lookup) or IData? AstNode::user2ClearTree(); - AstVar* rtnvarp = NULL; + AstVar* rtnvarp = nullptr; if (nodep->isFunction()) { AstVar* portp = VN_CAST(nodep->fvarp(), Var); UASSERT_OBJ(portp, nodep, "function without function output variable"); @@ -1000,7 +1001,7 @@ private: if (nodep->dpiOpenParent()) { // No need to make more than just the c prototype, children will VL_DO_DANGLING(pushDeletep(nodep), nodep); - return NULL; + return nullptr; } } @@ -1009,7 +1010,7 @@ private: if (!duplicatedDpiProto(nodep, dpiproto)) makeDpiExportWrapper(nodep, rtnvarp); } - AstVarScope* rtnvscp = NULL; + AstVarScope* rtnvscp = nullptr; if (rtnvarp) { rtnvscp = new AstVarScope(rtnvarp->fileline(), m_scopep, rtnvarp); m_scopep->addVarp(rtnvscp); @@ -1151,7 +1152,7 @@ private: // See also AstNode::addBeforeStmt; this predates that function if (debug() >= 9) nodep->dumpTree(cout, "-newstmt:"); UASSERT_OBJ(m_insStmtp, nodep, "Function not underneath a statement"); - AstNode* visitp = NULL; + AstNode* visitp = nullptr; if (m_insMode == IM_BEFORE) { // Add the whole thing before insertAt UINFO(5, " IM_Before " << m_insStmtp << endl); @@ -1180,7 +1181,7 @@ private: int origNCalls = m_modNCalls; { m_modp = nodep; - m_insStmtp = NULL; + m_insStmtp = nullptr; m_modNCalls = 0; iterateChildren(nodep); } @@ -1193,9 +1194,9 @@ private: } virtual void visit(AstScope* nodep) override { m_scopep = nodep; - m_insStmtp = NULL; + m_insStmtp = nullptr; iterateChildren(nodep); - m_scopep = NULL; + m_scopep = nullptr; } virtual void visit(AstNodeFTaskRef* nodep) override { // Includes handling AstMethodCall, AstNew @@ -1207,7 +1208,7 @@ private: string namePrefix = ((VN_IS(nodep, FuncRef) ? "__Vfunc_" : "__Vtask_") + nodep->taskp()->shortName() + "__" + cvtToStr(m_modNCalls++)); // Create output variable - AstVarScope* outvscp = NULL; + AstVarScope* outvscp = nullptr; if (nodep->taskp()->isFunction()) { // Not that it's a FUNCREF, but that we're calling a function (perhaps as a task) outvscp @@ -1215,7 +1216,7 @@ private: } // Create cloned statements AstNode* beginp; - AstCNew* cnewp = NULL; + AstCNew* cnewp = nullptr; if (m_statep->ftaskNoInline(nodep->taskp())) { // This may share VarScope's with a public task, if any. Yuk. beginp = createNonInlinedFTask(nodep, namePrefix, outvscp, cnewp /*ref*/); @@ -1223,7 +1224,7 @@ private: beginp = createInlinedFTask(nodep, namePrefix, outvscp); } // Replace the ref - AstNode* visitp = NULL; + AstNode* visitp = nullptr; if (VN_IS(nodep, New)) { UASSERT_OBJ(!nodep->isStatement(), nodep, "new is non-stmt"); UASSERT_OBJ(cnewp, nodep, "didn't create cnew for new"); @@ -1241,7 +1242,7 @@ private: IGNOREDRETURN, "Ignoring return value of non-void function (IEEE 1800-2017 13.4.1)"); } - // outvscp maybe non-NULL if calling a function in a taskref, + // outvscp maybe non-nullptr if calling a function in a taskref, // but if so we want to simply ignore the function result nodep->replaceWith(beginp); } @@ -1323,18 +1324,18 @@ private: // Special, as statements need to be put in different places // Preconditions insert first just before themselves (the normal // rule for other statement types) - m_insStmtp = NULL; // First thing should be new statement + m_insStmtp = nullptr; // First thing should be new statement iterateAndNextNull(nodep->precondsp()); // Conditions insert first at end of precondsp. m_insMode = IM_WHILE_PRECOND; m_insStmtp = nodep; iterateAndNextNull(nodep->condp()); // Body insert just before themselves - m_insStmtp = NULL; // First thing should be new statement + m_insStmtp = nullptr; // First thing should be new statement iterateAndNextNull(nodep->bodysp()); iterateAndNextNull(nodep->incsp()); // Done the loop - m_insStmtp = NULL; // Next thing should be new statement + m_insStmtp = nullptr; // Next thing should be new statement } virtual void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc( @@ -1348,7 +1349,7 @@ private: m_insMode = IM_BEFORE; m_insStmtp = nodep; iterateChildren(nodep); - m_insStmtp = NULL; // Next thing should be new statement + m_insStmtp = nullptr; // Next thing should be new statement } //-------------------- virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } @@ -1357,11 +1358,11 @@ public: // CONSTRUCTORS TaskVisitor(AstNetlist* nodep, TaskStateVisitor* statep) : m_statep(statep) { - m_modp = NULL; - m_topScopep = NULL; - m_scopep = NULL; + m_modp = nullptr; + m_topScopep = nullptr; + m_scopep = nullptr; m_insMode = IM_BEFORE; - m_insStmtp = NULL; + m_insStmtp = nullptr; m_modNCalls = 0; AstNode::user1ClearTree(); iterate(nodep); @@ -1375,7 +1376,7 @@ public: V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp) { // Output list will be in order of the port declaration variables (so // func calls are made right in C) - // Missing pin/expr? We return (pinvar, NULL) + // Missing pin/expr? We return (pinvar, nullptr) // Extra pin/expr? We clean it up typedef std::map NameToIndex; @@ -1385,11 +1386,11 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp) // Find ports int tpinnum = 0; - AstVar* sformatp = NULL; + AstVar* sformatp = nullptr; for (AstNode* stmtp = taskStmtsp; stmtp; stmtp = stmtp->nextp()) { if (AstVar* portp = VN_CAST(stmtp, Var)) { if (portp->isIO()) { - tconnects.push_back(make_pair(portp, static_cast(NULL))); + tconnects.push_back(make_pair(portp, static_cast(nullptr))); nameToIndex.insert( make_pair(portp->name(), tpinnum)); // For name based connections tpinnum++; @@ -1431,7 +1432,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp) } else { // By pin number if (ppinnum >= tpinnum) { if (sformatp) { - tconnects.push_back(make_pair(sformatp, static_cast(NULL))); + tconnects.push_back(make_pair(sformatp, static_cast(nullptr))); tconnects[ppinnum].second = argp; tpinnum++; } else { @@ -1451,7 +1452,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp) for (int i = 0; i < tpinnum; ++i) { AstVar* portp = tconnects[i].first; if (!tconnects[i].second || !tconnects[i].second->exprp()) { - AstNode* newvaluep = NULL; + AstNode* newvaluep = nullptr; if (!portp->valuep()) { nodep->v3error("Missing argument on non-defaulted argument " << portp->prettyNameQ() << " in function call to " @@ -1481,9 +1482,9 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp) // or not, we make this into a pin UINFO(9, "Default pin for " << portp << endl); AstArg* newp = new AstArg(nodep->fileline(), portp->name(), newvaluep); - if (tconnects[i].second) { // Have a "NULL" pin already defined for it + if (tconnects[i].second) { // Have a "nullptr" pin already defined for it VL_DO_CLEAR(tconnects[i].second->unlinkFrBack()->deleteTree(), - tconnects[i].second = NULL); + tconnects[i].second = nullptr); } tconnects[i].second = newp; reorganize = true; diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index b9be8a603..59a8a97d1 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -67,7 +67,7 @@ public: } TraceActivityVertex(V3Graph* graphp, vlsint32_t code) : V3GraphVertex(graphp) - , m_insertp(NULL) { + , m_insertp(nullptr) { m_activityCode = code; m_slow = false; } @@ -112,14 +112,14 @@ public: class TraceTraceVertex : public V3GraphVertex { AstTraceDecl* const m_nodep; // TRACEINC this represents - // NULL, or other vertex with the real code() that duplicates this one + // nullptr, or other vertex with the real code() that duplicates this one TraceTraceVertex* m_duplicatep; public: TraceTraceVertex(V3Graph* graphp, AstTraceDecl* nodep) : V3GraphVertex(graphp) , m_nodep(nodep) - , m_duplicatep(NULL) {} + , m_duplicatep(nullptr) {} virtual ~TraceTraceVertex() {} // ACCESSORS AstTraceDecl* nodep() const { return m_nodep; } @@ -273,7 +273,7 @@ private: if (const TraceTraceVertex* const vvertexp = dynamic_cast(itp)) { // Search for the incoming always edge - const V3GraphEdge* alwaysEdgep = NULL; + const V3GraphEdge* alwaysEdgep = nullptr; for (const V3GraphEdge* edgep = vvertexp->inBeginp(); edgep; edgep = edgep->inNextp()) { const TraceActivityVertex* const actVtxp @@ -536,8 +536,8 @@ private: int subFuncNum = 0; TraceVec::const_iterator it = traces.begin(); while (it != traces.end()) { - AstCFunc* topFuncp = NULL; - AstCFunc* subFuncp = NULL; + AstCFunc* topFuncp = nullptr; + AstCFunc* subFuncp = nullptr; int subStmts = 0; const uint32_t maxCodes = (nAllCodes + parallelism - 1) / parallelism; uint32_t nCodes = 0; @@ -566,14 +566,15 @@ private: // Create top function if not yet created if (!topFuncp) { - topFuncp = newCFunc(AstCFuncType::TRACE_FULL, NULL, regFuncp, topFuncNum); + topFuncp + = newCFunc(AstCFuncType::TRACE_FULL, nullptr, regFuncp, topFuncNum); } // Crate new sub function if required if (!subFuncp || subStmts > splitLimit) { subStmts = 0; - subFuncp - = newCFunc(AstCFuncType::TRACE_FULL_SUB, topFuncp, NULL, subFuncNum); + subFuncp = newCFunc(AstCFuncType::TRACE_FULL_SUB, topFuncp, nullptr, + subFuncNum); } // Add TraceInc node @@ -585,7 +586,7 @@ private: nCodes += declp->codeInc(); } } - if (topFuncp) { // might be NULL if all trailing entries were duplicates + if (topFuncp) { // might be nullptr if all trailing entries were duplicates UINFO(5, "traceFullTop" << topFuncNum - 1 << " codes: " << nCodes << "/" << maxCodes << endl); } @@ -600,13 +601,13 @@ private: int subFuncNum = 0; TraceVec::const_iterator it = traces.begin(); while (it != traces.end()) { - AstCFunc* topFuncp = NULL; - AstCFunc* subFuncp = NULL; + AstCFunc* topFuncp = nullptr; + AstCFunc* subFuncp = nullptr; int subStmts = 0; const uint32_t maxCodes = (nAllCodes + parallelism - 1) / parallelism; uint32_t nCodes = 0; - const ActCodeSet* prevActSet = NULL; - AstIf* ifp = NULL; + const ActCodeSet* prevActSet = nullptr; + AstIf* ifp = nullptr; for (; nCodes < maxCodes && it != traces.end(); ++it) { const TraceTraceVertex* const vtxp = it->second; // This is a duplicate decl, no need to add it to incremental dump @@ -617,23 +618,23 @@ private: // Create top function if not yet created if (!topFuncp) { - topFuncp = newCFunc(AstCFuncType::TRACE_CHANGE, NULL, regFuncp, topFuncNum); + topFuncp = newCFunc(AstCFuncType::TRACE_CHANGE, nullptr, regFuncp, topFuncNum); } // Crate new sub function if required if (!subFuncp || subStmts > splitLimit) { subStmts = 0; subFuncp - = newCFunc(AstCFuncType::TRACE_CHANGE_SUB, topFuncp, NULL, subFuncNum); - prevActSet = NULL; - ifp = NULL; + = newCFunc(AstCFuncType::TRACE_CHANGE_SUB, topFuncp, nullptr, subFuncNum); + prevActSet = nullptr; + ifp = nullptr; } // If required, create the conditional node checking the activity flags if (!prevActSet || actSet != *prevActSet) { FileLine* const flp = m_topScopep->fileline(); bool always = actSet.count(TraceActivityVertex::ACTIVITY_ALWAYS) != 0; - AstNode* condp = NULL; + AstNode* condp = nullptr; if (always) { condp = new AstConst(flp, 1); // Always true, will be folded later } else { @@ -643,7 +644,7 @@ private: condp = condp ? new AstOr(flp, condp, selp) : selp; } } - ifp = new AstIf(flp, condp, NULL, NULL); + ifp = new AstIf(flp, condp, nullptr, nullptr); if (!always) { ifp->branchPred(VBranchPred::BP_UNLIKELY); } subFuncp->addStmtsp(ifp); subStmts += EmitCBaseCounterVisitor(ifp).count(); @@ -659,7 +660,7 @@ private: // Track partitioning nCodes += declp->codeInc(); } - if (topFuncp) { // might be NULL if all trailing entries were duplicates/constants + if (topFuncp) { // might be nullptr if all trailing entries were duplicates/constants UINFO(5, "traceChgTop" << topFuncNum - 1 << " codes: " << nCodes << "/" << maxCodes << endl); } @@ -829,7 +830,7 @@ private: } m_funcp = nodep; iterateChildren(nodep); - m_funcp = NULL; + m_funcp = nullptr; } virtual void visit(AstTraceDecl* nodep) override { UINFO(8, " TRACE " << nodep << endl); @@ -840,7 +841,7 @@ private: UASSERT_OBJ(m_funcp, nodep, "Trace not under func"); m_tracep = nodep; iterateChildren(nodep); - m_tracep = NULL; + m_tracep = nullptr; } } virtual void visit(AstVarRef* nodep) override { @@ -874,12 +875,12 @@ public: // CONSTRUCTORS explicit TraceVisitor(AstNetlist* nodep) : m_alwaysVtxp(new TraceActivityVertex(&m_graph, TraceActivityVertex::ACTIVITY_ALWAYS)) { - m_funcp = NULL; - m_tracep = NULL; - m_topModp = NULL; - m_topScopep = NULL; + m_funcp = nullptr; + m_tracep = nullptr; + m_topModp = nullptr; + m_topScopep = nullptr; m_finding = false; - m_activityVscp = NULL; + m_activityVscp = nullptr; m_activityNumber = 0; m_code = 0; iterate(nodep); diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 5e86041a2..ce11cf3c4 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -65,7 +65,7 @@ private: if (!prettyName.empty() && prettyName[0] == '_') return "Leading underscore"; if (prettyName.find("._") != string::npos) return "Inlined leading underscore"; } - return NULL; + return nullptr; } AstCFunc* newCFunc(AstCFuncType type, const string& name) { @@ -91,7 +91,7 @@ private: AstCFunc* newCFuncSub(AstCFunc* basep) { const string name = "traceInitSub" + cvtToStr(m_funcNum++); AstCFunc* const funcp = newCFunc(AstCFuncType::TRACE_INIT_SUB, name); - if (!m_interface) callCFuncSub(basep, funcp, NULL); + if (!m_interface) callCFuncSub(basep, funcp, nullptr); return funcp; } void addTraceDecl(const VNumRange& arrayRange, @@ -191,7 +191,7 @@ private: m_traShowname = AstNode::vcdName(scopep->name() + " " + varp->name()); if (m_traShowname.substr(0, 4) == "TOP ") m_traShowname.erase(0, 4); } - UASSERT_OBJ(m_initSubFuncp, nodep, "NULL"); + UASSERT_OBJ(m_initSubFuncp, nodep, "nullptr"); m_traVscp = nodep; if (const char* const ignoreReasonp = vscIgnoreTrace(nodep)) { @@ -206,9 +206,9 @@ private: // Recurse into data type of the signal; the visitors will call addTraceDecl() iterate(varp->dtypep()->skipRefToEnump()); // Cleanup - if (m_traValuep) VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL); + if (m_traValuep) VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = nullptr); } - m_traVscp = NULL; + m_traVscp = nullptr; m_traShowname = ""; } } @@ -248,7 +248,7 @@ private: m_traValuep->dtypep(subtypep); iterate(subtypep); - VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL); + VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = nullptr); } m_traShowname = oldShowname; m_traValuep = oldValuep; @@ -275,7 +275,7 @@ private: subtypep->width()); m_traValuep->dtypep(subtypep); iterate(subtypep); - VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL); + VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = nullptr); } m_traShowname = oldShowname; m_traValuep = oldValuep; @@ -306,7 +306,7 @@ private: itemp->lsb(), subtypep->width()); m_traValuep->dtypep(subtypep); iterate(subtypep); - VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = NULL); + VL_DO_CLEAR(m_traValuep->deleteTree(), m_traValuep = nullptr); } else { // Else union, replicate fields iterate(subtypep); } @@ -339,13 +339,13 @@ private: public: // CONSTRUCTORS explicit TraceDeclVisitor(AstNetlist* nodep) { - m_topScopep = NULL; - m_initFuncp = NULL; - m_initSubFuncp = NULL; + m_topScopep = nullptr; + m_initFuncp = nullptr; + m_initSubFuncp = nullptr; m_initSubStmts = 0; m_funcNum = 0; - m_traVscp = NULL; - m_traValuep = NULL; + m_traVscp = nullptr; + m_traValuep = nullptr; m_interface = false; iterate(nodep); } diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 57cdbcc18..0f36c15b7 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -531,8 +531,8 @@ class TristateVisitor : public TristateBaseVisitor { // original port gets converted to an input. Don't tristate expand // if this is the top level so that we can force the final // tristate resolution at the top. - AstVar* envarp = NULL; - AstVar* outvarp = NULL; // __out + AstVar* envarp = nullptr; + AstVar* outvarp = nullptr; // __out AstVar* lhsp = invarp; // Variable to assign drive-value to ( or __out) if (!nodep->isTop() && invarp->isIO()) { // This var becomes an input @@ -554,9 +554,9 @@ class TristateVisitor : public TristateBaseVisitor { envarp = VN_CAST(invarp->user1p(), Var); // From CASEEQ, foo === 1'bz } - AstNode* orp = NULL; - AstNode* enp = NULL; - AstNode* undrivenp = NULL; + AstNode* orp = nullptr; + AstNode* enp = nullptr; + AstNode* undrivenp = nullptr; // loop through the lhs drivers to build the driver resolution logic for (RefVec::iterator ii = refsp->begin(); ii != refsp->end(); ++ii) { @@ -710,8 +710,8 @@ class TristateVisitor : public TristateBaseVisitor { AstNode* enp = new AstCond(nodep->fileline(), condp->cloneTree(false), en1p, en2p); UINFO(9, " newcond " << enp << endl); nodep->user1p(enp); // propagate up COND(lhsp->enable, rhsp->enable) - expr1p->user1p(NULL); - expr2p->user1p(NULL); + expr1p->user1p(nullptr); + expr2p->user1p(nullptr); } } } @@ -771,7 +771,7 @@ class TristateVisitor : public TristateBaseVisitor { if (nodep->user1p()) { // Each half of the concat gets a select of the enable expression AstNode* enp = nodep->user1p(); - nodep->user1p(NULL); + nodep->user1p(nullptr); nodep->lhsp()->user1p(new AstSel(nodep->fileline(), enp->cloneTree(true), nodep->rhsp()->width(), nodep->lhsp()->width())); @@ -794,8 +794,8 @@ class TristateVisitor : public TristateBaseVisitor { AstNode* enp = new AstConcat(nodep->fileline(), en1p, en2p); UINFO(9, " newconc " << enp << endl); nodep->user1p(enp); // propagate up CONCAT(lhsp->enable, rhsp->enable) - expr1p->user1p(NULL); - expr2p->user1p(NULL); + expr1p->user1p(nullptr); + expr2p->user1p(nullptr); } } } @@ -824,7 +824,7 @@ class TristateVisitor : public TristateBaseVisitor { } else { enp = expr1p; } - expr1p->user1p(NULL); + expr1p->user1p(nullptr); expr2p->user1p(enp); // Becomes new node // Don't need the BufIf any more, can just have the data direct nodep->replaceWith(expr2p); @@ -881,8 +881,8 @@ class TristateVisitor : public TristateBaseVisitor { new AstAnd(nodep->fileline(), en2p->cloneTree(false), subexpr2p))); UINFO(9, " neweqn " << enp << endl); nodep->user1p(enp); - expr1p->user1p(NULL); - expr2p->user1p(NULL); + expr1p->user1p(nullptr); + expr2p->user1p(nullptr); } } virtual void visit(AstAnd* nodep) override { visitAndOr(nodep, true); } @@ -899,7 +899,7 @@ class TristateVisitor : public TristateBaseVisitor { m_alhs = false; associateLogic(nodep->rhsp(), nodep); associateLogic(nodep, nodep->lhsp()); - m_logicp = NULL; + m_logicp = nullptr; } else { if (nodep->user2() & U2_NONGRAPH) { return; // Iterated here, or created assignment to ignore @@ -914,7 +914,7 @@ class TristateVisitor : public TristateBaseVisitor { // the appropriate output signal's VarRef. if (nodep->rhsp()->user1p()) { nodep->lhsp()->user1p(nodep->rhsp()->user1p()); - nodep->rhsp()->user1p(NULL); + nodep->rhsp()->user1p(nullptr); UINFO(9, " enp<-rhs " << nodep->lhsp()->user1p() << endl); m_tgraph.didProcess(nodep); } @@ -983,7 +983,7 @@ class TristateVisitor : public TristateBaseVisitor { virtual void visit(AstPull* nodep) override { UINFO(9, dbgState() << nodep << endl); - AstVarRef* varrefp = NULL; + AstVarRef* varrefp = nullptr; if (VN_IS(nodep->lhsp(), VarRef)) { varrefp = VN_CAST(nodep->lhsp(), VarRef); } else if (VN_IS(nodep->lhsp(), Sel) @@ -999,7 +999,7 @@ class TristateVisitor : public TristateBaseVisitor { m_logicp = nodep; m_tgraph.setTristate(nodep); associateLogic(nodep, varrefp->varp()); - m_logicp = NULL; + m_logicp = nullptr; } else { // Replace any pullup/pulldowns with assignw logic and set the // direction of the pull in the user3() data on the var. Given @@ -1027,7 +1027,7 @@ class TristateVisitor : public TristateBaseVisitor { associateLogic(nodep, nodep->exprp()); } iterateChildren(nodep); - m_logicp = NULL; + m_logicp = nullptr; } else { // All heavy lifting completed in graph visitor. if (nodep->exprp()) m_tgraph.didProcess(nodep); @@ -1119,8 +1119,8 @@ class TristateVisitor : public TristateBaseVisitor { if (debug() >= 9) enpinp->dumpTree(cout, "-pin-ena: "); } // Create new output pin - AstAssignW* outAssignp = NULL; // If reconnected, the related assignment - AstPin* outpinp = NULL; + AstAssignW* outAssignp = nullptr; // If reconnected, the related assignment + AstPin* outpinp = nullptr; AstVar* outModVarp = static_cast(nodep->modVarp()->user4p()); if (!outModVarp) { // At top, no need for __out as might be input only. Otherwise resolvable. @@ -1165,7 +1165,7 @@ class TristateVisitor : public TristateBaseVisitor { AstVarRef* exprrefp; // Tristate variable that the Pin's expression refers to if (!outAssignp) { if (!outpinp) { - exprrefp = NULL; // Primary input only + exprrefp = nullptr; // Primary input only } else { // pinReconnect should have converted this exprrefp = VN_CAST(outpinp->exprp(), VarRef); @@ -1295,7 +1295,7 @@ class TristateVisitor : public TristateBaseVisitor { m_graphing = false; m_tgraph.clear(); m_unique = 0; - m_logicp = NULL; + m_logicp = nullptr; m_lhsmap.clear(); m_modp = nodep; // Walk the graph, finding all variables and tristate constructs @@ -1334,7 +1334,7 @@ class TristateVisitor : public TristateBaseVisitor { m_cellp = nodep; m_alhs = false; iterateChildren(nodep); - m_cellp = NULL; + m_cellp = nullptr; } virtual void visit(AstNetlist* nodep) override { iterateChildrenBackwards(nodep); } @@ -1349,11 +1349,11 @@ public: // CONSTRUCTORS explicit TristateVisitor(AstNode* nodep) { m_graphing = false; - m_modp = NULL; - m_cellp = NULL; + m_modp = nullptr; + m_cellp = nullptr; m_unique = 0; m_alhs = false; - m_logicp = NULL; + m_logicp = nullptr; m_tgraph.clear(); iterate(nodep); } diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index d0d1ed597..94a258808 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -242,7 +242,7 @@ private: bool m_inContAssign; // In continuous assignment bool m_inProcAssign; // In procedural assignment AstNodeFTask* m_taskp; // Current task - AstAlways* m_alwaysCombp; // Current always if combo, otherwise NULL + AstAlways* m_alwaysCombp; // Current always if combo, otherwise nullptr // METHODS VL_DEBUG_FUNC; // Declare debug() @@ -408,7 +408,7 @@ private: if (nodep->keyword() == VAlwaysKwd::ALWAYS_COMB) { m_alwaysCombp = nodep; } else { - m_alwaysCombp = NULL; + m_alwaysCombp = nullptr; } iterateChildren(nodep); if (nodep->keyword() == VAlwaysKwd::ALWAYS_COMB) UINFO(9, " Done " << nodep << endl); @@ -443,8 +443,8 @@ public: m_inBBox = false; m_inContAssign = false; m_inProcAssign = false; - m_taskp = NULL; - m_alwaysCombp = NULL; + m_taskp = nullptr; + m_alwaysCombp = nullptr; iterate(nodep); } virtual ~UndrivenVisitor() { diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 90d1a1f1b..76d0c18f3 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -82,9 +82,9 @@ private: // of multiple statements. Perhaps someday make all wassigns into always's? UINFO(5, " IM_WireRep " << m_assignwp << endl); m_assignwp->convertToAlways(); - VL_DO_CLEAR(pushDeletep(m_assignwp), m_assignwp = NULL); + VL_DO_CLEAR(pushDeletep(m_assignwp), m_assignwp = nullptr); } - bool needDly = (m_assigndlyp != NULL); + bool needDly = (m_assigndlyp != nullptr); if (m_assigndlyp) { // Delayed assignments become normal assignments, // then the temp created becomes the delayed assignment @@ -92,7 +92,7 @@ private: m_assigndlyp->lhsp()->unlinkFrBackWithNext(), m_assigndlyp->rhsp()->unlinkFrBackWithNext()); m_assigndlyp->replaceWith(newp); - VL_DO_CLEAR(pushDeletep(m_assigndlyp), m_assigndlyp = NULL); + VL_DO_CLEAR(pushDeletep(m_assigndlyp), m_assigndlyp = nullptr); } AstNode* prep = nodep; @@ -125,7 +125,7 @@ private: new AstAssignDly(fl, prep, new AstVarRef(fl, varp, false))) : static_cast( new AstAssign(fl, prep, new AstVarRef(fl, varp, false)))), - NULL); + nullptr); newp->branchPred(VBranchPred::BP_LIKELY); if (debug() >= 9) newp->dumpTree(cout, " _new: "); abovep->addNextStmt(newp, abovep); @@ -147,12 +147,12 @@ private: virtual void visit(AstAssignDly* nodep) override { m_assigndlyp = nodep; VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep. - m_assigndlyp = NULL; + m_assigndlyp = nullptr; } virtual void visit(AstAssignW* nodep) override { m_assignwp = nodep; VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep. - m_assignwp = NULL; + m_assignwp = nullptr; } virtual void visit(AstCaseItem* nodep) override { m_constXCvt = false; // Avoid losing the X's in casex @@ -429,9 +429,9 @@ private: public: // CONSTRUCTORS explicit UnknownVisitor(AstNetlist* nodep) { - m_modp = NULL; - m_assigndlyp = NULL; - m_assignwp = NULL; + m_modp = nullptr; + m_assigndlyp = nullptr; + m_assignwp = nullptr; m_constXCvt = false; iterate(nodep); } diff --git a/src/V3Unroll.cpp b/src/V3Unroll.cpp index eff6bd57c..10eae4ab6 100644 --- a/src/V3Unroll.cpp +++ b/src/V3Unroll.cpp @@ -43,7 +43,7 @@ class UnrollVisitor : public AstNVisitor { private: // STATE AstVar* m_forVarp; // Iterator variable - AstVarScope* m_forVscp; // Iterator variable scope (NULL for generate pass) + AstVarScope* m_forVscp; // Iterator variable scope (nullptr for generate pass) AstConst* m_varValuep; // Current value of loop AstNode* m_ignoreIncp; // Increment node to ignore bool m_varModeCheck; // Just checking RHS assignments @@ -144,7 +144,7 @@ private: iterateAndNextNull(bodysp); iterateAndNextNull(incp); m_varModeCheck = false; - m_ignoreIncp = NULL; + m_ignoreIncp = nullptr; if (m_varAssignHit) return cantUnroll(nodep, "genvar assigned *inside* loop"); // @@ -191,7 +191,7 @@ private: SimulateVisitor simvis; AstNode* clonep = nodep->cloneTree(true); simvis.mainCheckTree(clonep); - VL_DO_CLEAR(pushDeletep(clonep), clonep = NULL); + VL_DO_CLEAR(pushDeletep(clonep), clonep = nullptr); return simvis.optimizable(); } @@ -208,8 +208,8 @@ private: m_varModeReplace = false; clonep = tempp->stmtsp()->unlinkFrBackWithNext(); tempp->deleteTree(); - tempp = NULL; - VL_DO_CLEAR(pushDeletep(m_varValuep), m_varValuep = NULL); + tempp = nullptr; + VL_DO_CLEAR(pushDeletep(m_varValuep), m_varValuep = nullptr); } SimulateVisitor simvis; simvis.mainParamEmulate(clonep); @@ -242,12 +242,12 @@ private: bool countLoops(AstAssign* initp, AstNode* condp, AstNode* incp, int max, int& outLoopsr) { outLoopsr = 0; V3Number loopValue = V3Number(initp); - if (!simulateTree(initp->rhsp(), NULL, initp, loopValue)) { // + if (!simulateTree(initp->rhsp(), nullptr, initp, loopValue)) { // return false; } while (true) { V3Number res = V3Number(initp); - if (!simulateTree(condp, &loopValue, NULL, res)) { // + if (!simulateTree(condp, &loopValue, nullptr, res)) { // return false; } if (!res.isEqOne()) break; @@ -270,10 +270,10 @@ private: AstNode* incp, AstNode* bodysp) { UINFO(9, "forUnroller " << nodep << endl); V3Number loopValue = V3Number(nodep); - if (!simulateTree(initp->rhsp(), NULL, initp, loopValue)) { // + if (!simulateTree(initp->rhsp(), nullptr, initp, loopValue)) { // return false; } - AstNode* stmtsp = NULL; + AstNode* stmtsp = nullptr; if (initp) { initp->unlinkFrBack(); // Always a single statement; nextp() may be nodep // Don't add to list, we do it once, and setting loop index isn't @@ -294,14 +294,14 @@ private: // Mark variable to disable some later warnings m_forVarp->usedLoopIdx(true); - AstNode* newbodysp = NULL; + AstNode* newbodysp = nullptr; ++m_statLoops; if (stmtsp) { int times = 0; while (true) { UINFO(8, " Looping " << loopValue << endl); V3Number res = V3Number(nodep); - if (!simulateTree(condp, &loopValue, NULL, res)) { + if (!simulateTree(condp, &loopValue, nullptr, res)) { nodep->v3error("Loop unrolling failed."); return false; } @@ -328,7 +328,7 @@ private: string nname = m_beginName + "__BRA__" + index + "__KET__"; oneloopp = new AstBegin(oneloopp->fileline(), nname, oneloopp, true); } - VL_DO_CLEAR(pushDeletep(m_varValuep), m_varValuep = NULL); + VL_DO_CLEAR(pushDeletep(m_varValuep), m_varValuep = nullptr); if (newbodysp) { newbodysp->addNext(oneloopp); } else { @@ -356,8 +356,8 @@ private: } } if (!newbodysp) { // initp might have effects after the loop - newbodysp = initp; // Maybe NULL - initp = NULL; + newbodysp = initp; // Maybe nullptr + initp = nullptr; } // Replace the FOR() if (newbodysp) { @@ -383,12 +383,12 @@ private: } if (nodep->condp()) V3Const::constifyEdit(nodep->condp()); // condp may change // Grab initial value - AstNode* initp = NULL; // Should be statement before the while. + AstNode* initp = nullptr; // Should be statement before the while. if (nodep->backp()->nextp() == nodep) initp = nodep->backp(); if (initp) { VL_DO_DANGLING(V3Const::constifyEdit(initp), initp); } if (nodep->backp()->nextp() == nodep) initp = nodep->backp(); // Grab assignment - AstNode* incp = NULL; // Should be last statement + AstNode* incp = nullptr; // Should be last statement AstNode* bodysp = nodep->bodysp(); if (nodep->incsp()) V3Const::constifyEdit(nodep->incsp()); // cppcheck-suppress duplicateCondition @@ -400,7 +400,7 @@ private: // Again, as may have changed bodysp = nodep->bodysp(); for (incp = nodep->bodysp(); incp && incp->nextp(); incp = incp->nextp()) {} - if (incp == bodysp) bodysp = NULL; + if (incp == bodysp) bodysp = nullptr; } // And check it if (forUnrollCheck(nodep, initp, nodep->precondsp(), nodep->condp(), incp, bodysp)) { @@ -427,8 +427,8 @@ private: // condition, but they'll become while's which can be // deleted by V3Const. VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); - } else if (forUnrollCheck(nodep, nodep->initsp(), NULL, nodep->condp(), nodep->incsp(), - nodep->bodysp())) { + } else if (forUnrollCheck(nodep, nodep->initsp(), nullptr, nodep->condp(), + nodep->incsp(), nodep->bodysp())) { VL_DO_DANGLING(pushDeletep(nodep), nodep); // Did replacement } else { nodep->v3error("For loop doesn't have genvar index, or is malformed"); @@ -477,10 +477,10 @@ public: } // METHODS void init(bool generate, const string& beginName) { - m_forVarp = NULL; - m_forVscp = NULL; - m_varValuep = NULL; - m_ignoreIncp = NULL; + m_forVarp = nullptr; + m_forVscp = nullptr; + m_varValuep = nullptr; + m_ignoreIncp = nullptr; m_varModeCheck = false; m_varModeReplace = false; m_varAssignHit = false; diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 1b78ab77d..02405e96e 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -111,13 +111,13 @@ public: // however AstPattern uses them } WidthVP(Determ determ, Stage stage) - : m_dtypep(NULL) + : m_dtypep(nullptr) , m_stage(stage) { if (determ != SELF && stage != PRELIM) v3fatalSrc("Context-determined width request only allowed as prelim step"); } WidthVP* p() { return this; } - bool selfDtm() const { return m_dtypep == NULL; } + bool selfDtm() const { return m_dtypep == nullptr; } AstNodeDType* dtypep() const { // Detect where overrideDType is probably the intended call if (!m_dtypep) v3fatalSrc("Width dtype request on self-determined or preliminary VUP"); @@ -186,7 +186,7 @@ private: // STATE WidthVP* m_vup; // Current node state bool m_paramsOnly; // Computing parameter value; limit operation - AstRange* m_cellRangep; // Range for arrayed instantiations, NULL for normal instantiations + AstRange* m_cellRangep; // Range for arrayed instantiations, nullptr for normal instantiations AstNodeFTask* m_ftaskp; // Current function/task AstNodeProcedure* m_procedurep; // Current final/always AstFunc* m_funcp; // Current function @@ -962,7 +962,7 @@ private: userIterateAndNext(nodep->attrp(), WidthVP(SELF, BOTH).p()); AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp != nodep) { - nodep = NULL; + nodep = nullptr; userIterate(selp, m_vup); return; } @@ -976,7 +976,7 @@ private: userIterateAndNext(nodep->attrp(), WidthVP(SELF, BOTH).p()); AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp != nodep) { - nodep = NULL; + nodep = nullptr; userIterate(selp, m_vup); return; } @@ -989,7 +989,7 @@ private: userIterateAndNext(nodep->attrp(), WidthVP(SELF, BOTH).p()); AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp != nodep) { - nodep = NULL; + nodep = nullptr; userIterate(selp, m_vup); return; } @@ -1002,7 +1002,7 @@ private: userIterateAndNext(nodep->attrp(), WidthVP(SELF, BOTH).p()); AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp != nodep) { - nodep = NULL; + nodep = nullptr; userIterate(selp, m_vup); return; } @@ -1146,7 +1146,7 @@ private: nodep->dtypeFrom(expDTypep); // rhs already finalized in iterate_shift_prelim iterateCheck(nodep, "LHS", nodep->lhsp(), SELF, FINAL, nodep->dtypep(), EXTEND_EXP); - AstNode* newp = NULL; // No change + AstNode* newp = nullptr; // No change if (nodep->lhsp()->isSigned() && nodep->rhsp()->isSigned()) { newp = new AstPowSS(nodep->fileline(), nodep->lhsp()->unlinkFrBack(), nodep->rhsp()->unlinkFrBack()); @@ -1259,7 +1259,7 @@ private: switch (nodep->attrType()) { case AstAttrType::DIM_SIZE: { AstNode* newp = new AstCMethodHard( - nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", NULL); + nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", nullptr); newp->dtypeSetSigned32(); newp->didWidth(true); newp->protect(false); @@ -1277,7 +1277,7 @@ private: case AstAttrType::DIM_RIGHT: case AstAttrType::DIM_HIGH: { AstNode* sizep = new AstCMethodHard( - nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", NULL); + nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", nullptr); sizep->dtypeSetSigned32(); sizep->didWidth(true); sizep->protect(false); @@ -1393,7 +1393,7 @@ private: AstNode* elementsp = nodep->elementsp()->unlinkFrBack(); AstNode* newp; if (VN_IS(elementsp, Unbounded)) { - newp = new AstQueueDType(nodep->fileline(), VFlagChildDType(), childp, NULL); + newp = new AstQueueDType(nodep->fileline(), VFlagChildDType(), childp, nullptr); VL_DO_DANGLING(elementsp->deleteTree(), elementsp); } else if (AstNodeDType* keyp = VN_CAST(elementsp, NodeDType)) { newp = new AstAssocArrayDType(nodep->fileline(), VFlagChildDType(), childp, keyp); @@ -1409,7 +1409,7 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); // Normally parent's iteration would cover this, but we might have entered by a specific // visit - VL_DO_DANGLING(userIterate(newp, NULL), newp); + VL_DO_DANGLING(userIterate(newp, nullptr), newp); } virtual void visit(AstDynArrayDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed @@ -1424,7 +1424,7 @@ private: nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); nodep->dtypep(nodep); // The array itself, not subDtype if (VN_IS(nodep->boundp(), Unbounded)) { - nodep->boundp()->unlinkFrBack()->deleteTree(); // NULL will represent unbounded + nodep->boundp()->unlinkFrBack()->deleteTree(); // nullptr will represent unbounded } UINFO(4, "dtWidthed " << nodep << endl); } @@ -1463,7 +1463,7 @@ private: if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); - userIterateChildren(nodep, NULL); + userIterateChildren(nodep, nullptr); nodep->dtypep(nodep); // Should already be set, but be clear it's not the subDType nodep->widthFromSub(nodep->subDTypep()); UINFO(4, "dtWidthed " << nodep << endl); @@ -1481,22 +1481,22 @@ private: // Type comes from expression's type userIterateAndNext(nodep->typeofp(), WidthVP(SELF, BOTH).p()); AstNode* typeofp = nodep->typeofp(); - nodep->typedefp(NULL); + nodep->typedefp(nullptr); nodep->refDTypep(typeofp->dtypep()); VL_DO_DANGLING(typeofp->unlinkFrBack()->deleteTree(), typeofp); // We had to use AstRefDType for this construct as pointers to this type // in type table are still correct (which they wouldn't be if we replaced the node) } - userIterateChildren(nodep, NULL); + userIterateChildren(nodep, nullptr); if (nodep->subDTypep()) { // Normally iterateEditMoveDTypep iterate would work, but the refs are under // the TypeDef which will upset iterateEditMoveDTypep as it can't find it under // this node's childDTypep - userIterate(nodep->subDTypep(), NULL); + userIterate(nodep->subDTypep(), nullptr); nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); - nodep->typedefp(NULL); // Note until line above subDTypep() may have followed this + nodep->typedefp(nullptr); // Note until line above subDTypep() may have followed this // Widths are resolved, but special iterate to check for recurstion - userIterate(nodep->subDTypep(), NULL); + userIterate(nodep->subDTypep(), nullptr); } // Effectively nodep->dtypeFrom(nodep->dtypeSkipRefp()); // But might be recursive, so instead manually recurse into the referenced type @@ -1509,12 +1509,12 @@ private: virtual void visit(AstTypedef* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); - userIterateChildren(nodep, NULL); + userIterateChildren(nodep, nullptr); } virtual void visit(AstParamTypeDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); - userIterateChildren(nodep, NULL); + userIterateChildren(nodep, nullptr); nodep->widthFromSub(nodep->subDTypep()); } virtual void visit(AstCastDynamic* nodep) override { @@ -1766,7 +1766,7 @@ private: } if (!nodep->varp()->didWidth()) { // Var hasn't been widthed, so make it so. - userIterate(nodep->varp(), NULL); + userIterate(nodep->varp(), nullptr); } // if (debug()>=9) { nodep->dumpTree(cout, " VRin "); // nodep->varp()->dumpTree(cout, " forvar "); } @@ -1915,7 +1915,7 @@ private: nodep->dtypeSetLogicBool(); if (debug() >= 9) nodep->dumpTree(cout, "-inside-in: "); // Now rip out the inside and replace with simple math - AstNode* newp = NULL; + AstNode* newp = nullptr; for (AstNode *nextip, *itemp = nodep->itemsp(); itemp; itemp = nextip) { nextip = itemp->nextp(); // Will be unlinking AstNode* inewp; @@ -1963,7 +1963,7 @@ private: nodep->v3warn(UNPACKED, "Unsupported: --no-structs-packed"); } } - userIterateChildren(nodep, NULL); // First size all members + userIterateChildren(nodep, nullptr); // First size all members nodep->repairMemberCache(); // Determine bit assignments and width nodep->dtypep(nodep); @@ -1990,7 +1990,7 @@ private: } virtual void visit(AstClass* nodep) override { if (nodep->didWidthAndSet()) return; - userIterateChildren(nodep, NULL); // First size all members + userIterateChildren(nodep, nullptr); // First size all members if (nodep->isVirtual()) nodep->v3warn(E_UNSUPPORTED, "Unsupported: virtual class"); nodep->repairCache(); } @@ -1998,14 +1998,14 @@ private: if (nodep->didWidthAndSet()) return; // TODO this maybe eventually required to properly resolve members, // though causes problems with t_class_forward.v, so for now avoided - // userIterateChildren(nodep->classp(), NULL); + // userIterateChildren(nodep->classp(), nullptr); } virtual void visit(AstClassExtends* nodep) override { if (nodep->didWidthAndSet()) return; nodep->v3warn(E_UNSUPPORTED, "Unsupported: class extends"); // Member/meth access breaks VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); // nodep->dtypep(iterateEditMoveDTypep(nodep)); // data_type '{ pattern } - // userIterateChildren(nodep, NULL); + // userIterateChildren(nodep, nullptr); } virtual void visit(AstMemberDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed @@ -2051,7 +2051,7 @@ private: // Method call on enum without following parenthesis, e.g. "ENUM.next" // Convert this into a method call, and let that visitor figure out what to do next AstNode* newp = new AstMethodCall(nodep->fileline(), nodep->fromp()->unlinkFrBack(), - nodep->name(), NULL); + nodep->name(), nullptr); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); userIterate(newp, m_vup); @@ -2072,7 +2072,7 @@ private: UASSERT_OBJ(first_classp, nodep, "Unlinked"); for (AstClass* classp = first_classp; classp;) { if (AstNode* foundp = classp->findMember(nodep->name())) return foundp; - classp = classp->extendsp() ? classp->extendsp()->classp() : NULL; + classp = classp->extendsp() ? classp->extendsp()->classp() : nullptr; } VSpellCheck speller; for (AstClass* classp = first_classp; classp;) { @@ -2081,14 +2081,14 @@ private: speller.pushCandidate(itemp->prettyName()); } } - classp = classp->extendsp() ? classp->extendsp()->classp() : NULL; + classp = classp->extendsp() ? classp->extendsp()->classp() : nullptr; } string suggest = speller.bestCandidateMsg(nodep->prettyName()); nodep->v3error( "Member " << nodep->prettyNameQ() << " not found in class " << first_classp->prettyNameQ() << "\n" << (suggest.empty() ? "" : nodep->fileline()->warnMore() + suggest)); - return NULL; // Caller handles error + return nullptr; // Caller handles error } bool memberSelStruct(AstMemberSel* nodep, AstNodeUOrStructDType* adtypep) { // Returns true if ok @@ -2134,7 +2134,7 @@ private: // Find the fromp dtype - should be a class UASSERT_OBJ(nodep->fromp() && nodep->fromp()->dtypep(), nodep, "Unsized expression"); AstNodeDType* fromDtp = nodep->fromp()->dtypep()->skipRefToEnump(); - AstBasicDType* basicp = fromDtp ? fromDtp->basicp() : NULL; + AstBasicDType* basicp = fromDtp ? fromDtp->basicp() : nullptr; UINFO(9, " from dt " << fromDtp << endl); if (AstEnumDType* adtypep = VN_CAST(fromDtp, EnumDType)) { methodCallEnum(nodep, adtypep); @@ -2193,7 +2193,7 @@ private: || nodep->name() == "first" // || nodep->name() == "last") { // Constant value - AstConst* newp = NULL; + AstConst* newp = nullptr; methodOkArguments(nodep, 0, 0); if (nodep->name() == "num") { int items = 0; @@ -2291,12 +2291,12 @@ private: } } void methodCallAssoc(AstMethodCall* nodep, AstAssocArrayDType* adtypep) { - AstCMethodHard* newp = NULL; + AstCMethodHard* newp = nullptr; if (nodep->name() == "num" // function int num() || nodep->name() == "size") { methodOkArguments(nodep, 0, 0); newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", - NULL); // So don't need num() + nullptr); // So don't need num() newp->dtypeSetSigned32(); newp->didWidth(true); newp->protect(false); @@ -2327,7 +2327,7 @@ private: methodCallLValue(nodep, nodep->fromp(), true); if (!nodep->pinsp()) { newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), - "clear", NULL); + "clear", nullptr); newp->protect(false); newp->makeStatement(); } else { @@ -2363,19 +2363,19 @@ private: } } void methodCallDyn(AstMethodCall* nodep, AstDynArrayDType* adtypep) { - AstCMethodHard* newp = NULL; + AstCMethodHard* newp = nullptr; if (nodep->name() == "at") { // Created internally for [] methodOkArguments(nodep, 1, 1); methodCallLValue(nodep, nodep->fromp(), true); newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "at", - NULL); + nullptr); newp->dtypeFrom(adtypep->subDTypep()); newp->protect(false); newp->didWidth(true); } else if (nodep->name() == "size") { methodOkArguments(nodep, 0, 0); newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", - NULL); + nullptr); newp->dtypeSetSigned32(); newp->didWidth(true); newp->protect(false); @@ -2383,7 +2383,7 @@ private: methodOkArguments(nodep, 0, 0); methodCallLValue(nodep, nodep->fromp(), true); newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "clear", - NULL); + nullptr); newp->makeStatement(); } else { nodep->v3warn(E_UNSUPPORTED, "Unsupported/unknown built-in dynamic array method " @@ -2396,12 +2396,12 @@ private: } } void methodCallQueue(AstMethodCall* nodep, AstQueueDType* adtypep) { - AstCMethodHard* newp = NULL; + AstCMethodHard* newp = nullptr; if (nodep->name() == "at") { // Created internally for [] methodOkArguments(nodep, 1, 1); methodCallLValue(nodep, nodep->fromp(), true); newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "at", - NULL); + nullptr); newp->dtypeFrom(adtypep->subDTypep()); newp->protect(false); newp->didWidth(true); @@ -2409,7 +2409,7 @@ private: || nodep->name() == "size") { methodOkArguments(nodep, 0, 0); newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", - NULL); + nullptr); newp->dtypeSetSigned32(); newp->didWidth(true); newp->protect(false); @@ -2418,14 +2418,14 @@ private: methodCallLValue(nodep, nodep->fromp(), true); if (!nodep->pinsp()) { newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), - "clear", NULL); + "clear", nullptr); newp->protect(false); newp->makeStatement(); } else { AstNode* index_exprp = methodCallQueueIndexExpr(nodep); if (index_exprp->isZero()) { // delete(0) is a pop_front newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), - "pop_front", NULL); + "pop_front", nullptr); newp->dtypeFrom(adtypep->subDTypep()); newp->protect(false); newp->didWidth(true); @@ -2465,7 +2465,7 @@ private: methodOkArguments(nodep, 0, 0); methodCallLValue(nodep, nodep->fromp(), true); newp = new AstCMethodHard(nodep->fileline(), nodep->fromp()->unlinkFrBack(), - nodep->name(), NULL); + nodep->name(), nullptr); newp->dtypeFrom(adtypep->subDTypep()); newp->protect(false); newp->didWidth(true); @@ -2506,7 +2506,7 @@ private: if (VN_IS(ftaskp, Task)) nodep->makeStatement(); return; } - classp = classp->extendsp() ? classp->extendsp()->classp() : NULL; + classp = classp->extendsp() ? classp->extendsp()->classp() : nullptr; } { VSpellCheck speller; @@ -2514,7 +2514,7 @@ private: for (AstNode* itemp = classp->membersp(); itemp; itemp = itemp->nextp()) { if (VN_IS(itemp, NodeFTask)) speller.pushCandidate(itemp->prettyName()); } - classp = classp->extendsp() ? classp->extendsp()->classp() : NULL; + classp = classp->extendsp() ? classp->extendsp()->classp() : nullptr; } string suggest = speller.bestCandidateMsg(nodep->prettyName()); nodep->v3error("Class method " @@ -2543,7 +2543,7 @@ private: if (methodId) { methodOkArguments(nodep, 0, 0); FileLine* fl = nodep->fileline(); - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int i = 0; i < adtypep->elementsConst(); ++i) { AstNode* arrayRef = nodep->fromp()->cloneTree(false); AstNode* selector = new AstArraySel(fl, arrayRef, i); @@ -2697,8 +2697,8 @@ private: classp->v3fatalSrc("Can't find class's new"); } - userIterate(nodep->taskp(), NULL); - userIterateChildren(nodep, NULL); + userIterate(nodep->taskp(), nullptr); + userIterateChildren(nodep, nullptr); processFTaskRefArgs(nodep); } virtual void visit(AstNewCopy* nodep) override { @@ -2783,16 +2783,16 @@ private: patp->unlinkFrBack(&relinkHandle); while (AstNode* movep = patp->lhssp()->nextp()) { movep->unlinkFrBack(); // Not unlinkFrBackWithNext, just one - AstNode* newkeyp = NULL; + AstNode* newkeyp = nullptr; if (patp->keyp()) newkeyp = patp->keyp()->cloneTree(true); AstPatMember* newp - = new AstPatMember(patp->fileline(), movep, newkeyp, NULL); + = new AstPatMember(patp->fileline(), movep, newkeyp, nullptr); patp->addNext(newp); } relinkHandle.relink(patp); } } - AstPatMember* defaultp = NULL; + AstPatMember* defaultp = nullptr; for (AstPatMember* patp = VN_CAST(nodep->itemsp(), PatMember); patp; patp = VN_CAST(patp->nextp(), PatMember)) { if (patp->isDefault()) { @@ -2850,13 +2850,13 @@ private: } if (memp && !patp) { // Missing init elements, warn below - memp = NULL; - patp = NULL; + memp = nullptr; + patp = nullptr; break; } else if (!memp && patp) { patp->v3error("Assignment pattern contains too many elements"); - memp = NULL; - patp = NULL; + memp = nullptr; + patp = nullptr; break; } else { std::pair ret @@ -2872,12 +2872,12 @@ private: if (patp) patp = VN_CAST(patp->nextp(), PatMember); } } - AstNode* newp = NULL; + AstNode* newp = nullptr; for (AstMemberDType* memp = vdtypep->membersp(); memp; memp = VN_CAST(memp->nextp(), MemberDType)) { PatMap::iterator it = patmap.find(memp); - AstPatMember* newpatp = NULL; - AstPatMember* patp = NULL; + AstPatMember* newpatp = nullptr; + AstPatMember* patp = nullptr; if (it == patmap.end()) { if (defaultp) { newpatp = defaultp->cloneTree(false); @@ -2918,10 +2918,10 @@ private: VNumRange range = arrayp->declRange(); PatVecMap patmap = patVectorMap(nodep, range); UINFO(9, "ent " << range.hi() << " to " << range.lo() << endl); - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int ent = range.hi(); ent >= range.lo(); --ent) { - AstPatMember* newpatp = NULL; - AstPatMember* patp = NULL; + AstPatMember* newpatp = nullptr; + AstPatMember* patp = nullptr; PatVecMap::iterator it = patmap.find(ent); if (it == patmap.end()) { if (defaultp) { @@ -2941,7 +2941,7 @@ private: AstNode* valuep = patternMemberValueIterate(patp); if (VN_IS(arrayp, UnpackArrayDType)) { if (!newp) { - AstInitArray* newap = new AstInitArray(nodep->fileline(), arrayp, NULL); + AstInitArray* newap = new AstInitArray(nodep->fileline(), arrayp, nullptr); newp = newap; } VN_CAST(newp, InitArray)->addIndexValuep(ent - range.lo(), valuep); @@ -2973,10 +2973,10 @@ private: VNumRange range = bdtypep->declRange(); PatVecMap patmap = patVectorMap(nodep, range); UINFO(9, "ent " << range.hi() << " to " << range.lo() << endl); - AstNode* newp = NULL; + AstNode* newp = nullptr; for (int ent = range.hi(); ent >= range.lo(); --ent) { - AstPatMember* newpatp = NULL; - AstPatMember* patp = NULL; + AstPatMember* newpatp = nullptr; + AstPatMember* patp = nullptr; PatVecMap::iterator it = patmap.find(ent); if (it == patmap.end()) { if (defaultp) { @@ -3046,7 +3046,7 @@ private: } int visitPatMemberRep(AstPatMember* nodep) { uint32_t times = 1; - if (nodep->repp()) { // else repp()==NULL shorthand for rep count 1 + if (nodep->repp()) { // else repp()==nullptr shorthand for rep count 1 iterateCheckSizedSelf(nodep, "LHS", nodep->repp(), SELF, BOTH); V3Const::constifyParamsEdit(nodep->repp()); // repp may change const AstConst* constp = VN_CAST(nodep->repp(), Const); @@ -3070,7 +3070,7 @@ private: virtual void visit(AstPropClocked* nodep) override { if (m_vup->prelim()) { // First stage evaluation iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); - userIterateAndNext(nodep->sensesp(), NULL); + userIterateAndNext(nodep->sensesp(), nullptr); if (nodep->disablep()) { iterateCheckBool(nodep, "Disable", nodep->disablep(), BOTH); // it's like an if() condition. @@ -3091,7 +3091,7 @@ private: for (AstCaseItem *nextip, *itemp = nodep->itemsp(); itemp; itemp = nextip) { nextip = VN_CAST(itemp->nextp(), CaseItem); // Prelim may cause the node to get replaced - if (!VN_IS(nodep, GenCase)) userIterateAndNext(itemp->bodysp(), NULL); + if (!VN_IS(nodep, GenCase)) userIterateAndNext(itemp->bodysp(), nullptr); for (AstNode *nextcp, *condp = itemp->condsp(); condp; condp = nextcp) { nextcp = condp->nextp(); // Prelim may cause the node to get replaced VL_DO_DANGLING(userIterate(condp, WidthVP(CONTEXT, PRELIM).p()), condp); @@ -3129,31 +3129,31 @@ private: } virtual void visit(AstNodeFor* nodep) override { assertAtStatement(nodep); - userIterateAndNext(nodep->initsp(), NULL); + userIterateAndNext(nodep->initsp(), nullptr); iterateCheckBool(nodep, "For Test Condition", nodep->condp(), BOTH); // it's like an if() condition. - if (!VN_IS(nodep, GenFor)) userIterateAndNext(nodep->bodysp(), NULL); - userIterateAndNext(nodep->incsp(), NULL); + if (!VN_IS(nodep, GenFor)) userIterateAndNext(nodep->bodysp(), nullptr); + userIterateAndNext(nodep->incsp(), nullptr); } virtual void visit(AstRepeat* nodep) override { assertAtStatement(nodep); userIterateAndNext(nodep->countp(), WidthVP(SELF, BOTH).p()); - userIterateAndNext(nodep->bodysp(), NULL); + userIterateAndNext(nodep->bodysp(), nullptr); } virtual void visit(AstWhile* nodep) override { assertAtStatement(nodep); - userIterateAndNext(nodep->precondsp(), NULL); + userIterateAndNext(nodep->precondsp(), nullptr); iterateCheckBool(nodep, "For Test Condition", nodep->condp(), BOTH); // it's like an if() condition. - userIterateAndNext(nodep->bodysp(), NULL); - userIterateAndNext(nodep->incsp(), NULL); + userIterateAndNext(nodep->bodysp(), nullptr); + userIterateAndNext(nodep->incsp(), nullptr); } virtual void visit(AstNodeIf* nodep) override { assertAtStatement(nodep); // if (debug()) nodep->dumpTree(cout, " IfPre: "); if (!VN_IS(nodep, GenIf)) { // for m_paramsOnly - userIterateAndNext(nodep->ifsp(), NULL); - userIterateAndNext(nodep->elsesp(), NULL); + userIterateAndNext(nodep->ifsp(), nullptr); + userIterateAndNext(nodep->elsesp(), nullptr); } iterateCheckBool(nodep, "If", nodep->condp(), BOTH); // it's like an if() condition. // if (debug()) nodep->dumpTree(cout, " IfOut: "); @@ -3250,8 +3250,8 @@ private: break; } case 'p': { // Pattern - AstNodeDType* dtypep = argp ? argp->dtypep()->skipRefp() : NULL; - AstBasicDType* basicp = dtypep ? dtypep->basicp() : NULL; + AstNodeDType* dtypep = argp ? argp->dtypep()->skipRefp() : nullptr; + AstBasicDType* basicp = dtypep ? dtypep->basicp() : nullptr; if (basicp && basicp->isString()) { added = true; newFormat += "\"%@\""; @@ -3504,7 +3504,7 @@ private: assertAtStatement(nodep); userIterateAndNext(nodep->filenamep(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->memp(), WidthVP(SELF, BOTH).p()); - AstNodeDType* subp = NULL; + AstNodeDType* subp = nullptr; if (AstAssocArrayDType* adtypep = VN_CAST(nodep->memp()->dtypep()->skipRefp(), AssocArrayDType)) { subp = adtypep->subDTypep(); @@ -3554,13 +3554,13 @@ private: virtual void visit(AstAssert* nodep) override { assertAtStatement(nodep); iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. - userIterateAndNext(nodep->passsp(), NULL); - userIterateAndNext(nodep->failsp(), NULL); + userIterateAndNext(nodep->passsp(), nullptr); + userIterateAndNext(nodep->failsp(), nullptr); } virtual void visit(AstCover* nodep) override { assertAtStatement(nodep); iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. - userIterateAndNext(nodep->passsp(), NULL); + userIterateAndNext(nodep->passsp(), nullptr); } virtual void visit(AstRestrict* nodep) override { assertAtStatement(nodep); @@ -3575,7 +3575,7 @@ private: } else if (!m_paramsOnly) { if (!nodep->modVarp()->didWidth()) { // Var hasn't been widthed, so make it so. - userIterate(nodep->modVarp(), NULL); + userIterate(nodep->modVarp(), nullptr); } if (!nodep->exprp()) { // No-connect return; @@ -3691,10 +3691,10 @@ private: m_cellRangep = nodep->rangep(); userIterateAndNext(nodep->rangep(), WidthVP(SELF, BOTH).p()); } - userIterateAndNext(nodep->pinsp(), NULL); + userIterateAndNext(nodep->pinsp(), nullptr); } - userIterateAndNext(nodep->paramsp(), NULL); - m_cellRangep = NULL; + userIterateAndNext(nodep->paramsp(), nullptr); + m_cellRangep = nullptr; } virtual void visit(AstGatePin* nodep) override { if (m_vup->prelim()) { @@ -3736,7 +3736,7 @@ private: // Would use user1 etc, but V3Width called from too many places to spend a user nodep->doingWidth(true); m_ftaskp = nodep; - userIterateChildren(nodep, NULL); + userIterateChildren(nodep, nullptr); if (nodep->isConstructor()) { // Pretend it's void so less special casing needed when look at dtypes nodep->dtypeSetVoid(); @@ -3747,8 +3747,8 @@ private: } nodep->didWidth(true); nodep->doingWidth(false); - m_funcp = NULL; - m_ftaskp = NULL; + m_funcp = nullptr; + m_ftaskp = nullptr; if (nodep->dpiImport() && !nodep->dpiOpenParent() && markHasOpenArray(nodep)) { nodep->dpiOpenParentInc(); // Mark so V3Task will wait for a child to build calling // func @@ -3783,7 +3783,7 @@ private: UINFO(5, " FTASKREF " << nodep << endl); UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked"); if (nodep->didWidth()) return; - userIterate(nodep->taskp(), NULL); + userIterate(nodep->taskp(), nullptr); // // And do the arguments to the task/function too do { @@ -3801,7 +3801,7 @@ private: UINFO(4, " sformat via metacomment: " << nodep << endl); AstNRelinker handle; argp->unlinkFrBackWithNext(&handle); // Format + additional args, if any - AstNode* argsp = NULL; + AstNode* argsp = nullptr; while (AstArg* nextargp = VN_CAST(argp->nextp(), Arg)) { argsp = AstNode::addNext( argsp, nextargp->exprp() @@ -3905,7 +3905,7 @@ private: UINFO(5, " FTASKREF " << nodep << endl); UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked"); if (nodep->didWidth()) return; - userIterate(nodep->taskp(), NULL); + userIterate(nodep->taskp(), nullptr); // And do the arguments to the task/function too processFTaskRefArgs(nodep); nodep->didWidth(true); @@ -3913,12 +3913,12 @@ private: virtual void visit(AstNodeProcedure* nodep) override { assertAtStatement(nodep); m_procedurep = nodep; - userIterateChildren(nodep, NULL); - m_procedurep = NULL; + userIterateChildren(nodep, nullptr); + m_procedurep = nullptr; } virtual void visit(AstNetlist* nodep) override { // Iterate modules backwards, in bottom-up order. That's faster - userIterateChildrenBackwards(nodep, NULL); + userIterateChildrenBackwards(nodep, nullptr); } //-------------------- @@ -3928,13 +3928,13 @@ private: nodep->v3fatalSrc( "Visit function missing? Widthed function missing for math node: " << nodep); } - userIterateChildren(nodep, NULL); + userIterateChildren(nodep, nullptr); } virtual void visit(AstNode* nodep) override { // Default: Just iterate UASSERT_OBJ(!m_vup, nodep, "Visit function missing? Widthed expectation for this node: " << nodep); - userIterateChildren(nodep, NULL); + userIterateChildren(nodep, nullptr); } //---------------------------------------------------------------------- @@ -4765,7 +4765,7 @@ private: if (expWidthMin == 0) expWidthMin = expWidth; bool bad = widthBad(underp, expDTypep); if ((bad || underp->width() != expWidth) && fixAutoExtend(underp /*ref*/, expWidth)) { - underp = NULL; // Changes underp + underp = nullptr; // Changes underp return; } if (VN_IS(underp, Const) && VN_CAST(underp, Const)->num().isFromString() @@ -4886,26 +4886,26 @@ private: } AstNodeBiop* replaceWithUOrSVersion(AstNodeBiop* nodep, bool signedFlavorNeeded) { // Given a signed/unsigned node type, create the opposite type - // Return new node or NULL if nothing - if (signedFlavorNeeded == nodep->signedFlavor()) return NULL; + // Return new node or nullptr if nothing + if (signedFlavorNeeded == nodep->signedFlavor()) return nullptr; if (!nodep->dtypep()) nodep->dtypeFrom(nodep->lhsp()); // To simplify callers, some node types don't need to change switch (nodep->type()) { - case AstType::atEq: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atNeq: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atEqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atNeqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atEqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atNeqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atAdd: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atSub: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; - case AstType::atShiftL: nodep->dtypeChgSigned(signedFlavorNeeded); return NULL; + case AstType::atEq: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atNeq: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atEqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atNeqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atEqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atNeqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atAdd: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atSub: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; + case AstType::atShiftL: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr; default: break; } FileLine* fl = nodep->fileline(); AstNode* lhsp = nodep->lhsp()->unlinkFrBack(); AstNode* rhsp = nodep->rhsp()->unlinkFrBack(); - AstNodeBiop* newp = NULL; + AstNodeBiop* newp = nullptr; switch (nodep->type()) { case AstType::atGt: newp = new AstGtS(fl, lhsp, rhsp); break; case AstType::atGtS: newp = new AstGt(fl, lhsp, rhsp); break; @@ -4935,12 +4935,12 @@ private: } AstNodeBiop* replaceWithDVersion(AstNodeBiop* nodep) { // Given a signed/unsigned node type, create the opposite type - // Return new node or NULL if nothing - if (nodep->doubleFlavor()) { return NULL; } + // Return new node or nullptr if nothing + if (nodep->doubleFlavor()) { return nullptr; } FileLine* fl = nodep->fileline(); AstNode* lhsp = nodep->lhsp()->unlinkFrBack(); AstNode* rhsp = nodep->rhsp()->unlinkFrBack(); - AstNodeBiop* newp = NULL; + AstNodeBiop* newp = nullptr; // No width change on output;... // All below have bool or double outputs switch (nodep->type()) { case AstType::atAdd: newp = new AstAddD(fl, lhsp, rhsp); break; @@ -4974,12 +4974,12 @@ private: } AstNodeBiop* replaceWithNVersion(AstNodeBiop* nodep) { // Given a signed/unsigned node type, replace with string version - // Return new node or NULL if nothing - if (nodep->stringFlavor()) return NULL; + // Return new node or nullptr if nothing + if (nodep->stringFlavor()) return nullptr; FileLine* fl = nodep->fileline(); AstNode* lhsp = nodep->lhsp()->unlinkFrBack(); AstNode* rhsp = nodep->rhsp()->unlinkFrBack(); - AstNodeBiop* newp = NULL; + AstNodeBiop* newp = nullptr; // No width change on output;... // All below have bool or double outputs switch (nodep->type()) { case AstType::atEq: @@ -5006,11 +5006,11 @@ private: } AstNodeUniop* replaceWithDVersion(AstNodeUniop* nodep) { // Given a signed/unsigned node type, create the opposite type - // Return new node or NULL if nothing - if (nodep->doubleFlavor()) return NULL; + // Return new node or nullptr if nothing + if (nodep->doubleFlavor()) return nullptr; FileLine* fl = nodep->fileline(); AstNode* lhsp = nodep->lhsp()->unlinkFrBack(); - AstNodeUniop* newp = NULL; + AstNodeUniop* newp = nullptr; switch (nodep->type()) { case AstType::atNegate: newp = new AstNegateD(fl, lhsp); break; default: @@ -5047,7 +5047,7 @@ private: // METHODS - data types AstNodeDType* iterateEditMoveDTypep(AstNode* parentp, AstNodeDType* dtnodep) { - UASSERT_OBJ(dtnodep, parentp, "Caller should check for NULL before computing dtype"); + UASSERT_OBJ(dtnodep, parentp, "Caller should check for nullptr before computing dtype"); // Iterate into a data type to resolve that type. // The data type may either: // 1. Be a child (typically getChildDTypep() returns it) @@ -5065,7 +5065,7 @@ private: if (child1 || child2) { UINFO(9, "iterateEditMoveDTypep child iterating " << dtnodep << endl); // Iterate, this might edit the dtypes which means dtnodep now lost - VL_DO_DANGLING(userIterate(dtnodep, NULL), dtnodep); + VL_DO_DANGLING(userIterate(dtnodep, nullptr), dtnodep); // Figure out the new dtnodep, remained a child of parent so find it there dtnodep = child1 ? parentp->getChildDTypep() : parentp->getChild2DTypep(); UASSERT_OBJ(dtnodep, parentp, "iterateEditMoveDTypep lost pointer to child"); @@ -5082,7 +5082,7 @@ private: // See notes in visit(AstBracketArrayDType*) UASSERT_OBJ(!VN_IS(dtnodep, BracketArrayDType), parentp, "Brackets should have been iterated as children"); - userIterate(dtnodep, NULL); + userIterate(dtnodep, nullptr); UASSERT_OBJ(dtnodep->didWidth(), parentp, "iterateEditMoveDTypep didn't get width resolution"); } @@ -5110,7 +5110,7 @@ private: } break; } - AstConst* valp = NULL; // If NULL, construct from val + AstConst* valp = nullptr; // If nullptr, construct from val int val = 0; switch (attrType) { case AstAttrType::DIM_BITS: { @@ -5162,7 +5162,7 @@ private: AstNodeArrayDType* vardtypep = new AstUnpackArrayDType(nodep->fileline(), nodep->findSigned32DType(), new AstRange(nodep->fileline(), msbdim, 0)); - AstInitArray* initp = new AstInitArray(nodep->fileline(), vardtypep, NULL); + AstInitArray* initp = new AstInitArray(nodep->fileline(), vardtypep, nullptr); v3Global.rootp()->typeTablep()->addTypesp(vardtypep); AstVar* varp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP, "__Vdimtab_" + VString::downcase(attrType.ascii()) @@ -5178,7 +5178,7 @@ private: for (unsigned i = 1; i < msbdim + 1; ++i) { initp->addValuep(dimensionValue(nodep->fileline(), nodep, attrType, i)); } - userIterate(varp, NULL); // May have already done $unit so must do this var + userIterate(varp, nullptr); // May have already done $unit so must do this var m_tableMap.insert(make_pair(make_pair(nodep, attrType), varp)); return varp; } @@ -5196,7 +5196,7 @@ private: } AstNodeArrayDType* vardtypep = new AstUnpackArrayDType( nodep->fileline(), basep, new AstRange(nodep->fileline(), msbdim, 0)); - AstInitArray* initp = new AstInitArray(nodep->fileline(), vardtypep, NULL); + AstInitArray* initp = new AstInitArray(nodep->fileline(), vardtypep, nullptr); v3Global.rootp()->typeTablep()->addTypesp(vardtypep); AstVar* varp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP, "__Venumtab_" + VString::downcase(attrType.ascii()) @@ -5221,7 +5221,7 @@ private: UASSERT_OBJ(nodep->itemsp(), nodep, "enum without items"); std::vector values; values.resize(msbdim + 1); - for (unsigned i = 0; i < (msbdim + 1); ++i) values[i] = NULL; + for (unsigned i = 0; i < (msbdim + 1); ++i) values[i] = nullptr; { AstEnumItem* firstp = nodep->itemsp(); AstEnumItem* prevp = firstp; // Prev must start with last item @@ -5249,7 +5249,7 @@ private: AstNode* valp = values[i]; if (valp) initp->addIndexValuep(i, valp); } - userIterate(varp, NULL); // May have already done $unit so must do this var + userIterate(varp, nullptr); // May have already done $unit so must do this var m_tableMap.insert(make_pair(make_pair(nodep, attrType), varp)); return varp; } @@ -5354,7 +5354,7 @@ private: // These functions save/restore the AstNUser information so it can pass to child nodes. AstNode* userIterateSubtreeReturnEdits(AstNode* nodep, WidthVP* vup) { - if (!nodep) return NULL; + if (!nodep) return nullptr; WidthVP* saveVup = m_vup; AstNode* ret; { @@ -5407,14 +5407,14 @@ public: bool doGenerate) { // [in] TRUE if we are inside a generate statement and // // don't wish to trigger errors m_paramsOnly = paramsOnly; - m_cellRangep = NULL; - m_ftaskp = NULL; - m_procedurep = NULL; - m_funcp = NULL; - m_attrp = NULL; + m_cellRangep = nullptr; + m_ftaskp = nullptr; + m_procedurep = nullptr; + m_funcp = nullptr; + m_attrp = nullptr; m_doGenerate = doGenerate; m_dtTables = 0; - m_vup = NULL; + m_vup = nullptr; } AstNode* mainAcceptEdit(AstNode* nodep) { return userIterateSubtreeReturnEdits(nodep, WidthVP(SELF, BOTH).p()); diff --git a/src/V3WidthCommit.h b/src/V3WidthCommit.h index 86077d41c..f17f29a10 100644 --- a/src/V3WidthCommit.h +++ b/src/V3WidthCommit.h @@ -81,7 +81,7 @@ public: newp->dtypeFrom(nodep); return newp; } else { - return NULL; + return nullptr; } } @@ -95,7 +95,7 @@ private: // See if the dtype/refDType can be converted to a standard one // This reduces the number of dtypes in the system, and since // dtypep() figures into sameTree() results in better optimizations - if (!nodep) return NULL; + if (!nodep) return nullptr; // Recurse to handle the data type, as may change the size etc of this type if (!nodep->user1()) iterate(nodep); // Look for duplicate diff --git a/src/V3WidthSel.cpp b/src/V3WidthSel.cpp index 550815863..eadf0fbef 100644 --- a/src/V3WidthSel.cpp +++ b/src/V3WidthSel.cpp @@ -308,7 +308,7 @@ private: if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: "); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); - } else { // NULL=bad extract, or unknown node type + } else { // nullptr=bad extract, or unknown node type nodep->v3error("Illegal bit or array select; type already selected, or bad dimension: " << "data type is" << fromdata.m_errp->prettyDTypeNameQ()); // How to recover? We'll strip a dimension. @@ -438,7 +438,7 @@ private: // if (debug() >= 9) newp->dumpTree(cout, "--SELEXnew: "); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); - } else { // NULL=bad extract, or unknown node type + } else { // nullptr=bad extract, or unknown node type nodep->v3error("Illegal range select; type already selected, or bad dimension: " << "data type is " << fromdata.m_errp->prettyDTypeNameQ()); UINFO(1, " Related ddtype: " << ddtypep << endl); @@ -513,7 +513,7 @@ private: newwidthp = new AstConst(nodep->fileline(), AstConst::Unsized32(), width * elwidth); } - AstNode* newlsbp = NULL; + AstNode* newlsbp = nullptr; if (VN_IS(nodep, SelPlus)) { if (fromRange.littleEndian()) { // SELPLUS(from,lsb,width) -> SEL(from, (vector_msb-width+1)-sel, width) @@ -544,7 +544,7 @@ private: if (debug() >= 9) newp->dumpTree(cout, "--SELNEW: "); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); - } else { // NULL=bad extract, or unknown node type + } else { // nullptr=bad extract, or unknown node type nodep->v3error("Illegal +: or -: select; type already selected, or bad dimension: " << "data type is " << fromdata.m_errp->prettyDTypeNameQ()); // How to recover? We'll strip a dimension. diff --git a/src/VlcBucket.h b/src/VlcBucket.h index b422c9e95..6e4bfb4ad 100644 --- a/src/VlcBucket.h +++ b/src/VlcBucket.h @@ -53,13 +53,13 @@ public: // CONSTRUCTORS VlcBuckets() { m_dataSize = 0; - m_datap = NULL; + m_datap = nullptr; m_bucketsCovered = 0; allocate(1024); } ~VlcBuckets() { m_dataSize = 0; - VL_DO_CLEAR(free(m_datap), m_datap = NULL); + VL_DO_CLEAR(free(m_datap), m_datap = nullptr); } // ACCESSORS diff --git a/src/VlcTest.h b/src/VlcTest.h index dd0a6ccea..97ad08897 100644 --- a/src/VlcTest.h +++ b/src/VlcTest.h @@ -107,7 +107,7 @@ public: VlcTests() {} ~VlcTests() { for (VlcTests::ByName::iterator it = begin(); it != end(); ++it) { - VL_DO_CLEAR(delete *it, *it = NULL); + VL_DO_CLEAR(delete *it, *it = nullptr); } } diff --git a/src/VlcTop.cpp b/src/VlcTop.cpp index 67f74570c..9e5ddd260 100644 --- a/src/VlcTop.cpp +++ b/src/VlcTop.cpp @@ -172,7 +172,7 @@ void VlcTop::rank() { UINFO(9, "Left on iter" << nextrank << ": "); // LCOV_EXCL_LINE remaining.dump(); // LCOV_EXCL_LINE } - VlcTest* bestTestp = NULL; + VlcTest* bestTestp = nullptr; vluint64_t bestRemain = 0; for (std::vector::iterator it = bytime.begin(); it != bytime.end(); ++it) { VlcTest* testp = *it; diff --git a/src/verilog.y b/src/verilog.y index 727cd3839..c030ca40e 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -78,17 +78,17 @@ public: m_varDecl = AstVarType::UNKNOWN; m_varDeclTyped = false; m_varIO = VDirection::NONE; - m_varDTypep = NULL; - m_gateRangep = NULL; - m_memDTypep = NULL; - m_modp = NULL; + m_varDTypep = nullptr; + m_gateRangep = nullptr; + m_memDTypep = nullptr; + m_modp = nullptr; m_pinAnsi = false; m_pinNum = -1; - m_instModuleFl = NULL; + m_instModuleFl = nullptr; m_instModule = ""; - m_instParamp = NULL; - m_varAttrp = NULL; - m_caseAttrp = NULL; + m_instParamp = nullptr; + m_varAttrp = nullptr; + m_caseAttrp = nullptr; m_tracingParse = true; } static V3ParseGrammar* singletonp() { @@ -111,7 +111,8 @@ public: return new AstText(fileline, newtext); } AstDisplay* createDisplayError(FileLine* fileline) { - AstDisplay* nodep = new AstDisplay(fileline, AstDisplayType::DT_ERROR, "", NULL, NULL); + AstDisplay* nodep + = new AstDisplay(fileline, AstDisplayType::DT_ERROR, "", nullptr, nullptr); nodep->addNext(new AstStop(fileline, true)); return nodep; } @@ -135,7 +136,7 @@ public: } void setVarDecl(AstVarType type) { m_varDecl = type; } void setDType(AstNodeDType* dtypep) { - if (m_varDTypep) VL_DO_CLEAR(m_varDTypep->deleteTree(), m_varDTypep = NULL); + if (m_varDTypep) VL_DO_CLEAR(m_varDTypep->deleteTree(), m_varDTypep = nullptr); m_varDTypep = dtypep; } void pinPush() { @@ -167,7 +168,7 @@ public: // If rangesp is "wire [3:3][2:2][1:1] foo [5:5][4:4]" // then [1:1] becomes the basicdtype range; everything else is arraying // the final [5:5][4:4] will be passed in another call to createArray - AstNodeRange* rangearraysp = NULL; + AstNodeRange* rangearraysp = nullptr; if (dtypep->isRanged()) { rangearraysp = rangesp; // Already a range; everything is an array } else { @@ -230,7 +231,7 @@ int V3ParseGrammar::s_modTypeImpNum = 0; { \ VARDECL(UNKNOWN); \ VARIO(NONE); \ - VARDTYPE_NDECL(NULL); \ + VARDTYPE_NDECL(nullptr); \ GRAMMARP->m_varLifetime = VLifetime::NONE; \ GRAMMARP->m_varDeclTyped = false; \ } @@ -1027,11 +1028,11 @@ description: // ==IEEE: description timeunits_declaration: // ==IEEE: timeunits_declaration yTIMEUNIT yaTIMENUM ';' - { PARSEP->timescaleMod($2, GRAMMARP->m_modp, true, $2, false, 0); $$ = NULL; } + { PARSEP->timescaleMod($2, GRAMMARP->m_modp, true, $2, false, 0); $$ = nullptr; } | yTIMEUNIT yaTIMENUM '/' yaTIMENUM ';' - { PARSEP->timescaleMod($2, GRAMMARP->m_modp, true, $2, true, $4); $$ = NULL; } + { PARSEP->timescaleMod($2, GRAMMARP->m_modp, true, $2, true, $4); $$ = nullptr; } | yTIMEPRECISION yaTIMENUM ';' - { PARSEP->timescaleMod($2, GRAMMARP->m_modp, false, 0, true, $2); $$ = NULL; } + { PARSEP->timescaleMod($2, GRAMMARP->m_modp, false, 0, true, $2); $$ = nullptr; } ; //********************************************************************** @@ -1041,7 +1042,7 @@ package_declaration: // ==IEEE: package_declaration packageFront package_itemListE yENDPACKAGE endLabelE { $1->modTrace(GRAMMARP->allTracingOn($1->fileline())); // Stash for implicit wires, etc if ($2) $1->addStmtp($2); - GRAMMARP->m_modp = NULL; + GRAMMARP->m_modp = nullptr; SYMP->popScope($1); GRAMMARP->endLabel($4,$1,$4); } ; @@ -1059,7 +1060,7 @@ packageFront: ; package_itemListE: // IEEE: [{ package_item }] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | package_itemList { $$ = $1; } ; @@ -1089,7 +1090,7 @@ package_or_generate_item_declaration: // ==IEEE: package_or_generate_item | parameter_declaration ';' { $$ = $1; } //UNSUP covergroup_declaration { $$ = $1; } //UNSUP assertion_item_declaration { $$ = $1; } - | ';' { $$ = NULL; } + | ';' { $$ = nullptr; } ; package_import_declarationList: @@ -1110,7 +1111,7 @@ package_import_item: // ==IEEE: package_import_item idCC/*package_identifier*/ yP_COLONCOLON package_import_itemObj { if (!VN_CAST($1, Package)) { - $$ = NULL; + $$ = nullptr; $1->v3error("Importing from missing package '" << *$1 << "'"); } else { $$ = new AstPackageImport($2, VN_CAST($1, Package), *$3); @@ -1150,7 +1151,7 @@ module_declaration: // ==IEEE: module_declaration { $1->modTrace(GRAMMARP->allTracingOn($1->fileline())); // Stash for implicit wires, etc if ($2) $1->addStmtp($2); if ($3) $1->addStmtp($3); if ($5) $1->addStmtp($5); - GRAMMARP->m_modp = NULL; + GRAMMARP->m_modp = nullptr; SYMP->popScope($1); GRAMMARP->endLabel($7,$1,$7); } | udpFront parameter_port_listE portsStarE ';' @@ -1159,7 +1160,7 @@ module_declaration: // ==IEEE: module_declaration if ($2) $1->addStmtp($2); if ($3) $1->addStmtp($3); if ($5) $1->addStmtp($5); GRAMMARP->m_tracingParse = true; - GRAMMARP->m_modp = NULL; + GRAMMARP->m_modp = nullptr; SYMP->popScope($1); GRAMMARP->endLabel($7,$1,$7); } // @@ -1200,7 +1201,7 @@ udpFront: ; parameter_value_assignmentE: // IEEE: [ parameter_value_assignment ] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | parameter_value_assignment { $$ = $1; } ; @@ -1224,8 +1225,8 @@ parameter_value_assignmentClass: // IEEE: [ parameter_value_assignment ] ( ; parameter_port_listE: // IEEE: parameter_port_list + empty == parameter_value_assignment - /* empty */ { $$ = NULL; } - | '#' '(' ')' { $$ = NULL; } + /* empty */ { $$ = nullptr; } + | '#' '(' ')' { $$ = nullptr; } // // IEEE: '#' '(' list_of_param_assignments { ',' parameter_port_declaration } ')' // // IEEE: '#' '(' parameter_port_declaration { ',' parameter_port_declaration } ')' // // Can't just do that as "," conflicts with between vars and between stmts, so @@ -1243,12 +1244,12 @@ paramPortDeclOrArg: // IEEE: param_assignment + parameter_port_declaratio // // We combine the two as we can't tell which follows a comma parameter_port_declarationFrontE param_assignment { $$ = $2; } | parameter_port_declarationTypeFrontE type_assignment { $$ = $2; } - | vlTag { $$ = NULL; } + | vlTag { $$ = nullptr; } ; portsStarE: // IEEE: .* + list_of_ports + list_of_port_declarations + empty - /* empty */ { $$ = NULL; } - | '(' ')' { $$ = NULL; } + /* empty */ { $$ = nullptr; } + | '(' ')' { $$ = nullptr; } // // .* expanded from module_declaration //UNSUP '(' yP_DOTSTAR ')' { UNSUP } | '(' {VARRESET_LIST(PORT);} list_of_ports ')' { $$ = $3; VARRESET_NONLIST(UNKNOWN); } @@ -1283,9 +1284,9 @@ port: // ==IEEE: port VARDTYPE(new AstIfaceRefDType($2, $4, "", *$2, *$4)); $$->addNextNull(VARDONEP($$,$6,$7)); } | portDirNetE yINTERFACE portSig rangeListE sigAttrListE - { $$ = NULL; BBUNSUP($2, "Unsupported: virtual or generic interfaces"); } + { $$ = nullptr; BBUNSUP($2, "Unsupported: virtual or generic interfaces"); } | portDirNetE yINTERFACE '.' idAny/*modport*/ portSig rangeListE sigAttrListE - { $$ = NULL; BBUNSUP($2, "Unsupported: virtual or generic interfaces"); } + { $$ = nullptr; BBUNSUP($2, "Unsupported: virtual or generic interfaces"); } // // // IEEE: ansi_port_declaration, with [port_direction] removed // // IEEE: [ net_port_header | interface_port_header ] port_identifier { unpacked_dimension } [ '=' constant_expression ] @@ -1350,8 +1351,8 @@ portDirNetE: // IEEE: part of port, optional net type and/or direction /* empty */ { } // // Per spec, if direction given default the nettype. // // The higher level rule may override this VARDTYPE with one later in the parse. - | port_direction { VARDECL(PORT); VARDTYPE_NDECL(NULL/*default_nettype*/); } - | port_direction { VARDECL(PORT); } net_type { VARDTYPE_NDECL(NULL/*default_nettype*/); } // net_type calls VARDECL + | port_direction { VARDECL(PORT); VARDTYPE_NDECL(nullptr/*default_nettype*/); } + | port_direction { VARDECL(PORT); } net_type { VARDTYPE_NDECL(nullptr/*default_nettype*/); } // net_type calls VARDECL | net_type { } // net_type calls VARDECL ; @@ -1390,7 +1391,7 @@ intFront: ; interface_itemListE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | interface_itemList { $$ = $1; } ; @@ -1405,10 +1406,10 @@ interface_item: // IEEE: interface_item + non_port_interface_item // // IEEE: generate_region | interface_generate_region { $$ = $1; } | interface_or_generate_item { $$ = $1; } - | program_declaration { $$ = NULL; BBUNSUP(CRELINE(), "Unsupported: program decls within interface decls"); } + | program_declaration { $$ = nullptr; BBUNSUP(CRELINE(), "Unsupported: program decls within interface decls"); } // // IEEE 1800-2017: modport_item // // See instead old 2012 position in interface_or_generate_item - | interface_declaration { $$ = NULL; BBUNSUP(CRELINE(), "Unsupported: interface decls within interface decls"); } + | interface_declaration { $$ = nullptr; BBUNSUP(CRELINE(), "Unsupported: interface decls within interface decls"); } | timeunits_declaration { $$ = $1; } // // See note in interface_or_generate item | module_common_item { $$ = $1; } @@ -1416,7 +1417,7 @@ interface_item: // IEEE: interface_item + non_port_interface_item interface_generate_region: // ==IEEE: generate_region yGENERATE interface_itemList yENDGENERATE { $$ = $2; } - | yGENERATE yENDGENERATE { $$ = NULL; } + | yGENERATE yENDGENERATE { $$ = nullptr; } ; interface_or_generate_item: // ==IEEE: interface_or_generate_item @@ -1431,11 +1432,11 @@ interface_or_generate_item: // ==IEEE: interface_or_generate_item anonymous_program: // ==IEEE: anonymous_program // // See the spec - this doesn't change the scope, items still go up "top" - yPROGRAM ';' anonymous_program_itemListE yENDPROGRAM { BBUNSUP($1, "Unsupported: Anonymous programs"); $$ = NULL; } + yPROGRAM ';' anonymous_program_itemListE yENDPROGRAM { BBUNSUP($1, "Unsupported: Anonymous programs"); $$ = nullptr; } ; anonymous_program_itemListE: // IEEE: { anonymous_program_item } - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | anonymous_program_itemList { $$ = $1; } ; @@ -1450,7 +1451,7 @@ anonymous_program_item: // ==IEEE: anonymous_program_item | class_declaration { $$ = $1; } //UNSUP covergroup_declaration { $$ = $1; } // // class_constructor_declaration is part of function_declaration - | ';' { $$ = NULL; } + | ';' { $$ = nullptr; } ; program_declaration: // IEEE: program_declaration + program_nonansi_header + program_ansi_header: @@ -1460,7 +1461,7 @@ program_declaration: // IEEE: program_declaration + program_nonansi_header + pr { $1->modTrace(GRAMMARP->allTracingOn($1->fileline())); // Stash for implicit wires, etc if ($2) $1->addStmtp($2); if ($3) $1->addStmtp($3); if ($5) $1->addStmtp($5); - GRAMMARP->m_modp = NULL; + GRAMMARP->m_modp = nullptr; SYMP->popScope($1); GRAMMARP->endLabel($7,$1,$7); } | yEXTERN pgmFront parameter_port_listE portsStarE ';' @@ -1481,7 +1482,7 @@ pgmFront: ; program_itemListE: // ==IEEE: [{ program_item }] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | program_itemList { $$ = $1; } ; @@ -1513,9 +1514,9 @@ program_generate_item: // ==IEEE: program_generate_item ; extern_tf_declaration: // ==IEEE: extern_tf_declaration - yEXTERN task_prototype ';' { $$ = NULL; BBUNSUP($1, "Unsupported: extern task"); } - | yEXTERN function_prototype ';' { $$ = NULL; BBUNSUP($1, "Unsupported: extern function"); } - | yEXTERN yFORKJOIN task_prototype ';' { $$ = NULL; BBUNSUP($1, "Unsupported: extern forkjoin"); } + yEXTERN task_prototype ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: extern task"); } + | yEXTERN function_prototype ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: extern function"); } + | yEXTERN yFORKJOIN task_prototype ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: extern forkjoin"); } ; modport_declaration: // ==IEEE: modport_declaration @@ -1546,14 +1547,14 @@ modportPortsDecl: // // IEEE: modport_simple_ports_declaration port_direction modportSimplePort { $$ = new AstModportVarRef($2, *$2, GRAMMARP->m_varIO); } // // IEEE: modport_clocking_declaration - | yCLOCKING idAny/*clocking_identifier*/ { $$ = NULL; BBUNSUP($1, "Unsupported: Modport clocking"); } + | yCLOCKING idAny/*clocking_identifier*/ { $$ = nullptr; BBUNSUP($1, "Unsupported: Modport clocking"); } // // IEEE: yIMPORT modport_tf_port // // IEEE: yEXPORT modport_tf_port // // modport_tf_port expanded here | yIMPORT id/*tf_identifier*/ { $$ = new AstModportFTaskRef($2, *$2, false); } | yEXPORT id/*tf_identifier*/ { $$ = new AstModportFTaskRef($2, *$2, true); } - | yIMPORT method_prototype { $$ = NULL; BBUNSUP($1, "Unsupported: Modport import with prototype"); } - | yEXPORT method_prototype { $$ = NULL; BBUNSUP($1, "Unsupported: Modport export with prototype"); } + | yIMPORT method_prototype { $$ = nullptr; BBUNSUP($1, "Unsupported: Modport import with prototype"); } + | yEXPORT method_prototype { $$ = nullptr; BBUNSUP($1, "Unsupported: Modport export with prototype"); } // Continuations of above after a comma. // // IEEE: modport_simple_ports_declaration | modportSimplePort { $$ = new AstModportVarRef($1,*$1,GRAMMARP->m_varIO); } @@ -1580,7 +1581,7 @@ list_of_genvar_identifiers: // IEEE: list_of_genvar_identifiers (for decl genvar_identifierDecl: // IEEE: genvar_identifier (for declaration) id/*new-genvar_identifier*/ sigAttrListE { VARRESET_NONLIST(GENVAR); VARDTYPE(new AstBasicDType($1,AstBasicDTypeKwd::INTEGER)); - $$ = VARDONEA($1, *$1, NULL, $2); } + $$ = VARDONEA($1, *$1, nullptr, $2); } ; parameter_declaration: // IEEE: local_ or parameter_declaration @@ -1716,7 +1717,7 @@ port_declaration: // ==IEEE: port_declaration /*mid*/ { VARDTYPE_NDECL(new AstBasicDType($3, LOGIC_IMPLICIT, $3)); } /*cont*/ list_of_variable_decl_assignments { $$ = $5; } | port_directionReset port_declNetE /*implicit*/ - /*mid*/ { VARDTYPE_NDECL(NULL);/*default_nettype*/} + /*mid*/ { VARDTYPE_NDECL(nullptr);/*default_nettype*/} /*cont*/ list_of_variable_decl_assignments { $$ = $4; } // // IEEE: interface_declaration // // Looks just like variable declaration unless has a period @@ -1777,7 +1778,7 @@ simple_type: // ==IEEE: simple_type // // Even though we looked up the type and have a AstNode* to it, // // we can't fully resolve it because it may have been just a forward definition. | packageClassScopeE idType - { AstRefDType* refp = new AstRefDType($2, *$2, $1, NULL); + { AstRefDType* refp = new AstRefDType($2, *$2, $1, nullptr); $$ = refp; } // // // { generate_block_identifer ... } '.' @@ -1795,7 +1796,7 @@ data_type: // ==IEEE: data_type // // IEEE: ps_covergroup_identifier // // Don't distinguish between types and classes so all these combined | packageClassScopeE idType packed_dimensionListE - { AstRefDType* refp = new AstRefDType($2, *$2, $1, NULL); + { AstRefDType* refp = new AstRefDType($2, *$2, $1, nullptr); $$ = GRAMMARP->createArray(refp, $3, true); } | packageClassScopeE idType parameter_value_assignmentClass packed_dimensionListE { AstRefDType* refp = new AstRefDType($2, *$2, $1, $3); @@ -1822,8 +1823,8 @@ data_typeNoRef: // ==IEEE: data_type, excluding class_type etc referenc // // IEEE has ['.' modport] but that will conflict with port // // declarations which decode '.' modport themselves, so // // instead see data_typeVar - | yVIRTUAL__INTERFACE yINTERFACE id/*interface*/ { $$ = NULL; BBUNSUP($1, "Unsupported: virtual interface"); } - | yVIRTUAL__anyID id/*interface*/ { $$ = NULL; BBUNSUP($1, "Unsupported: virtual data type"); } + | yVIRTUAL__INTERFACE yINTERFACE id/*interface*/ { $$ = nullptr; BBUNSUP($1, "Unsupported: virtual interface"); } + | yVIRTUAL__anyID id/*interface*/ { $$ = nullptr; BBUNSUP($1, "Unsupported: virtual data type"); } | type_reference { $$ = $1; } // // IEEE: class_scope: see data_type above // // IEEE: class_type: see data_type above @@ -1867,8 +1868,8 @@ struct_union_member: // ==IEEE: struct_union_member // // UNSUP random_qualifer not propagagted until have randomize support random_qualifierE data_type_or_void /*mid*/ { GRAMMARP->m_memDTypep = $2; } // As a list follows, need to attach this dtype to each member. - /*cont*/ list_of_member_decl_assignments ';' { $$ = $4; GRAMMARP->m_memDTypep = NULL; } - | vlTag { $$ = NULL; } + /*cont*/ list_of_member_decl_assignments ';' { $$ = $4; GRAMMARP->m_memDTypep = nullptr; } + | vlTag { $$ = nullptr; } ; list_of_member_decl_assignments: // Derived from IEEE: list_of_variable_decl_assignments @@ -1887,8 +1888,8 @@ member_decl_assignment: // Derived from IEEE: variable_decl_assignment | id variable_dimensionListE '=' variable_declExpr { BBUNSUP($4, "Unsupported: Initial values in struct/union members."); // But still need error if packed according to IEEE 7.2.2 - $$ = NULL; } - | idSVKwd { $$ = NULL; } + $$ = nullptr; } + | idSVKwd { $$ = nullptr; } // // // IEEE: "dynamic_array_variable_identifier '[' ']' [ '=' dynamic_array_new ]" // // Matches above with variable_dimensionE = "[]" @@ -1898,7 +1899,7 @@ member_decl_assignment: // Derived from IEEE: variable_decl_assignment // // // IEEE: "[ covergroup_variable_identifier ] '=' class_new // // Pushed into variable_declExpr:class_new - | '=' class_new { NULL; BBUNSUP($1, "Unsupported: member declaration assignment with new()"); } + | '=' class_new { nullptr; BBUNSUP($1, "Unsupported: member declaration assignment with new()"); } ; list_of_variable_decl_assignments: // ==IEEE: list_of_variable_decl_assignments @@ -1911,7 +1912,7 @@ variable_decl_assignment: // ==IEEE: variable_decl_assignment { $$ = VARDONEA($1,*$1,$2,$3); } | id variable_dimensionListE sigAttrListE '=' variable_declExpr { $$ = VARDONEA($1,*$1,$2,$3); $$->valuep($5); } - | idSVKwd { $$ = NULL; } + | idSVKwd { $$ = nullptr; } // // // IEEE: "dynamic_array_variable_identifier '[' ']' [ '=' dynamic_array_new ]" // // Matches above with variable_dimensionE = "[]" @@ -1921,7 +1922,7 @@ variable_decl_assignment: // ==IEEE: variable_decl_assignment // // // IEEE: "[ covergroup_variable_identifier ] '=' class_new // // Pushed into variable_declExpr:class_new - | '=' class_new { NULL; BBUNSUP($1, "Unsupported: declaration assignment with new()"); } + | '=' class_new { nullptr; BBUNSUP($1, "Unsupported: declaration assignment with new()"); } ; list_of_tf_variable_identifiers: // ==IEEE: list_of_tf_variable_identifiers @@ -1942,7 +1943,7 @@ variable_declExpr: // IEEE: part of variable_decl_assignment - rhs of ex ; variable_dimensionListE: // IEEE: variable_dimension + empty - /*empty*/ { $$ = NULL; } + /*empty*/ { $$ = nullptr; } | variable_dimensionList { $$ = $1; } ; @@ -1960,8 +1961,8 @@ variable_dimension: // ==IEEE: variable_dimension // // IEEE: associative_dimension (if data_type) // // Can't tell which until see if expr is data type or not | '[' exprOrDataType ']' { $$ = new AstBracketRange($1, $2); } - | yP_BRASTAR ']' { $$ = NULL; BBUNSUP($1, "Unsupported: [*] wildcard associative arrays"); } - | '[' '*' ']' { $$ = NULL; BBUNSUP($2, "Unsupported: [*] wildcard associative arrays"); } + | yP_BRASTAR ']' { $$ = nullptr; BBUNSUP($1, "Unsupported: [*] wildcard associative arrays"); } + | '[' '*' ']' { $$ = nullptr; BBUNSUP($2, "Unsupported: [*] wildcard associative arrays"); } // // IEEE: queue_dimension // // '[' '$' ']' -- $ is part of expr, see '[' constExpr ']' // // '[' '$' ':' expr ']' -- anyrange:expr:$ @@ -2013,7 +2014,7 @@ enum_base_typeE: // IEEE: enum_base_type | idAny rangeListE { $$ = GRAMMARP->createArray(new AstRefDType($1, *$1), $2, true); } | packageClassScope idAny rangeListE - { AstRefDType* refp = new AstRefDType($2, *$2, $1, NULL); + { AstRefDType* refp = new AstRefDType($2, *$2, $1, nullptr); $$ = GRAMMARP->createArray(refp, $3, true); } ; @@ -2027,13 +2028,13 @@ enum_name_declaration: // ==IEEE: enum_name_declaration ; enumNameRangeE: // IEEE: second part of enum_name_declaration - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | '[' intnumAsConst ']' { $$ = new AstRange($1, new AstConst($1, 0), new AstConst($1, $2->toSInt()-1)); } | '[' intnumAsConst ':' intnumAsConst ']' { $$ = new AstRange($1,$2,$4); } ; enumNameStartE: // IEEE: third part of enum_name_declaration - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | '=' constExpr { $$ = $2; } ; @@ -2054,7 +2055,7 @@ data_declaration: // ==IEEE: data_declaration // // Therefore the virtual_interface_declaration term isn't used // // 1800-2009: //UNSUP net_type_declaration { $$ = $1; } - | vlTag { $$ = NULL; } + | vlTag { $$ = nullptr; } ; class_property: // ==IEEE: class_property, which is {property_qualifier} data_declaration @@ -2140,7 +2141,7 @@ data_declarationVarFrontClass: // IEEE: part of data_declaration (for class_prop implicit_typeE: // IEEE: part of *data_type_or_implicit // // Also expanded in data_declaration - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | signingE rangeList { $$ = GRAMMARP->addRange(new AstBasicDType($2->fileline(), LOGIC_IMPLICIT, $1),$2,true); } | signing { $$ = new AstBasicDType($1, LOGIC_IMPLICIT, $1); } ; @@ -2155,21 +2156,21 @@ type_declaration: // ==IEEE: type_declaration yTYPEDEF data_type idAny variable_dimensionListE dtypeAttrListE ';' /**/ { $$ = new AstTypedef($3, *$3, $5, VFlagChildDType(), GRAMMARP->createArray($2,$4,false)); SYMP->reinsert($$); PARSEP->tagNodep($$); } - | yTYPEDEF id/*interface*/ '.' idAny/*type*/ idAny/*type*/ ';' { $$ = NULL; BBUNSUP($1, "Unsupported: SystemVerilog 2005 typedef in this context"); } + | yTYPEDEF id/*interface*/ '.' idAny/*type*/ idAny/*type*/ ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: SystemVerilog 2005 typedef in this context"); } // // Combines into above "data_type id" rule // // Verilator: Not important what it is in the AST, just need to make sure the yaID__aTYPE gets returned //UNSUP // Below should be idAny to allow duplicate forward defs; need to expand // // data_type to exclude IDs, or add id__SEMI rule - | yTYPEDEF id ';' { $$ = NULL; $$ = new AstTypedefFwd($2, *$2); SYMP->reinsert($$); PARSEP->tagNodep($$); } - | yTYPEDEF yENUM idAny ';' { $$ = NULL; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } - | yTYPEDEF ySTRUCT idAny ';' { $$ = NULL; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } - | yTYPEDEF yUNION idAny ';' { $$ = NULL; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } - | yTYPEDEF yCLASS idAny ';' { $$ = NULL; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } - | yTYPEDEF yINTERFACE yCLASS idAny ';' { $$ = NULL; $$ = new AstTypedefFwd($4, *$4); SYMP->reinsert($$); PARSEP->tagNodep($$); } + | yTYPEDEF id ';' { $$ = nullptr; $$ = new AstTypedefFwd($2, *$2); SYMP->reinsert($$); PARSEP->tagNodep($$); } + | yTYPEDEF yENUM idAny ';' { $$ = nullptr; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } + | yTYPEDEF ySTRUCT idAny ';' { $$ = nullptr; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } + | yTYPEDEF yUNION idAny ';' { $$ = nullptr; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } + | yTYPEDEF yCLASS idAny ';' { $$ = nullptr; $$ = new AstTypedefFwd($3, *$3); SYMP->reinsert($$); PARSEP->tagNodep($$); } + | yTYPEDEF yINTERFACE yCLASS idAny ';' { $$ = nullptr; $$ = new AstTypedefFwd($4, *$4); SYMP->reinsert($$); PARSEP->tagNodep($$); } ; dtypeAttrListE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | dtypeAttrList { $$ = $1; } ; @@ -2190,7 +2191,7 @@ vlTag: // verilator tag handling // Module Items module_itemListE: // IEEE: Part of module_declaration - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | module_itemList { $$ = $1; } ; @@ -2209,9 +2210,9 @@ non_port_module_item: // ==IEEE: non_port_module_item | module_or_generate_item { $$ = $1; } | specify_block { $$ = $1; } | specparam_declaration { $$ = $1; } - | program_declaration { $$ = NULL; BBUNSUP(CRELINE(), "Unsupported: program decls within module decls"); } - | module_declaration { $$ = NULL; BBUNSUP(CRELINE(), "Unsupported: module decls within module decls"); } - | interface_declaration { $$ = NULL; BBUNSUP(CRELINE(), "Unsupported: interface decls within module decls"); } + | program_declaration { $$ = nullptr; BBUNSUP(CRELINE(), "Unsupported: program decls within module decls"); } + | module_declaration { $$ = nullptr; BBUNSUP(CRELINE(), "Unsupported: module decls within module decls"); } + | interface_declaration { $$ = nullptr; BBUNSUP(CRELINE(), "Unsupported: interface decls within module decls"); } | timeunits_declaration { $$ = $1; } // // Verilator specific | yaSCHDR { $$ = new AstScHdr($1,*$1); } @@ -2247,21 +2248,21 @@ module_common_item: // ==IEEE: module_common_item | bind_directive { $$ = $1; } | continuous_assign { $$ = $1; } // // IEEE: net_alias - | yALIAS variable_lvalue aliasEqList ';' { $$ = NULL; BBUNSUP($1, "Unsupported: alias statements"); } + | yALIAS variable_lvalue aliasEqList ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: alias statements"); } | initial_construct { $$ = $1; } | final_construct { $$ = $1; } // // IEEE: always_construct // // Verilator only - event_control attached to always - | yALWAYS stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS, NULL, $2); } - | yALWAYS_FF stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_FF, NULL, $2); } - | yALWAYS_LATCH stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_LATCH, NULL, $2); } - | yALWAYS_COMB stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_COMB, NULL, $2); } + | yALWAYS stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS, nullptr, $2); } + | yALWAYS_FF stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_FF, nullptr, $2); } + | yALWAYS_LATCH stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_LATCH, nullptr, $2); } + | yALWAYS_COMB stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_COMB, nullptr, $2); } // | loop_generate_construct { $$ = $1; } | conditional_generate_construct { $$ = $1; } | elaboration_system_task { $$ = $1; } // - | error ';' { $$ = NULL; } + | error ';' { $$ = nullptr; } ; continuous_assign: // IEEE: continuous_assign @@ -2280,7 +2281,7 @@ module_or_generate_item_declaration: // ==IEEE: module_or_generate_item_d package_or_generate_item_declaration { $$ = $1; } | genvar_declaration { $$ = $1; } | clocking_declaration { $$ = $1; } - | yDEFAULT yCLOCKING idAny/*new-clocking_identifier*/ ';' { $$ = NULL; BBUNSUP($1, "Unsupported: default clocking identifier"); } + | yDEFAULT yCLOCKING idAny/*new-clocking_identifier*/ ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: default clocking identifier"); } //UNSUP yDEFAULT yDISABLE yIFF expr/*expression_or_dist*/ ';' { } ; @@ -2294,7 +2295,7 @@ bind_directive: // ==IEEE: bind_directive + bind_target_scope // // We merged the rules - id may be a bind_target_instance or module_identifier or interface_identifier yBIND bind_target_instance bind_instantiation { $$ = new AstBind($2, *$2, $3); } | yBIND bind_target_instance ':' bind_target_instance_list bind_instantiation - { $$ = NULL; BBUNSUP($1, "Unsupported: Bind with instance list"); } + { $$ = nullptr; BBUNSUP($1, "Unsupported: Bind with instance list"); } ; bind_target_instance_list: // ==IEEE: bind_target_instance_list @@ -2325,7 +2326,7 @@ bind_instantiation: // ==IEEE: bind_instantiation generate_region: // ==IEEE: generate_region yGENERATE ~c~genItemList yENDGENERATE { $$ = $2; } - | yGENERATE yENDGENERATE { $$ = NULL; } + | yGENERATE yENDGENERATE { $$ = nullptr; } ; //UNSUPc_generate_region: // IEEE: generate_region (for checkers) @@ -2335,20 +2336,20 @@ generate_region: // ==IEEE: generate_region generate_block_or_null: // IEEE: generate_block_or_null (called from gencase/genif/genfor) // ';' // is included in // // IEEE: generate_block - // // Must always return a BEGIN node, or NULL - see GenFor construction - generate_item { $$ = $1 ? (new AstBegin($1->fileline(),"",$1,true,true)) : NULL; } + // // Must always return a BEGIN node, or nullptr - see GenFor construction + generate_item { $$ = $1 ? (new AstBegin($1->fileline(),"",$1,true,true)) : nullptr; } | genItemBegin { $$ = $1; } ; genItemBegin: // IEEE: part of generate_block yBEGIN ~c~genItemList yEND { $$ = new AstBegin($1,"",$2,true,false); } - | yBEGIN yEND { $$ = NULL; } + | yBEGIN yEND { $$ = nullptr; } | id ':' yBEGIN ~c~genItemList yEND endLabelE { $$ = new AstBegin($1,*$1,$4,true,false); GRAMMARP->endLabel($6,*$1,$6); } - | id ':' yBEGIN yEND endLabelE { $$ = NULL; GRAMMARP->endLabel($5,*$1,$5); } + | id ':' yBEGIN yEND endLabelE { $$ = nullptr; GRAMMARP->endLabel($5,*$1,$5); } | yBEGIN ':' idAny ~c~genItemList yEND endLabelE { $$ = new AstBegin($3,*$3,$4,true,false); GRAMMARP->endLabel($6,*$3,$6); } - | yBEGIN ':' idAny yEND endLabelE { $$ = NULL; GRAMMARP->endLabel($5,*$3,$5); } + | yBEGIN ':' idAny yEND endLabelE { $$ = nullptr; GRAMMARP->endLabel($5,*$3,$5); } ; //UNSUPc_genItemBegin: // IEEE: part of generate_block (for checkers) @@ -2391,7 +2392,7 @@ conditional_generate_construct: // ==IEEE: conditional_generate_construct yCASE '(' expr ')' ~c~case_generate_itemListE yENDCASE { $$ = new AstGenCase($1, $3, $5); } | yIF '(' expr ')' ~c~generate_block_or_null %prec prLOWER_THAN_ELSE - { $$ = new AstGenIf($1, $3, $5, NULL); } + { $$ = new AstGenIf($1, $3, $5, nullptr); } | yIF '(' expr ')' ~c~generate_block_or_null yELSE ~c~generate_block_or_null { $$ = new AstGenIf($1, $3, $5, $7); } ; @@ -2405,11 +2406,11 @@ loop_generate_construct: // ==IEEE: loop_generate_construct { // Convert BEGIN(...) to BEGIN(GENFOR(...)), as we need the BEGIN to hide the local genvar AstBegin* lowerBegp = VN_CAST($9, Begin); UASSERT_OBJ(!($9 && !lowerBegp), $9, "Child of GENFOR should have been begin"); - if (!lowerBegp) lowerBegp = new AstBegin($1, "genblk", NULL, true, true); // Empty body + if (!lowerBegp) lowerBegp = new AstBegin($1, "genblk", nullptr, true, true); // Empty body AstNode* lowerNoBegp = lowerBegp->stmtsp(); if (lowerNoBegp) lowerNoBegp->unlinkFrBackWithNext(); // - AstBegin* blkp = new AstBegin($1, lowerBegp->name(), NULL, true, true); + AstBegin* blkp = new AstBegin($1, lowerBegp->name(), nullptr, true, true); // V3LinkDot detects BEGIN(GENFOR(...)) as a special case AstNode* initp = $3; AstNode* varp = $3; if (VN_IS(varp, Var)) { // Genvar @@ -2456,7 +2457,7 @@ genvar_iteration: // ==IEEE: genvar_iteration ; case_generate_itemListE: // IEEE: [{ case_generate_itemList }] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | case_generate_itemList { $$ = $1; } ; @@ -2471,8 +2472,8 @@ case_generate_itemList: // IEEE: { case_generate_itemList } case_generate_item: // ==IEEE: case_generate_item caseCondList ':' generate_block_or_null { $$ = new AstCaseItem($2,$1,$3); } - | yDEFAULT ':' generate_block_or_null { $$ = new AstCaseItem($1,NULL,$3); } - | yDEFAULT generate_block_or_null { $$ = new AstCaseItem($1,NULL,$2); } + | yDEFAULT ':' generate_block_or_null { $$ = new AstCaseItem($1,nullptr,$3); } + | yDEFAULT generate_block_or_null { $$ = new AstCaseItem($1,nullptr,$2); } ; //UNSUPc_case_generate_item: // IEEE: case_generate_item (for checkers) @@ -2492,7 +2493,7 @@ assignOne: ; //UNSUPdelay_or_event_controlE: // IEEE: delay_or_event_control plus empty -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | delay_control { $$ = $1; } //UNSUP | event_control { $$ = $1; } //UNSUP | yREPEAT '(' expr ')' event_control { } @@ -2539,8 +2540,8 @@ netSigList: // IEEE: list_of_port_identifiers ; netSig: // IEEE: net_decl_assignment - one element from list_of_port_identifiers - netId sigAttrListE { $$ = VARDONEA($1,*$1, NULL, $2); } - | netId sigAttrListE '=' expr { $$ = VARDONEA($1,*$1, NULL, $2); + netId sigAttrListE { $$ = VARDONEA($1,*$1, nullptr, $2); } + | netId sigAttrListE '=' expr { $$ = VARDONEA($1,*$1, nullptr, $2); $$->addNext(new AstAssignW($3, new AstVarRef($1, *$1, true), $4)); } | netId variable_dimensionList sigAttrListE { $$ = VARDONEA($1,*$1, $2, $3); } ; @@ -2551,7 +2552,7 @@ netId: ; sigAttrListE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | sigAttrList { $$ = $1; } ; @@ -2570,7 +2571,7 @@ sigAttr: | yVL_PUBLIC_FLAT_RD { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC_FLAT_RD); v3Global.dpi(true); } | yVL_PUBLIC_FLAT_RW { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC_FLAT_RW); v3Global.dpi(true); } | yVL_PUBLIC_FLAT_RW attr_event_control { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC_FLAT_RW); v3Global.dpi(true); - $$ = $$->addNext(new AstAlwaysPublic($1,$2,NULL)); } + $$ = $$->addNext(new AstAlwaysPublic($1,$2,nullptr)); } | yVL_ISOLATE_ASSIGNMENTS { $$ = new AstAttrOf($1,AstAttrType::VAR_ISOLATE_ASSIGNMENTS); } | yVL_SC_BV { $$ = new AstAttrOf($1,AstAttrType::VAR_SC_BV); } | yVL_SFORMAT { $$ = new AstAttrOf($1,AstAttrType::VAR_SFORMAT); } @@ -2578,7 +2579,7 @@ sigAttr: ; rangeListE: // IEEE: [{packed_dimension}] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | rangeList { $$ = $1; } ; @@ -2588,7 +2589,7 @@ rangeList: // IEEE: {packed_dimension} ; //UNSUPbit_selectE: // IEEE: constant_bit_select (IEEE included empty) -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | '[' constExpr ']' { $$=$1; $$ = "["+$2+"]"; } //UNSUP ; @@ -2600,7 +2601,7 @@ anyrange: ; packed_dimensionListE: // IEEE: [{ packed_dimension }] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | packed_dimensionList { $$ = $1; } ; @@ -2611,7 +2612,7 @@ packed_dimensionList: // IEEE: { packed_dimension } packed_dimension: // ==IEEE: packed_dimension anyrange { $$ = $1; } - | '[' ']' { $$ = NULL; BBUNSUP($1, "Unsupported: [] dimensions"); } + | '[' ']' { $$ = nullptr; BBUNSUP($1, "Unsupported: [] dimensions"); } ; //************************************************ @@ -2627,7 +2628,7 @@ param_assignment: // ==IEEE: param_assignment if (VSymEnt* foundp = SYMP->symCurrentp()->findIdFallback(refp->name())) { UINFO(9, "declaring type via param assignment" << foundp->nodep() << endl); VARDTYPE(new AstParseTypeDType($1)) - SYMP->reinsert(foundp->nodep()->cloneTree(false), NULL, *$1); }} + SYMP->reinsert(foundp->nodep()->cloneTree(false), nullptr, *$1); }} $$ = VARDONEA($1, *$1, $2, $3); if ($4) $$->valuep($4); } ; @@ -2639,7 +2640,7 @@ list_of_param_assignments: // ==IEEE: list_of_param_assignments type_assignment: // ==IEEE: type_assignment // // note exptOrDataType being a data_type is only for yPARAMETER yTYPE idAny/*new-parameter*/ sigAttrListE '=' data_type - { $$ = VARDONEA($1, *$1, NULL, $2); $$->valuep($4); } + { $$ = VARDONEA($1, *$1, nullptr, $2); $$->valuep($4); } ; list_of_type_assignments: // ==IEEE: list_of_type_assignments @@ -2655,7 +2656,7 @@ list_of_defparam_assignments: //== IEEE: list_of_defparam_assignments defparam_assignment: // ==IEEE: defparam_assignment idAny '.' idAny '=' expr { $$ = new AstDefParam($4, *$1, *$3, $5); } | idAny '.' idAny '.' - { $$ = NULL; + { $$ = nullptr; BBUNSUP($4, "Unsupported: defparam with more than one dot"); } ; @@ -2681,14 +2682,14 @@ instDecl: { $$ = $4; GRAMMARP->m_impliedDecl=false; if (GRAMMARP->m_instParamp) { VL_DO_CLEAR(GRAMMARP->m_instParamp->deleteTree(), - GRAMMARP->m_instParamp = NULL); + GRAMMARP->m_instParamp = nullptr); } } // // IEEE: interface_identifier' .' modport_identifier list_of_interface_identifiers | id/*interface*/ '.' id/*modport*/ /*mid*/ { VARRESET_NONLIST(AstVarType::IFACEREF); VARDTYPE(new AstIfaceRefDType($1, $3, "", *$1, *$3)); } /*cont*/ mpInstnameList ';' - { $$ = VARDONEP($5,NULL,NULL); } + { $$ = VARDONEP($5,nullptr,nullptr); } //UNSUP: strengthSpecE for udp_instantiations ; @@ -2714,7 +2715,7 @@ instnameParen: GRAMMARP->scrubRange($2)); $$->trace(GRAMMARP->allTracingOn($1)); } | id instRangeListE { $$ = new AstCell($1, GRAMMARP->m_instModuleFl, - *$1, GRAMMARP->m_instModule, NULL, + *$1, GRAMMARP->m_instModule, nullptr, AstPin::cloneTreeNull(GRAMMARP->m_instParamp, true), GRAMMARP->scrubRange($2)); $$->trace(GRAMMARP->allTracingOn($1)); } @@ -2725,7 +2726,7 @@ instnameParen: ; instRangeListE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | instRangeList { $$ = $1; } ; @@ -2759,15 +2760,15 @@ cellpinItList: // IEEE: list_of_port_connections cellparamItemE: // IEEE: named_parameter_assignment + empty // // Note empty can match either () or (,); V3LinkCells cleans up () - /* empty: ',,' is legal */ { $$ = new AstPin(CRELINE(), PINNUMINC(), "", NULL); } - | yP_DOTSTAR { $$ = new AstPin($1,PINNUMINC(),".*",NULL); } + /* empty: ',,' is legal */ { $$ = new AstPin(CRELINE(), PINNUMINC(), "", nullptr); } + | yP_DOTSTAR { $$ = new AstPin($1,PINNUMINC(),".*",nullptr); } | '.' idSVKwd { $$ = new AstPin($2,PINNUMINC(), *$2, - new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); + new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,nullptr,nullptr)); $$->svImplicit(true);} | '.' idAny { $$ = new AstPin($2,PINNUMINC(), *$2, - new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); + new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,nullptr,nullptr)); $$->svImplicit(true);} - | '.' idAny '(' ')' { $$ = new AstPin($2,PINNUMINC(),*$2,NULL); } + | '.' idAny '(' ')' { $$ = new AstPin($2,PINNUMINC(),*$2,nullptr); } // // mintypmax is expanded here, as it might be a UDP or gate primitive // // data_type for 'parameter type' hookups | '.' idAny '(' exprOrDataType ')' { $$ = new AstPin($2, PINNUMINC(), *$2, $4); } @@ -2781,11 +2782,11 @@ cellparamItemE: // IEEE: named_parameter_assignment + empty cellpinItemE: // IEEE: named_port_connection + empty // // Note empty can match either () or (,); V3LinkCells cleans up () - /* empty: ',,' is legal */ { $$ = new AstPin(CRELINE(), PINNUMINC(), "", NULL); } - | yP_DOTSTAR { $$ = new AstPin($1,PINNUMINC(),".*",NULL); } - | '.' idSVKwd { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} - | '.' idAny { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} - | '.' idAny '(' ')' { $$ = new AstPin($2,PINNUMINC(),*$2,NULL); } + /* empty: ',,' is legal */ { $$ = new AstPin(CRELINE(), PINNUMINC(), "", nullptr); } + | yP_DOTSTAR { $$ = new AstPin($1,PINNUMINC(),".*",nullptr); } + | '.' idSVKwd { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,nullptr,nullptr)); $$->svImplicit(true);} + | '.' idAny { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,nullptr,nullptr)); $$->svImplicit(true);} + | '.' idAny '(' ')' { $$ = new AstPin($2,PINNUMINC(),*$2,nullptr); } // // mintypmax is expanded here, as it might be a UDP or gate primitive //UNSUP pev_expr below | '.' idAny '(' expr ')' { $$ = new AstPin($2,PINNUMINC(),*$2,$4); } @@ -2801,20 +2802,20 @@ cellpinItemE: // IEEE: named_port_connection + empty // EventControl lists attr_event_controlE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | attr_event_control { $$ = $1; } ; attr_event_control: // ==IEEE: event_control '@' '(' event_expression ')' { $$ = new AstSenTree($1,$3); } - | '@' '(' '*' ')' { $$ = NULL; } - | '@' '*' { $$ = NULL; } + | '@' '(' '*' ')' { $$ = nullptr; } + | '@' '*' { $$ = nullptr; } ; event_control: // ==IEEE: event_control '@' '(' event_expression ')' { $$ = new AstSenTree($1,$3); } - | '@' '(' '*' ')' { $$ = NULL; } - | '@' '*' { $$ = NULL; } + | '@' '(' '*' ')' { $$ = nullptr; } + | '@' '*' { $$ = nullptr; } // // IEEE: hierarchical_event_identifier // // UNSUP below should be idClassSel | '@' senitemVar { $$ = new AstSenTree($1,$2); } /* For events only */ @@ -2847,8 +2848,8 @@ senitem: // IEEE: part of event_expression, non-'OR' ',' terms | senitem yP_ANDAND senitem { $$ = new AstSenItem($2, AstSenItem::Illegal()); } //UNSUP expr yIFF expr { UNSUP } // Since expr is unsupported we allow and ignore constants (removed in V3Const) - | yaINTNUM { $$ = NULL; } - | yaFLOATNUM { $$ = NULL; } + | yaINTNUM { $$ = nullptr; } + | yaFLOATNUM { $$ = nullptr; } ; senitemVar: @@ -2914,13 +2915,13 @@ par_block: // ==IEEE: par_block ; seq_blockFront: // IEEE: part of seq_block - yBEGIN { $$ = new AstBegin($1,"",NULL); SYMP->pushNew($$); } - | yBEGIN ':' idAny/*new-block_identifier*/ { $$ = new AstBegin($3, *$3, NULL); SYMP->pushNew($$); } + yBEGIN { $$ = new AstBegin($1,"",nullptr); SYMP->pushNew($$); } + | yBEGIN ':' idAny/*new-block_identifier*/ { $$ = new AstBegin($3, *$3, nullptr); SYMP->pushNew($$); } ; par_blockFront: // IEEE: part of par_block - yFORK { $$ = new AstFork($1, "", NULL); SYMP->pushNew($$); } - | yFORK ':' idAny/*new-block_identifier*/ { $$ = new AstFork($3, *$3, NULL); SYMP->pushNew($$); } + yFORK { $$ = new AstFork($1, "", nullptr); SYMP->pushNew($$); } + | yFORK ':' idAny/*new-block_identifier*/ { $$ = new AstFork($3, *$3, nullptr); SYMP->pushNew($$); } ; blockDeclStmtList: // IEEE: { block_item_declaration } { statement or null } @@ -2943,7 +2944,7 @@ block_item_declaration: // ==IEEE: block_item_declaration stmtList: stmtBlock { $$ = $1; } - | stmtList stmtBlock { $$ = ($2==NULL)?($1):($1->addNext($2)); } + | stmtList stmtBlock { $$ = ($2==nullptr)?($1):($1->addNext($2)); } ; stmt: // IEEE: statement_or_null == function_statement_or_null @@ -2951,7 +2952,7 @@ stmt: // IEEE: statement_or_null == function_statement_or_null // // S05 block creation rule | id/*block_identifier*/ ':' statement_item { $$ = new AstBegin($1, *$1, $3); } // // from _or_null - | ';' { $$ = NULL; } + | ';' { $$ = nullptr; } ; statement_item: // IEEE: statement_item @@ -2971,9 +2972,9 @@ statement_item: // IEEE: statement_item // // IEEE: procedural_continuous_assignment | yASSIGN idClassSel '=' delayE expr ';' { $$ = new AstAssign($1,$2,$5); } //UNSUP: delay_or_event_controlE above - | yDEASSIGN variable_lvalue ';' { $$ = NULL; BBUNSUP($1, "Unsupported: Verilog 1995 deassign"); } - | yFORCE expr '=' expr ';' { $$ = NULL; BBUNSUP($1, "Unsupported: Verilog 1995 force"); } - | yRELEASE variable_lvalue ';' { $$ = NULL; BBUNSUP($1, "Unsupported: Verilog 1995 release"); } + | yDEASSIGN variable_lvalue ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: Verilog 1995 deassign"); } + | yFORCE expr '=' expr ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: Verilog 1995 force"); } + | yRELEASE variable_lvalue ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: Verilog 1995 release"); } // // // IEEE: case_statement | unique_priorityE caseStart caseAttrE case_itemListE yENDCASE { $$ = $2; if ($4) $2->addItemsp($4); @@ -2990,7 +2991,7 @@ statement_item: // IEEE: statement_item // // // IEEE: conditional_statement | unique_priorityE yIF '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE - { AstIf* newp = new AstIf($2,$4,$6,NULL); + { AstIf* newp = new AstIf($2,$4,$6,nullptr); $$ = newp; if ($1 == uniq_UNIQUE) newp->uniquePragma(true); if ($1 == uniq_UNIQUE0) newp->unique0Pragma(true); @@ -3059,7 +3060,7 @@ statement_item: // IEEE: statement_item $$ = $2->cloneTree(true); $$->addNext(new AstWhile($1,$5,$2)); } - else $$ = new AstWhile($1,$5,NULL); } + else $$ = new AstWhile($1,$5,nullptr); } // // IEEE says array_identifier here, but dotted accepted in VMM and 1800-2009 | yFOREACH '(' idClassSelForeach ')' stmtBlock { $$ = new AstForeach($1, $3, $5); } // @@ -3095,11 +3096,11 @@ statement_item: // IEEE: statement_item //UNSUP randsequence_statement { $$ = $1; } // // // IEEE: randcase_statement - | yRANDCASE case_itemList yENDCASE { $$ = NULL; BBUNSUP($1, "Unsupported: SystemVerilog 2005 randcase statements"); } + | yRANDCASE case_itemList yENDCASE { $$ = nullptr; BBUNSUP($1, "Unsupported: SystemVerilog 2005 randcase statements"); } // //UNSUP expect_property_statement { $$ = $1; } // - | error ';' { $$ = NULL; } + | error ';' { $$ = nullptr; } ; statementFor: // IEEE: part of statement @@ -3183,13 +3184,13 @@ finc_or_dec_expression: // ==IEEE: inc_or_dec_expression class_new: // ==IEEE: class_new // // Special precence so (...) doesn't match expr - yNEW__ETC { $$ = new AstNew($1, NULL); } + yNEW__ETC { $$ = new AstNew($1, nullptr); } | yNEW__ETC expr { $$ = new AstNewCopy($1, $2); } | yNEW__PAREN '(' list_of_argumentsE ')' { $$ = new AstNew($1, $3); } ; dynamic_array_new: // ==IEEE: dynamic_array_new - yNEW__ETC '[' expr ']' { $$ = new AstNewDynamic($1, $3, NULL); } + yNEW__ETC '[' expr ']' { $$ = new AstNewDynamic($1, $3, nullptr); } | yNEW__ETC '[' expr ']' '(' expr ')' { $$ = new AstNewDynamic($1, $3, $6); } ; @@ -3204,9 +3205,9 @@ unique_priorityE: // IEEE: unique_priority + empty ; caseStart: // IEEE: part of case_statement - yCASE '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,VCaseType::CT_CASE,$3,NULL); } - | yCASEX '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,VCaseType::CT_CASEX,$3,NULL); } - | yCASEZ '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,VCaseType::CT_CASEZ,$3,NULL); } + yCASE '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,VCaseType::CT_CASE,$3,nullptr); } + | yCASEX '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,VCaseType::CT_CASEX,$3,nullptr); } + | yCASEZ '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,VCaseType::CT_CASEZ,$3,nullptr); } ; caseAttrE: @@ -3221,31 +3222,31 @@ caseAttrE: //UNSUP ; case_itemListE: // IEEE: [ { case_item } ] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | case_itemList { $$ = $1; } ; case_insideListE: // IEEE: [ { case_inside_item } ] - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | case_inside_itemList { $$ = $1; } ; case_itemList: // IEEE: { case_item + ... } caseCondList ':' stmtBlock { $$ = new AstCaseItem($2,$1,$3); } - | yDEFAULT ':' stmtBlock { $$ = new AstCaseItem($1,NULL,$3); } - | yDEFAULT stmtBlock { $$ = new AstCaseItem($1,NULL,$2); } + | yDEFAULT ':' stmtBlock { $$ = new AstCaseItem($1,nullptr,$3); } + | yDEFAULT stmtBlock { $$ = new AstCaseItem($1,nullptr,$2); } | case_itemList caseCondList ':' stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($3,$2,$4)); } - | case_itemList yDEFAULT stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,NULL,$3)); } - | case_itemList yDEFAULT ':' stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,NULL,$4)); } + | case_itemList yDEFAULT stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,nullptr,$3)); } + | case_itemList yDEFAULT ':' stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,nullptr,$4)); } ; case_inside_itemList: // IEEE: { case_inside_item + open_range_list ... } open_range_list ':' stmtBlock { $$ = new AstCaseItem($2,$1,$3); } - | yDEFAULT ':' stmtBlock { $$ = new AstCaseItem($1,NULL,$3); } - | yDEFAULT stmtBlock { $$ = new AstCaseItem($1,NULL,$2); } + | yDEFAULT ':' stmtBlock { $$ = new AstCaseItem($1,nullptr,$3); } + | yDEFAULT stmtBlock { $$ = new AstCaseItem($1,nullptr,$2); } | case_inside_itemList open_range_list ':' stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($3,$2,$4)); } - | case_inside_itemList yDEFAULT stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,NULL,$3)); } - | case_inside_itemList yDEFAULT ':' stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,NULL,$4)); } + | case_inside_itemList yDEFAULT stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,nullptr,$3)); } + | case_inside_itemList yDEFAULT ':' stmtBlock { $$ = $1;$1->addNext(new AstCaseItem($2,nullptr,$4)); } ; open_range_list: // ==IEEE: open_range_list + open_value_range @@ -3273,11 +3274,11 @@ caseCondList: // IEEE: part of case_item ; patternNoExpr: // IEEE: pattern **Excluding Expr* - '.' id/*variable*/ { $$ = NULL; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } - | yP_DOTSTAR { $$ = NULL; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } + '.' id/*variable*/ { $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } + | yP_DOTSTAR { $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } // // IEEE: "expr" excluded; expand in callers // // "yTAGGED id [expr]" Already part of expr - //UNSUP yTAGGED id/*member_identifier*/ patternNoExpr { $$ = NULL; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } + //UNSUP yTAGGED id/*member_identifier*/ patternNoExpr { $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } // // "yP_TICKBRA patternList '}'" part of expr under assignment_pattern ; @@ -3287,8 +3288,8 @@ patternList: // IEEE: part of pattern ; patternOne: // IEEE: part of pattern - expr { if ($1) { $$ = new AstPatMember($1->fileline(),$1,NULL,NULL); } else { $$=NULL; } } - | expr '{' argsExprList '}' { $$ = new AstPatMember($2,$3,NULL,$1); } + expr { if ($1) { $$ = new AstPatMember($1->fileline(),$1,nullptr,nullptr); } else { $$=nullptr; } } + | expr '{' argsExprList '}' { $$ = new AstPatMember($2,$3,nullptr,$1); } | patternNoExpr { $$ = $1; } ; @@ -3298,11 +3299,11 @@ patternMemberList: // IEEE: part of pattern and assignment_pattern ; patternMemberOne: // IEEE: part of pattern and assignment_pattern - patternKey ':' expr { $$ = new AstPatMember($1->fileline(),$3,$1,NULL); } - | patternKey ':' patternNoExpr { $$ = NULL; BBUNSUP($2, "Unsupported: '{} .* patterns"); } + patternKey ':' expr { $$ = new AstPatMember($1->fileline(),$3,$1,nullptr); } + | patternKey ':' patternNoExpr { $$ = nullptr; BBUNSUP($2, "Unsupported: '{} .* patterns"); } // // From assignment_pattern_key - | yDEFAULT ':' expr { $$ = new AstPatMember($1,$3,NULL,NULL); $$->isDefault(true); } - | yDEFAULT ':' patternNoExpr { $$ = NULL; BBUNSUP($2, "Unsupported: '{} .* patterns"); } + | yDEFAULT ':' expr { $$ = new AstPatMember($1,$3,nullptr,nullptr); $$->isDefault(true); } + | yDEFAULT ':' patternNoExpr { $$ = nullptr; BBUNSUP($2, "Unsupported: '{} .* patterns"); } ; patternKey: // IEEE: merge structure_pattern_key, array_pattern_key, assignment_pattern_key @@ -3336,7 +3337,7 @@ assignment_pattern: // ==IEEE: assignment_pattern | yP_TICKBRA patternMemberList '}' { $$ = new AstPattern($1,$2); } // // IEEE: Not in grammar, but in VMM | yP_TICKBRA '}' - { $$ = new AstPattern($1, NULL); $1->v3warn(E_UNSUPPORTED, "Unsupported: Empty '{}"); } + { $$ = new AstPattern($1, nullptr); $1->v3warn(E_UNSUPPORTED, "Unsupported: Empty '{}"); } ; // "datatype id = x {, id = x }" | "yaId = x {, id=x}" is legal @@ -3344,7 +3345,7 @@ for_initialization: // ==IEEE: for_initialization + for_variable_declarat // // IEEE: for_variable_declaration for_initializationItemList ';' { $$ = $1; } // // IEEE: 1800-2017 empty initialization - | ';' { $$ = NULL; } + | ';' { $$ = nullptr; } ; for_initializationItemList: // IEEE: [for_variable_declaration...] @@ -3356,12 +3357,12 @@ for_initializationItem: // IEEE: variable_assignment + for_variable_decl // // IEEE: for_variable_declaration data_type idAny/*new*/ '=' expr { VARRESET_NONLIST(VAR); VARDTYPE($1); - $$ = VARDONEA($2,*$2,NULL,NULL); + $$ = VARDONEA($2,*$2,nullptr,nullptr); $$->addNext(new AstAssign($3, new AstVarRef($2, *$2, true), $4));} // // IEEE-2012: | yVAR data_type idAny/*new*/ '=' expr { VARRESET_NONLIST(VAR); VARDTYPE($2); - $$ = VARDONEA($3,*$3,NULL,NULL); + $$ = VARDONEA($3,*$3,nullptr,nullptr); $$->addNext(new AstAssign($4, new AstVarRef($3, *$3, true), $5));} // // IEEE: variable_assignment // // UNSUP variable_lvalue below @@ -3369,7 +3370,7 @@ for_initializationItem: // IEEE: variable_assignment + for_variable_decl ; for_stepE: // IEEE: for_step + empty - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | for_step { $$ = $1; } ; @@ -3401,7 +3402,7 @@ loop_variables: // IEEE: loop_variables // Functions/tasks taskRef: // IEEE: part of tf_call - id { $$ = new AstTaskRef($1,*$1,NULL); } + id { $$ = new AstTaskRef($1,*$1,nullptr); } | id '(' list_of_argumentsE ')' { $$ = new AstTaskRef($1,*$1,$3); } | packageClassScope id '(' list_of_argumentsE ')' { $$ = AstDot::newIfPkg($2, $1, new AstTaskRef($2, *$2, $4)); } @@ -3431,7 +3432,7 @@ task_subroutine_callNoMethod: // function_subroutine_callNoMethod (as tas // // funcref below not task ref to avoid conflict, must later handle either | funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWith($2, true, $1, $4); } // // can call as method and yWITH without parenthesis - | id yWITH__PAREN '(' expr ')' { $$ = new AstWith($2, true, new AstFuncRef($1, *$1, NULL), $4); } + | id yWITH__PAREN '(' expr ')' { $$ = new AstWith($2, true, new AstFuncRef($1, *$1, nullptr), $4); } | system_t_call { $$ = $1; } // // IEEE: method_call requires a "." so is in expr // // IEEE: ['std::'] not needed, as normal std package resolution will find it @@ -3446,7 +3447,7 @@ function_subroutine_callNoMethod: // IEEE: function_subroutine_call (as f funcRef { $$ = $1; } | funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWith($2, false, $1, $4); } // // can call as method and yWITH without parenthesis - | id yWITH__PAREN '(' expr ')' { $$ = new AstWith($2, false, new AstFuncRef($1, *$1, NULL), $4); } + | id yWITH__PAREN '(' expr ')' { $$ = new AstWith($2, false, new AstFuncRef($1, *$1, nullptr), $4); } | system_f_call { $$ = $1; } // // IEEE: method_call requires a "." so is in expr // // IEEE: ['std::'] not needed, as normal std package resolution will find it @@ -3454,7 +3455,7 @@ function_subroutine_callNoMethod: // IEEE: function_subroutine_call (as f // // We implement randomize as a normal funcRef, since randomize isn't a keyword // // Note yNULL is already part of expressions, so they come for free | funcRef yWITH__CUR constraint_block { $$ = $1; BBUNSUP($2, "Unsupported: randomize() 'with' constraint"); } - | funcRef yWITH__CUR '{' '}' { $$ = new AstWith($2, false, $1, NULL); } + | funcRef yWITH__CUR '{' '}' { $$ = new AstWith($2, false, $1, nullptr); } ; system_t_call: // IEEE: system_tf_call (as task) @@ -3483,11 +3484,11 @@ system_t_call: // IEEE: system_tf_call (as task) | yD_DUMPON parenE { $$ = new AstDumpCtl($1, VDumpCtlType::ON); } | yD_DUMPON '(' expr ')' { $$ = new AstDumpCtl($1, VDumpCtlType::ON); DEL($3); } // - | yD_C '(' cStrList ')' { $$ = (v3Global.opt.ignc() ? NULL : new AstUCStmt($1,$3)); } + | yD_C '(' cStrList ')' { $$ = (v3Global.opt.ignc() ? nullptr : new AstUCStmt($1,$3)); } | yD_SYSTEM '(' expr ')' { $$ = new AstSystemT($1, $3); } // | yD_FCLOSE '(' idClassSel ')' { $$ = new AstFClose($1, $3); } - | yD_FFLUSH parenE { $$ = new AstFFlush($1, NULL); } + | yD_FFLUSH parenE { $$ = new AstFFlush($1, nullptr); } | yD_FFLUSH '(' expr ')' { $$ = new AstFFlush($1, $3); } | yD_FINISH parenE { $$ = new AstFinish($1); } | yD_FINISH '(' expr ')' { $$ = new AstFinish($1); DEL($3); } @@ -3500,61 +3501,61 @@ system_t_call: // IEEE: system_tf_call (as task) | yD_SWRITEH '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5, 'h'); } | yD_SWRITEO '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5, 'o'); } // - | yD_DISPLAY parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, NULL); } - | yD_DISPLAY '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, $3); } - | yD_DISPLAYB parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, NULL, 'b'); } - | yD_DISPLAYB '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, $3, 'b'); } - | yD_DISPLAYH parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, NULL, 'h'); } - | yD_DISPLAYH '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, $3, 'h'); } - | yD_DISPLAYO parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, NULL, 'o'); } - | yD_DISPLAYO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, $3, 'o'); } - | yD_WRITE parenE { $$ = NULL; } // NOP - | yD_WRITE '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, NULL, $3); } - | yD_WRITEB parenE { $$ = NULL; } // NOP - | yD_WRITEB '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, NULL, $3, 'b'); } - | yD_WRITEH parenE { $$ = NULL; } // NOP - | yD_WRITEH '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, NULL, $3, 'h'); } - | yD_WRITEO parenE { $$ = NULL; } // NOP - | yD_WRITEO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, NULL, $3, 'o'); } - | yD_FDISPLAY '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, NULL); } + | yD_DISPLAY parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr); } + | yD_DISPLAY '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3); } + | yD_DISPLAYB parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr, 'b'); } + | yD_DISPLAYB '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3, 'b'); } + | yD_DISPLAYH parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr, 'h'); } + | yD_DISPLAYH '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3, 'h'); } + | yD_DISPLAYO parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr, 'o'); } + | yD_DISPLAYO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3, 'o'); } + | yD_WRITE parenE { $$ = nullptr; } // NOP + | yD_WRITE '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3); } + | yD_WRITEB parenE { $$ = nullptr; } // NOP + | yD_WRITEB '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3, 'b'); } + | yD_WRITEH parenE { $$ = nullptr; } // NOP + | yD_WRITEH '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3, 'h'); } + | yD_WRITEO parenE { $$ = nullptr; } // NOP + | yD_WRITEO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3, 'o'); } + | yD_FDISPLAY '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr); } | yD_FDISPLAY '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5); } - | yD_FDISPLAYB '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, NULL, 'b'); } + | yD_FDISPLAYB '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr, 'b'); } | yD_FDISPLAYB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5, 'b'); } - | yD_FDISPLAYH '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, NULL, 'h'); } + | yD_FDISPLAYH '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr, 'h'); } | yD_FDISPLAYH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5, 'h'); } - | yD_FDISPLAYO '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, NULL, 'o'); } + | yD_FDISPLAYO '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr, 'o'); } | yD_FDISPLAYO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5, 'o'); } | yD_FWRITE '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, $3, $5); } | yD_FWRITEB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, $3, $5, 'b'); } | yD_FWRITEO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, $3, $5, 'h'); } | yD_FWRITEH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, $3, $5, 'o'); } - | yD_INFO parenE { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, NULL, NULL); } - | yD_INFO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, NULL, $3); } - | yD_WARNING parenE { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING, NULL, NULL); } - | yD_WARNING '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING, NULL, $3); } + | yD_INFO parenE { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, nullptr, nullptr); } + | yD_INFO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, nullptr, $3); } + | yD_WARNING parenE { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING, nullptr, nullptr); } + | yD_WARNING '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING, nullptr, $3); } | yD_ERROR parenE { $$ = GRAMMARP->createDisplayError($1); } - | yD_ERROR '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_ERROR, NULL, $3); $$->addNext(new AstStop($1, true)); } - | yD_FATAL parenE { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, NULL, NULL); $$->addNext(new AstStop($1, false)); } - | yD_FATAL '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, NULL, NULL); $$->addNext(new AstStop($1, false)); DEL($3); } - | yD_FATAL '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, NULL, $5); $$->addNext(new AstStop($1, false)); DEL($3); } + | yD_ERROR '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_ERROR, nullptr, $3); $$->addNext(new AstStop($1, true)); } + | yD_FATAL parenE { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, nullptr, nullptr); $$->addNext(new AstStop($1, false)); } + | yD_FATAL '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, nullptr, nullptr); $$->addNext(new AstStop($1, false)); DEL($3); } + | yD_FATAL '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, nullptr, $5); $$->addNext(new AstStop($1, false)); DEL($3); } // | yD_PRINTTIMESCALE { $$ = new AstPrintTimeScale($1); } | yD_PRINTTIMESCALE '(' ')' { $$ = new AstPrintTimeScale($1); } | yD_PRINTTIMESCALE '(' idClassSel ')' { $$ = new AstPrintTimeScale($1); DEL($3); } | yD_TIMEFORMAT '(' expr ',' expr ',' expr ',' expr ')' { $$ = new AstTimeFormat($1, $3, $5, $7, $9); } // - | yD_READMEMB '(' expr ',' idClassSel ')' { $$ = new AstReadMem($1,false,$3,$5,NULL,NULL); } - | yD_READMEMB '(' expr ',' idClassSel ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,NULL); } + | yD_READMEMB '(' expr ',' idClassSel ')' { $$ = new AstReadMem($1,false,$3,$5,nullptr,nullptr); } + | yD_READMEMB '(' expr ',' idClassSel ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,nullptr); } | yD_READMEMB '(' expr ',' idClassSel ',' expr ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,$9); } - | yD_READMEMH '(' expr ',' idClassSel ')' { $$ = new AstReadMem($1,true, $3,$5,NULL,NULL); } - | yD_READMEMH '(' expr ',' idClassSel ',' expr ')' { $$ = new AstReadMem($1,true, $3,$5,$7,NULL); } + | yD_READMEMH '(' expr ',' idClassSel ')' { $$ = new AstReadMem($1,true, $3,$5,nullptr,nullptr); } + | yD_READMEMH '(' expr ',' idClassSel ',' expr ')' { $$ = new AstReadMem($1,true, $3,$5,$7,nullptr); } | yD_READMEMH '(' expr ',' idClassSel ',' expr ',' expr ')' { $$ = new AstReadMem($1,true, $3,$5,$7,$9); } // - | yD_WRITEMEMB '(' expr ',' idClassSel ')' { $$ = new AstWriteMem($1, false, $3, $5, NULL, NULL); } - | yD_WRITEMEMB '(' expr ',' idClassSel ',' expr ')' { $$ = new AstWriteMem($1, false, $3, $5, $7, NULL); } + | yD_WRITEMEMB '(' expr ',' idClassSel ')' { $$ = new AstWriteMem($1, false, $3, $5, nullptr, nullptr); } + | yD_WRITEMEMB '(' expr ',' idClassSel ',' expr ')' { $$ = new AstWriteMem($1, false, $3, $5, $7, nullptr); } | yD_WRITEMEMB '(' expr ',' idClassSel ',' expr ',' expr ')' { $$ = new AstWriteMem($1, false, $3, $5, $7, $9); } - | yD_WRITEMEMH '(' expr ',' idClassSel ')' { $$ = new AstWriteMem($1, true, $3, $5, NULL, NULL); } - | yD_WRITEMEMH '(' expr ',' idClassSel ',' expr ')' { $$ = new AstWriteMem($1, true, $3, $5, $7, NULL); } + | yD_WRITEMEMH '(' expr ',' idClassSel ')' { $$ = new AstWriteMem($1, true, $3, $5, nullptr, nullptr); } + | yD_WRITEMEMH '(' expr ',' idClassSel ',' expr ')' { $$ = new AstWriteMem($1, true, $3, $5, $7, nullptr); } | yD_WRITEMEMH '(' expr ',' idClassSel ',' expr ',' expr ')' { $$ = new AstWriteMem($1, true, $3, $5, $7, $9); } // // Any system function as a task @@ -3564,14 +3565,14 @@ system_t_call: // IEEE: system_tf_call (as task) system_f_call: // IEEE: system_tf_call (as func) yaD_PLI systemDpiArgsE { $$ = new AstFuncRef($1, *$1, $2); VN_CAST($$, FuncRef)->pli(true); } // - | yD_C '(' cStrList ')' { $$ = (v3Global.opt.ignc() ? NULL : new AstUCFunc($1,$3)); } + | yD_C '(' cStrList ')' { $$ = (v3Global.opt.ignc() ? nullptr : new AstUCFunc($1,$3)); } | yD_SYSTEM '(' expr ')' { $$ = new AstSystemF($1,$3); } // | system_f_call_or_t { $$ = $1; } ; systemDpiArgsE: // IEEE: part of system_if_call for aruments of $dpi call - parenE { $$ = NULL; } + parenE { $$ = nullptr; } | '(' exprList ')' { $$ = GRAMMARP->argWrapList($2); } ; @@ -3607,31 +3608,31 @@ system_f_call_or_t: // IEEE: part of system_tf_call (can be task or func) | yD_FERROR '(' idClassSel ',' idClassSel ')' { $$ = new AstFError($1, $3, $5); } | yD_FGETC '(' expr ')' { $$ = new AstFGetC($1,$3); } | yD_FGETS '(' idClassSel ',' expr ')' { $$ = new AstFGetS($1,$3,$5); } - | yD_FREAD '(' idClassSel ',' expr ')' { $$ = new AstFRead($1,$3,$5,NULL,NULL); } - | yD_FREAD '(' idClassSel ',' expr ',' expr ')' { $$ = new AstFRead($1,$3,$5,$7,NULL); } + | yD_FREAD '(' idClassSel ',' expr ')' { $$ = new AstFRead($1,$3,$5,nullptr,nullptr); } + | yD_FREAD '(' idClassSel ',' expr ',' expr ')' { $$ = new AstFRead($1,$3,$5,$7,nullptr); } | yD_FREAD '(' idClassSel ',' expr ',' expr ',' expr ')' { $$ = new AstFRead($1,$3,$5,$7,$9); } | yD_FREWIND '(' idClassSel ')' { $$ = new AstFRewind($1, $3); } | yD_FLOOR '(' expr ')' { $$ = new AstFloorD($1,$3); } | yD_FSCANF '(' expr ',' str commaVRDListE ')' { $$ = new AstFScanF($1,*$5,$3,$6); } | yD_FSEEK '(' idClassSel ',' expr ',' expr ')' { $$ = new AstFSeek($1,$3,$5,$7); } | yD_FTELL '(' idClassSel ')' { $$ = new AstFTell($1, $3); } - | yD_HIGH '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_HIGH,$3,NULL); } + | yD_HIGH '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_HIGH,$3,nullptr); } | yD_HIGH '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_HIGH,$3,$5); } | yD_HYPOT '(' expr ',' expr ')' { $$ = new AstHypotD($1,$3,$5); } - | yD_INCREMENT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_INCREMENT,$3,NULL); } + | yD_INCREMENT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_INCREMENT,$3,nullptr); } | yD_INCREMENT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_INCREMENT,$3,$5); } | yD_ISUNBOUNDED '(' expr ')' { $$ = new AstIsUnbounded($1, $3); } | yD_ISUNKNOWN '(' expr ')' { $$ = new AstIsUnknown($1, $3); } | yD_ITOR '(' expr ')' { $$ = new AstIToRD($1,$3); } - | yD_LEFT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LEFT,$3,NULL); } + | yD_LEFT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LEFT,$3,nullptr); } | yD_LEFT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LEFT,$3,$5); } | yD_LN '(' expr ')' { $$ = new AstLogD($1,$3); } | yD_LOG10 '(' expr ')' { $$ = new AstLog10D($1,$3); } - | yD_LOW '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LOW,$3,NULL); } + | yD_LOW '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LOW,$3,nullptr); } | yD_LOW '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LOW,$3,$5); } | yD_ONEHOT '(' expr ')' { $$ = new AstOneHot($1,$3); } | yD_ONEHOT0 '(' expr ')' { $$ = new AstOneHot0($1,$3); } - | yD_PAST '(' expr ')' { $$ = new AstPast($1,$3, NULL); } + | yD_PAST '(' expr ')' { $$ = new AstPast($1,$3, nullptr); } | yD_PAST '(' expr ',' expr ')' { $$ = new AstPast($1,$3, $5); } | yD_PAST '(' expr ',' expr ',' expr ')' { $$ = $3; BBUNSUP($1, "Unsupported: $past expr2 and clock arguments"); } | yD_PAST '(' expr ',' expr ',' expr ',' expr')' { $$ = $3; BBUNSUP($1, "Unsupported: $past expr2 and clock arguments"); } @@ -3642,7 +3643,7 @@ system_f_call_or_t: // IEEE: part of system_tf_call (can be task or func) | yD_REALTIME parenE { $$ = new AstTimeD($1, VTimescale(VTimescale::NONE)); } | yD_REALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); } | yD_REWIND '(' idClassSel ')' { $$ = new AstFSeek($1, $3, new AstConst($1, 0), new AstConst($1, 0)); } - | yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,NULL); } + | yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,nullptr); } | yD_RIGHT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,$5); } | yD_ROSE '(' expr ')' { $$ = new AstRose($1,$3); } | yD_ROSE '(' expr ',' expr ')' { $$ = $3; BBUNSUP($1, "Unsupported: $rose and clock arguments"); } @@ -3653,7 +3654,7 @@ system_f_call_or_t: // IEEE: part of system_tf_call (can be task or func) | yD_SIGNED '(' expr ')' { $$ = new AstSigned($1,$3); } | yD_SIN '(' expr ')' { $$ = new AstSinD($1,$3); } | yD_SINH '(' expr ')' { $$ = new AstSinhD($1,$3); } - | yD_SIZE '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_SIZE,$3,NULL); } + | yD_SIZE '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_SIZE,$3,nullptr); } | yD_SIZE '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_SIZE,$3,$5); } | yD_SQRT '(' expr ')' { $$ = new AstSqrtD($1,$3); } | yD_SSCANF '(' expr ',' str commaVRDListE ')' { $$ = new AstSScanF($1,*$5,$3,$6); } @@ -3678,14 +3679,14 @@ elaboration_system_task: // IEEE: elaboration_system_task (1800-2009) elaboration_system_task_guts: // IEEE: part of elaboration_system_task (1800-2009) // // $fatal first argument is exit number, must be constant - yD_INFO parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_INFO, NULL); } + yD_INFO parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_INFO, nullptr); } | yD_INFO '(' exprList ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_INFO, $3); } - | yD_WARNING parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_WARNING, NULL); } + | yD_WARNING parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_WARNING, nullptr); } | yD_WARNING '(' exprList ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_WARNING, $3); } - | yD_ERROR parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_ERROR, NULL); } + | yD_ERROR parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_ERROR, nullptr); } | yD_ERROR '(' exprList ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_ERROR, $3); } - | yD_FATAL parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, NULL); } - | yD_FATAL '(' expr ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, NULL); DEL($3); } + | yD_FATAL parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, nullptr); } + | yD_FATAL '(' expr ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, nullptr); DEL($3); } | yD_FATAL '(' expr ',' exprListE ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, $5); DEL($3); } ; @@ -3723,7 +3724,7 @@ list_of_argumentsE: // IEEE: [list_of_arguments] argsDottedList { $$ = $1; } | argsExprListE { if (VN_IS($1, Arg) && VN_CAST($1, Arg)->emptyConnectNoNext()) { - $1->deleteTree(); $$ = NULL; // Mis-created when have 'func()' + $1->deleteTree(); $$ = nullptr; // Mis-created when have 'func()' } else { $$ = $1; } } | argsExprListE ',' argsDottedList { $$ = $1->addNextNull($3); } ; @@ -3786,7 +3787,7 @@ lifetime: // ==IEEE: lifetime taskId: tfIdScoped - { $$ = new AstTask($1, *$1, NULL); + { $$ = new AstTask($1, *$1, nullptr); SYMP->pushNewUnderNodeOrCurrent($$, $1); } ; @@ -3794,37 +3795,37 @@ funcId: // IEEE: function_data_type_or_implicit + part of function_bod // // IEEE: function_data_type_or_implicit must be expanded here to prevent conflict // // function_data_type expanded here to prevent conflicts with implicit_type:empty vs data_type:ID /**/ tfIdScoped - { $$ = new AstFunc($1,*$1,NULL, + { $$ = new AstFunc($1,*$1,nullptr, new AstBasicDType($1, LOGIC_IMPLICIT)); SYMP->pushNewUnderNodeOrCurrent($$, $1); } | signingE rangeList tfIdScoped - { $$ = new AstFunc($3,*$3,NULL, + { $$ = new AstFunc($3,*$3,nullptr, GRAMMARP->addRange(new AstBasicDType($3, LOGIC_IMPLICIT, $1), $2,true)); SYMP->pushNewUnderNodeOrCurrent($$, $3); } | signing tfIdScoped - { $$ = new AstFunc($2,*$2,NULL, + { $$ = new AstFunc($2,*$2,nullptr, new AstBasicDType($2, LOGIC_IMPLICIT, $1)); SYMP->pushNewUnderNodeOrCurrent($$, $2); } | data_type tfIdScoped - { $$ = new AstFunc($2,*$2,NULL,$1); + { $$ = new AstFunc($2,*$2,nullptr,$1); SYMP->pushNewUnderNodeOrCurrent($$, $2); } // // To verilator tasks are the same as void functions (we separately detect time passing) | yVOID tfIdScoped - { $$ = new AstTask($2, *$2, NULL); + { $$ = new AstTask($2, *$2, nullptr); SYMP->pushNewUnderNodeOrCurrent($$, $2); } ; funcIdNew: // IEEE: from class_constructor_declaration yNEW__ETC - { $$ = new AstFunc($1, "new", NULL, NULL); + { $$ = new AstFunc($1, "new", nullptr, nullptr); $$->isConstructor(true); - SYMP->pushNewUnder($$, NULL); } + SYMP->pushNewUnder($$, nullptr); } | yNEW__PAREN - { $$ = new AstFunc($1, "new", NULL, NULL); + { $$ = new AstFunc($1, "new", nullptr, nullptr); $$->isConstructor(true); - SYMP->pushNewUnder($$, NULL); } + SYMP->pushNewUnder($$, nullptr); } | packageClassScopeNoId yNEW__PAREN - { $$ = new AstFunc($2, "new", NULL, NULL); + { $$ = new AstFunc($2, "new", nullptr, nullptr); BBUNSUP($2, "Unsupported: scoped new constructor"); $$->isConstructor(true); SYMP->pushNewUnderNodeOrCurrent($$, $1); } @@ -3833,10 +3834,10 @@ funcIdNew: // IEEE: from class_constructor_declaration tfIdScoped: // IEEE: part of function_body_declaration/task_body_declaration // // IEEE: [ interface_identifier '.' | class_scope ] function_identifier id - { $$ = $1; $$ = NULL; $$ = $1; } + { $$ = $1; $$ = nullptr; $$ = $1; } // | id/*interface_identifier*/ '.' id - { $$ = $3; $$ = NULL; $$ = $3; + { $$ = $3; $$ = nullptr; $$ = $3; BBUNSUP($2, "Unsupported: Out of block function declaration"); } // | packageClassScope id @@ -3850,7 +3851,7 @@ tfGuts: ; tfBodyE: // IEEE: part of function_body_declaration/task_body_declaration - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | tf_item_declarationList { $$ = $1; } | tf_item_declarationList stmtList { $$ = $1->addNextNull($2); } | stmtList { $$ = $1; } @@ -3886,7 +3887,7 @@ tf_port_listList: // IEEE: part of tf_port_list tf_port_item: // ==IEEE: tf_port_item // // We split tf_port_item into the type and assignment as don't know what follows a comma - /* empty */ { $$ = NULL; PINNUMINC(); } // For example a ",," port + /* empty */ { $$ = nullptr; PINNUMINC(); } // For example a ",," port | tf_port_itemFront tf_port_itemAssignment { $$ = $2; } | tf_port_itemAssignment { $$ = $1; } ; @@ -3898,7 +3899,7 @@ tf_port_itemFront: // IEEE: part of tf_port_item, which has the data type | yVAR data_type { VARDTYPE($2); } | yVAR implicit_typeE { VARDTYPE($2); } // - | tf_port_itemDir /*implicit*/ { VARDTYPE(NULL); /*default_nettype-see spec*/ } + | tf_port_itemDir /*implicit*/ { VARDTYPE(nullptr); /*default_nettype-see spec*/ } | tf_port_itemDir data_type { VARDTYPE($2); } | tf_port_itemDir signingE rangeList { VARDTYPE(GRAMMARP->addRange(new AstBasicDType($3->fileline(), LOGIC_IMPLICIT, $2),$3,true)); } | tf_port_itemDir signing { VARDTYPE(new AstBasicDType($2, LOGIC_IMPLICIT, $2)); } @@ -3928,10 +3929,10 @@ parenE: // // method_call_root not needed, part of expr resolution // // What's left is below array_methodNoRoot array_methodNoRoot: - yOR { $$ = new AstFuncRef($1, "or", NULL); } - | yAND { $$ = new AstFuncRef($1, "and", NULL); } - | yXOR { $$ = new AstFuncRef($1, "xor", NULL); } - | yUNIQUE { $$ = new AstFuncRef($1, "unique", NULL); } + yOR { $$ = new AstFuncRef($1, "or", nullptr); } + | yAND { $$ = new AstFuncRef($1, "and", nullptr); } + | yXOR { $$ = new AstFuncRef($1, "xor", nullptr); } + | yUNIQUE { $$ = new AstFuncRef($1, "unique", nullptr); } ; array_methodWith: @@ -3947,13 +3948,13 @@ dpi_import_export: // ==IEEE: dpi_import_export { $$ = $5; if (*$4 != "") $5->cname(*$4); $5->dpiContext($3==iprop_CONTEXT); $5->pure($3==iprop_PURE); $5->dpiImport(true); GRAMMARP->checkDpiVer($1,*$2); v3Global.dpi(true); - if ($$->prettyName()[0]=='$') SYMP->reinsert($$,NULL,$$->prettyName()); // For $SysTF overriding + if ($$->prettyName()[0]=='$') SYMP->reinsert($$,nullptr,$$->prettyName()); // For $SysTF overriding SYMP->reinsert($$); } | yIMPORT yaSTRING dpi_tf_import_propertyE dpi_importLabelE task_prototype ';' { $$ = $5; if (*$4 != "") $5->cname(*$4); $5->dpiContext($3==iprop_CONTEXT); $5->pure($3==iprop_PURE); $5->dpiImport(true); $5->dpiTask(true); GRAMMARP->checkDpiVer($1,*$2); v3Global.dpi(true); - if ($$->prettyName()[0]=='$') SYMP->reinsert($$,NULL,$$->prettyName()); // For $SysTF overriding + if ($$->prettyName()[0]=='$') SYMP->reinsert($$,nullptr,$$->prettyName()); // For $SysTF overriding SYMP->reinsert($$); } | yEXPORT yaSTRING dpi_importLabelE yFUNCTION idAny ';' { $$ = new AstDpiExport($5, *$5, *$3); @@ -3987,13 +3988,13 @@ dpi_tf_import_propertyE: // IEEE: [ dpi_function_import_property + dpi_ta exprEqE: // IEEE: optional '=' expression (part of param_assignment) // // constant_param_expression: '$' is in expr - /*empty*/ { $$ = NULL; } + /*empty*/ { $$ = nullptr; } | '=' expr { $$ = $2; } ; exprOrDataTypeEqE: // IEEE: optional '=' expression (part of param_assignment) // // constant_param_expression: '$' is in expr - /*empty*/ { $$ = NULL; } + /*empty*/ { $$ = nullptr; } | '=' exprOrDataType { $$ = $2; } ; @@ -4308,7 +4309,7 @@ cateList: ; exprListE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | exprList { $$ = $1; } ; @@ -4331,7 +4332,7 @@ vrdList: ; commaVRDListE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | ',' vrdList { $$ = $2; } ; @@ -4351,12 +4352,12 @@ argsExprListE: // IEEE: part of list_of_arguments //UNSUP ; argsExprOneE: // IEEE: part of list_of_arguments - /*empty*/ { $$ = new AstArg(CRELINE(), "", NULL); } + /*empty*/ { $$ = new AstArg(CRELINE(), "", nullptr); } | expr { $$ = new AstArg($1->fileline(), "", $1); } ; //UNSUPpev_argsExprOneE: // IEEE: part of list_of_arguments - pev_expr at bottom -//UNSUP /*empty*/ { $$ = NULL; } // ,, is legal in list_of_arguments +//UNSUP /*empty*/ { $$ = nullptr; } // ,, is legal in list_of_arguments //UNSUP | pev_expr { $$ = $1; } //UNSUP ; @@ -4371,12 +4372,12 @@ argsDottedList: // IEEE: part of list_of_arguments //UNSUP ; argsDotted: // IEEE: part of list_of_arguments - '.' idAny '(' ')' { $$ = new AstArg($2, *$2, NULL); } + '.' idAny '(' ')' { $$ = new AstArg($2, *$2, nullptr); } | '.' idAny '(' expr ')' { $$ = new AstArg($2, *$2, $4); } ; //UNSUPpev_argsDotted: // IEEE: part of list_of_arguments - pev_expr at bottom -//UNSUP '.' idAny '(' ')' { $$ = new AstArg($2, *$2, NULL); } +//UNSUP '.' idAny '(' ')' { $$ = new AstArg($2, *$2, nullptr); } //UNSUP | '.' idAny '(' pev_expr ')' { $$ = new AstArg($2, *$2, $4); } //UNSUP ; @@ -4638,15 +4639,15 @@ tableEntryList: // IEEE: { combinational_entry | sequential_entry } tableEntry: // IEEE: combinational_entry + sequential_entry yaTABLELINE { $$ = new AstUdpTableLine($1,*$1); } - | error { $$ = NULL; } + | error { $$ = nullptr; } ; //************************************************ // Specify specify_block: // ==IEEE: specify_block - ySPECIFY specifyJunkList yENDSPECIFY { $$ = NULL; } - | ySPECIFY yENDSPECIFY { $$ = NULL; } + ySPECIFY specifyJunkList yENDSPECIFY { $$ = nullptr; } + | ySPECIFY yENDSPECIFY { $$ = nullptr; } ; specifyJunkList: @@ -4661,7 +4662,7 @@ specifyJunk: ; specparam_declaration: // ==IEEE: specparam_declaration - ySPECPARAM junkToSemiList ';' { $$ = NULL; } + ySPECPARAM junkToSemiList ';' { $$ = nullptr; } ; junkToSemiList: @@ -4784,7 +4785,7 @@ idDottedMoreForeach: // enum_identifier idArrayed: // IEEE: id + select id - { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, NULL, NULL); } + { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, nullptr, nullptr); } // // IEEE: id + part_select_range/constant_part_select_range | idArrayed '[' expr ']' { $$ = new AstSelBit($2, $1, $3); } // Or AstArraySel, don't know yet. | idArrayed '[' constExpr ':' constExpr ']' { $$ = new AstSelExtract($2, $1, $3, $5); } @@ -4795,7 +4796,7 @@ idArrayed: // IEEE: id + select idArrayedForeach: // IEEE: id + select (under foreach expression) id - { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, NULL, NULL); } + { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, nullptr, nullptr); } // // IEEE: id + part_select_range/constant_part_select_range | idArrayed '[' expr ']' { $$ = new AstSelBit($2, $1, $3); } // Or AstArraySel, don't know yet. | idArrayed '[' constExpr ':' constExpr ']' { $$ = new AstSelExtract($2, $1, $3, $5); } @@ -4823,7 +4824,7 @@ strAsInt: ; strAsIntIgnore: // strAsInt, but never matches for when expr shouldn't parse strings - yaSTRING__IGNORE { $$ = NULL; yyerror("Impossible token"); } + yaSTRING__IGNORE { $$ = nullptr; yyerror("Impossible token"); } ; strAsText: @@ -4831,7 +4832,7 @@ strAsText: ; endLabelE: - /* empty */ { $$ = NULL; $$=NULL; } + /* empty */ { $$ = nullptr; $$=nullptr; } | ':' idAny { $$ = $2; $$=$2; } | ':' yNEW__ETC { static string n = "new"; $$ = &n; $$=$2; } ; @@ -4842,7 +4843,7 @@ endLabelE: clocking_declaration: // IEEE: clocking_declaration (INCOMPLETE) //UNSUP: vvv remove this -- vastly simplified grammar: yDEFAULT yCLOCKING '@' '(' senitemEdge ')' ';' yENDCLOCKING - { $$ = new AstClocking($2, $5, NULL); } + { $$ = new AstClocking($2, $5, nullptr); } //UNSUP: ^^^ remove this -- vastly simplified grammar: //UNSUP clockingFront clocking_event ';' //UNSUP clocking_itemListE yENDCLOCKING endLabelE { SYMP->popScope($$); } @@ -4863,7 +4864,7 @@ clocking_declaration: // IEEE: clocking_declaration (INCOMPLETE) //UNSUP ; //UNSUPclocking_itemListE: -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | clocking_itemList { $$ = $1; } //UNSUP ; @@ -4901,7 +4902,7 @@ clocking_declaration: // IEEE: clocking_declaration (INCOMPLETE) //UNSUP ; //UNSUPclocking_skewE: // IEEE: [clocking_skew] -//UNSUP /* empty */ { $$ = NULL;} +//UNSUP /* empty */ { $$ = nullptr;} //UNSUP | clocking_skew { $$ = $1; } //UNSUP ; @@ -4933,7 +4934,7 @@ clocking_declaration: // IEEE: clocking_declaration (INCOMPLETE) assertion_item: // ==IEEE: assertion_item concurrent_assertion_item { $$ = $1; } | deferred_immediate_assertion_item - { $$ = $1 ? new AstAlways($1->fileline(), VAlwaysKwd::ALWAYS_COMB, NULL, $1) : NULL; } + { $$ = $1 ? new AstAlways($1->fileline(), VAlwaysKwd::ALWAYS_COMB, nullptr, $1) : nullptr; } ; deferred_immediate_assertion_item: // ==IEEE: deferred_immediate_assertion_item @@ -4957,12 +4958,12 @@ immediate_assertion_statement: // ==IEEE: immediate_assertion_statement simple_immediate_assertion_statement: // ==IEEE: simple_immediate_assertion_statement // // action_block expanded here, for compatibility with AstAssert - yASSERT '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $3, $5, NULL, true); } - | yASSERT '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $3, NULL, $6, true); } + yASSERT '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $3, $5, nullptr, true); } + | yASSERT '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $3, nullptr, $6, true); } | yASSERT '(' expr ')' stmtBlock yELSE stmtBlock { $$ = new AstAssert($1, $3, $5, $7, true); } // // action_block expanded here, for compatibility with AstAssert - | yASSUME '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $3, $5, NULL, true); } - | yASSUME '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $3, NULL, $6, true); } + | yASSUME '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $3, $5, nullptr, true); } + | yASSUME '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $3, nullptr, $6, true); } | yASSUME '(' expr ')' stmtBlock yELSE stmtBlock { $$ = new AstAssert($1, $3, $5, $7, true); } // // IEEE: simple_immediate_cover_statement | yCOVER '(' expr ')' stmt { $$ = new AstCover($1, $3, $5, true); } @@ -4977,12 +4978,12 @@ final_zero: // IEEE: part of deferred_immediate_assertion_statement deferred_immediate_assertion_statement: // ==IEEE: deferred_immediate_assertion_statement // // IEEE: deferred_immediate_assert_statement - yASSERT final_zero '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $4, $6, NULL, true); } - | yASSERT final_zero '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $4, NULL, $7, true); } + yASSERT final_zero '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $4, $6, nullptr, true); } + | yASSERT final_zero '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $4, nullptr, $7, true); } | yASSERT final_zero '(' expr ')' stmtBlock yELSE stmtBlock { $$ = new AstAssert($1, $4, $6, $8, true); } // // IEEE: deferred_immediate_assume_statement - | yASSUME final_zero '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $4, $6, NULL, true); } - | yASSUME final_zero '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $4, NULL, $7, true); } + | yASSUME final_zero '(' expr ')' stmtBlock %prec prLOWER_THAN_ELSE { $$ = new AstAssert($1, $4, $6, nullptr, true); } + | yASSUME final_zero '(' expr ')' yELSE stmtBlock { $$ = new AstAssert($1, $4, nullptr, $7, true); } | yASSUME final_zero '(' expr ')' stmtBlock yELSE stmtBlock { $$ = new AstAssert($1, $4, $6, $8, true); } // // IEEE: deferred_immediate_cover_statement | yCOVER final_zero '(' expr ')' stmt { $$ = new AstCover($1, $4, $6, true); } @@ -5003,7 +5004,7 @@ concurrent_assertion_item: // IEEE: concurrent_assertion_item concurrent_assertion_statement: // ==IEEE: concurrent_assertion_statement // // IEEE: assert_property_statement //UNSUP remove below: - yASSERT yPROPERTY '(' property_spec ')' elseStmtBlock { $$ = new AstAssert($1, $4, NULL, $6, false); } + yASSERT yPROPERTY '(' property_spec ')' elseStmtBlock { $$ = new AstAssert($1, $4, nullptr, $6, false); } //UNSUP yASSERT yPROPERTY '(' property_spec ')' action_block { } // // IEEE: assume_property_statement //UNSUP yASSUME yPROPERTY '(' property_spec ')' action_block { } @@ -5020,7 +5021,7 @@ concurrent_assertion_statement: // ==IEEE: concurrent_assertion_statement ; elseStmtBlock: // Part of concurrent_assertion_statement - ';' { $$ = NULL; } + ';' { $$ = nullptr; } | yELSE stmtBlock { $$ = $2; } ; @@ -5036,7 +5037,7 @@ elseStmtBlock: // Part of concurrent_assertion_statement //UNSUP ; //UNSUPproperty_port_listE: // IEEE: [ ( [ property_port_list ] ) ] -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | '(' {VARRESET_LIST(""); VARIO("input"); } property_port_list ')' //UNSUP { VARRESET_NONLIST(""); } //UNSUP ; @@ -5073,7 +5074,7 @@ elseStmtBlock: // Part of concurrent_assertion_statement //UNSUP ; //UNSUPproperty_port_itemDirE: -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | yLOCAL__ETC { } //UNSUP | yLOCAL__ETC port_direction { } //UNSUP ; @@ -5138,10 +5139,10 @@ property_spec: // IEEE: property_spec //UNSUP remove below '@' '(' senitemEdge ')' yDISABLE yIFF '(' expr ')' pexpr { $$ = new AstPropClocked($1, $3, $8, $10); } - | '@' '(' senitemEdge ')' pexpr { $$ = new AstPropClocked($1, $3, NULL, $5); } + | '@' '(' senitemEdge ')' pexpr { $$ = new AstPropClocked($1, $3, nullptr, $5); } //UNSUP remove above - | yDISABLE yIFF '(' expr ')' pexpr { $$ = new AstPropClocked($4->fileline(), NULL, $4, $6); } - | pexpr { $$ = new AstPropClocked($1->fileline(), NULL, NULL, $1); } + | yDISABLE yIFF '(' expr ')' pexpr { $$ = new AstPropClocked($4->fileline(), nullptr, $4, $6); } + | pexpr { $$ = new AstPropClocked($1->fileline(), nullptr, nullptr, $1); } ; //UNSUPproperty_statement_spec: // ==IEEE: property_statement_spec @@ -5216,7 +5217,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP: This rule has been super-specialized to what is supported now //UNSUP remove below expr yP_ORMINUSGT pexpr { $$ = new AstLogOr($2, new AstLogNot($2, $1), $3); } - //UNSUP expr yP_OREQGT pexpr { $$ = new AstLogOr($2, new AstLogNot($2, new AstPast($2, $1, NULL)), $3); } // This handles disable iff in the past time step incorrectly + //UNSUP expr yP_OREQGT pexpr { $$ = new AstLogOr($2, new AstLogNot($2, new AstPast($2, $1, nullptr)), $3); } // This handles disable iff in the past time step incorrectly | expr { $$ = $1; } //UNSUP remove above, use below: // @@ -5408,7 +5409,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPcoverage_spec_or_optionListE: // IEEE: [{coverage_spec_or_option}] -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | coverage_spec_or_optionList { $$ = $1; } //UNSUP ; @@ -5422,7 +5423,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP cover_point { $$ = $1; } //UNSUP | cover_cross { $$ = $1; } //UNSUP | coverage_option ';' { $$ = $1; } -//UNSUP | error { $$ = NULL; } +//UNSUP | error { $$ = nullptr; } //UNSUP ; //UNSUPcoverage_option: // ==IEEE: coverage_option @@ -5443,14 +5444,14 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPiffE: // IEEE: part of cover_point, others -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | yIFF '(' expr ')' { } //UNSUP ; //UNSUPbins_or_empty: // ==IEEE: bins_or_empty //UNSUP '{' bins_or_optionsList '}' { $$ = $2; } -//UNSUP | '{' '}' { $$ = NULL; } -//UNSUP | ';' { $$ = NULL; } +//UNSUP | '{' '}' { $$ = nullptr; } +//UNSUP | ';' { $$ = nullptr; } //UNSUP ; //UNSUPbins_or_optionsList: // IEEE: { bins_or_options ';' } @@ -5478,7 +5479,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPbins_orBraE: // IEEE: part of bins_or_options: -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | '[' ']' { } //UNSUP | '[' cgexpr ']' { } //UNSUP ; @@ -5532,7 +5533,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPcross_itemList: // IEEE: part of list_of_cross_items -//UNSUP cross_item { $$ = NULL; } +//UNSUP cross_item { $$ = nullptr; } //UNSUP | cross_itemList ',' cross_item { $$ = AstNode::addNextNull($1, $3); } //UNSUP ; @@ -5541,10 +5542,10 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPcross_body: // ==IEEE: cross_body -//UNSUP '{' '}' { $$ = NULL; } +//UNSUP '{' '}' { $$ = nullptr; } //UNSUP // // IEEE-2012: No semicolon here, mistake in spec //UNSUP | '{' cross_body_itemSemiList '}' { $$ = $1; } -//UNSUP | ';' { $$ = NULL; } +//UNSUP | ';' { $$ = nullptr; } //UNSUP ; //UNSUPcross_body_itemSemiList: // IEEE: part of cross_body @@ -5595,7 +5596,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPcoverage_eventE: // IEEE: [ coverage_event ] -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | clocking_event { $$ = $1; } //UNSUP | yWITH__ETC function idAny/*"sample"*/ '(' tf_port_listE ')' { } //UNSUP | yP_ATAT '(' block_event_expression ')' { } @@ -5667,7 +5668,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPrs_code_block: // ==IEEE: rs_code_block -//UNSUP '{' '}' { $$ = NULL; } +//UNSUP '{' '}' { $$ = nullptr; } //UNSUP | '{' rs_code_blockItemList '}' { $$ = $2; } //UNSUP ; @@ -5740,7 +5741,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP ; //UNSUPchecker_or_generate_itemListE: // IEEE: [{ checker_or_generate_itemList }] -//UNSUP /* empty */ { $$ = NULL; } +//UNSUP /* empty */ { $$ = nullptr; } //UNSUP | checker_or_generate_itemList { $$ = $1; } //UNSUP ; @@ -5772,7 +5773,7 @@ pexpr: // IEEE: property_expr (The name pexpr is important as regexps j //UNSUP | clocking_declaration { $$ = $1; } //UNSUP | yDEFAULT yCLOCKING id/*clocking_identifier*/ ';' { } //UNSUP | yDEFAULT yDISABLE yIFF expr/*expression_or_dist*/ ';' { } -//UNSUP | ';' { $$ = NULL; } +//UNSUP | ';' { $$ = nullptr; } //UNSUP ; //UNSUPchecker_generate_item: // ==IEEE: checker_generate_item @@ -5833,7 +5834,7 @@ classVirtualE: classExtendsE: // IEEE: part of class_declaration // // The classExtendsE rule relys on classFront having the // // new class scope correct via classFront - /* empty */ { $$ = NULL; $$ = NULL; } + /* empty */ { $$ = nullptr; $$ = nullptr; } | yEXTENDS classExtendsList { $$ = $2; $$ = $2; } ; @@ -5858,13 +5859,13 @@ classExtendsOne: // IEEE: part of class_declaration classImplementsE: // IEEE: part of class_declaration // // All 1800-2012 - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | yIMPLEMENTS classImplementsList { $$ = $2; } ; classImplementsList: // IEEE: part of class_declaration // // All 1800-2012 - class_typeExtImpList { $$ = NULL; BBUNSUP($1, "Unsupported: implements class"); } + class_typeExtImpList { $$ = nullptr; BBUNSUP($1, "Unsupported: implements class"); } | classImplementsList ',' class_typeExtImpList { $$ = AstNode::addNextNull($1, $3); } ; @@ -5893,13 +5894,13 @@ class_typeExtImpOne: // part of IEEE: class_type, where we either get a p // // // package_sopeIdFollows expanded | yD_UNIT yP_COLONCOLON - { $$ = new AstClassOrPackageRef($1, "$unit", NULL, NULL); - $$ = NULL; // No purpose otherwise, every symtab can see root + { $$ = new AstClassOrPackageRef($1, "$unit", nullptr, nullptr); + $$ = nullptr; // No purpose otherwise, every symtab can see root SYMP->nextId(PARSEP->rootp()); } // | yLOCAL__COLONCOLON yP_COLONCOLON - { $$ = new AstClassOrPackageRef($1, "local::", NULL, NULL); - $$ = NULL; // UNSUP + { $$ = new AstClassOrPackageRef($1, "local::", nullptr, nullptr); + $$ = nullptr; // UNSUP SYMP->nextId(PARSEP->rootp()); BBUNSUP($1, "Unsupported: Randomize 'local::'"); } ; @@ -5912,7 +5913,7 @@ class_typeExtImpOne: // part of IEEE: class_type, where we either get a p //=== Below rules assume special scoping per above packageClassScopeNoId: // IEEE: [package_scope] not followed by yaID - packageClassScope { $$ = $1; $$ = $1; SYMP->nextId(NULL); } + packageClassScope { $$ = $1; $$ = $1; SYMP->nextId(nullptr); } ; packageClassScopeE: // IEEE: [package_scope] @@ -5920,7 +5921,7 @@ packageClassScopeE: // IEEE: [package_scope] // // if not needed must use packageClassScopeNoId // // TODO: To support classes should return generic type, not packagep // // class_qualifier := [ yLOCAL '::' ] [ implicit_class_handle '.' class_scope ] - /* empty */ { $$ = NULL; $$ = NULL; } + /* empty */ { $$ = nullptr; $$ = nullptr; } | packageClassScope { $$ = $1; $$ = $1; } ; @@ -5956,7 +5957,7 @@ packageClassScopeItem: // IEEE: package_scope or [package_scope]::[class_ idCC /*mid*/ { SYMP->nextId($1); } /*cont*/ yP_COLONCOLON - { $$ = new AstClassOrPackageRef($1, *$1, $1, NULL); $$ = $1; } + { $$ = new AstClassOrPackageRef($1, *$1, $1, nullptr); $$ = $1; } // | idCC parameter_value_assignment /*mid*/ { SYMP->nextId($1); } // Change next *after* we handle parameters, not before @@ -5969,7 +5970,7 @@ dollarUnitNextId: // $unit // // if not needed must use packageClassScopeNoId // // Must call nextId without any additional tokens following yD_UNIT - { $$ = new AstClassOrPackageRef($1, "$unit", GRAMMARP->unitPackage($1), NULL); + { $$ = new AstClassOrPackageRef($1, "$unit", GRAMMARP->unitPackage($1), nullptr); SYMP->nextId(PARSEP->rootp()); } ; @@ -5978,7 +5979,7 @@ localNextId: // local // // if not needed must use packageClassScopeNoId // // Must call nextId without any additional tokens following yLOCAL__COLONCOLON - { $$ = new AstClassOrPackageRef($1, "local::", GRAMMARP->unitPackage($1), NULL); + { $$ = new AstClassOrPackageRef($1, "local::", GRAMMARP->unitPackage($1), nullptr); SYMP->nextId(PARSEP->rootp()); BBUNSUP($1, "Unsupported: Randomize 'local::'"); } ; @@ -5986,7 +5987,7 @@ localNextId: // local //^^^========= class_itemListE: - /* empty */ { $$ = NULL; } + /* empty */ { $$ = nullptr; } | class_itemList { $$ = $1; } ; @@ -6000,14 +6001,14 @@ class_item: // ==IEEE: class_item | class_method { $$ = $1; } | class_constraint { $$ = $1; } // - | class_declaration { $$ = NULL; BBUNSUP($1, "Unsupported: class within class"); } + | class_declaration { $$ = nullptr; BBUNSUP($1, "Unsupported: class within class"); } | timeunits_declaration { $$ = $1; } //UNSUP covergroup_declaration { $$ = $1; } // // local_parameter_declaration under parameter_declaration | parameter_declaration ';' { $$ = $1; BBUNSUP($2, "Unsupported: class parameters"); } // 1800-2009 - | ';' { $$ = NULL; } + | ';' { $$ = nullptr; } // - | error ';' { $$ = NULL; } + | error ';' { $$ = nullptr; } ; class_method: // ==IEEE: class_method @@ -6061,11 +6062,11 @@ class_constraint: // ==IEEE: class_constraint // // IEEE: constraint_declaration // // UNSUP: We have the unsupported warning on the randomize() call, so don't bother on // // constraint blocks. When we support randomize we need to make AST nodes for below rules - constraintStaticE yCONSTRAINT idAny constraint_block { $$ = NULL; /*UNSUP*/ } + constraintStaticE yCONSTRAINT idAny constraint_block { $$ = nullptr; /*UNSUP*/ } // // IEEE: constraint_prototype + constraint_prototype_qualifier - | constraintStaticE yCONSTRAINT idAny ';' { $$ = NULL; } - | yEXTERN constraintStaticE yCONSTRAINT idAny ';' { $$ = NULL; BBUNSUP($1, "Unsupported: extern constraint"); } - | yPURE constraintStaticE yCONSTRAINT idAny ';' { $$ = NULL; BBUNSUP($1, "Unsupported: pure constraint"); } + | constraintStaticE yCONSTRAINT idAny ';' { $$ = nullptr; } + | yEXTERN constraintStaticE yCONSTRAINT idAny ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: extern constraint"); } + | yPURE constraintStaticE yCONSTRAINT idAny ';' { $$ = nullptr; BBUNSUP($1, "Unsupported: pure constraint"); } ; constraint_block: // ==IEEE: constraint_block @@ -6079,7 +6080,7 @@ constraint_block_itemList: // IEEE: { constraint_block_item } constraint_block_item: // ==IEEE: constraint_block_item constraint_expression { $$ = $1; } - | ySOLVE solve_before_list yBEFORE solve_before_list ';' { $$ = NULL; BBUNSUP($2, "Unsupported: solve before"); } + | ySOLVE solve_before_list yBEFORE solve_before_list ';' { $$ = nullptr; BBUNSUP($2, "Unsupported: solve before"); } ; solve_before_list: // ==IEEE: solve_before_list @@ -6100,19 +6101,19 @@ constraint_expressionList: // ==IEEE: { constraint_expression } constraint_expression: // ==IEEE: constraint_expression expr/*expression_or_dist*/ ';' { $$ = $1; } // // 1800-2012: - | ySOFT expr/*expression_or_dist*/ ';' { $$ = NULL; /*UNSUP-no-UVM*/ } + | ySOFT expr/*expression_or_dist*/ ';' { $$ = nullptr; /*UNSUP-no-UVM*/ } // // 1800-2012: // // IEEE: uniqueness_constraint ';' - | yUNIQUE '{' open_range_list '}' { $$ = NULL; /*UNSUP-no-UVM*/ } + | yUNIQUE '{' open_range_list '}' { $$ = nullptr; /*UNSUP-no-UVM*/ } // // IEEE: expr yP_MINUSGT constraint_set // // Conflicts with expr:"expr yP_MINUSGT expr"; rule moved there // - | yIF '(' expr ')' constraint_set %prec prLOWER_THAN_ELSE { $$ = NULL; /*UNSUP-UVM*/ } - | yIF '(' expr ')' constraint_set yELSE constraint_set { $$ = NULL; /*UNSUP-UVM*/ } + | yIF '(' expr ')' constraint_set %prec prLOWER_THAN_ELSE { $$ = nullptr; /*UNSUP-UVM*/ } + | yIF '(' expr ')' constraint_set yELSE constraint_set { $$ = nullptr; /*UNSUP-UVM*/ } // // IEEE says array_identifier here, but dotted accepted in VMM + 1800-2009 - | yFOREACH '(' idClassSelForeach ')' constraint_set { $$ = NULL; /*UNSUP-UVM*/ } + | yFOREACH '(' idClassSelForeach ')' constraint_set { $$ = nullptr; /*UNSUP-UVM*/ } // // soft is 1800-2012 - | yDISABLE ySOFT expr/*constraint_primary*/ ';' { $$ = NULL; /*UNSUP-no-UVM*/ } + | yDISABLE ySOFT expr/*constraint_primary*/ ';' { $$ = nullptr; /*UNSUP-no-UVM*/ } ; constraint_set: // ==IEEE: constraint_set diff --git a/test_regress/t/TestSimulator.h b/test_regress/t/TestSimulator.h index 63d537eff..5d791c6c9 100644 --- a/test_regress/t/TestSimulator.h +++ b/test_regress/t/TestSimulator.h @@ -75,4 +75,4 @@ public: } }; -#define VPI_HANDLE(signal) vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted(signal), NULL); +#define VPI_HANDLE(signal) vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted(signal), nullptr); diff --git a/test_regress/t/TestVpi.h b/test_regress/t/TestVpi.h index 843d65c4c..5e7dc99f4 100644 --- a/test_regress/t/TestVpi.h +++ b/test_regress/t/TestVpi.h @@ -20,14 +20,14 @@ class TestVpiHandle { public: TestVpiHandle() - : m_handle(NULL) + : m_handle(nullptr) , m_free(true) {} TestVpiHandle(vpiHandle h) : m_handle(h) , m_free(true) {} ~TestVpiHandle() { if (m_handle && m_free) { - { vpi_free_object(m_handle); m_handle = NULL; } + { vpi_free_object(m_handle); m_handle = nullptr; } } } operator vpiHandle() const { return m_handle; } diff --git a/test_regress/t/t_clk_2in.cpp b/test_regress/t/t_clk_2in.cpp index a102ec98a..ba601f846 100644 --- a/test_regress/t/t_clk_2in.cpp +++ b/test_regress/t/t_clk_2in.cpp @@ -13,7 +13,7 @@ unsigned int main_time = 0; double sc_time_stamp() { return main_time; } -VM_PREFIX* topp = NULL; +VM_PREFIX* topp = nullptr; void clockit(int clk1, int clk0) { topp->clks = clk1 << 1 | clk0; diff --git a/test_regress/t/t_dpi_arg_inout_type.cpp b/test_regress/t/t_dpi_arg_inout_type.cpp index 04b8165de..147e19595 100644 --- a/test_regress/t/t_dpi_arg_inout_type.cpp +++ b/test_regress/t/t_dpi_arg_inout_type.cpp @@ -159,7 +159,7 @@ void i_shortreal(float* x) { void i_chandle(void** x) { static int n = 0; printf("i_chandle %d\n", n); - if (*x != NULL) stop(); + if (*x != nullptr) stop(); *x = (n % 2) ? reinterpret_cast(&i_chandle) : 0; n++; } @@ -287,7 +287,7 @@ void i_shortreal_t(float* x) { void i_chandle_t(void** x) { static int n = 0; printf("i_chandle_t %d\n", n); - if (*x != NULL) stop(); + if (*x != nullptr) stop(); *x = (n % 2) ? 0 : reinterpret_cast(&i_chandle_t); n++; } @@ -955,16 +955,16 @@ void check_exports() { x_chandle = reinterpret_cast(&e_chandle); x_string = "Good"; } else { - x_chandle = NULL; + x_chandle = nullptr; x_string = "Bye"; } e_chandle(&x_chandle); e_string(&x_string); if ((n % 2) == 0) { - if (x_chandle != NULL) stop(); + if (x_chandle != nullptr) stop(); if (strcmp(x_string, "Hello") != 0) stop(); } else { - if (x_chandle != NULL) stop(); + if (x_chandle != nullptr) stop(); if (strcmp(x_string, "World") != 0) stop(); } @@ -1035,7 +1035,7 @@ void check_exports() { #endif if ((n % 2) == 0) { - x_chandle_t = NULL; + x_chandle_t = nullptr; x_string_t = "Bye"; } else { x_chandle_t = reinterpret_cast(&e_chandle_t); @@ -1044,10 +1044,10 @@ void check_exports() { e_chandle_t(&x_chandle_t); e_string_t(&x_string_t); if ((n % 2) == 0) { - if (x_chandle_t != NULL) stop(); + if (x_chandle_t != nullptr) stop(); if (strcmp(x_string_t, "World") != 0) stop(); } else { - if (x_chandle_t != NULL) stop(); + if (x_chandle_t != nullptr) stop(); if (strcmp(x_string_t, "Hello") != 0) stop(); } diff --git a/test_regress/t/t_dpi_arg_input_type.cpp b/test_regress/t/t_dpi_arg_input_type.cpp index e794bd745..cae552c2b 100644 --- a/test_regress/t/t_dpi_arg_input_type.cpp +++ b/test_regress/t/t_dpi_arg_input_type.cpp @@ -145,7 +145,7 @@ void i_shortreal(float i) { void i_chandle(void* i) { static int n = 0; printf("i_chandle %d\n", n); - if (i != NULL) stop(); + if (i != nullptr) stop(); n++; } @@ -256,7 +256,7 @@ void i_shortreal_t(float i) { void i_chandle_t(void* i) { static int n = 0; printf("i_chandle_t %d\n", n); - if (i != NULL) stop(); + if (i != nullptr) stop(); n++; } @@ -618,7 +618,7 @@ void check_exports() { #ifndef NO_SHORTREAL e_shortreal(1.0f * n + 0.25f); #endif - e_chandle((n % 2) ? reinterpret_cast(&e_chandle) : NULL); + e_chandle((n % 2) ? reinterpret_cast(&e_chandle) : nullptr); e_string((n % 2) ? "World" : "Hello"); e_bit(n % 2); e_logic(!(n % 2)); @@ -645,7 +645,7 @@ void check_exports() { #ifndef NO_SHORTREAL e_shortreal_t(1.0f * (2 * n) + 0.25f); #endif - e_chandle_t((n % 2) ? NULL : reinterpret_cast(&e_chandle_t)); + e_chandle_t((n % 2) ? nullptr : reinterpret_cast(&e_chandle_t)); e_string_t((n % 2) ? "Hello" : "World"); e_bit_t(n % 2); e_logic_t(!(n % 2)); diff --git a/test_regress/t/t_dpi_arg_output_type.cpp b/test_regress/t/t_dpi_arg_output_type.cpp index c257f53ff..af0bbc488 100644 --- a/test_regress/t/t_dpi_arg_output_type.cpp +++ b/test_regress/t/t_dpi_arg_output_type.cpp @@ -131,7 +131,7 @@ void i_shortreal(float* o) { void i_chandle(void** o) { static int n = 0; printf("i_chandle %d\n", n); - *o = (n++ % 2) ? reinterpret_cast(&i_chandle) : NULL; + *o = (n++ % 2) ? reinterpret_cast(&i_chandle) : nullptr; } void i_string(const char** o) { @@ -247,7 +247,7 @@ void i_shortreal_t(float* o) { void i_chandle_t(void** o) { static int n = 0; printf("i_chandle_t %d\n", n); - *o = (n++ % 2) ? reinterpret_cast(&i_chandle) : NULL; + *o = (n++ % 2) ? reinterpret_cast(&i_chandle) : nullptr; } void i_string_t(const char** o) { @@ -707,7 +707,7 @@ void check_exports() { #endif e_chandle(&x_chandle); - if (x_chandle != NULL) stop(); + if (x_chandle != nullptr) stop(); e_string(&x_string); if ((n % 2) == 0) { @@ -768,7 +768,7 @@ void check_exports() { #endif e_chandle_t(&x_chandle_t); - if (x_chandle_t != NULL) stop(); + if (x_chandle_t != nullptr) stop(); e_string_t(&x_string_t); if ((n % 2) == 0) { diff --git a/test_regress/t/t_dpi_export_c.cpp b/test_regress/t/t_dpi_export_c.cpp index 297a6edc1..6f2ed9011 100644 --- a/test_regress/t/t_dpi_export_c.cpp +++ b/test_regress/t/t_dpi_export_c.cpp @@ -79,7 +79,7 @@ extern "C" { } #define CHECK_RESULT_NNULL(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = %p EXP = !NULL\n", __FILE__, __LINE__, (got)); \ + printf("%%Error: %s:%d: GOT = %p EXP = !nullptr\n", __FILE__, __LINE__, (got)); \ return __LINE__; \ } diff --git a/test_regress/t/t_dpi_export_context_bad.cpp b/test_regress/t/t_dpi_export_context_bad.cpp index a4bad53d4..7f0a9f4b3 100644 --- a/test_regress/t/t_dpi_export_context_bad.cpp +++ b/test_regress/t/t_dpi_export_context_bad.cpp @@ -33,7 +33,7 @@ unsigned int main_time = 0; double sc_time_stamp() { return main_time; } -VM_PREFIX* topp = NULL; +VM_PREFIX* topp = nullptr; int main(int argc, char* argv[]) { topp = new VM_PREFIX; diff --git a/test_regress/t/t_dpi_qw_c.cpp b/test_regress/t/t_dpi_qw_c.cpp index 802f87991..5db3dbe8f 100644 --- a/test_regress/t/t_dpi_qw_c.cpp +++ b/test_regress/t/t_dpi_qw_c.cpp @@ -33,7 +33,7 @@ void poke_value(int i) { #endif svScope scope = svGetScopeFromName("top.t.a"); - if (scope == NULL) { + if (scope == nullptr) { printf("%%Error: null scope for top.t.a\n"); return; } diff --git a/test_regress/t/t_dpi_result_type.cpp b/test_regress/t/t_dpi_result_type.cpp index 2f5bbe7f5..1c0ff11ec 100644 --- a/test_regress/t/t_dpi_result_type.cpp +++ b/test_regress/t/t_dpi_result_type.cpp @@ -108,7 +108,7 @@ float i_shortreal() { void* i_chandle() { static int n = 0; printf("i_chandle %d\n", n); - return (n++ % 2) ? reinterpret_cast(&i_chandle) : NULL; + return (n++ % 2) ? reinterpret_cast(&i_chandle) : nullptr; } const char* i_string() { @@ -205,7 +205,7 @@ float i_shortreal_t() { void* i_chandle_t() { static int n = 0; printf("i_chandle_t %d\n", n); - return (n++ % 2) ? reinterpret_cast(&i_chandle) : NULL; + return (n++ % 2) ? reinterpret_cast(&i_chandle) : nullptr; } const char* i_string_t() { @@ -299,7 +299,7 @@ void check_exports() { #ifndef NO_SHORTREAL if (e_shortreal() != 1.0f * n + 0.25f) stop(); #endif - if (e_chandle() != NULL) stop(); + if (e_chandle() != nullptr) stop(); if ((n % 2) == 0) { if (strcmp(e_string(), "Hello") != 0) stop(); } else { @@ -323,7 +323,7 @@ void check_exports() { #ifndef NO_SHORTREAL if (e_shortreal_t() != 1.0f * (2 * n) + 0.25f) stop(); #endif - if (e_chandle_t() != NULL) stop(); + if (e_chandle_t() != nullptr) stop(); if ((n % 2) == 0) { if (strcmp(e_string_t(), "Hello") != 0) stop(); } else { diff --git a/test_regress/t/t_dpi_vams.cpp b/test_regress/t/t_dpi_vams.cpp index a7473f174..2a0b44465 100644 --- a/test_regress/t/t_dpi_vams.cpp +++ b/test_regress/t/t_dpi_vams.cpp @@ -36,7 +36,7 @@ unsigned int main_time = 0; double sc_time_stamp() { return main_time; } -VM_PREFIX* topp = NULL; +VM_PREFIX* topp = nullptr; int main(int argc, char* argv[]) { topp = new VM_PREFIX; diff --git a/test_regress/t/t_dpi_var.cpp b/test_regress/t/t_dpi_var.cpp index dad42dcc1..bf6fc0658 100644 --- a/test_regress/t/t_dpi_var.cpp +++ b/test_regress/t/t_dpi_var.cpp @@ -20,8 +20,8 @@ struct MyMon { vluint32_t* sigsp[2]; MyMon() { - sigsp[0] = NULL; - sigsp[1] = NULL; + sigsp[0] = nullptr; + sigsp[1] = nullptr; } }; MyMon mons[2]; diff --git a/test_regress/t/t_embed1_c.cpp b/test_regress/t/t_embed1_c.cpp index ff9cf19ca..8feeea826 100644 --- a/test_regress/t/t_embed1_c.cpp +++ b/test_regress/t/t_embed1_c.cpp @@ -46,7 +46,7 @@ Vt_embed1_child* __get_modelp() { svScope scope = svGetScope(); if (!scope) { vl_fatal(__FILE__, __LINE__, __FILE__, "svGetScope failed"); - return NULL; + return nullptr; } void* __modelp = svGetUserData(scope, &T_Embed_Child_Unique); diff --git a/test_regress/t/t_flag_fi.cpp b/test_regress/t/t_flag_fi.cpp index afad2c751..4c0a89ed1 100644 --- a/test_regress/t/t_flag_fi.cpp +++ b/test_regress/t/t_flag_fi.cpp @@ -15,7 +15,7 @@ unsigned int main_time = 0; double sc_time_stamp() { return main_time; } -VM_PREFIX* topp = NULL; +VM_PREFIX* topp = nullptr; bool gotit = false; void myfunction() { gotit = true; } diff --git a/test_regress/t/t_mem_multi_io2.cpp b/test_regress/t/t_mem_multi_io2.cpp index ea00ec3e6..6598388cf 100644 --- a/test_regress/t/t_mem_multi_io2.cpp +++ b/test_regress/t/t_mem_multi_io2.cpp @@ -6,7 +6,7 @@ #include VM_PREFIX_INCLUDE -VM_PREFIX* tb = NULL; +VM_PREFIX* tb = nullptr; bool pass = true; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_mem_multi_io3.cpp b/test_regress/t/t_mem_multi_io3.cpp index 6191d051d..9068af3f9 100644 --- a/test_regress/t/t_mem_multi_io3.cpp +++ b/test_regress/t/t_mem_multi_io3.cpp @@ -6,7 +6,7 @@ #include VM_PREFIX_INCLUDE -VM_PREFIX* tb = NULL; +VM_PREFIX* tb = nullptr; bool pass = true; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_order_quad.cpp b/test_regress/t/t_order_quad.cpp index fb9da0545..89773b790 100644 --- a/test_regress/t/t_order_quad.cpp +++ b/test_regress/t/t_order_quad.cpp @@ -15,7 +15,7 @@ unsigned int main_time = 0; double sc_time_stamp() { return main_time; } -VM_PREFIX* topp = NULL; +VM_PREFIX* topp = nullptr; bool fail = false; void check(QData got, QData exp) { diff --git a/test_regress/t/t_sc_names.cpp b/test_regress/t/t_sc_names.cpp index 13316602e..00a7503f4 100644 --- a/test_regress/t/t_sc_names.cpp +++ b/test_regress/t/t_sc_names.cpp @@ -6,7 +6,7 @@ #include VM_PREFIX_INCLUDE #include "Vt_sc_names.h" -VM_PREFIX* tb = NULL; +VM_PREFIX* tb = nullptr; int sc_main(int argc, char* argv[]) { tb = new VM_PREFIX("tb"); diff --git a/test_regress/t/t_scope_map.cpp b/test_regress/t/t_scope_map.cpp index 65fcd125a..082fa53bc 100644 --- a/test_regress/t/t_scope_map.cpp +++ b/test_regress/t/t_scope_map.cpp @@ -43,7 +43,7 @@ int main(int argc, char** argv, char** env) { it->second->scopeDump(); #endif VerilatedVarNameMap* varNameMap = it->second->varsp(); - if (varNameMap == NULL) { + if (varNameMap == nullptr) { VL_PRINTF("%%Error: Bad varsp()\n"); return -1; } @@ -119,7 +119,7 @@ int main(int argc, char** argv, char** env) { for (VerilatedScopeNameMap::const_iterator it = scopeMapp->begin(); it != scopeMapp->end(); ++it) { VerilatedVarNameMap* varNameMap = it->second->varsp(); - if (varNameMap == NULL) { + if (varNameMap == nullptr) { VL_PRINTF("%%Error: Bad varsp()\n"); return -1; } diff --git a/test_regress/t/t_time_vpi_c.cpp b/test_regress/t/t_time_vpi_c.cpp index da3eb7f98..c693fd2f0 100644 --- a/test_regress/t/t_time_vpi_c.cpp +++ b/test_regress/t/t_time_vpi_c.cpp @@ -53,7 +53,7 @@ void show(vpiHandle obj) { void dpii_check() { show(0); - vpiHandle mod = vpi_handle_by_name((PLI_BYTE8*)"top.t", NULL); + vpiHandle mod = vpi_handle_by_name((PLI_BYTE8*)"top.t", nullptr); if (!mod) { vpi_printf(const_cast("-- Cannot vpi_find module\n")); } else { diff --git a/test_regress/t/t_timescale_parse.cpp b/test_regress/t/t_timescale_parse.cpp index c77eebde1..eb9fcc18a 100644 --- a/test_regress/t/t_timescale_parse.cpp +++ b/test_regress/t/t_timescale_parse.cpp @@ -5,7 +5,7 @@ #include "Vt_timescale_parse.h" -VM_PREFIX* tb = NULL; +VM_PREFIX* tb = nullptr; double sc_time_stamp() { return 2 * 1e9; // e.g. 2 seconds in ns units diff --git a/test_regress/t/t_tri_gate.cpp b/test_regress/t/t_tri_gate.cpp index 8a6cce86a..6b1c881a6 100644 --- a/test_regress/t/t_tri_gate.cpp +++ b/test_regress/t/t_tri_gate.cpp @@ -6,7 +6,7 @@ #include VM_PREFIX_INCLUDE -VM_PREFIX* tb = NULL; +VM_PREFIX* tb = nullptr; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_tri_inout.cpp b/test_regress/t/t_tri_inout.cpp index c9c591cb7..a60dd6123 100644 --- a/test_regress/t/t_tri_inout.cpp +++ b/test_regress/t/t_tri_inout.cpp @@ -6,7 +6,7 @@ #include "Vt_tri_inout.h" -Vt_tri_inout* tb = NULL; +Vt_tri_inout* tb = nullptr; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_tri_inz.cpp b/test_regress/t/t_tri_inz.cpp index a2674bda5..d5b173b73 100644 --- a/test_regress/t/t_tri_inz.cpp +++ b/test_regress/t/t_tri_inz.cpp @@ -5,7 +5,7 @@ #include "Vt_tri_inz.h" -Vt_tri_inz* tb = NULL; +Vt_tri_inz* tb = nullptr; bool pass = true; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_tri_pullup.cpp b/test_regress/t/t_tri_pullup.cpp index 4906ed218..bc7f901cf 100644 --- a/test_regress/t/t_tri_pullup.cpp +++ b/test_regress/t/t_tri_pullup.cpp @@ -6,7 +6,7 @@ #include "Vt_tri_pullup.h" -Vt_tri_pullup* tb = NULL; +Vt_tri_pullup* tb = nullptr; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_tri_select.cpp b/test_regress/t/t_tri_select.cpp index 6e76584e9..083a0c668 100644 --- a/test_regress/t/t_tri_select.cpp +++ b/test_regress/t/t_tri_select.cpp @@ -5,7 +5,7 @@ #include "Vt_tri_select.h" -Vt_tri_select* tb = NULL; +Vt_tri_select* tb = nullptr; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_var_pinsizes.cpp b/test_regress/t/t_var_pinsizes.cpp index 3b74de365..32624893c 100644 --- a/test_regress/t/t_var_pinsizes.cpp +++ b/test_regress/t/t_var_pinsizes.cpp @@ -5,7 +5,7 @@ #include VM_PREFIX_INCLUDE -VM_PREFIX* tb = NULL; +VM_PREFIX* tb = nullptr; double sc_time_stamp() { return 0; } diff --git a/test_regress/t/t_vpi_get.cpp b/test_regress/t/t_vpi_get.cpp index 9a18662f6..178c84c5b 100644 --- a/test_regress/t/t_vpi_get.cpp +++ b/test_regress/t/t_vpi_get.cpp @@ -52,7 +52,7 @@ unsigned int main_time = 0; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", FILENM, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", FILENM, __LINE__); \ return __LINE__; \ } @@ -168,7 +168,7 @@ int mon_check_props() { {"testout", {24, vpiOutput, 0, vpiPort}, {0, 0, 0, 0}}, {"sub.subin", {1, vpiInput, 1, vpiPort}, {0, 0, 0, 0}}, {"sub.subout", {1, vpiOutput, 1, vpiPort}, {0, 0, 0, 0}}, - {NULL, {0, 0, 0, 0}, {0, 0, 0, 0}}}; + {nullptr, {0, 0, 0, 0}, {0, 0, 0, 0}}}; struct params* value = values; while (value->signal) { TestVpiHandle h = VPI_HANDLE(value->signal); @@ -211,7 +211,7 @@ static int mon_check_vpi() { vpi_value.format = vpiIntVal; vpi_value.value.integer = mon_check(); - vpi_put_value(href, &vpi_value, NULL, vpiNoDelay); + vpi_put_value(href, &vpi_value, nullptr, vpiNoDelay); return 0; } diff --git a/test_regress/t/t_vpi_memory.cpp b/test_regress/t/t_vpi_memory.cpp index 60891c5a6..01cf2a65c 100644 --- a/test_regress/t/t_vpi_memory.cpp +++ b/test_regress/t/t_vpi_memory.cpp @@ -52,7 +52,7 @@ unsigned int main_time = 0; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", FILENM, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", FILENM, __LINE__); \ return __LINE__; \ } @@ -116,7 +116,7 @@ int _mon_check_memory() { s_vpi_error_info e; vpi_printf((PLI_BYTE8*)"Check memory vpi ...\n"); - mem_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted("mem0"), NULL); + mem_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted("mem0"), nullptr); CHECK_RESULT_NZ(mem_h); // check type int vpitype = vpi_get(vpiType, mem_h); @@ -127,7 +127,7 @@ int _mon_check_memory() { cnt = 0; while ((lcl_h = vpi_scan(iter_h))) { value.value.integer = ++cnt; - vpi_put_value(lcl_h, &value, NULL, vpiNoDelay); + vpi_put_value(lcl_h, &value, nullptr, vpiNoDelay); // check size and range if (int status = _mon_check_range(lcl_h, 32, 31, 0)) return status; } @@ -176,7 +176,7 @@ int _mon_check_memory() { CHECK_RESULT(value.value.integer, 1); // check writing to vpiConstant - vpi_put_value(side_h, &value, NULL, vpiNoDelay); + vpi_put_value(side_h, &value, nullptr, vpiNoDelay); CHECK_RESULT_NZ(vpi_chk_error(&e)); return 0; // Ok @@ -198,7 +198,7 @@ static int mon_check_vpi() { vpi_value.format = vpiIntVal; vpi_value.value.integer = mon_check(); - vpi_put_value(href, &vpi_value, NULL, vpiNoDelay); + vpi_put_value(href, &vpi_value, nullptr, vpiNoDelay); return 0; } diff --git a/test_regress/t/t_vpi_module.cpp b/test_regress/t/t_vpi_module.cpp index abbb9fc8a..2283c55ca 100644 --- a/test_regress/t/t_vpi_module.cpp +++ b/test_regress/t/t_vpi_module.cpp @@ -44,7 +44,7 @@ unsigned int main_time = 0; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", FILENM, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", FILENM, __LINE__); \ return __LINE__; \ } @@ -57,7 +57,7 @@ unsigned int main_time = 0; extern "C" { int mon_check() { - vpiHandle it = vpi_iterate(vpiModule, NULL); + vpiHandle it = vpi_iterate(vpiModule, nullptr); CHECK_RESULT_NZ(it); vpiHandle topmod = vpi_scan(it); @@ -104,7 +104,7 @@ static int mon_check_vpi() { vpi_value.format = vpiIntVal; vpi_value.value.integer = mon_check(); - vpi_put_value(href, &vpi_value, NULL, vpiNoDelay); + vpi_put_value(href, &vpi_value, nullptr, vpiNoDelay); return 0; } diff --git a/test_regress/t/t_vpi_param.cpp b/test_regress/t/t_vpi_param.cpp index f2b5f4e10..108725ab6 100644 --- a/test_regress/t/t_vpi_param.cpp +++ b/test_regress/t/t_vpi_param.cpp @@ -52,7 +52,7 @@ unsigned int main_time = 0; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", FILENM, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", FILENM, __LINE__); \ return __LINE__; \ } @@ -91,7 +91,7 @@ int check_param_int(std::string name, PLI_INT32 format, int exp_value, bool verb const char* p; vpi_printf((PLI_BYTE8*)"Check parameter %s vpi ...\n", name.c_str()); - param_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted(name.c_str()), NULL); + param_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted(name.c_str()), nullptr); CHECK_RESULT_NZ(param_h); vpi_type = vpi_get(vpiType, param_h); CHECK_RESULT(vpi_type, vpiParameter); @@ -111,7 +111,7 @@ int check_param_int(std::string name, PLI_INT32 format, int exp_value, bool verb // values if (verbose) {vpi_printf((PLI_BYTE8*)" Try writing value to %s ...\n", name.c_str()); } value.value.integer = exp_value; - vpi_put_value(param_h, &value, NULL, vpiNoDelay); + vpi_put_value(param_h, &value, nullptr, vpiNoDelay); CHECK_RESULT_NZ(vpi_chk_error(&e)); if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } @@ -135,7 +135,7 @@ int check_param_str(std::string name, PLI_INT32 format, std::string exp_value, b const char* p; vpi_printf((PLI_BYTE8*)"Check parameter %s vpi ...\n", name.c_str()); - param_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted(name.c_str()), NULL); + param_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted(name.c_str()), nullptr); CHECK_RESULT_NZ(param_h); vpi_type = vpi_get(vpiType, param_h); CHECK_RESULT(vpi_type, vpiParameter); @@ -155,7 +155,7 @@ int check_param_str(std::string name, PLI_INT32 format, std::string exp_value, b // values if (verbose) {vpi_printf((PLI_BYTE8*)" Try writing value to %s ...\n", name.c_str()); } value.value.str = (PLI_BYTE8*) exp_value.c_str(); - vpi_put_value(param_h, &value, NULL, vpiNoDelay); + vpi_put_value(param_h, &value, nullptr, vpiNoDelay); CHECK_RESULT_NZ(vpi_chk_error(&e)); if (verbose && vpi_chk_error(&e)) {vpi_printf((PLI_BYTE8*)" vpi_chk_error: %s\n", e.message); } @@ -200,7 +200,7 @@ static int mon_check_vpi() { vpi_value.format = vpiIntVal; vpi_value.value.integer = mon_check(); - vpi_put_value(href, &vpi_value, NULL, vpiNoDelay); + vpi_put_value(href, &vpi_value, nullptr, vpiNoDelay); return 0; } diff --git a/test_regress/t/t_vpi_sc.cpp b/test_regress/t/t_vpi_sc.cpp index e6be1c64b..6cdf5adf9 100644 --- a/test_regress/t/t_vpi_sc.cpp +++ b/test_regress/t/t_vpi_sc.cpp @@ -5,7 +5,7 @@ #include "Vt_vpi_sc.h" -VM_PREFIX* tb = NULL; +VM_PREFIX* tb = nullptr; int sc_main(int argc, char* argv[]) { tb = new VM_PREFIX("tb"); diff --git a/test_regress/t/t_vpi_time_cb.cpp b/test_regress/t/t_vpi_time_cb.cpp index 110f0a160..39caa4513 100644 --- a/test_regress/t/t_vpi_time_cb.cpp +++ b/test_regress/t/t_vpi_time_cb.cpp @@ -53,7 +53,7 @@ unsigned int callback_count_start_of_sim = 0; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", __FILE__, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", __FILE__, __LINE__); \ return __LINE__; \ } diff --git a/test_regress/t/t_vpi_unimpl.cpp b/test_regress/t/t_vpi_unimpl.cpp index 63ce3f507..e2bac0a88 100644 --- a/test_regress/t/t_vpi_unimpl.cpp +++ b/test_regress/t/t_vpi_unimpl.cpp @@ -41,7 +41,7 @@ unsigned int callback_count = 0; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", FILENM, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", FILENM, __LINE__); \ return __LINE__; \ } @@ -81,7 +81,7 @@ int _mon_check_unimpl(p_cb_data cb_data) { } else { // setup and install static t_cb_data cb_data; - clk_h = vpi_handle_by_name((PLI_BYTE8*)"t.clk", NULL); + clk_h = vpi_handle_by_name((PLI_BYTE8*)"t.clk", nullptr); cb_data.reason = cbPLIError; cb_data.cb_rtn = _mon_check_unimpl; // this function @@ -90,60 +90,60 @@ int _mon_check_unimpl(p_cb_data cb_data) { CHECK_RESULT_NZ(cb); // now exercise unimplemented fns - vpi_get_cb_info(cb, NULL); + vpi_get_cb_info(cb, nullptr); CHECK_RESULT(callback_count, 1); - vpi_register_systf(NULL); + vpi_register_systf(nullptr); CHECK_RESULT(callback_count, 2); - vpi_get_systf_info(NULL, NULL); + vpi_get_systf_info(nullptr, nullptr); CHECK_RESULT(callback_count, 3); - vpi_handle_multi(0, NULL, NULL); + vpi_handle_multi(0, nullptr, nullptr); CHECK_RESULT(callback_count, 4); - vpi_get64(0, NULL); + vpi_get64(0, nullptr); CHECK_RESULT(callback_count, 5); - vpi_get_delays(NULL, NULL); + vpi_get_delays(nullptr, nullptr); CHECK_RESULT(callback_count, 6); - vpi_put_delays(NULL, NULL); + vpi_put_delays(nullptr, nullptr); CHECK_RESULT(callback_count, 7); - vpi_get_value_array(NULL, NULL, NULL, 0); + vpi_get_value_array(nullptr, nullptr, nullptr, 0); CHECK_RESULT(callback_count, 8); - vpi_put_value_array(NULL, NULL, NULL, 0); + vpi_put_value_array(nullptr, nullptr, nullptr, 0); CHECK_RESULT(callback_count, 9); - vpi_get_time(NULL, NULL); + vpi_get_time(nullptr, nullptr); CHECK_RESULT(callback_count, 10); vpi_mcd_name(0); CHECK_RESULT(callback_count, 11); - vpi_compare_objects(NULL, NULL); + vpi_compare_objects(nullptr, nullptr); CHECK_RESULT(callback_count, 12); - vpi_get_data(0, NULL, 0); + vpi_get_data(0, nullptr, 0); CHECK_RESULT(callback_count, 13); - vpi_put_data(0, NULL, 0); + vpi_put_data(0, nullptr, 0); CHECK_RESULT(callback_count, 14); - vpi_get_userdata(NULL); + vpi_get_userdata(nullptr); CHECK_RESULT(callback_count, 15); - vpi_put_userdata(NULL, NULL); + vpi_put_userdata(nullptr, nullptr); CHECK_RESULT(callback_count, 16); - vpi_handle_by_multi_index(NULL, 0, NULL); + vpi_handle_by_multi_index(nullptr, 0, nullptr); CHECK_RESULT(callback_count, 17); vpi_control(0); CHECK_RESULT(callback_count, 18); s_vpi_time time_s; time_s.type = 0; - vpi_get_time(NULL, &time_s); + vpi_get_time(nullptr, &time_s); CHECK_RESULT(callback_count, 19); - handle = vpi_put_value(NULL, NULL, NULL, 0); + handle = vpi_put_value(nullptr, nullptr, nullptr, 0); CHECK_RESULT(callback_count, 20); CHECK_RESULT(handle, 0); - handle = vpi_handle(0, NULL); + handle = vpi_handle(0, nullptr); CHECK_RESULT(callback_count, 21); CHECK_RESULT(handle, 0); - vpi_iterate(0, NULL); + vpi_iterate(0, nullptr); CHECK_RESULT(callback_count, 22); - handle = vpi_register_cb(NULL); + handle = vpi_register_cb(nullptr); CHECK_RESULT(callback_count, 23); CHECK_RESULT(handle, 0); s_cb_data cb_data_s; @@ -157,7 +157,7 @@ int _mon_check_unimpl(p_cb_data cb_data) { int mon_check() { // Callback from initial block in monitor - if (int status = _mon_check_unimpl(NULL)) return status; + if (int status = _mon_check_unimpl(nullptr)) return status; return 0; // Ok } diff --git a/test_regress/t/t_vpi_var.cpp b/test_regress/t/t_vpi_var.cpp index 0b067dab6..63b66efb4 100644 --- a/test_regress/t/t_vpi_var.cpp +++ b/test_regress/t/t_vpi_var.cpp @@ -57,7 +57,7 @@ unsigned int callback_count_strs_max = 500; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", FILENM, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", FILENM, __LINE__); \ return __LINE__; \ } @@ -79,7 +79,7 @@ unsigned int callback_count_strs_max = 500; #define CHECK_RESULT_CSTR(got, exp) \ if (strcmp((got), (exp))) { \ printf("%%Error: %s:%d: GOT = '%s' EXP = '%s'\n", FILENM, __LINE__, \ - ((got) != NULL) ? (got) : "", ((exp) != NULL) ? (exp) : ""); \ + ((got) != nullptr) ? (got) : "", ((exp) != nullptr) ? (exp) : ""); \ return __LINE__; \ } @@ -129,8 +129,8 @@ int _mon_check_callbacks() { cb_data.reason = cbEndOfSimulation; cb_data.cb_rtn = _mon_check_callbacks_error; cb_data.user_data = 0; - cb_data.value = NULL; - cb_data.time = NULL; + cb_data.value = nullptr; + cb_data.time = nullptr; vpiHandle vh = vpi_register_cb(&cb_data); CHECK_RESULT_NZ(vh); @@ -184,7 +184,7 @@ int _mon_check_value_callbacks() { cb_data.cb_rtn = _value_callback; cb_data.obj = vh1; cb_data.value = &v; - cb_data.time = NULL; + cb_data.time = nullptr; vpiHandle vh = vpi_register_cb(&cb_data); CHECK_RESULT_NZ(vh); @@ -223,7 +223,7 @@ int _mon_check_var() { TestVpiHandle vh1 = VPI_HANDLE("onebit"); CHECK_RESULT_NZ(vh1); - TestVpiHandle vh2 = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::top(), NULL); + TestVpiHandle vh2 = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::top(), nullptr); CHECK_RESULT_NZ(vh2); // scope attributes @@ -527,7 +527,7 @@ int _mon_check_putget_str(p_cb_data cb_data) { for (int i = 1; i <= 128; i++) { char buf[32]; snprintf(buf, sizeof(buf), TestSimulator::rooted("arr[%d].arr"), i); - CHECK_RESULT_NZ(data[i].scope = vpi_handle_by_name((PLI_BYTE8*)buf, NULL)); + CHECK_RESULT_NZ(data[i].scope = vpi_handle_by_name((PLI_BYTE8*)buf, nullptr)); CHECK_RESULT_NZ(data[i].sig = vpi_handle_by_name((PLI_BYTE8*)"sig", data[i].scope)); CHECK_RESULT_NZ(data[i].rfr = vpi_handle_by_name((PLI_BYTE8*)"rfr", data[i].scope)); CHECK_RESULT_NZ(data[i].check @@ -544,7 +544,7 @@ int _mon_check_putget_str(p_cb_data cb_data) { cb_data.cb_rtn = _mon_check_putget_str; // this function cb_data.obj = count_h; cb_data.value = &v; - cb_data.time = NULL; + cb_data.time = nullptr; v.format = vpiIntVal; cb = vpi_register_cb(&cb_data); @@ -578,7 +578,7 @@ int mon_check() { if (int status = _mon_check_getput()) return status; if (int status = _mon_check_quad()) return status; if (int status = _mon_check_string()) return status; - if (int status = _mon_check_putget_str(NULL)) return status; + if (int status = _mon_check_putget_str(nullptr)) return status; if (int status = _mon_check_vlog_info()) return status; #ifndef IS_VPI VerilatedVpi::selfTest(); @@ -596,7 +596,7 @@ static int mon_check_vpi() { vpi_value.format = vpiIntVal; vpi_value.value.integer = mon_check(); - vpi_put_value(href, &vpi_value, NULL, vpiNoDelay); + vpi_put_value(href, &vpi_value, nullptr, vpiNoDelay); return 0; } diff --git a/test_regress/t/t_vpi_zero_time_cb.cpp b/test_regress/t/t_vpi_zero_time_cb.cpp index a553bec45..b740cabc2 100644 --- a/test_regress/t/t_vpi_zero_time_cb.cpp +++ b/test_regress/t/t_vpi_zero_time_cb.cpp @@ -52,7 +52,7 @@ unsigned int callback_count_start_of_sim = 0; #define CHECK_RESULT_NZ(got) \ if (!(got)) { \ - printf("%%Error: %s:%d: GOT = NULL EXP = !NULL\n", __FILE__, __LINE__); \ + printf("%%Error: %s:%d: GOT = nullptr EXP = !nullptr\n", __FILE__, __LINE__); \ return __LINE__; \ }