From 79d33bf1ee42e65fb5f7ac2761f8e24f2a189399 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 10 Nov 2020 22:10:38 -0500 Subject: [PATCH] Use C++11 for loops, from clang-migrate. No functional change intended --- src/V3AstNodes.cpp | 12 +++++------- src/V3Case.cpp | 2 +- src/V3Cdc.cpp | 6 +++--- src/V3Combine.cpp | 4 ++-- src/V3Config.cpp | 16 +++++----------- src/V3Coverage.cpp | 8 ++++---- src/V3Dead.cpp | 7 +++---- src/V3EmitC.cpp | 15 +++++++-------- src/V3EmitCMake.cpp | 8 ++++---- src/V3EmitCSyms.cpp | 8 ++++---- src/V3EmitMk.cpp | 5 +---- src/V3EmitV.cpp | 6 +++--- src/V3File.cpp | 13 ++++++------- src/V3Gate.cpp | 4 ++-- src/V3GraphAcyc.cpp | 7 ++----- src/V3GraphDfa.cpp | 5 ++--- src/V3GraphPathChecker.cpp | 2 +- src/V3Hashed.cpp | 16 ++++++++-------- src/V3HierBlock.cpp | 22 ++++++++-------------- src/V3Inst.cpp | 5 ++--- src/V3LifePost.cpp | 4 ++-- src/V3LinkDot.cpp | 6 +++--- src/V3LinkLevel.cpp | 6 +++--- src/V3Options.cpp | 3 +-- src/V3Order.cpp | 6 ++---- src/V3Param.cpp | 14 ++++++-------- src/V3ParseImp.cpp | 15 +++++---------- src/V3Partition.cpp | 10 ++++------ src/V3PreProc.cpp | 4 ++-- src/V3Scope.cpp | 7 +++---- src/V3Split.cpp | 18 +++++++++--------- src/V3SplitVar.cpp | 4 +--- src/V3Stats.cpp | 6 +++--- src/V3StatsReport.cpp | 20 ++++++++++---------- src/V3TSP.cpp | 4 +--- src/V3Table.cpp | 5 +---- src/V3Task.cpp | 12 ++++++------ src/V3Tristate.cpp | 6 ++---- src/V3Width.cpp | 30 +++++++++++++++--------------- 39 files changed, 152 insertions(+), 199 deletions(-) diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index d796631e1..3074722cf 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -846,9 +846,7 @@ bool AstSenTree::hasCombo() const { 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] = nullptr; - } + for (auto& itr : m_basicps) itr = nullptr; m_detailedMap.clear(); // Clear generic()'s so dead detection will work for (AstNode* nodep = typesp(); nodep; nodep = nodep->nextp()) { @@ -1176,12 +1174,12 @@ void AstInitArray::dump(std::ostream& str) const { this->AstNode::dump(str); int n = 0; 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) { str << " ..."; break; } - str << " [" << it->first << "]=" << (void*)it->second; + str << " [" << itr.first << "]=" << (void*)itr.second; } } void AstJumpGo::dump(std::ostream& str) const { @@ -1406,8 +1404,8 @@ void AstTypeTable::dump(std::ostream& str) const { } { const DetailedMap& mapr = m_detailedMap; - for (DetailedMap::const_iterator it = mapr.begin(); it != mapr.end(); ++it) { - AstBasicDType* dtypep = it->second; + for (const auto& itr : mapr) { + AstBasicDType* dtypep = itr.second; str << endl; // Newline from caller, so newline first str << "\t\tdetailed -> "; dtypep->dump(str); diff --git a/src/V3Case.cpp b/src/V3Case.cpp index ac15870f7..a9a0a3511 100644 --- a/src/V3Case.cpp +++ b/src/V3Case.cpp @@ -486,7 +486,7 @@ private: public: // CONSTRUCTORS 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); } virtual ~CaseVisitor() override { diff --git a/src/V3Cdc.cpp b/src/V3Cdc.cpp index 202ef4001..60e85be33 100644 --- a/src/V3Cdc.cpp +++ b/src/V3Cdc.cpp @@ -587,15 +587,15 @@ private: // Convert list of senses into one sense node AstSenTree* senoutp = nullptr; bool senedited = false; - for (SenSet::iterator it = senouts.begin(); it != senouts.end(); ++it) { + for (const auto& itr : senouts) { if (!senoutp) { - senoutp = *it; + senoutp = itr; } else { if (!senedited) { senedited = 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 diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index bc82a812d..ad2bcc690 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -203,8 +203,8 @@ private: } #endif void walkEmptyFuncs() { - for (V3Hashed::iterator it = m_hashed.begin(); it != m_hashed.end(); ++it) { - AstNode* node1p = it->second; + for (const auto& itr : m_hashed) { + AstNode* node1p = itr.second; AstCFunc* oldfuncp = VN_CAST(node1p, CFunc); if (oldfuncp && oldfuncp->emptyBody() && !oldfuncp->dontCombine()) { UINFO(5, " EmptyFunc " << std::hex << V3Hash(oldfuncp->user4p()) << " " diff --git a/src/V3Config.cpp b/src/V3Config.cpp index d36880697..7a29b21fd 100644 --- a/src/V3Config.cpp +++ b/src/V3Config.cpp @@ -282,15 +282,9 @@ public: } void update(const V3ConfigFile& file) { // Copy in all Attributes - for (LineAttrMap::const_iterator it = file.m_lineAttrs.begin(); - it != file.m_lineAttrs.end(); ++it) { - m_lineAttrs[it->first] |= it->second; - } + for (const auto& itr : file.m_lineAttrs) { m_lineAttrs[itr.first] |= itr.second; } // Copy in all ignores - for (IgnLines::const_iterator it = file.m_ignLines.begin(); it != file.m_ignLines.end(); - ++it) { - m_ignLines.insert(*it); - } + for (const auto& ignLine : file.m_ignLines) m_ignLines.insert(ignLine); // Update the iterator after the list has changed m_lastIgnore.it = m_ignLines.begin(); m_waivers.reserve(m_waivers.size() + file.m_waivers.size()); @@ -338,9 +332,9 @@ public: } } bool waive(V3ErrorCode code, const string& match) { - for (Waivers::const_iterator it = m_waivers.begin(); it != m_waivers.end(); ++it) { - if (((it->first == code) || (it->first == V3ErrorCode::I_LINT)) - && VString::wildmatch(match, it->second)) { + for (const auto& itr : m_waivers) { + if (((itr.first == code) || (itr.first == V3ErrorCode::I_LINT)) + && VString::wildmatch(match, itr.second)) { return true; } } diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index 344d24d28..a216b385c 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -188,15 +188,15 @@ private: const LinenoSet& lines = m_handleLines[state.m_handle]; int first = 0; int last = 0; - for (LinenoSet::iterator it = lines.begin(); it != lines.end(); ++it) { + for (int linen : lines) { if (!first) { - first = last = *it; - } else if (*it == last + 1) { + first = last = linen; + } else if (linen == last + 1) { ++last; } else { if (!out.empty()) out += ","; out += linesFirstLast(first, last); - first = last = *it; + first = last = linen; } } if (first) { diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index 9f709f5ab..7b75e4bdb 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -367,14 +367,13 @@ private: void deadCheckClasses() { for (bool retry = true; retry;) { retry = false; - for (std::vector::iterator it = m_classesp.begin(); it != m_classesp.end(); - ++it) { - if (AstClass* nodep = *it) { // nullptr if deleted earlier + for (auto& itr : m_classesp) { + if (AstClass* nodep = itr) { // 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 = nullptr; + itr = nullptr; retry = true; } } diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index ee4712910..79a11f158 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1294,8 +1294,8 @@ public: // 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) { int diffs = 0; - for (MTaskIdSet::iterator it = set_a.begin(); it != set_a.end(); ++it) { - if (set_b.find(*it) == set_b.end()) ++diffs; + for (int i : set_a) { + if (set_b.find(i) == set_b.end()) ++diffs; } return diffs; } @@ -1731,10 +1731,9 @@ class EmitCImp : EmitCStmts { puts("}\n"); } const AstInitArray::KeyItemMap& mapr = initarp->map(); - for (AstInitArray::KeyItemMap::const_iterator it = mapr.begin(); it != mapr.end(); - ++it) { - AstNode* valuep = it->second->valuep(); - emitSetVarConstant(varp->nameProtect() + "[" + cvtToStr(it->first) + "]", + for (const auto& itr : mapr) { + AstNode* valuep = itr.second->valuep(); + emitSetVarConstant(varp->nameProtect() + "[" + cvtToStr(itr.first) + "]", VN_CAST(valuep, Const)); } } else { @@ -2902,8 +2901,8 @@ void EmitCStmts::emitVarSort(const VarSortMap& vmap, VarVec* sortedp) { if (!v3Global.opt.mtasks()) { // Plain old serial mode. Sort by size, from small to large, // to optimize for both packing and small offsets in code. - for (VarSortMap::const_iterator it = vmap.begin(); it != vmap.end(); ++it) { - for (VarVec::const_iterator jt = it->second.begin(); jt != it->second.end(); ++jt) { + for (const auto& itr : vmap) { + for (VarVec::const_iterator jt = itr.second.begin(); jt != itr.second.end(); ++jt) { sortedp->push_back(*jt); } } diff --git a/src/V3EmitCMake.cpp b/src/V3EmitCMake.cpp index ffc4eb31a..0b7e0f52e 100644 --- a/src/V3EmitCMake.cpp +++ b/src/V3EmitCMake.cpp @@ -71,8 +71,8 @@ class CMakeEmitter { // Swap all backslashes for forward slashes, because of Windows static string deslash(const string& s) { std::string res = s; - for (string::iterator it = res.begin(); it != res.end(); ++it) { - if (*it == '\\') *it = '/'; + for (char& c : res) { + if (c == '\\') c = '/'; } return res; } @@ -243,9 +243,9 @@ class CMakeEmitter { *of << "verilate(${TOP_TARGET_NAME} PREFIX " << v3Global.opt.prefix() << " TOP_MODULE " << v3Global.rootp()->topModulep()->name() << " DIRECTORY " << deslash(v3Global.opt.makeDir()) << " SOURCES "; - for (V3HierBlockPlan::const_iterator it = planp->begin(); it != planp->end(); ++it) { + for (const auto& itr : *planp) { *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 << " VERILATOR_ARGS "; diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index 8d8bc81af..f0e63fa1d 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -398,8 +398,8 @@ void EmitCSyms::emitSymHdr() { if (v3Global.dpi()) { puts("\n// DPI TYPES for DPI Export callbacks (Internal use)\n"); std::map types; // Remove duplicates and sort - for (ScopeFuncs::iterator it = m_scopeFuncs.begin(); it != m_scopeFuncs.end(); ++it) { - AstCFunc* funcp = it->second.m_cfuncp; + for (const auto& itr : m_scopeFuncs) { + AstCFunc* funcp = itr.second.m_cfuncp; if (funcp->dpiExport()) { string cbtype = protect(v3Global.opt.prefix() + "__Vcb_" + funcp->cname() + "_t"); types["typedef void (*" + cbtype + ") (" + cFuncArgs(funcp) + ");\n"] = 1; @@ -455,8 +455,8 @@ void EmitCSyms::emitSymHdr() { if (!m_scopeNames.empty()) { // Scope names puts("\n// SCOPE NAMES\n"); - for (ScopeNames::iterator it = m_scopeNames.begin(); it != m_scopeNames.end(); ++it) { - puts("VerilatedScope " + protect("__Vscope_" + it->second.m_symName) + ";\n"); + for (const auto& itr : m_scopeNames) { + puts("VerilatedScope " + protect("__Vscope_" + itr.second.m_symName) + ";\n"); } } diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index 813ac0367..0a55a2ef9 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -362,10 +362,7 @@ class EmitMkHierVerilation { of.puts(v3Global.opt.prefix() + ".mk: $(VM_HIER_INPUT_FILES) $(VM_HIER_VERILOG_LIBS) "); of.puts(V3Os::filenameNonDir(argsFile) + " "); - for (V3HierBlockPlan::const_iterator it = m_planp->begin(); it != m_planp->end(); - ++it) { - of.puts(it->second->hierWrapper(true) + " "); - } + for (const auto& itr : *m_planp) of.puts(itr.second->hierWrapper(true) + " "); of.puts("\n"); emitLaunchVerilator(of, argsFile); } diff --git a/src/V3EmitV.cpp b/src/V3EmitV.cpp index 27e8b3d21..aa53317dd 100644 --- a/src/V3EmitV.cpp +++ b/src/V3EmitV.cpp @@ -493,11 +493,11 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { putfs(nodep, "'{"); int comma = 0; 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(", "); - puts(cvtToStr(it->first)); + puts(cvtToStr(itr.first)); puts(":"); - AstNode* valuep = it->second->valuep(); + AstNode* valuep = itr.second->valuep(); iterate(valuep); } puts("}"); diff --git a/src/V3File.cpp b/src/V3File.cpp index 5acdafa57..ed7749481 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -172,9 +172,8 @@ inline void V3FileDependImp::writeDepend(const string& filename) { inline std::vector V3FileDependImp::getAllDeps() const { std::vector r; - for (std::set::const_iterator iter = m_filenameList.begin(); - iter != m_filenameList.end(); ++iter) { - if (!iter->target() && iter->exists()) { r.push_back(iter->filename()); } + for (const auto& itr : m_filenameList) { + if (!itr.target() && itr.exists()) r.push_back(itr.filename()); } return r; } @@ -942,8 +941,8 @@ void V3OutCFile::putsGuard() { UASSERT(!m_guard, "Already called putsGuard in emit file"); m_guard = true; string var = VString::upcase(string("_") + V3Os::filenameNonDir(filename()) + "_"); - for (string::iterator pos = var.begin(); pos != var.end(); ++pos) { - if (!isalnum(*pos)) *pos = '_'; + for (char& c : var) { + if (!isalnum(c)) c = '_'; } puts("\n#ifndef " + var + "\n"); puts("#define " + var + " // guard\n"); @@ -1046,8 +1045,8 @@ public: "IPTION: Verilator output: XML representation of netlist -->\n"); of.puts("\n"); { - for (IdMap::const_iterator it = m_nameMap.begin(); it != m_nameMap.end(); ++it) { - of.puts("second + "\" to=\"" + it->first + "\"/>\n"); + for (const auto& itr : m_nameMap) { + of.puts("\n"); } } of.puts("\n"); diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 0276ee97c..3d53fb356 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -1002,8 +1002,8 @@ public: void check() { m_hashed.check(); - for (V3Hashed::HashMmap::iterator it = m_hashed.begin(); it != m_hashed.end(); ++it) { - AstNode* nodep = it->second; + for (const auto& itr : m_hashed) { + AstNode* nodep = itr.second; AstNode* activep = nodep->user3p(); AstNode* condVarp = nodep->user5p(); if (!isReplaced(nodep)) { diff --git a/src/V3GraphAcyc.cpp b/src/V3GraphAcyc.cpp index 393b74754..57fc442e6 100644 --- a/src/V3GraphAcyc.cpp +++ b/src/V3GraphAcyc.cpp @@ -143,9 +143,7 @@ private: } OrigEdgeList* oEListp = static_cast(toEdgep->userp()); if (OrigEdgeList* addListp = static_cast(addEdgep->userp())) { - for (OrigEdgeList::iterator it = addListp->begin(); it != addListp->end(); ++it) { - oEListp->push_back(*it); - } + for (const auto& itr : *addListp) oEListp->push_back(itr); addListp->clear(); // Done with it } else { oEListp->push_back(addEdgep); @@ -160,8 +158,7 @@ private: v3fatalSrc("No original edge associated with cutting edge " << breakEdgep << endl); } // The breakGraph edge may represent multiple real edges; cut them all - for (OrigEdgeList::iterator it = oEListp->begin(); it != oEListp->end(); ++it) { - V3GraphEdge* origEdgep = *it; + for (const auto& origEdgep : *oEListp) { origEdgep->cut(); UINFO(8, " " << why << " " << origEdgep->fromp() << " ->" << origEdgep->top() << endl); diff --git a/src/V3GraphDfa.cpp b/src/V3GraphDfa.cpp index 97f66ef3a..2c8f0bb48 100644 --- a/src/V3GraphDfa.cpp +++ b/src/V3GraphDfa.cpp @@ -317,9 +317,8 @@ private: } // Foreach input state (NFA inputs of this DFA state) - for (std::set::const_iterator inIt = inputs.begin(); inIt != inputs.end(); - ++inIt) { - DfaInput input = *inIt; + for (int inIt : inputs) { + DfaInput input = inIt; UINFO(9, " ===" << ++i << "=======================\n"); UINFO(9, " On input " << cvtToHex(input.toNodep()) << endl); diff --git a/src/V3GraphPathChecker.cpp b/src/V3GraphPathChecker.cpp index d0242f9dc..2497f35ca 100644 --- a/src/V3GraphPathChecker.cpp +++ b/src/V3GraphPathChecker.cpp @@ -42,7 +42,7 @@ struct GraphPCNode { // CONSTRUCTORS GraphPCNode() { - for (int w = 0; w < GraphWay::NUM_WAYS; w++) m_cp[w] = 0; + for (unsigned int& w : m_cp) w = 0; } ~GraphPCNode() {} }; diff --git a/src/V3Hashed.cpp b/src/V3Hashed.cpp index 22758e288..14579bc87 100644 --- a/src/V3Hashed.cpp +++ b/src/V3Hashed.cpp @@ -139,8 +139,8 @@ void V3Hashed::erase(iterator it) { } void V3Hashed::check() { - for (HashMmap::iterator it = begin(); it != end(); ++it) { - AstNode* nodep = it->second; + for (const auto& itr : *this) { + AstNode* nodep = itr.second; 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; - for (HashMmap::iterator it = begin(); it != end(); ++it) { - if (lasthash != it->first) { - lasthash = it->first; - *logp << " " << it->first << endl; + for (const auto& itr : *this) { + if (lasthash != itr.first) { + lasthash = itr.first; + *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, // 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, " "); } } diff --git a/src/V3HierBlock.cpp b/src/V3HierBlock.cpp index cd76be85f..f605723fc 100644 --- a/src/V3HierBlock.cpp +++ b/src/V3HierBlock.cpp @@ -107,9 +107,8 @@ static void V3HierWriteCommonInputs(const V3HierBlock* hblockp, std::ostream* of V3HierBlock::StrGParams V3HierBlock::stringifyParams(const GParams& gparams, bool forGOption) { StrGParams strParams; - for (V3HierBlock::GParams::const_iterator gparamIt = gparams.begin(); - gparamIt != gparams.end(); ++gparamIt) { - if (const AstConst* constp = VN_CAST((*gparamIt)->valuep(), Const)) { + for (const auto& gparam : gparams) { + if (const AstConst* constp = VN_CAST(gparam->valuep(), Const)) { string s; // Only constant parameter needs to be set to -G because already checked in // 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 = VString::quoteAny(s, '\'', '\\'); } - strParams.push_back(std::make_pair((*gparamIt)->name(), s)); + strParams.push_back(std::make_pair(gparam->name(), s)); } } return strParams; @@ -139,9 +138,8 @@ V3HierBlock::StrGParams V3HierBlock::stringifyParams(const GParams& gparams, boo V3HierBlock::~V3HierBlock() { UASSERT(m_children.empty(), "at least one module must be a leaf"); - for (HierBlockSet::const_iterator child = m_children.begin(); child != m_children.end(); - ++child) { - const bool deleted = (*child)->m_children.erase(this); + for (const auto& hierblockp : m_children) { + const bool deleted = hierblockp->m_children.erase(this); UASSERT_OBJ(deleted, m_modp, " is not registered"); } } @@ -214,9 +212,8 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const { *of << "--cc\n"; if (!forCMake) { - for (V3HierBlock::HierBlockSet::const_iterator child = m_children.begin(); - child != m_children.end(); ++child) { - *of << v3Global.opt.makeDir() << "/" << (*child)->hierWrapper(true) << "\n"; + for (const auto& hierblockp : m_children) { + *of << v3Global.opt.makeDir() << "/" << hierblockp->hierWrapper(true) << "\n"; } *of << "-Mdir " << v3Global.opt.makeDir() << "/" << hierPrefix() << " \n"; } @@ -224,10 +221,7 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const { const V3StringList& commandOpts = commandArgs(false); for (const string& opt : commandOpts) *of << opt << "\n"; *of << hierBlockArgs().front() << "\n"; - for (HierBlockSet::const_iterator child = m_children.begin(); child != m_children.end(); - ++child) { - *of << (*child)->hierBlockArgs().front() << "\n"; - } + for (const auto& hierblockp : m_children) *of << hierblockp->hierBlockArgs().front() << "\n"; // Hierarchical blocks should not use multi-threading, // but needs to be thread safe when top is multi-threaded. if (v3Global.opt.threads() > 0) { *of << "--threads 1\n"; } diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index 2483deb0e..1c016ac8f 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -172,9 +172,8 @@ public: } } void dump() { - for (VarNameMap::iterator it = m_modVarNameMap.begin(); it != m_modVarNameMap.end(); - ++it) { - cout << "-namemap: " << it->first << " -> " << it->second << endl; + for (const auto& itr : m_modVarNameMap) { + cout << "-namemap: " << itr.first << " -> " << itr.second << endl; } } diff --git a/src/V3LifePost.cpp b/src/V3LifePost.cpp index d3878ffce..4e254a991 100644 --- a/src/V3LifePost.cpp +++ b/src/V3LifePost.cpp @@ -186,8 +186,8 @@ private: return true; } void squashAssignposts() { - for (PostLocMap::iterator it = m_assignposts.begin(); it != m_assignposts.end(); ++it) { - LifePostLocation* app = &it->second; + for (auto& itr : m_assignposts) { + LifePostLocation* app = &itr.second; AstVarRef* lhsp = VN_CAST(app->nodep->lhsp(), VarRef); // original var AstVarRef* rhsp = VN_CAST(app->nodep->rhsp(), VarRef); // dly var AstVarScope* dlyVarp = rhsp->varScopep(); diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 8274b84fd..b8dce26fe 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -1726,9 +1726,9 @@ public: }; void LinkDotState::computeIfaceModSyms() { - for (IfaceModSyms::iterator it = m_ifaceModSyms.begin(); it != m_ifaceModSyms.end(); ++it) { - AstIface* nodep = it->first; - VSymEnt* symp = it->second; + for (const auto& itr : m_ifaceModSyms) { + AstIface* nodep = itr.first; + VSymEnt* symp = itr.second; LinkDotIfaceVisitor(nodep, symp, this); } m_ifaceModSyms.clear(); diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index e59d87ffe..da3904efb 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -89,9 +89,9 @@ void V3LinkLevel::timescaling(const ModVec& mods) { 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) { - if (!modTimedp && !(*it)->timeunit().isNone()) { - modTimedp = *it; + for (const auto& modp : mods) { + if (!modTimedp && !modp->timeunit().isNone()) { + modTimedp = modp; unit = modTimedp->timeunit(); break; } diff --git a/src/V3Options.cpp b/src/V3Options.cpp index ae18997d9..799c7ed87 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -392,8 +392,7 @@ string V3Options::allArgsString() const { // Delete some options for Verilation of the hierarchical blocks. string V3Options::allArgsStringForHierBlock(bool forTop) const { std::set vFiles; - for (V3StringList::const_iterator it = m_vFiles.begin(); it != m_vFiles.end(); ++it) - vFiles.insert(*it); + for (const auto& vFile : m_vFiles) vFiles.insert(vFile); string out; for (std::list::const_iterator it = m_impp->m_allArgs.begin(); it != m_impp->m_allArgs.end(); ++it) { diff --git a/src/V3Order.cpp b/src/V3Order.cpp index 2d5a80038..7c555cd7f 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -153,9 +153,7 @@ public: OrderMoveVertex* vertexp); // Mark one vertex as finished, remove from ready list if done // STATIC MEMBERS (for lookup) static void clear() { - for (DomScopeMap::iterator it = s_dsMap.begin(); it != s_dsMap.end(); ++it) { - delete it->second; - } + for (const auto& itr : s_dsMap) delete itr.second; s_dsMap.clear(); } V3List& readyVertices() { return m_readyVertices; } @@ -219,7 +217,7 @@ public: // CONSTRUCTORS OrderUser() { - for (int i = 0; i < WV_MAX; i++) m_vertexp[i] = nullptr; + for (auto& vertexp : m_vertexp) vertexp = nullptr; } ~OrderUser() {} }; diff --git a/src/V3Param.cpp b/src/V3Param.cpp index e8ae9d7a0..8b03ed87a 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -119,10 +119,11 @@ class ParameterizedHierBlocks { public: ParameterizedHierBlocks(const V3HierBlockOptSet& hierOpts, AstNetlist* nodep) { - for (V3HierBlockOptSet::const_iterator it = hierOpts.begin(); it != hierOpts.end(); ++it) { - m_hierBlockOptsByOrigName.insert(std::make_pair(it->second.origName(), &it->second)); - const V3HierarchicalBlockOption::ParamStrMap& params = it->second.params(); - ParamConstMap& consts = m_params[&it->second]; + for (const auto& hierOpt : hierOpts) { + m_hierBlockOptsByOrigName.insert( + std::make_pair(hierOpt.second.origName(), &hierOpt.second)); + const V3HierarchicalBlockOption::ParamStrMap& params = hierOpt.second.params(); + ParamConstMap& consts = m_params[&hierOpt.second]; for (V3HierarchicalBlockOption::ParamStrMap::const_iterator pIt = params.begin(); pIt != params.end(); ++pIt) { AstConst* constp = AstConst::parseParamLiteral( @@ -141,10 +142,7 @@ public: } ~ParameterizedHierBlocks() { 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(); - ++pIt) { - delete pIt->second; - } + for (const auto& pItr : it->second) { delete pItr.second; } } } AstNodeModule* findByParams(const string& origName, AstPin* firstPinp, diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index c4b1766a4..e7800e0fd 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -49,13 +49,9 @@ int V3ParseSym::s_anonNum = 0; // Parser constructor V3ParseImp::~V3ParseImp() { - for (std::deque::iterator it = m_stringps.begin(); it != m_stringps.end(); ++it) { - VL_DO_DANGLING(delete *it, *it); - } + for (auto& itr : m_stringps) VL_DO_DANGLING(delete itr, itr); m_stringps.clear(); - for (std::deque::iterator it = m_numberps.begin(); it != m_numberps.end(); ++it) { - VL_DO_DANGLING(delete *it, *it); - } + for (auto& itr : m_numberps) VL_DO_DANGLING(delete itr, itr); m_numberps.clear(); lexDestroy(); parserClear(); @@ -252,11 +248,10 @@ void V3ParseImp::preprocDumps(std::ostream& os) { V3PreShell::dumpDefines(os); } else { bool noblanks = v3Global.opt.preprocOnly() && v3Global.opt.preprocNoLine(); - for (std::deque::iterator it = m_ppBuffers.begin(); it != m_ppBuffers.end(); - ++it) { + for (auto& buf : m_ppBuffers) { if (noblanks) { 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') { blank = false; break; @@ -264,7 +259,7 @@ void V3ParseImp::preprocDumps(std::ostream& os) { } if (blank) continue; } - os << *it; + os << buf; } } } diff --git a/src/V3Partition.cpp b/src/V3Partition.cpp index 0d840b181..abfb6ce0d 100644 --- a/src/V3Partition.cpp +++ b/src/V3Partition.cpp @@ -308,7 +308,7 @@ private: // Generate a pseudo-random graph vluint64_t rngState[2] = {0x12345678ULL, 0x9abcdef0ULL}; // 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 // lower-to-higher index vertices, so we get a DAG. for (unsigned i = 0; i < 250; ++i) { @@ -328,10 +328,8 @@ private: // Seed the propagator with every input node; // This should result in the complete graph getting all CP's assigned. - for (unsigned i = 0; i < 50; ++i) { - if (!m_vx[i]->inBeginp()) { - prop.cpHasIncreased(m_vx[i], 1 /* inclusive CP starts at 1 */); - } + for (const auto& i : m_vx) { + if (!i->inBeginp()) prop.cpHasIncreased(i, 1 /* inclusive CP starts at 1 */); } // Run the propagator. @@ -451,7 +449,7 @@ public: // CONSTRUCTORS LogicMTask(V3Graph* graphp, MTaskMoveVertex* mtmvVxp) : 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 m_vertices.push_back(mtmvVxp); if (OrderLogicVertex* olvp = mtmvVxp->logicp()) { diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 90ba90ac4..0b1b0d782 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -1549,8 +1549,8 @@ int V3PreProcImp::getFinalToken(string& buf) { } } // Track newlines in prep for next token - for (string::iterator cp = buf.begin(); cp != buf.end(); ++cp) { - if (*cp == '\n') { + for (char& c : buf) { + if (c == '\n') { m_finAtBol = true; m_finFilelinep->linenoInc(); } else { diff --git a/src/V3Scope.cpp b/src/V3Scope.cpp index 9e3d19886..1922c7c80 100644 --- a/src/V3Scope.cpp +++ b/src/V3Scope.cpp @@ -65,10 +65,9 @@ private: VL_DEBUG_FUNC; // Declare debug() void cleanupVarRefs() { - for (VarRefScopeSet::iterator it = m_varRefScopes.begin(); it != m_varRefScopes.end(); - ++it) { - AstVarRef* nodep = it->first; - AstScope* scopep = it->second; + for (const auto& itr : m_varRefScopes) { + AstVarRef* nodep = itr.first; + AstScope* scopep = itr.second; if (nodep->packagep() && !nodep->varp()->isClassMember()) { const auto it2 = m_packageScopes.find(nodep->packagep()); UASSERT_OBJ(it2 != m_packageScopes.end(), nodep, "Can't locate package scope"); diff --git a/src/V3Split.cpp b/src/V3Split.cpp index 31ddbd268..bb528c0ae 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -291,10 +291,10 @@ private: if (!m_pliVertexp) { 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... - new SplitScorebdEdge(&m_graph, *it, m_pliVertexp); - new SplitScorebdEdge(&m_graph, m_pliVertexp, *it); + new SplitScorebdEdge(&m_graph, vtxp, m_pliVertexp); + new SplitScorebdEdge(&m_graph, m_pliVertexp, vtxp); } } void scoreboardPushStmt(AstNode* nodep) { @@ -709,7 +709,7 @@ public: void go() { // Create a new always for each color 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; // V3Activate already moved it to a parent node. AstAlways* alwaysp @@ -718,7 +718,7 @@ public: // We'll strip these out after the blocks are fully cloned. AstSplitPlaceholder* placeholderp = makePlaceholderp(); alwaysp->addStmtp(placeholderp); - m_addAfter[*color] = placeholderp; + m_addAfter[color] = placeholderp; m_newBlocksp->push_back(alwaysp); } // Scan the body of the always. We'll handle if/else @@ -761,7 +761,7 @@ protected: typedef std::unordered_map CloneMap; 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 AstSplitPlaceholder* if_placeholderp = makePlaceholderp(); AstSplitPlaceholder* else_placeholderp = makePlaceholderp(); @@ -775,9 +775,9 @@ protected: clonep->unique0Pragma(origp->unique0Pragma()); clonep->priorityPragma(origp->priorityPragma()); } - clones[*color] = clonep; - m_addAfter[*color]->addNextHere(clonep); - m_addAfter[*color] = if_placeholderp; + clones[color] = clonep; + m_addAfter[color]->addNextHere(clonep); + m_addAfter[color] = if_placeholderp; } iterateAndNextNull(nodep->ifsp()); diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index 51717f15d..9e29743e0 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -361,9 +361,7 @@ public: v.iterate(nodep); } void visit(AstNVisitor* visitor) { - for (VarSet::iterator it = m_vars.begin(), it_end = m_vars.end(); it != it_end; ++it) { - visitor->iterate(*it); - } + for (const auto& varp : m_vars) visitor->iterate(varp); 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 // because the VarRef would not be visited in SplitPackedVarVisitor::visit(AstSel*). diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 1e9669da6..9562aa8a0 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -234,10 +234,10 @@ public: if (count != 0.0) { if (v3Global.opt.statsVars()) { NameMap& nameMapr = m_statVarWidthNames.at(i); - for (NameMap::iterator it = nameMapr.begin(); it != nameMapr.end(); ++it) { + for (const auto& itr : nameMapr) { std::ostringstream os; - os << "Vars, width " << std::setw(5) << std::dec << i << " " << it->first; - V3Stats::addStat(m_stage, os.str(), it->second); + os << "Vars, width " << std::setw(5) << std::dec << i << " " << itr.first; + V3Stats::addStat(m_stage, os.str(), itr.second); } } else { std::ostringstream os; diff --git a/src/V3StatsReport.cpp b/src/V3StatsReport.cpp index ae45f6f00..71db187a3 100644 --- a/src/V3StatsReport.cpp +++ b/src/V3StatsReport.cpp @@ -53,15 +53,15 @@ class StatsReport { typedef std::multimap ByName; ByName byName; // * is always first - for (StatColl::iterator it = s_allStats.begin(); it != s_allStats.end(); ++it) { - V3Statistic* repp = &(*it); + for (auto& itr : s_allStats) { + V3Statistic* repp = &itr; byName.insert(make_pair(repp->name(), repp)); } // Process duplicates V3Statistic* lastp = nullptr; - for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) { - V3Statistic* repp = it->second; + for (const auto& itr : byName) { + V3Statistic* repp = itr.second; if (lastp && lastp->sumit() && lastp->printit() && lastp->name() == repp->name() && lastp->stage() == repp->stage()) { repp->combineWith(lastp); @@ -76,8 +76,8 @@ class StatsReport { typedef std::multimap ByName; ByName byName; // * is always first - for (StatColl::iterator it = s_allStats.begin(); it != s_allStats.end(); ++it) { - const V3Statistic* repp = &(*it); + for (const auto& itr : s_allStats) { + const V3Statistic* repp = &itr; if (repp->stage() == "*" && repp->printit()) { if (maxWidth < repp->name().length()) maxWidth = repp->name().length(); byName.insert(make_pair(repp->name(), repp)); @@ -87,8 +87,8 @@ class StatsReport { // Print organized by stage os << "Global Statistics:\n"; os << endl; - for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) { - const V3Statistic* repp = it->second; + for (const auto& itr : byName) { + const V3Statistic* repp = itr.second; if (repp->perf()) continue; os << " " << std::left << std::setw(maxWidth) << repp->name(); repp->dump(os); @@ -99,8 +99,8 @@ class StatsReport { // Print organized by stage os << "Performance Statistics:\n"; os << endl; - for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) { - const V3Statistic* repp = it->second; + for (const auto& itr : byName) { + const V3Statistic* repp = itr.second; if (!repp->perf()) continue; os << " " << std::left << std::setw(maxWidth) << repp->name(); repp->dump(os); diff --git a/src/V3TSP.cpp b/src/V3TSP.cpp index 9be68d1d7..3cd98df8d 100644 --- a/src/V3TSP.cpp +++ b/src/V3TSP.cpp @@ -411,9 +411,7 @@ void V3TSP::tspSort(const V3TSP::StateVec& states, V3TSP::StateVec* resultp) { // Build the initial graph from the starting state set. typedef TspGraphTmpl Graph; Graph graph; - for (V3TSP::StateVec::const_iterator it = states.begin(); it != states.end(); ++it) { - graph.addVertex(*it); - } + for (const auto& state : states) graph.addVertex(state); for (V3TSP::StateVec::const_iterator it = states.begin(); it != states.end(); ++it) { for (V3TSP::StateVec::const_iterator jt = it; jt != states.end(); ++jt) { if (it == jt) continue; diff --git a/src/V3Table.cpp b/src/V3Table.cpp index 76428dc32..dcec7c663 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -200,10 +200,7 @@ private: // Collapse duplicate tables chgVscp = findDuplicateTable(chgVscp); - for (std::deque::iterator it = m_tableVarps.begin(); - it != m_tableVarps.end(); ++it) { - *it = findDuplicateTable(*it); - } + for (auto& vscp : m_tableVarps) vscp = findDuplicateTable(vscp); createOutputAssigns(nodep, stmtsp, indexVscp, chgVscp); diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 2f58f79f0..f6a0c4a3c 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -402,9 +402,9 @@ private: // Create input variables AstNode::user2ClearTree(); V3TaskConnects tconnects = V3Task::taskConnects(refp, beginp); - for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { - AstVar* portp = it->first; - AstArg* argp = it->second; + for (const auto& itr : tconnects) { + AstVar* portp = itr.first; + AstArg* argp = itr.second; AstNode* pinp = argp->exprp(); portp->unlinkFrBack(); pushDeletep(portp); // Remove it from the clone (not original) @@ -536,9 +536,9 @@ private: // Convert complicated outputs to temp signals V3TaskConnects tconnects = V3Task::taskConnects(refp, refp->taskp()->stmtsp()); - for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { - AstVar* portp = it->first; - AstNode* pinp = it->second->exprp(); + for (const auto& itr : tconnects) { + AstVar* portp = itr.first; + AstNode* pinp = itr.second->exprp(); if (!pinp) { // Too few arguments in function call } else { diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 92131f735..922fac45b 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -480,8 +480,7 @@ class TristateVisitor : public TristateBaseVisitor { // 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. TristateGraph::VarVec vars = m_tgraph.tristateVars(); - for (TristateGraph::VarVec::iterator ii = vars.begin(); ii != vars.end(); ++ii) { - AstVar* varp = (*ii); + for (auto varp : vars) { if (m_tgraph.isTristate(varp)) { const auto it = m_lhsmap.find(varp); if (it == m_lhsmap.end()) { @@ -557,8 +556,7 @@ class TristateVisitor : public TristateBaseVisitor { AstNode* undrivenp = nullptr; // loop through the lhs drivers to build the driver resolution logic - for (RefVec::iterator ii = refsp->begin(); ii != refsp->end(); ++ii) { - AstVarRef* refp = (*ii); + for (auto refp : *refsp) { int w = lhsp->width(); // create the new lhs driver for this var diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 3b98eb02e..7afd7a905 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -4246,9 +4246,9 @@ private: do { reloop: V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); - for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { - AstVar* portp = it->first; - AstArg* argp = it->second; + for (const auto& tconnect : tconnects) { + AstVar* portp = tconnect.first; + AstArg* argp = tconnect.second; AstNode* pinp = argp->exprp(); if (!pinp) continue; // Argument error we'll find later // Prelim may cause the node to get replaced; we've lost our @@ -4301,9 +4301,9 @@ private: // Stage 2 { V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); - for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { - AstVar* portp = it->first; - AstArg* argp = it->second; + for (const auto& tconnect : tconnects) { + AstVar* portp = tconnect.first; + AstArg* argp = tconnect.second; AstNode* pinp = argp->exprp(); if (!pinp) continue; // Argument error we'll find later // Change data types based on above accept completion @@ -4313,9 +4313,9 @@ private: // Stage 3 { V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); - for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { - AstVar* portp = it->first; - AstArg* argp = it->second; + for (const auto& tconnect : tconnects) { + AstVar* portp = tconnect.first; + AstArg* argp = tconnect.second; AstNode* pinp = argp->exprp(); if (!pinp) continue; // Argument error we'll find later // Do PRELIM again, because above accept may have exited early @@ -4328,9 +4328,9 @@ private: // Stage 4 { V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); - for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { - AstVar* portp = it->first; - AstArg* argp = it->second; + for (const auto& tconnect : tconnects) { + AstVar* portp = tconnect.first; + AstArg* argp = tconnect.second; AstNode* pinp = argp->exprp(); if (!pinp) continue; // Argument error we'll find later if (portp->direction() == VDirection::REF @@ -5777,9 +5777,9 @@ private: nodep->name(nodep->taskp()->name()); // Replace open array arguments with the callee's task V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp()); - for (V3TaskConnects::iterator it = tconnects.begin(); it != tconnects.end(); ++it) { - AstVar* portp = it->first; - AstArg* argp = it->second; + for (const auto& tconnect : tconnects) { + AstVar* portp = tconnect.first; + AstArg* argp = tconnect.second; AstNode* pinp = argp->exprp(); if (!pinp) continue; // Argument error we'll find later if (hasOpenArrayIterateDType(portp->dtypep())) portp->dtypep(pinp->dtypep());