Internals: Favor const_iterator. No functional change.

This commit is contained in:
Wilson Snyder 2020-04-11 10:54:42 -04:00
parent ef211fc9e0
commit afa8e4c786
3 changed files with 5 additions and 4 deletions

View File

@ -2520,7 +2520,8 @@ public:
AstDot(FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: ASTGEN_SUPER(fl) { setOp1p(lhsp); setOp2p(rhsp); }
ASTNODE_NODE_FUNCS(Dot)
static AstNode* newIfPkg(FileLine*fl, AstPackage* packagep, AstNode* rhsp) { // For parser, make only if non-null package
// For parser, make only if non-null package
static AstNode* newIfPkg(FileLine* fl, AstPackage* packagep, AstNode* rhsp) {
if (!packagep) return rhsp;
return new AstDot(fl, new AstPackageRef(fl, packagep), rhsp);
}

View File

@ -1998,7 +1998,7 @@ void EmitCStmts::displayNode(AstNode* nodep, AstScopeName* scopenamep,
case 'e': displayArg(nodep, &elistp, isScan, vfmt, 'e'); break;
case 'f': displayArg(nodep, &elistp, isScan, vfmt, 'f'); break;
case 'g': displayArg(nodep, &elistp, isScan, vfmt, 'g'); break;
case '^': displayArg(nodep,&elistp,isScan, vfmt,'^'); break; // Realtime
case '^': displayArg(nodep, &elistp, isScan, vfmt, '^'); break; // Realtime
case 'v': displayArg(nodep, &elistp, isScan, vfmt, 'v'); break;
case 'm': {
UASSERT_OBJ(scopenamep, nodep, "Display with %m but no AstScopeName");

View File

@ -74,14 +74,14 @@ void V3LinkLevel::modSortByLevel() {
// Reorder the netlist's modules to have modules in level sorted order
stable_sort(mods.begin(), mods.end(), CmpLevel()); // Sort the vector
UINFO(9,"modSortByLevel() sorted\n"); // Comment required for gcc4.6.3 / bug666
for (ModVec::iterator it = mods.begin(); it != mods.end(); ++it) {
for (ModVec::const_iterator it = mods.begin(); it != mods.end(); ++it) {
AstNodeModule* nodep = *it;
nodep->clearIter(); // Because we didn't iterate to find the node
// pointers, may have a stale m_iterp() needing cleanup
nodep->unlinkFrBack();
}
UASSERT_OBJ(!v3Global.rootp()->modulesp(), v3Global.rootp(), "Unlink didn't work");
for (ModVec::iterator it = mods.begin(); it != mods.end(); ++it) {
for (ModVec::const_iterator it = mods.begin(); it != mods.end(); ++it) {
AstNodeModule* nodep = *it;
v3Global.rootp()->addModulep(nodep);
}