Use C++11 for loops, from clang-migrate. No functional change intended

This commit is contained in:
Wilson Snyder 2020-11-10 22:10:38 -05:00
parent 44eb362a18
commit 79d33bf1ee
39 changed files with 152 additions and 199 deletions

View File

@ -846,9 +846,7 @@ bool AstSenTree::hasCombo() const {
void AstTypeTable::clearCache() { void AstTypeTable::clearCache() {
// When we mass-change widthMin in V3WidthCommit, we need to correct the table. // 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 // Just clear out the maps; the search functions will be used to rebuild the map
for (int i = 0; i < static_cast<int>(AstBasicDTypeKwd::_ENUM_MAX); ++i) { for (auto& itr : m_basicps) itr = nullptr;
m_basicps[i] = nullptr;
}
m_detailedMap.clear(); m_detailedMap.clear();
// Clear generic()'s so dead detection will work // Clear generic()'s so dead detection will work
for (AstNode* nodep = typesp(); nodep; nodep = nodep->nextp()) { for (AstNode* nodep = typesp(); nodep; nodep = nodep->nextp()) {
@ -1176,12 +1174,12 @@ void AstInitArray::dump(std::ostream& str) const {
this->AstNode::dump(str); this->AstNode::dump(str);
int n = 0; int n = 0;
const AstInitArray::KeyItemMap& mapr = map(); const AstInitArray::KeyItemMap& mapr = map();
for (AstInitArray::KeyItemMap::const_iterator it = mapr.begin(); it != mapr.end(); ++it) { for (const auto& itr : mapr) {
if (n++ > 5) { if (n++ > 5) {
str << " ..."; str << " ...";
break; break;
} }
str << " [" << it->first << "]=" << (void*)it->second; str << " [" << itr.first << "]=" << (void*)itr.second;
} }
} }
void AstJumpGo::dump(std::ostream& str) const { void AstJumpGo::dump(std::ostream& str) const {
@ -1406,8 +1404,8 @@ void AstTypeTable::dump(std::ostream& str) const {
} }
{ {
const DetailedMap& mapr = m_detailedMap; const DetailedMap& mapr = m_detailedMap;
for (DetailedMap::const_iterator it = mapr.begin(); it != mapr.end(); ++it) { for (const auto& itr : mapr) {
AstBasicDType* dtypep = it->second; AstBasicDType* dtypep = itr.second;
str << endl; // Newline from caller, so newline first str << endl; // Newline from caller, so newline first
str << "\t\tdetailed -> "; str << "\t\tdetailed -> ";
dtypep->dump(str); dtypep->dump(str);

View File

@ -486,7 +486,7 @@ private:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
explicit CaseVisitor(AstNetlist* nodep) { explicit CaseVisitor(AstNetlist* nodep) {
for (uint32_t i = 0; i < (1UL << CASE_OVERLAP_WIDTH); ++i) m_valueItem[i] = nullptr; for (auto& itr : m_valueItem) itr = nullptr;
iterate(nodep); iterate(nodep);
} }
virtual ~CaseVisitor() override { virtual ~CaseVisitor() override {

View File

@ -587,15 +587,15 @@ private:
// Convert list of senses into one sense node // Convert list of senses into one sense node
AstSenTree* senoutp = nullptr; AstSenTree* senoutp = nullptr;
bool senedited = false; bool senedited = false;
for (SenSet::iterator it = senouts.begin(); it != senouts.end(); ++it) { for (const auto& itr : senouts) {
if (!senoutp) { if (!senoutp) {
senoutp = *it; senoutp = itr;
} else { } else {
if (!senedited) { if (!senedited) {
senedited = true; senedited = true;
senoutp = senoutp->cloneTree(true); senoutp = senoutp->cloneTree(true);
} }
senoutp->addSensesp((*it)->sensesp()->cloneTree(true)); senoutp->addSensesp(itr->sensesp()->cloneTree(true));
} }
} }
// If multiple domains need to do complicated optimizations // If multiple domains need to do complicated optimizations

View File

@ -203,8 +203,8 @@ private:
} }
#endif #endif
void walkEmptyFuncs() { void walkEmptyFuncs() {
for (V3Hashed::iterator it = m_hashed.begin(); it != m_hashed.end(); ++it) { for (const auto& itr : m_hashed) {
AstNode* node1p = it->second; AstNode* node1p = itr.second;
AstCFunc* oldfuncp = VN_CAST(node1p, CFunc); AstCFunc* oldfuncp = VN_CAST(node1p, CFunc);
if (oldfuncp && oldfuncp->emptyBody() && !oldfuncp->dontCombine()) { if (oldfuncp && oldfuncp->emptyBody() && !oldfuncp->dontCombine()) {
UINFO(5, " EmptyFunc " << std::hex << V3Hash(oldfuncp->user4p()) << " " UINFO(5, " EmptyFunc " << std::hex << V3Hash(oldfuncp->user4p()) << " "

View File

@ -282,15 +282,9 @@ public:
} }
void update(const V3ConfigFile& file) { void update(const V3ConfigFile& file) {
// Copy in all Attributes // Copy in all Attributes
for (LineAttrMap::const_iterator it = file.m_lineAttrs.begin(); for (const auto& itr : file.m_lineAttrs) { m_lineAttrs[itr.first] |= itr.second; }
it != file.m_lineAttrs.end(); ++it) {
m_lineAttrs[it->first] |= it->second;
}
// Copy in all ignores // Copy in all ignores
for (IgnLines::const_iterator it = file.m_ignLines.begin(); it != file.m_ignLines.end(); for (const auto& ignLine : file.m_ignLines) m_ignLines.insert(ignLine);
++it) {
m_ignLines.insert(*it);
}
// Update the iterator after the list has changed // Update the iterator after the list has changed
m_lastIgnore.it = m_ignLines.begin(); m_lastIgnore.it = m_ignLines.begin();
m_waivers.reserve(m_waivers.size() + file.m_waivers.size()); m_waivers.reserve(m_waivers.size() + file.m_waivers.size());
@ -338,9 +332,9 @@ public:
} }
} }
bool waive(V3ErrorCode code, const string& match) { bool waive(V3ErrorCode code, const string& match) {
for (Waivers::const_iterator it = m_waivers.begin(); it != m_waivers.end(); ++it) { for (const auto& itr : m_waivers) {
if (((it->first == code) || (it->first == V3ErrorCode::I_LINT)) if (((itr.first == code) || (itr.first == V3ErrorCode::I_LINT))
&& VString::wildmatch(match, it->second)) { && VString::wildmatch(match, itr.second)) {
return true; return true;
} }
} }

View File

@ -188,15 +188,15 @@ private:
const LinenoSet& lines = m_handleLines[state.m_handle]; const LinenoSet& lines = m_handleLines[state.m_handle];
int first = 0; int first = 0;
int last = 0; int last = 0;
for (LinenoSet::iterator it = lines.begin(); it != lines.end(); ++it) { for (int linen : lines) {
if (!first) { if (!first) {
first = last = *it; first = last = linen;
} else if (*it == last + 1) { } else if (linen == last + 1) {
++last; ++last;
} else { } else {
if (!out.empty()) out += ","; if (!out.empty()) out += ",";
out += linesFirstLast(first, last); out += linesFirstLast(first, last);
first = last = *it; first = last = linen;
} }
} }
if (first) { if (first) {

View File

@ -367,14 +367,13 @@ private:
void deadCheckClasses() { void deadCheckClasses() {
for (bool retry = true; retry;) { for (bool retry = true; retry;) {
retry = false; retry = false;
for (std::vector<AstClass*>::iterator it = m_classesp.begin(); it != m_classesp.end(); for (auto& itr : m_classesp) {
++it) { if (AstClass* nodep = itr) { // nullptr if deleted earlier
if (AstClass* nodep = *it) { // nullptr if deleted earlier
if (nodep->user1() == 0) { if (nodep->user1() == 0) {
if (nodep->extendsp()) nodep->extendsp()->user1Inc(-1); if (nodep->extendsp()) nodep->extendsp()->user1Inc(-1);
if (nodep->packagep()) nodep->packagep()->user1Inc(-1); if (nodep->packagep()) nodep->packagep()->user1Inc(-1);
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
*it = nullptr; itr = nullptr;
retry = true; retry = true;
} }
} }

View File

@ -1294,8 +1294,8 @@ public:
// Returns the number of elements in set_a that don't appear in set_b // Returns the number of elements in set_a that don't appear in set_b
static int diffs(const MTaskIdSet& set_a, const MTaskIdSet& set_b) { static int diffs(const MTaskIdSet& set_a, const MTaskIdSet& set_b) {
int diffs = 0; int diffs = 0;
for (MTaskIdSet::iterator it = set_a.begin(); it != set_a.end(); ++it) { for (int i : set_a) {
if (set_b.find(*it) == set_b.end()) ++diffs; if (set_b.find(i) == set_b.end()) ++diffs;
} }
return diffs; return diffs;
} }
@ -1731,10 +1731,9 @@ class EmitCImp : EmitCStmts {
puts("}\n"); puts("}\n");
} }
const AstInitArray::KeyItemMap& mapr = initarp->map(); const AstInitArray::KeyItemMap& mapr = initarp->map();
for (AstInitArray::KeyItemMap::const_iterator it = mapr.begin(); it != mapr.end(); for (const auto& itr : mapr) {
++it) { AstNode* valuep = itr.second->valuep();
AstNode* valuep = it->second->valuep(); emitSetVarConstant(varp->nameProtect() + "[" + cvtToStr(itr.first) + "]",
emitSetVarConstant(varp->nameProtect() + "[" + cvtToStr(it->first) + "]",
VN_CAST(valuep, Const)); VN_CAST(valuep, Const));
} }
} else { } else {
@ -2902,8 +2901,8 @@ void EmitCStmts::emitVarSort(const VarSortMap& vmap, VarVec* sortedp) {
if (!v3Global.opt.mtasks()) { if (!v3Global.opt.mtasks()) {
// Plain old serial mode. Sort by size, from small to large, // Plain old serial mode. Sort by size, from small to large,
// to optimize for both packing and small offsets in code. // to optimize for both packing and small offsets in code.
for (VarSortMap::const_iterator it = vmap.begin(); it != vmap.end(); ++it) { for (const auto& itr : vmap) {
for (VarVec::const_iterator jt = it->second.begin(); jt != it->second.end(); ++jt) { for (VarVec::const_iterator jt = itr.second.begin(); jt != itr.second.end(); ++jt) {
sortedp->push_back(*jt); sortedp->push_back(*jt);
} }
} }

View File

@ -71,8 +71,8 @@ class CMakeEmitter {
// Swap all backslashes for forward slashes, because of Windows // Swap all backslashes for forward slashes, because of Windows
static string deslash(const string& s) { static string deslash(const string& s) {
std::string res = s; std::string res = s;
for (string::iterator it = res.begin(); it != res.end(); ++it) { for (char& c : res) {
if (*it == '\\') *it = '/'; if (c == '\\') c = '/';
} }
return res; return res;
} }
@ -243,9 +243,9 @@ class CMakeEmitter {
*of << "verilate(${TOP_TARGET_NAME} PREFIX " << v3Global.opt.prefix() << " TOP_MODULE " *of << "verilate(${TOP_TARGET_NAME} PREFIX " << v3Global.opt.prefix() << " TOP_MODULE "
<< v3Global.rootp()->topModulep()->name() << " DIRECTORY " << v3Global.rootp()->topModulep()->name() << " DIRECTORY "
<< deslash(v3Global.opt.makeDir()) << " SOURCES "; << deslash(v3Global.opt.makeDir()) << " SOURCES ";
for (V3HierBlockPlan::const_iterator it = planp->begin(); it != planp->end(); ++it) { for (const auto& itr : *planp) {
*of << " " *of << " "
<< deslash(v3Global.opt.makeDir() + "/" + it->second->hierWrapper(true)); << deslash(v3Global.opt.makeDir() + "/" + itr.second->hierWrapper(true));
} }
*of << " " << deslash(cmake_list(v3Global.opt.vFiles())); *of << " " << deslash(cmake_list(v3Global.opt.vFiles()));
*of << " VERILATOR_ARGS "; *of << " VERILATOR_ARGS ";

View File

@ -398,8 +398,8 @@ void EmitCSyms::emitSymHdr() {
if (v3Global.dpi()) { if (v3Global.dpi()) {
puts("\n// DPI TYPES for DPI Export callbacks (Internal use)\n"); puts("\n// DPI TYPES for DPI Export callbacks (Internal use)\n");
std::map<const string, int> types; // Remove duplicates and sort std::map<const string, int> types; // Remove duplicates and sort
for (ScopeFuncs::iterator it = m_scopeFuncs.begin(); it != m_scopeFuncs.end(); ++it) { for (const auto& itr : m_scopeFuncs) {
AstCFunc* funcp = it->second.m_cfuncp; AstCFunc* funcp = itr.second.m_cfuncp;
if (funcp->dpiExport()) { if (funcp->dpiExport()) {
string cbtype = protect(v3Global.opt.prefix() + "__Vcb_" + funcp->cname() + "_t"); string cbtype = protect(v3Global.opt.prefix() + "__Vcb_" + funcp->cname() + "_t");
types["typedef void (*" + cbtype + ") (" + cFuncArgs(funcp) + ");\n"] = 1; types["typedef void (*" + cbtype + ") (" + cFuncArgs(funcp) + ");\n"] = 1;
@ -455,8 +455,8 @@ void EmitCSyms::emitSymHdr() {
if (!m_scopeNames.empty()) { // Scope names if (!m_scopeNames.empty()) { // Scope names
puts("\n// SCOPE NAMES\n"); puts("\n// SCOPE NAMES\n");
for (ScopeNames::iterator it = m_scopeNames.begin(); it != m_scopeNames.end(); ++it) { for (const auto& itr : m_scopeNames) {
puts("VerilatedScope " + protect("__Vscope_" + it->second.m_symName) + ";\n"); puts("VerilatedScope " + protect("__Vscope_" + itr.second.m_symName) + ";\n");
} }
} }

View File

@ -362,10 +362,7 @@ class EmitMkHierVerilation {
of.puts(v3Global.opt.prefix() of.puts(v3Global.opt.prefix()
+ ".mk: $(VM_HIER_INPUT_FILES) $(VM_HIER_VERILOG_LIBS) "); + ".mk: $(VM_HIER_INPUT_FILES) $(VM_HIER_VERILOG_LIBS) ");
of.puts(V3Os::filenameNonDir(argsFile) + " "); of.puts(V3Os::filenameNonDir(argsFile) + " ");
for (V3HierBlockPlan::const_iterator it = m_planp->begin(); it != m_planp->end(); for (const auto& itr : *m_planp) of.puts(itr.second->hierWrapper(true) + " ");
++it) {
of.puts(it->second->hierWrapper(true) + " ");
}
of.puts("\n"); of.puts("\n");
emitLaunchVerilator(of, argsFile); emitLaunchVerilator(of, argsFile);
} }

View File

@ -493,11 +493,11 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
putfs(nodep, "'{"); putfs(nodep, "'{");
int comma = 0; int comma = 0;
const AstInitArray::KeyItemMap& mapr = nodep->map(); const AstInitArray::KeyItemMap& mapr = nodep->map();
for (AstInitArray::KeyItemMap::const_iterator it = mapr.begin(); it != mapr.end(); ++it) { for (const auto& itr : mapr) {
if (comma++) putbs(", "); if (comma++) putbs(", ");
puts(cvtToStr(it->first)); puts(cvtToStr(itr.first));
puts(":"); puts(":");
AstNode* valuep = it->second->valuep(); AstNode* valuep = itr.second->valuep();
iterate(valuep); iterate(valuep);
} }
puts("}"); puts("}");

View File

@ -172,9 +172,8 @@ inline void V3FileDependImp::writeDepend(const string& filename) {
inline std::vector<string> V3FileDependImp::getAllDeps() const { inline std::vector<string> V3FileDependImp::getAllDeps() const {
std::vector<string> r; std::vector<string> r;
for (std::set<DependFile>::const_iterator iter = m_filenameList.begin(); for (const auto& itr : m_filenameList) {
iter != m_filenameList.end(); ++iter) { if (!itr.target() && itr.exists()) r.push_back(itr.filename());
if (!iter->target() && iter->exists()) { r.push_back(iter->filename()); }
} }
return r; return r;
} }
@ -942,8 +941,8 @@ void V3OutCFile::putsGuard() {
UASSERT(!m_guard, "Already called putsGuard in emit file"); UASSERT(!m_guard, "Already called putsGuard in emit file");
m_guard = true; m_guard = true;
string var = VString::upcase(string("_") + V3Os::filenameNonDir(filename()) + "_"); string var = VString::upcase(string("_") + V3Os::filenameNonDir(filename()) + "_");
for (string::iterator pos = var.begin(); pos != var.end(); ++pos) { for (char& c : var) {
if (!isalnum(*pos)) *pos = '_'; if (!isalnum(c)) c = '_';
} }
puts("\n#ifndef " + var + "\n"); puts("\n#ifndef " + var + "\n");
puts("#define " + var + " // guard\n"); puts("#define " + var + " // guard\n");
@ -1046,8 +1045,8 @@ public:
"IPTION: Verilator output: XML representation of netlist -->\n"); "IPTION: Verilator output: XML representation of netlist -->\n");
of.puts("<verilator_id_map>\n"); of.puts("<verilator_id_map>\n");
{ {
for (IdMap::const_iterator it = m_nameMap.begin(); it != m_nameMap.end(); ++it) { for (const auto& itr : m_nameMap) {
of.puts("<map from=\"" + it->second + "\" to=\"" + it->first + "\"/>\n"); of.puts("<map from=\"" + itr.second + "\" to=\"" + itr.first + "\"/>\n");
} }
} }
of.puts("</verilator_id_map>\n"); of.puts("</verilator_id_map>\n");

View File

@ -1002,8 +1002,8 @@ public:
void check() { void check() {
m_hashed.check(); m_hashed.check();
for (V3Hashed::HashMmap::iterator it = m_hashed.begin(); it != m_hashed.end(); ++it) { for (const auto& itr : m_hashed) {
AstNode* nodep = it->second; AstNode* nodep = itr.second;
AstNode* activep = nodep->user3p(); AstNode* activep = nodep->user3p();
AstNode* condVarp = nodep->user5p(); AstNode* condVarp = nodep->user5p();
if (!isReplaced(nodep)) { if (!isReplaced(nodep)) {

View File

@ -143,9 +143,7 @@ private:
} }
OrigEdgeList* oEListp = static_cast<OrigEdgeList*>(toEdgep->userp()); OrigEdgeList* oEListp = static_cast<OrigEdgeList*>(toEdgep->userp());
if (OrigEdgeList* addListp = static_cast<OrigEdgeList*>(addEdgep->userp())) { if (OrigEdgeList* addListp = static_cast<OrigEdgeList*>(addEdgep->userp())) {
for (OrigEdgeList::iterator it = addListp->begin(); it != addListp->end(); ++it) { for (const auto& itr : *addListp) oEListp->push_back(itr);
oEListp->push_back(*it);
}
addListp->clear(); // Done with it addListp->clear(); // Done with it
} else { } else {
oEListp->push_back(addEdgep); oEListp->push_back(addEdgep);
@ -160,8 +158,7 @@ private:
v3fatalSrc("No original edge associated with cutting edge " << breakEdgep << endl); v3fatalSrc("No original edge associated with cutting edge " << breakEdgep << endl);
} }
// The breakGraph edge may represent multiple real edges; cut them all // The breakGraph edge may represent multiple real edges; cut them all
for (OrigEdgeList::iterator it = oEListp->begin(); it != oEListp->end(); ++it) { for (const auto& origEdgep : *oEListp) {
V3GraphEdge* origEdgep = *it;
origEdgep->cut(); origEdgep->cut();
UINFO(8, UINFO(8,
" " << why << " " << origEdgep->fromp() << " ->" << origEdgep->top() << endl); " " << why << " " << origEdgep->fromp() << " ->" << origEdgep->top() << endl);

View File

@ -317,9 +317,8 @@ private:
} }
// Foreach input state (NFA inputs of this DFA state) // Foreach input state (NFA inputs of this DFA state)
for (std::set<int>::const_iterator inIt = inputs.begin(); inIt != inputs.end(); for (int inIt : inputs) {
++inIt) { DfaInput input = inIt;
DfaInput input = *inIt;
UINFO(9, " ===" << ++i << "=======================\n"); UINFO(9, " ===" << ++i << "=======================\n");
UINFO(9, " On input " << cvtToHex(input.toNodep()) << endl); UINFO(9, " On input " << cvtToHex(input.toNodep()) << endl);

View File

@ -42,7 +42,7 @@ struct GraphPCNode {
// CONSTRUCTORS // CONSTRUCTORS
GraphPCNode() { GraphPCNode() {
for (int w = 0; w < GraphWay::NUM_WAYS; w++) m_cp[w] = 0; for (unsigned int& w : m_cp) w = 0;
} }
~GraphPCNode() {} ~GraphPCNode() {}
}; };

View File

@ -139,8 +139,8 @@ void V3Hashed::erase(iterator it) {
} }
void V3Hashed::check() { void V3Hashed::check() {
for (HashMmap::iterator it = begin(); it != end(); ++it) { for (const auto& itr : *this) {
AstNode* nodep = it->second; AstNode* nodep = itr.second;
UASSERT_OBJ(nodep->user4p(), nodep, "V3Hashed check failed, non-hashed node"); UASSERT_OBJ(nodep->user4p(), nodep, "V3Hashed check failed, non-hashed node");
} }
} }
@ -179,15 +179,15 @@ void V3Hashed::dumpFile(const string& filename, bool tree) {
} }
*logp << "\n*** Dump:\n" << endl; *logp << "\n*** Dump:\n" << endl;
for (HashMmap::iterator it = begin(); it != end(); ++it) { for (const auto& itr : *this) {
if (lasthash != it->first) { if (lasthash != itr.first) {
lasthash = it->first; lasthash = itr.first;
*logp << " " << it->first << endl; *logp << " " << itr.first << endl;
} }
*logp << "\t" << it->second << endl; *logp << "\t" << itr.second << endl;
// Dumping the entire tree may make nearly N^2 sized dumps, // Dumping the entire tree may make nearly N^2 sized dumps,
// because the nodes under this one may also be in the hash table! // because the nodes under this one may also be in the hash table!
if (tree) it->second->dumpTree(*logp, " "); if (tree) itr.second->dumpTree(*logp, " ");
} }
} }

View File

@ -107,9 +107,8 @@ static void V3HierWriteCommonInputs(const V3HierBlock* hblockp, std::ostream* of
V3HierBlock::StrGParams V3HierBlock::stringifyParams(const GParams& gparams, bool forGOption) { V3HierBlock::StrGParams V3HierBlock::stringifyParams(const GParams& gparams, bool forGOption) {
StrGParams strParams; StrGParams strParams;
for (V3HierBlock::GParams::const_iterator gparamIt = gparams.begin(); for (const auto& gparam : gparams) {
gparamIt != gparams.end(); ++gparamIt) { if (const AstConst* constp = VN_CAST(gparam->valuep(), Const)) {
if (const AstConst* constp = VN_CAST((*gparamIt)->valuep(), Const)) {
string s; string s;
// Only constant parameter needs to be set to -G because already checked in // Only constant parameter needs to be set to -G because already checked in
// V3Param.cpp. See also ParamVisitor::checkSupportedParam() in the file. // V3Param.cpp. See also ParamVisitor::checkSupportedParam() in the file.
@ -131,7 +130,7 @@ V3HierBlock::StrGParams V3HierBlock::stringifyParams(const GParams& gparams, boo
s = constp->num().ascii(true, true); s = constp->num().ascii(true, true);
s = VString::quoteAny(s, '\'', '\\'); s = VString::quoteAny(s, '\'', '\\');
} }
strParams.push_back(std::make_pair((*gparamIt)->name(), s)); strParams.push_back(std::make_pair(gparam->name(), s));
} }
} }
return strParams; return strParams;
@ -139,9 +138,8 @@ V3HierBlock::StrGParams V3HierBlock::stringifyParams(const GParams& gparams, boo
V3HierBlock::~V3HierBlock() { V3HierBlock::~V3HierBlock() {
UASSERT(m_children.empty(), "at least one module must be a leaf"); UASSERT(m_children.empty(), "at least one module must be a leaf");
for (HierBlockSet::const_iterator child = m_children.begin(); child != m_children.end(); for (const auto& hierblockp : m_children) {
++child) { const bool deleted = hierblockp->m_children.erase(this);
const bool deleted = (*child)->m_children.erase(this);
UASSERT_OBJ(deleted, m_modp, " is not registered"); UASSERT_OBJ(deleted, m_modp, " is not registered");
} }
} }
@ -214,9 +212,8 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const {
*of << "--cc\n"; *of << "--cc\n";
if (!forCMake) { if (!forCMake) {
for (V3HierBlock::HierBlockSet::const_iterator child = m_children.begin(); for (const auto& hierblockp : m_children) {
child != m_children.end(); ++child) { *of << v3Global.opt.makeDir() << "/" << hierblockp->hierWrapper(true) << "\n";
*of << v3Global.opt.makeDir() << "/" << (*child)->hierWrapper(true) << "\n";
} }
*of << "-Mdir " << v3Global.opt.makeDir() << "/" << hierPrefix() << " \n"; *of << "-Mdir " << v3Global.opt.makeDir() << "/" << hierPrefix() << " \n";
} }
@ -224,10 +221,7 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const {
const V3StringList& commandOpts = commandArgs(false); const V3StringList& commandOpts = commandArgs(false);
for (const string& opt : commandOpts) *of << opt << "\n"; for (const string& opt : commandOpts) *of << opt << "\n";
*of << hierBlockArgs().front() << "\n"; *of << hierBlockArgs().front() << "\n";
for (HierBlockSet::const_iterator child = m_children.begin(); child != m_children.end(); for (const auto& hierblockp : m_children) *of << hierblockp->hierBlockArgs().front() << "\n";
++child) {
*of << (*child)->hierBlockArgs().front() << "\n";
}
// Hierarchical blocks should not use multi-threading, // Hierarchical blocks should not use multi-threading,
// but needs to be thread safe when top is multi-threaded. // but needs to be thread safe when top is multi-threaded.
if (v3Global.opt.threads() > 0) { *of << "--threads 1\n"; } if (v3Global.opt.threads() > 0) { *of << "--threads 1\n"; }

View File

@ -172,9 +172,8 @@ public:
} }
} }
void dump() { void dump() {
for (VarNameMap::iterator it = m_modVarNameMap.begin(); it != m_modVarNameMap.end(); for (const auto& itr : m_modVarNameMap) {
++it) { cout << "-namemap: " << itr.first << " -> " << itr.second << endl;
cout << "-namemap: " << it->first << " -> " << it->second << endl;
} }
} }

View File

@ -186,8 +186,8 @@ private:
return true; return true;
} }
void squashAssignposts() { void squashAssignposts() {
for (PostLocMap::iterator it = m_assignposts.begin(); it != m_assignposts.end(); ++it) { for (auto& itr : m_assignposts) {
LifePostLocation* app = &it->second; LifePostLocation* app = &itr.second;
AstVarRef* lhsp = VN_CAST(app->nodep->lhsp(), VarRef); // original var AstVarRef* lhsp = VN_CAST(app->nodep->lhsp(), VarRef); // original var
AstVarRef* rhsp = VN_CAST(app->nodep->rhsp(), VarRef); // dly var AstVarRef* rhsp = VN_CAST(app->nodep->rhsp(), VarRef); // dly var
AstVarScope* dlyVarp = rhsp->varScopep(); AstVarScope* dlyVarp = rhsp->varScopep();

View File

@ -1726,9 +1726,9 @@ public:
}; };
void LinkDotState::computeIfaceModSyms() { void LinkDotState::computeIfaceModSyms() {
for (IfaceModSyms::iterator it = m_ifaceModSyms.begin(); it != m_ifaceModSyms.end(); ++it) { for (const auto& itr : m_ifaceModSyms) {
AstIface* nodep = it->first; AstIface* nodep = itr.first;
VSymEnt* symp = it->second; VSymEnt* symp = itr.second;
LinkDotIfaceVisitor(nodep, symp, this); LinkDotIfaceVisitor(nodep, symp, this);
} }
m_ifaceModSyms.clear(); m_ifaceModSyms.clear();

View File

@ -89,9 +89,9 @@ void V3LinkLevel::timescaling(const ModVec& mods) {
AstNodeModule* modTimedp = nullptr; AstNodeModule* modTimedp = nullptr;
VTimescale unit(VTimescale::NONE); VTimescale unit(VTimescale::NONE);
// Use highest level module as default unit - already sorted in proper order // Use highest level module as default unit - already sorted in proper order
for (ModVec::const_iterator it = mods.begin(); it != mods.end(); ++it) { for (const auto& modp : mods) {
if (!modTimedp && !(*it)->timeunit().isNone()) { if (!modTimedp && !modp->timeunit().isNone()) {
modTimedp = *it; modTimedp = modp;
unit = modTimedp->timeunit(); unit = modTimedp->timeunit();
break; break;
} }

View File

@ -392,8 +392,7 @@ string V3Options::allArgsString() const {
// Delete some options for Verilation of the hierarchical blocks. // Delete some options for Verilation of the hierarchical blocks.
string V3Options::allArgsStringForHierBlock(bool forTop) const { string V3Options::allArgsStringForHierBlock(bool forTop) const {
std::set<string> vFiles; std::set<string> vFiles;
for (V3StringList::const_iterator it = m_vFiles.begin(); it != m_vFiles.end(); ++it) for (const auto& vFile : m_vFiles) vFiles.insert(vFile);
vFiles.insert(*it);
string out; string out;
for (std::list<string>::const_iterator it = m_impp->m_allArgs.begin(); for (std::list<string>::const_iterator it = m_impp->m_allArgs.begin();
it != m_impp->m_allArgs.end(); ++it) { it != m_impp->m_allArgs.end(); ++it) {

View File

@ -153,9 +153,7 @@ public:
OrderMoveVertex* vertexp); // Mark one vertex as finished, remove from ready list if done OrderMoveVertex* vertexp); // Mark one vertex as finished, remove from ready list if done
// STATIC MEMBERS (for lookup) // STATIC MEMBERS (for lookup)
static void clear() { static void clear() {
for (DomScopeMap::iterator it = s_dsMap.begin(); it != s_dsMap.end(); ++it) { for (const auto& itr : s_dsMap) delete itr.second;
delete it->second;
}
s_dsMap.clear(); s_dsMap.clear();
} }
V3List<OrderMoveVertex*>& readyVertices() { return m_readyVertices; } V3List<OrderMoveVertex*>& readyVertices() { return m_readyVertices; }
@ -219,7 +217,7 @@ public:
// CONSTRUCTORS // CONSTRUCTORS
OrderUser() { OrderUser() {
for (int i = 0; i < WV_MAX; i++) m_vertexp[i] = nullptr; for (auto& vertexp : m_vertexp) vertexp = nullptr;
} }
~OrderUser() {} ~OrderUser() {}
}; };

View File

@ -119,10 +119,11 @@ class ParameterizedHierBlocks {
public: public:
ParameterizedHierBlocks(const V3HierBlockOptSet& hierOpts, AstNetlist* nodep) { ParameterizedHierBlocks(const V3HierBlockOptSet& hierOpts, AstNetlist* nodep) {
for (V3HierBlockOptSet::const_iterator it = hierOpts.begin(); it != hierOpts.end(); ++it) { for (const auto& hierOpt : hierOpts) {
m_hierBlockOptsByOrigName.insert(std::make_pair(it->second.origName(), &it->second)); m_hierBlockOptsByOrigName.insert(
const V3HierarchicalBlockOption::ParamStrMap& params = it->second.params(); std::make_pair(hierOpt.second.origName(), &hierOpt.second));
ParamConstMap& consts = m_params[&it->second]; const V3HierarchicalBlockOption::ParamStrMap& params = hierOpt.second.params();
ParamConstMap& consts = m_params[&hierOpt.second];
for (V3HierarchicalBlockOption::ParamStrMap::const_iterator pIt = params.begin(); for (V3HierarchicalBlockOption::ParamStrMap::const_iterator pIt = params.begin();
pIt != params.end(); ++pIt) { pIt != params.end(); ++pIt) {
AstConst* constp = AstConst::parseParamLiteral( AstConst* constp = AstConst::parseParamLiteral(
@ -141,10 +142,7 @@ public:
} }
~ParameterizedHierBlocks() { ~ParameterizedHierBlocks() {
for (ParamsMap::const_iterator it = m_params.begin(); it != m_params.end(); ++it) { for (ParamsMap::const_iterator it = m_params.begin(); it != m_params.end(); ++it) {
for (ParamConstMap::const_iterator pIt = it->second.begin(); pIt != it->second.end(); for (const auto& pItr : it->second) { delete pItr.second; }
++pIt) {
delete pIt->second;
}
} }
} }
AstNodeModule* findByParams(const string& origName, AstPin* firstPinp, AstNodeModule* findByParams(const string& origName, AstPin* firstPinp,

View File

@ -49,13 +49,9 @@ int V3ParseSym::s_anonNum = 0;
// Parser constructor // Parser constructor
V3ParseImp::~V3ParseImp() { V3ParseImp::~V3ParseImp() {
for (std::deque<string*>::iterator it = m_stringps.begin(); it != m_stringps.end(); ++it) { for (auto& itr : m_stringps) VL_DO_DANGLING(delete itr, itr);
VL_DO_DANGLING(delete *it, *it);
}
m_stringps.clear(); m_stringps.clear();
for (std::deque<V3Number*>::iterator it = m_numberps.begin(); it != m_numberps.end(); ++it) { for (auto& itr : m_numberps) VL_DO_DANGLING(delete itr, itr);
VL_DO_DANGLING(delete *it, *it);
}
m_numberps.clear(); m_numberps.clear();
lexDestroy(); lexDestroy();
parserClear(); parserClear();
@ -252,11 +248,10 @@ void V3ParseImp::preprocDumps(std::ostream& os) {
V3PreShell::dumpDefines(os); V3PreShell::dumpDefines(os);
} else { } else {
bool noblanks = v3Global.opt.preprocOnly() && v3Global.opt.preprocNoLine(); bool noblanks = v3Global.opt.preprocOnly() && v3Global.opt.preprocNoLine();
for (std::deque<string>::iterator it = m_ppBuffers.begin(); it != m_ppBuffers.end(); for (auto& buf : m_ppBuffers) {
++it) {
if (noblanks) { if (noblanks) {
bool blank = true; bool blank = true;
for (string::iterator its = it->begin(); its != it->end(); ++its) { for (string::iterator its = buf.begin(); its != buf.end(); ++its) {
if (!isspace(*its) && *its != '\n') { if (!isspace(*its) && *its != '\n') {
blank = false; blank = false;
break; break;
@ -264,7 +259,7 @@ void V3ParseImp::preprocDumps(std::ostream& os) {
} }
if (blank) continue; if (blank) continue;
} }
os << *it; os << buf;
} }
} }
} }

View File

@ -308,7 +308,7 @@ private:
// Generate a pseudo-random graph // Generate a pseudo-random graph
vluint64_t rngState[2] = {0x12345678ULL, 0x9abcdef0ULL}; vluint64_t rngState[2] = {0x12345678ULL, 0x9abcdef0ULL};
// Create 50 vertices // Create 50 vertices
for (unsigned i = 0; i < 50; ++i) m_vx[i] = new V3GraphVertex(&m_graph); for (auto& i : m_vx) i = new V3GraphVertex(&m_graph);
// Create 250 edges at random. Edges must go from // Create 250 edges at random. Edges must go from
// lower-to-higher index vertices, so we get a DAG. // lower-to-higher index vertices, so we get a DAG.
for (unsigned i = 0; i < 250; ++i) { for (unsigned i = 0; i < 250; ++i) {
@ -328,10 +328,8 @@ private:
// Seed the propagator with every input node; // Seed the propagator with every input node;
// This should result in the complete graph getting all CP's assigned. // This should result in the complete graph getting all CP's assigned.
for (unsigned i = 0; i < 50; ++i) { for (const auto& i : m_vx) {
if (!m_vx[i]->inBeginp()) { if (!i->inBeginp()) prop.cpHasIncreased(i, 1 /* inclusive CP starts at 1 */);
prop.cpHasIncreased(m_vx[i], 1 /* inclusive CP starts at 1 */);
}
} }
// Run the propagator. // Run the propagator.
@ -451,7 +449,7 @@ public:
// CONSTRUCTORS // CONSTRUCTORS
LogicMTask(V3Graph* graphp, MTaskMoveVertex* mtmvVxp) LogicMTask(V3Graph* graphp, MTaskMoveVertex* mtmvVxp)
: AbstractLogicMTask{graphp} { : AbstractLogicMTask{graphp} {
for (int i = 0; i < GraphWay::NUM_WAYS; ++i) m_critPathCost[i] = 0; for (unsigned int& i : m_critPathCost) i = 0;
if (mtmvVxp) { // Else null for test if (mtmvVxp) { // Else null for test
m_vertices.push_back(mtmvVxp); m_vertices.push_back(mtmvVxp);
if (OrderLogicVertex* olvp = mtmvVxp->logicp()) { if (OrderLogicVertex* olvp = mtmvVxp->logicp()) {

View File

@ -1549,8 +1549,8 @@ int V3PreProcImp::getFinalToken(string& buf) {
} }
} }
// Track newlines in prep for next token // Track newlines in prep for next token
for (string::iterator cp = buf.begin(); cp != buf.end(); ++cp) { for (char& c : buf) {
if (*cp == '\n') { if (c == '\n') {
m_finAtBol = true; m_finAtBol = true;
m_finFilelinep->linenoInc(); m_finFilelinep->linenoInc();
} else { } else {

View File

@ -65,10 +65,9 @@ private:
VL_DEBUG_FUNC; // Declare debug() VL_DEBUG_FUNC; // Declare debug()
void cleanupVarRefs() { void cleanupVarRefs() {
for (VarRefScopeSet::iterator it = m_varRefScopes.begin(); it != m_varRefScopes.end(); for (const auto& itr : m_varRefScopes) {
++it) { AstVarRef* nodep = itr.first;
AstVarRef* nodep = it->first; AstScope* scopep = itr.second;
AstScope* scopep = it->second;
if (nodep->packagep() && !nodep->varp()->isClassMember()) { if (nodep->packagep() && !nodep->varp()->isClassMember()) {
const auto it2 = m_packageScopes.find(nodep->packagep()); const auto it2 = m_packageScopes.find(nodep->packagep());
UASSERT_OBJ(it2 != m_packageScopes.end(), nodep, "Can't locate package scope"); UASSERT_OBJ(it2 != m_packageScopes.end(), nodep, "Can't locate package scope");

View File

@ -291,10 +291,10 @@ private:
if (!m_pliVertexp) { if (!m_pliVertexp) {
m_pliVertexp = new SplitPliVertex(&m_graph, nodep); // m_graph.clear() will delete it m_pliVertexp = new SplitPliVertex(&m_graph, nodep); // m_graph.clear() will delete it
} }
for (VStack::iterator it = m_stmtStackps.begin(); it != m_stmtStackps.end(); ++it) { for (const auto& vtxp : m_stmtStackps) {
// Both ways... // Both ways...
new SplitScorebdEdge(&m_graph, *it, m_pliVertexp); new SplitScorebdEdge(&m_graph, vtxp, m_pliVertexp);
new SplitScorebdEdge(&m_graph, m_pliVertexp, *it); new SplitScorebdEdge(&m_graph, m_pliVertexp, vtxp);
} }
} }
void scoreboardPushStmt(AstNode* nodep) { void scoreboardPushStmt(AstNode* nodep) {
@ -709,7 +709,7 @@ public:
void go() { void go() {
// Create a new always for each color // Create a new always for each color
const ColorSet& colors = m_ifColorp->colors(); const ColorSet& colors = m_ifColorp->colors();
for (ColorSet::const_iterator color = colors.begin(); color != colors.end(); ++color) { for (unsigned int color : colors) {
// We don't need to clone m_origAlwaysp->sensesp() here; // We don't need to clone m_origAlwaysp->sensesp() here;
// V3Activate already moved it to a parent node. // V3Activate already moved it to a parent node.
AstAlways* alwaysp AstAlways* alwaysp
@ -718,7 +718,7 @@ public:
// We'll strip these out after the blocks are fully cloned. // We'll strip these out after the blocks are fully cloned.
AstSplitPlaceholder* placeholderp = makePlaceholderp(); AstSplitPlaceholder* placeholderp = makePlaceholderp();
alwaysp->addStmtp(placeholderp); alwaysp->addStmtp(placeholderp);
m_addAfter[*color] = placeholderp; m_addAfter[color] = placeholderp;
m_newBlocksp->push_back(alwaysp); m_newBlocksp->push_back(alwaysp);
} }
// Scan the body of the always. We'll handle if/else // Scan the body of the always. We'll handle if/else
@ -761,7 +761,7 @@ protected:
typedef std::unordered_map<uint32_t, AstNodeIf*> CloneMap; typedef std::unordered_map<uint32_t, AstNodeIf*> CloneMap;
CloneMap clones; CloneMap clones;
for (ColorSet::const_iterator color = colors.begin(); color != colors.end(); ++color) { for (unsigned int color : colors) {
// Clone this if into its set of split blocks // Clone this if into its set of split blocks
AstSplitPlaceholder* if_placeholderp = makePlaceholderp(); AstSplitPlaceholder* if_placeholderp = makePlaceholderp();
AstSplitPlaceholder* else_placeholderp = makePlaceholderp(); AstSplitPlaceholder* else_placeholderp = makePlaceholderp();
@ -775,9 +775,9 @@ protected:
clonep->unique0Pragma(origp->unique0Pragma()); clonep->unique0Pragma(origp->unique0Pragma());
clonep->priorityPragma(origp->priorityPragma()); clonep->priorityPragma(origp->priorityPragma());
} }
clones[*color] = clonep; clones[color] = clonep;
m_addAfter[*color]->addNextHere(clonep); m_addAfter[color]->addNextHere(clonep);
m_addAfter[*color] = if_placeholderp; m_addAfter[color] = if_placeholderp;
} }
iterateAndNextNull(nodep->ifsp()); iterateAndNextNull(nodep->ifsp());

View File

@ -361,9 +361,7 @@ public:
v.iterate(nodep); v.iterate(nodep);
} }
void visit(AstNVisitor* visitor) { void visit(AstNVisitor* visitor) {
for (VarSet::iterator it = m_vars.begin(), it_end = m_vars.end(); it != it_end; ++it) { for (const auto& varp : m_vars) visitor->iterate(varp);
visitor->iterate(*it);
}
for (SelSet::iterator it = m_sels.begin(), it_end = m_sels.end(); it != it_end; ++it) { for (SelSet::iterator it = m_sels.begin(), it_end = m_sels.end(); it != it_end; ++it) {
// If m_refs includes VarRef from ArraySel, remove it // If m_refs includes VarRef from ArraySel, remove it
// because the VarRef would not be visited in SplitPackedVarVisitor::visit(AstSel*). // because the VarRef would not be visited in SplitPackedVarVisitor::visit(AstSel*).

View File

@ -234,10 +234,10 @@ public:
if (count != 0.0) { if (count != 0.0) {
if (v3Global.opt.statsVars()) { if (v3Global.opt.statsVars()) {
NameMap& nameMapr = m_statVarWidthNames.at(i); NameMap& nameMapr = m_statVarWidthNames.at(i);
for (NameMap::iterator it = nameMapr.begin(); it != nameMapr.end(); ++it) { for (const auto& itr : nameMapr) {
std::ostringstream os; std::ostringstream os;
os << "Vars, width " << std::setw(5) << std::dec << i << " " << it->first; os << "Vars, width " << std::setw(5) << std::dec << i << " " << itr.first;
V3Stats::addStat(m_stage, os.str(), it->second); V3Stats::addStat(m_stage, os.str(), itr.second);
} }
} else { } else {
std::ostringstream os; std::ostringstream os;

View File

@ -53,15 +53,15 @@ class StatsReport {
typedef std::multimap<string, V3Statistic*> ByName; typedef std::multimap<string, V3Statistic*> ByName;
ByName byName; ByName byName;
// * is always first // * is always first
for (StatColl::iterator it = s_allStats.begin(); it != s_allStats.end(); ++it) { for (auto& itr : s_allStats) {
V3Statistic* repp = &(*it); V3Statistic* repp = &itr;
byName.insert(make_pair(repp->name(), repp)); byName.insert(make_pair(repp->name(), repp));
} }
// Process duplicates // Process duplicates
V3Statistic* lastp = nullptr; V3Statistic* lastp = nullptr;
for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) { for (const auto& itr : byName) {
V3Statistic* repp = it->second; V3Statistic* repp = itr.second;
if (lastp && lastp->sumit() && lastp->printit() && lastp->name() == repp->name() if (lastp && lastp->sumit() && lastp->printit() && lastp->name() == repp->name()
&& lastp->stage() == repp->stage()) { && lastp->stage() == repp->stage()) {
repp->combineWith(lastp); repp->combineWith(lastp);
@ -76,8 +76,8 @@ class StatsReport {
typedef std::multimap<string, const V3Statistic*> ByName; typedef std::multimap<string, const V3Statistic*> ByName;
ByName byName; ByName byName;
// * is always first // * is always first
for (StatColl::iterator it = s_allStats.begin(); it != s_allStats.end(); ++it) { for (const auto& itr : s_allStats) {
const V3Statistic* repp = &(*it); const V3Statistic* repp = &itr;
if (repp->stage() == "*" && repp->printit()) { if (repp->stage() == "*" && repp->printit()) {
if (maxWidth < repp->name().length()) maxWidth = repp->name().length(); if (maxWidth < repp->name().length()) maxWidth = repp->name().length();
byName.insert(make_pair(repp->name(), repp)); byName.insert(make_pair(repp->name(), repp));
@ -87,8 +87,8 @@ class StatsReport {
// Print organized by stage // Print organized by stage
os << "Global Statistics:\n"; os << "Global Statistics:\n";
os << endl; os << endl;
for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) { for (const auto& itr : byName) {
const V3Statistic* repp = it->second; const V3Statistic* repp = itr.second;
if (repp->perf()) continue; if (repp->perf()) continue;
os << " " << std::left << std::setw(maxWidth) << repp->name(); os << " " << std::left << std::setw(maxWidth) << repp->name();
repp->dump(os); repp->dump(os);
@ -99,8 +99,8 @@ class StatsReport {
// Print organized by stage // Print organized by stage
os << "Performance Statistics:\n"; os << "Performance Statistics:\n";
os << endl; os << endl;
for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) { for (const auto& itr : byName) {
const V3Statistic* repp = it->second; const V3Statistic* repp = itr.second;
if (!repp->perf()) continue; if (!repp->perf()) continue;
os << " " << std::left << std::setw(maxWidth) << repp->name(); os << " " << std::left << std::setw(maxWidth) << repp->name();
repp->dump(os); repp->dump(os);

View File

@ -411,9 +411,7 @@ void V3TSP::tspSort(const V3TSP::StateVec& states, V3TSP::StateVec* resultp) {
// Build the initial graph from the starting state set. // Build the initial graph from the starting state set.
typedef TspGraphTmpl<const TspStateBase*> Graph; typedef TspGraphTmpl<const TspStateBase*> Graph;
Graph graph; Graph graph;
for (V3TSP::StateVec::const_iterator it = states.begin(); it != states.end(); ++it) { for (const auto& state : states) graph.addVertex(state);
graph.addVertex(*it);
}
for (V3TSP::StateVec::const_iterator it = states.begin(); it != states.end(); ++it) { for (V3TSP::StateVec::const_iterator it = states.begin(); it != states.end(); ++it) {
for (V3TSP::StateVec::const_iterator jt = it; jt != states.end(); ++jt) { for (V3TSP::StateVec::const_iterator jt = it; jt != states.end(); ++jt) {
if (it == jt) continue; if (it == jt) continue;

View File

@ -200,10 +200,7 @@ private:
// Collapse duplicate tables // Collapse duplicate tables
chgVscp = findDuplicateTable(chgVscp); chgVscp = findDuplicateTable(chgVscp);
for (std::deque<AstVarScope*>::iterator it = m_tableVarps.begin(); for (auto& vscp : m_tableVarps) vscp = findDuplicateTable(vscp);
it != m_tableVarps.end(); ++it) {
*it = findDuplicateTable(*it);
}
createOutputAssigns(nodep, stmtsp, indexVscp, chgVscp); createOutputAssigns(nodep, stmtsp, indexVscp, chgVscp);

View File

@ -402,9 +402,9 @@ private:
// Create input variables // Create input variables
AstNode::user2ClearTree(); AstNode::user2ClearTree();
V3TaskConnects tconnects = V3Task::taskConnects(refp, beginp); V3TaskConnects tconnects = V3Task::taskConnects(refp, beginp);
for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { for (const auto& itr : tconnects) {
AstVar* portp = it->first; AstVar* portp = itr.first;
AstArg* argp = it->second; AstArg* argp = itr.second;
AstNode* pinp = argp->exprp(); AstNode* pinp = argp->exprp();
portp->unlinkFrBack(); portp->unlinkFrBack();
pushDeletep(portp); // Remove it from the clone (not original) pushDeletep(portp); // Remove it from the clone (not original)
@ -536,9 +536,9 @@ private:
// Convert complicated outputs to temp signals // Convert complicated outputs to temp signals
V3TaskConnects tconnects = V3Task::taskConnects(refp, refp->taskp()->stmtsp()); V3TaskConnects tconnects = V3Task::taskConnects(refp, refp->taskp()->stmtsp());
for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { for (const auto& itr : tconnects) {
AstVar* portp = it->first; AstVar* portp = itr.first;
AstNode* pinp = it->second->exprp(); AstNode* pinp = itr.second->exprp();
if (!pinp) { if (!pinp) {
// Too few arguments in function call // Too few arguments in function call
} else { } else {

View File

@ -480,8 +480,7 @@ class TristateVisitor : public TristateBaseVisitor {
// or inouts without high-Z logic and put a 1'bz driver on them and add // or inouts without high-Z logic and put a 1'bz driver on them and add
// them to the lhs map so they get expanded correctly. // them to the lhs map so they get expanded correctly.
TristateGraph::VarVec vars = m_tgraph.tristateVars(); TristateGraph::VarVec vars = m_tgraph.tristateVars();
for (TristateGraph::VarVec::iterator ii = vars.begin(); ii != vars.end(); ++ii) { for (auto varp : vars) {
AstVar* varp = (*ii);
if (m_tgraph.isTristate(varp)) { if (m_tgraph.isTristate(varp)) {
const auto it = m_lhsmap.find(varp); const auto it = m_lhsmap.find(varp);
if (it == m_lhsmap.end()) { if (it == m_lhsmap.end()) {
@ -557,8 +556,7 @@ class TristateVisitor : public TristateBaseVisitor {
AstNode* undrivenp = nullptr; AstNode* undrivenp = nullptr;
// loop through the lhs drivers to build the driver resolution logic // loop through the lhs drivers to build the driver resolution logic
for (RefVec::iterator ii = refsp->begin(); ii != refsp->end(); ++ii) { for (auto refp : *refsp) {
AstVarRef* refp = (*ii);
int w = lhsp->width(); int w = lhsp->width();
// create the new lhs driver for this var // create the new lhs driver for this var

View File

@ -4246,9 +4246,9 @@ private:
do { do {
reloop: reloop:
V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());
for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { for (const auto& tconnect : tconnects) {
AstVar* portp = it->first; AstVar* portp = tconnect.first;
AstArg* argp = it->second; AstArg* argp = tconnect.second;
AstNode* pinp = argp->exprp(); AstNode* pinp = argp->exprp();
if (!pinp) continue; // Argument error we'll find later if (!pinp) continue; // Argument error we'll find later
// Prelim may cause the node to get replaced; we've lost our // Prelim may cause the node to get replaced; we've lost our
@ -4301,9 +4301,9 @@ private:
// Stage 2 // Stage 2
{ {
V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());
for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { for (const auto& tconnect : tconnects) {
AstVar* portp = it->first; AstVar* portp = tconnect.first;
AstArg* argp = it->second; AstArg* argp = tconnect.second;
AstNode* pinp = argp->exprp(); AstNode* pinp = argp->exprp();
if (!pinp) continue; // Argument error we'll find later if (!pinp) continue; // Argument error we'll find later
// Change data types based on above accept completion // Change data types based on above accept completion
@ -4313,9 +4313,9 @@ private:
// Stage 3 // Stage 3
{ {
V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());
for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { for (const auto& tconnect : tconnects) {
AstVar* portp = it->first; AstVar* portp = tconnect.first;
AstArg* argp = it->second; AstArg* argp = tconnect.second;
AstNode* pinp = argp->exprp(); AstNode* pinp = argp->exprp();
if (!pinp) continue; // Argument error we'll find later if (!pinp) continue; // Argument error we'll find later
// Do PRELIM again, because above accept may have exited early // Do PRELIM again, because above accept may have exited early
@ -4328,9 +4328,9 @@ private:
// Stage 4 // Stage 4
{ {
V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());
for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { for (const auto& tconnect : tconnects) {
AstVar* portp = it->first; AstVar* portp = tconnect.first;
AstArg* argp = it->second; AstArg* argp = tconnect.second;
AstNode* pinp = argp->exprp(); AstNode* pinp = argp->exprp();
if (!pinp) continue; // Argument error we'll find later if (!pinp) continue; // Argument error we'll find later
if (portp->direction() == VDirection::REF if (portp->direction() == VDirection::REF
@ -5777,9 +5777,9 @@ private:
nodep->name(nodep->taskp()->name()); nodep->name(nodep->taskp()->name());
// Replace open array arguments with the callee's task // Replace open array arguments with the callee's task
V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());
for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { for (const auto& tconnect : tconnects) {
AstVar* portp = it->first; AstVar* portp = tconnect.first;
AstArg* argp = it->second; AstArg* argp = tconnect.second;
AstNode* pinp = argp->exprp(); AstNode* pinp = argp->exprp();
if (!pinp) continue; // Argument error we'll find later if (!pinp) continue; // Argument error we'll find later
if (hasOpenArrayIterateDType(portp->dtypep())) portp->dtypep(pinp->dtypep()); if (hasOpenArrayIterateDType(portp->dtypep())) portp->dtypep(pinp->dtypep());