C++11: More range for. No functional change intended.
This commit is contained in:
parent
78aee6f4e7
commit
ac04e85a1c
|
|
@ -974,9 +974,7 @@ std::ostream& operator<<(std::ostream& os, const V3Hash& rhs) {
|
|||
|
||||
V3Hash::V3Hash(const string& name) {
|
||||
uint32_t val = 0;
|
||||
for (string::const_iterator it = name.begin(); it != name.end(); ++it) {
|
||||
val = val * 31 + *it;
|
||||
}
|
||||
for (const auto& c : name) val = val * 31 + c;
|
||||
setBoth(1, val);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -632,9 +632,7 @@ AstVar* AstVar::scVarRecurse(AstNode* nodep) {
|
|||
string AstVar::mtasksString() const {
|
||||
std::ostringstream os;
|
||||
os << "all: ";
|
||||
for (MTaskIdSet::const_iterator it = m_mtaskIds.begin(); it != m_mtaskIds.end(); ++it) {
|
||||
os << *it << " ";
|
||||
}
|
||||
for (const auto& id : m_mtaskIds) os << id << " ";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,10 +170,7 @@ public:
|
|||
void update(const V3ConfigModule& m) {
|
||||
m_tasks.update(m.m_tasks);
|
||||
m_vars.update(m.m_vars);
|
||||
for (StringSet::const_iterator it = m.m_coverageOffBlocks.begin();
|
||||
it != m.m_coverageOffBlocks.end(); ++it) {
|
||||
m_coverageOffBlocks.insert(*it);
|
||||
}
|
||||
for (const string& i : m.m_coverageOffBlocks) m_coverageOffBlocks.insert(i);
|
||||
if (!m_inline) {
|
||||
m_inline = m.m_inline;
|
||||
m_inlineValue = m.m_inlineValue;
|
||||
|
|
@ -210,9 +207,8 @@ public:
|
|||
void applyBlock(AstNodeBlock* nodep) {
|
||||
AstPragmaType pragma = AstPragmaType::COVERAGE_BLOCK_OFF;
|
||||
if (!nodep->unnamed()) {
|
||||
for (StringSet::const_iterator it = m_coverageOffBlocks.begin();
|
||||
it != m_coverageOffBlocks.end(); ++it) {
|
||||
if (VString::wildmatch(nodep->name(), *it)) {
|
||||
for (const string& i : m_coverageOffBlocks) {
|
||||
if (VString::wildmatch(nodep->name(), i)) {
|
||||
nodep->addStmtsp(new AstPragma(nodep->fileline(), pragma));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2013,8 +2013,7 @@ private:
|
|||
bool inPct = false;
|
||||
AstNode* argp = nodep->exprsp();
|
||||
string text = nodep->text();
|
||||
for (string::const_iterator it = text.begin(); it != text.end(); ++it) {
|
||||
char ch = *it;
|
||||
for (const char ch : text) {
|
||||
if (!inPct && ch == '%') {
|
||||
inPct = true;
|
||||
fmt = ch;
|
||||
|
|
|
|||
|
|
@ -2828,10 +2828,7 @@ void EmitCStmts::emitVarSort(const VarSortMap& vmap, VarVec* sortedp) {
|
|||
for (VarSortMap::const_iterator it = vmap.begin(); it != vmap.end(); ++it) {
|
||||
int size_class = it->first;
|
||||
const VarVec& vec = it->second;
|
||||
for (VarVec::const_iterator jt = vec.begin(); jt != vec.end(); ++jt) {
|
||||
const AstVar* varp = *jt;
|
||||
m2v[varp->mtaskIds()][size_class].push_back(varp);
|
||||
}
|
||||
for (const AstVar* varp : vec) { m2v[varp->mtaskIds()][size_class].push_back(varp); }
|
||||
}
|
||||
|
||||
// Create a TSP sort state for each MTaskIdSet footprint
|
||||
|
|
@ -2908,8 +2905,7 @@ void EmitCStmts::emitSortedVarList(const VarVec& anons, const VarVec& nonanons,
|
|||
}
|
||||
}
|
||||
// Output nonanons
|
||||
for (VarVec::const_iterator it = nonanons.begin(); it != nonanons.end(); ++it) {
|
||||
const AstVar* varp = *it;
|
||||
for (const AstVar* varp : nonanons) {
|
||||
emitVarCmtChg(varp, &curVarCmt);
|
||||
emitVarDecl(varp, prefixIfImp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,9 +226,7 @@ class CMakeEmitter {
|
|||
}
|
||||
*of << " ";
|
||||
const V3StringList& vFiles = v3Global.opt.vFiles();
|
||||
for (V3StringList::const_iterator it = vFiles.begin(); it != vFiles.end(); ++it) {
|
||||
*of << V3Os::filenameRealPath(*it);
|
||||
}
|
||||
for (const string& i : vFiles) *of << V3Os::filenameRealPath(i);
|
||||
*of << " VERILATOR_ARGS ";
|
||||
*of << "-f " << deslash(hblockp->commandArgsFileName(true))
|
||||
<< " -CFLAGS -fPIC" // hierarchical block will be static, but may be linked
|
||||
|
|
|
|||
|
|
@ -193,17 +193,13 @@ public:
|
|||
of.puts("VM_USER_CFLAGS = \\\n");
|
||||
if (!v3Global.opt.protectLib().empty()) of.puts("\t-fPIC \\\n");
|
||||
const V3StringList& cFlags = v3Global.opt.cFlags();
|
||||
for (V3StringList::const_iterator it = cFlags.begin(); it != cFlags.end(); ++it) {
|
||||
of.puts("\t" + *it + " \\\n");
|
||||
}
|
||||
for (const string& i : cFlags) of.puts("\t" + i + " \\\n");
|
||||
of.puts("\n");
|
||||
|
||||
of.puts("# User LDLIBS (from -LDFLAGS on Verilator command line)\n");
|
||||
of.puts("VM_USER_LDLIBS = \\\n");
|
||||
const V3StringList& ldLibs = v3Global.opt.ldLibs();
|
||||
for (V3StringList::const_iterator it = ldLibs.begin(); it != ldLibs.end(); ++it) {
|
||||
of.puts("\t" + *it + " \\\n");
|
||||
}
|
||||
for (const string& i : ldLibs) of.puts("\t" + i + " \\\n");
|
||||
of.puts("\n");
|
||||
|
||||
V3StringSet dirs;
|
||||
|
|
@ -236,8 +232,7 @@ public:
|
|||
of.puts("\n### Executable rules... (from --exe)\n");
|
||||
of.puts("VPATH += $(VM_USER_DIR)\n");
|
||||
of.puts("\n");
|
||||
for (V3StringSet::const_iterator it = cppFiles.begin(); it != cppFiles.end(); ++it) {
|
||||
string cppfile = *it;
|
||||
for (const string& cppfile : cppFiles) {
|
||||
string basename = V3Os::filenameNonExt(cppfile);
|
||||
// NOLINTNEXTLINE(performance-inefficient-string-concatenation)
|
||||
of.puts(basename + ".o: " + cppfile + "\n");
|
||||
|
|
@ -292,22 +287,17 @@ class EmitMkHierVerilation {
|
|||
of.puts("VM_HIER_VERILATOR := " + perl_wrapper + "\n");
|
||||
of.puts("VM_HIER_INPUT_FILES := \\\n");
|
||||
const V3StringList& vFiles = v3Global.opt.vFiles();
|
||||
for (V3StringList::const_iterator it = vFiles.begin(); it != vFiles.end(); ++it) {
|
||||
of.puts("\t" + V3Os::filenameRealPath(*it) + " \\\n");
|
||||
}
|
||||
for (const string& i : vFiles) of.puts("\t" + V3Os::filenameRealPath(i) + " \\\n");
|
||||
of.puts("\n");
|
||||
const V3StringSet& libraryFiles = v3Global.opt.libraryFiles();
|
||||
of.puts("VM_HIER_VERILOG_LIBS := \\\n");
|
||||
for (V3StringSet::const_iterator it = libraryFiles.begin(); it != libraryFiles.end();
|
||||
++it) {
|
||||
of.puts("\t" + V3Os::filenameRealPath(*it) + " \\\n");
|
||||
for (const string& i : libraryFiles) {
|
||||
of.puts("\t" + V3Os::filenameRealPath(i) + " \\\n");
|
||||
}
|
||||
of.puts("\n");
|
||||
}
|
||||
void emitOpts(V3OutMkFile& of, const V3StringList& opts) const {
|
||||
for (V3StringList::const_iterator it = opts.begin(); it != opts.end(); ++it) {
|
||||
of.puts("\t\t" + *it + " \\\n");
|
||||
}
|
||||
for (const string& i : opts) { of.puts("\t\t" + i + " \\\n"); }
|
||||
}
|
||||
void emitLaunchVerilator(V3OutMkFile& of, const string& argsFile) const {
|
||||
of.puts("\t@$(MAKE) -C $(VM_HIER_RUN_DIR) -f " + m_makefile
|
||||
|
|
|
|||
|
|
@ -421,16 +421,16 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
// %k Potential line break
|
||||
bool inPct = false;
|
||||
putbs("");
|
||||
for (string::const_iterator pos = format.begin(); pos != format.end(); ++pos) {
|
||||
if (pos[0] == '%') {
|
||||
for (const char c : format) {
|
||||
if (c == '%') {
|
||||
inPct = true;
|
||||
} else if (!inPct) { // Normal text
|
||||
string s;
|
||||
s += pos[0];
|
||||
s += c;
|
||||
puts(s);
|
||||
} else { // Format character
|
||||
inPct = false;
|
||||
switch (*pos) {
|
||||
switch (c) {
|
||||
case '%': puts("%"); break;
|
||||
case 'f': putfs(nodep, ""); break;
|
||||
case 'k': putbs(""); break;
|
||||
|
|
@ -459,7 +459,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
iterateAndNextNull(nodep->dtypep());
|
||||
break;
|
||||
}
|
||||
default: nodep->v3fatalSrc("Unknown emitVerilog format code: %" << pos[0]); break;
|
||||
default: nodep->v3fatalSrc("Unknown emitVerilog format code: %" << c); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -828,14 +828,12 @@ void V3OutFormatter::putsQuoted(const string& strg) {
|
|||
// Don't use to quote a filename for #include - #include doesn't \ escape.
|
||||
putcNoTracking('"');
|
||||
string quoted = quoteNameControls(strg);
|
||||
for (string::const_iterator cp = quoted.begin(); cp != quoted.end(); ++cp) {
|
||||
putcNoTracking(*cp);
|
||||
}
|
||||
for (const char c : quoted) putcNoTracking(c);
|
||||
putcNoTracking('"');
|
||||
}
|
||||
void V3OutFormatter::putsNoTracking(const string& strg) {
|
||||
// Don't track {}'s, probably because it's a $display format string
|
||||
for (string::const_iterator cp = strg.begin(); cp != strg.end(); ++cp) putcNoTracking(*cp);
|
||||
for (const char c : strg) putcNoTracking(c);
|
||||
}
|
||||
|
||||
void V3OutFormatter::putcNoTracking(char chr) {
|
||||
|
|
@ -864,43 +862,43 @@ string V3OutFormatter::quoteNameControls(const string& namein, V3OutFormatter::L
|
|||
string out;
|
||||
if (lang == LA_XML) {
|
||||
// Encode chars into XML string
|
||||
for (string::const_iterator pos = namein.begin(); pos != namein.end(); ++pos) {
|
||||
if (pos[0] == '"') {
|
||||
for (const char c : namein) {
|
||||
if (c == '"') {
|
||||
out += string(""");
|
||||
} else if (pos[0] == '\'') {
|
||||
} else if (c == '\'') {
|
||||
out += string("'");
|
||||
} else if (pos[0] == '<') {
|
||||
} else if (c == '<') {
|
||||
out += string("<");
|
||||
} else if (pos[0] == '>') {
|
||||
} else if (c == '>') {
|
||||
out += string(">");
|
||||
} else if (pos[0] == '&') {
|
||||
} else if (c == '&') {
|
||||
out += string("&");
|
||||
} else if (isprint(pos[0])) {
|
||||
out += pos[0];
|
||||
} else if (isprint(c)) {
|
||||
out += c;
|
||||
} else {
|
||||
char decimal[10];
|
||||
sprintf(decimal, "&#%u;", (unsigned char)pos[0]);
|
||||
sprintf(decimal, "&#%u;", (unsigned char)c);
|
||||
out += decimal;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Encode control chars into C style escapes
|
||||
for (string::const_iterator pos = namein.begin(); pos != namein.end(); ++pos) {
|
||||
if (pos[0] == '\\' || pos[0] == '"') {
|
||||
out += string("\\") + pos[0];
|
||||
} else if (pos[0] == '\n') {
|
||||
for (const char c : namein) {
|
||||
if (c == '\\' || c == '"') {
|
||||
out += string("\\") + c;
|
||||
} else if (c == '\n') {
|
||||
out += "\\n";
|
||||
} else if (pos[0] == '\r') {
|
||||
} else if (c == '\r') {
|
||||
out += "\\r";
|
||||
} else if (pos[0] == '\t') {
|
||||
} else if (c == '\t') {
|
||||
out += "\\t";
|
||||
} else if (isprint(pos[0])) {
|
||||
out += pos[0];
|
||||
} else if (isprint(c)) {
|
||||
out += c;
|
||||
} else {
|
||||
// This will also cover \a etc
|
||||
// Can't use %03o as messes up when signed
|
||||
char octal[10];
|
||||
sprintf(octal, "\\%o%o%o", (pos[0] >> 6) & 3, (pos[0] >> 3) & 7, pos[0] & 7);
|
||||
sprintf(octal, "\\%o%o%o", (c >> 6) & 3, (c >> 3) & 7, c & 7);
|
||||
out += octal;
|
||||
}
|
||||
}
|
||||
|
|
@ -937,9 +935,7 @@ V3OutFile::~V3OutFile() {
|
|||
|
||||
void V3OutFile::putsForceIncs() {
|
||||
const V3StringList& forceIncs = v3Global.opt.forceIncs();
|
||||
for (V3StringList::const_iterator it = forceIncs.begin(); it != forceIncs.end(); ++it) {
|
||||
puts("#include \"" + *it + "\"\n");
|
||||
}
|
||||
for (const string& i : forceIncs) { puts("#include \"" + i + "\"\n"); }
|
||||
}
|
||||
|
||||
void V3OutCFile::putsGuard() {
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ void V3Global::readFiles() {
|
|||
V3Parse parser(v3Global.rootp(), &filter, &parseSyms);
|
||||
// Read top module
|
||||
const V3StringList& vFiles = v3Global.opt.vFiles();
|
||||
for (V3StringList::const_iterator it = vFiles.begin(); it != vFiles.end(); ++it) {
|
||||
string filename = *it;
|
||||
for (const string& filename : vFiles) {
|
||||
parser.parseFile(new FileLine(FileLine::commandLineFilename()), filename, false,
|
||||
"Cannot find file containing module: ");
|
||||
}
|
||||
|
|
@ -62,8 +61,7 @@ void V3Global::readFiles() {
|
|||
// To be compatible with other simulators,
|
||||
// this needs to be done after the top file is read
|
||||
const V3StringSet& libraryFiles = v3Global.opt.libraryFiles();
|
||||
for (V3StringSet::const_iterator it = libraryFiles.begin(); it != libraryFiles.end(); ++it) {
|
||||
string filename = *it;
|
||||
for (const string& filename : libraryFiles) {
|
||||
parser.parseFile(new FileLine(FileLine::commandLineFilename()), filename, true,
|
||||
"Cannot find file containing library module: ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -505,10 +505,7 @@ void V3Graph::sortEdges() {
|
|||
// We know the vector contains all of the edges that were
|
||||
// there originally (didn't delete or add)
|
||||
vertexp->outUnlink();
|
||||
for (std::vector<V3GraphEdge*>::const_iterator it = edges.begin(); it != edges.end();
|
||||
++it) {
|
||||
(*it)->outPushBack();
|
||||
}
|
||||
for (V3GraphEdge* edgep : edges) edgep->outPushBack();
|
||||
// Prep for next
|
||||
edges.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,11 +133,7 @@ private:
|
|||
uint32_t hashDfaOrigins(const DfaStates& nfasWithInput) {
|
||||
// Find the NFA states this dfa came from,
|
||||
uint32_t hash = 0;
|
||||
for (DfaStates::const_iterator nfaIt = nfasWithInput.begin(); nfaIt != nfasWithInput.end();
|
||||
++nfaIt) {
|
||||
DfaVertex* nfaStatep = *nfaIt;
|
||||
hash ^= hashVertex(nfaStatep);
|
||||
}
|
||||
for (DfaVertex* nfaStatep : nfasWithInput) hash ^= hashVertex(nfaStatep);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -147,9 +143,7 @@ private:
|
|||
nextStep();
|
||||
// Mark all input vertexes
|
||||
int num1s = 0;
|
||||
for (DfaStates::const_iterator nfaIt = nfasWithInput.begin(); nfaIt != nfasWithInput.end();
|
||||
++nfaIt) {
|
||||
DfaVertex* nfaStatep = *nfaIt;
|
||||
for (DfaVertex* nfaStatep : nfasWithInput) {
|
||||
nfaStatep->user(m_step);
|
||||
num1s++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,14 +91,10 @@ static string V3HierCommandArgsFileName(const string& prefix, bool forCMake) {
|
|||
static void V3HierWriteCommonInputs(std::ostream* of, bool forCMake) {
|
||||
if (!forCMake) {
|
||||
const V3StringList& vFiles = v3Global.opt.vFiles();
|
||||
for (V3StringList::const_iterator it = vFiles.begin(); it != vFiles.end(); ++it) {
|
||||
*of << *it << "\n";
|
||||
}
|
||||
for (const string& i : vFiles) *of << i << "\n";
|
||||
}
|
||||
const V3StringSet& libraryFiles = v3Global.opt.libraryFiles();
|
||||
for (V3StringSet::const_iterator it = libraryFiles.begin(); it != libraryFiles.end(); ++it) {
|
||||
*of << "-v " << *it << "\n";
|
||||
}
|
||||
for (const string& i : libraryFiles) *of << "-v " << i << "\n";
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
|
|
@ -211,9 +207,7 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const {
|
|||
*of << "-Mdir " << v3Global.opt.makeDir() << "/" << hierPrefix() << " \n";
|
||||
V3HierWriteCommonInputs(of.get(), forCMake);
|
||||
const V3StringList& commandOpts = commandArgs(false);
|
||||
for (V3StringList::const_iterator it = commandOpts.begin(); it != commandOpts.end(); ++it) {
|
||||
*of << (*it) << "\n";
|
||||
}
|
||||
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) {
|
||||
|
|
@ -262,9 +256,7 @@ class HierBlockUsageCollectVisitor : public AstNVisitor {
|
|||
|
||||
if (nodep->hierBlock()) {
|
||||
m_planp->add(nodep, m_gparams);
|
||||
for (ModuleSet::const_iterator it = m_referred.begin(); it != m_referred.end(); ++it) {
|
||||
m_planp->registerUsage(nodep, *it);
|
||||
}
|
||||
for (const AstModule* modp : m_referred) m_planp->registerUsage(nodep, modp);
|
||||
m_hierBlockp = prevHierBlockp;
|
||||
m_referred = prevReferred;
|
||||
}
|
||||
|
|
@ -406,9 +398,7 @@ void V3HierBlockPlan::writeCommandArgsFiles(bool forCMake) const {
|
|||
V3HierWriteCommonInputs(of.get(), forCMake);
|
||||
if (!forCMake) {
|
||||
const V3StringSet& cppFiles = v3Global.opt.cppFiles();
|
||||
for (V3StringSet::const_iterator it = cppFiles.begin(); it != cppFiles.end(); ++it) {
|
||||
*of << *it << "\n";
|
||||
}
|
||||
for (const string& i : cppFiles) *of << i << "\n";
|
||||
*of << "--top-module " << v3Global.rootp()->topModulep()->name() << "\n";
|
||||
*of << "--prefix " << v3Global.opt.prefix() << "\n";
|
||||
*of << "-Mdir " << v3Global.opt.makeDir() << "\n";
|
||||
|
|
|
|||
|
|
@ -61,8 +61,7 @@ void V3LinkLevel::modSortByLevel() {
|
|||
<< "... Suggest see manual; fix the duplicates, or use "
|
||||
"--top-module to select top."
|
||||
<< V3Error::warnContextNone());
|
||||
for (ModVec::const_iterator it = tops.begin(); it != tops.end(); ++it) {
|
||||
AstNode* alsop = *it;
|
||||
for (AstNode* alsop : tops) {
|
||||
std::cout << secp->warnMore() << "... Top module " << alsop->prettyNameQ() << endl
|
||||
<< alsop->warnContextSecondary();
|
||||
}
|
||||
|
|
@ -74,17 +73,13 @@ 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::const_iterator it = mods.begin(); it != mods.end(); ++it) {
|
||||
AstNodeModule* nodep = *it;
|
||||
for (AstNodeModule* nodep : mods) {
|
||||
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::const_iterator it = mods.begin(); it != mods.end(); ++it) {
|
||||
AstNodeModule* nodep = *it;
|
||||
v3Global.rootp()->addModulep(nodep);
|
||||
}
|
||||
for (AstNodeModule* nodep : mods) v3Global.rootp()->addModulep(nodep);
|
||||
UINFO(9, "modSortByLevel() done\n"); // Comment required for gcc4.6.3 / bug666
|
||||
V3Global::dumpCheckGlobalTree("cells", false, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
||||
}
|
||||
|
|
@ -105,8 +100,7 @@ void V3LinkLevel::timescaling(const ModVec& mods) {
|
|||
if (unit.isNone()) unit = VTimescale(VTimescale::TS_DEFAULT);
|
||||
v3Global.rootp()->timeunit(unit);
|
||||
|
||||
for (ModVec::const_iterator it = mods.begin(); it != mods.end(); ++it) {
|
||||
AstNodeModule* nodep = *it;
|
||||
for (AstNodeModule* nodep : mods) {
|
||||
if (nodep->timeunit().isNone()) {
|
||||
if (modTimedp && !VN_IS(nodep, Iface)
|
||||
&& !(VN_IS(nodep, Package) && VN_CAST(nodep, Package)->isDollarUnit())) {
|
||||
|
|
|
|||
|
|
@ -304,8 +304,7 @@ private:
|
|||
bool inPct = false;
|
||||
bool inIgnore = false;
|
||||
string fmt;
|
||||
for (string::const_iterator it = format.begin(); it != format.end(); ++it) {
|
||||
char ch = *it;
|
||||
for (const char ch : format) {
|
||||
if (!inPct && ch == '%') {
|
||||
inPct = true;
|
||||
inIgnore = false;
|
||||
|
|
|
|||
|
|
@ -385,10 +385,9 @@ void V3Options::addArg(const string& arg) { m_impp->m_allArgs.push_back(arg); }
|
|||
|
||||
string V3Options::allArgsString() const {
|
||||
string out;
|
||||
for (std::list<string>::const_iterator it = m_impp->m_allArgs.begin();
|
||||
it != m_impp->m_allArgs.end(); ++it) {
|
||||
for (const string& i : m_impp->m_allArgs) {
|
||||
if (out != "") out += " ";
|
||||
out += *it;
|
||||
out += i;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
|
@ -1706,9 +1705,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
|
|||
// Convert to argv style arg list and parse them
|
||||
std::vector<char*> argv;
|
||||
argv.reserve(args.size() + 1);
|
||||
for (std::vector<std::string>::const_iterator it = args.begin(); it != args.end(); ++it) {
|
||||
argv.push_back(const_cast<char*>(it->c_str()));
|
||||
}
|
||||
for (const string& i : args) argv.push_back(const_cast<char*>(i.c_str()));
|
||||
argv.push_back(nullptr); // argv is nullptr-terminated
|
||||
parseOptsList(fl, optdir, static_cast<int>(argv.size() - 1), argv.data());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -782,15 +782,11 @@ protected:
|
|||
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
|
||||
for (ColorSet::const_iterator color = colors.begin(); color != colors.end(); ++color) {
|
||||
m_addAfter[*color] = clones[*color]->elsesp();
|
||||
}
|
||||
for (const auto& color : colors) m_addAfter[color] = clones[color]->elsesp();
|
||||
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
|
||||
for (ColorSet::const_iterator color = colors.begin(); color != colors.end(); ++color) {
|
||||
m_addAfter[*color] = clones[*color];
|
||||
}
|
||||
for (const auto& color : colors) m_addAfter[color] = clones[color];
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -803,8 +799,7 @@ class RemovePlaceholdersVisitor : public AstNVisitor {
|
|||
public:
|
||||
explicit RemovePlaceholdersVisitor(AstNode* nodep) {
|
||||
iterate(nodep);
|
||||
for (NodeSet::const_iterator it = m_removeSet.begin(); it != m_removeSet.end(); ++it) {
|
||||
AstNode* np = *it;
|
||||
for (AstNode* np : m_removeSet) {
|
||||
np->unlinkFrBack(); // Without next
|
||||
VL_DO_DANGLING(np->deleteTree(), np);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,12 +135,10 @@ class StatsReport {
|
|||
|
||||
// Header
|
||||
os << " Stat " << std::left << std::setw(maxWidth - 5 - 2) << "";
|
||||
for (Stages::const_iterator it = stages.begin(); it != stages.end(); ++it) {
|
||||
os << " " << std::left << std::setw(9) << *it;
|
||||
}
|
||||
for (const string& i : stages) os << " " << std::left << std::setw(9) << i;
|
||||
os << endl;
|
||||
os << " -------- " << std::left << std::setw(maxWidth - 5 - 2) << "";
|
||||
for (Stages::const_iterator it = stages.begin(); it != stages.end(); ++it) {
|
||||
for (auto it = stages.begin(); it != stages.end(); ++it) {
|
||||
os << " " << std::left << std::setw(9) << "-------";
|
||||
}
|
||||
// os<<endl;
|
||||
|
|
|
|||
|
|
@ -86,9 +86,9 @@ string VString::upcase(const string& str) {
|
|||
|
||||
string VString::quoteAny(const string& str, char tgt, char esc) {
|
||||
string out;
|
||||
for (string::const_iterator pos = str.begin(); pos != str.end(); ++pos) {
|
||||
if (*pos == tgt) out += esc;
|
||||
out += *pos;
|
||||
for (const char c : str) {
|
||||
if (c == tgt) out += esc;
|
||||
out += c;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
|
@ -100,9 +100,9 @@ string VString::quoteStringLiteralForShell(const string& str) {
|
|||
result.push_back(dquote); // Start quoted string
|
||||
result.push_back(escape);
|
||||
result.push_back(dquote); // "
|
||||
for (string::const_iterator it = str.begin(); it != str.end(); ++it) {
|
||||
if (*it == dquote || *it == escape) { result.push_back(escape); }
|
||||
result.push_back(*it);
|
||||
for (const char c : str) {
|
||||
if (c == dquote || c == escape) result.push_back(escape);
|
||||
result.push_back(c);
|
||||
}
|
||||
result.push_back(escape);
|
||||
result.push_back(dquote); // "
|
||||
|
|
@ -112,9 +112,9 @@ string VString::quoteStringLiteralForShell(const string& str) {
|
|||
|
||||
string VString::spaceUnprintable(const string& str) {
|
||||
string out;
|
||||
for (string::const_iterator pos = str.begin(); pos != str.end(); ++pos) {
|
||||
if (isprint(*pos)) {
|
||||
out += *pos;
|
||||
for (const char c : str) {
|
||||
if (isprint(c)) {
|
||||
out += c;
|
||||
} else {
|
||||
out += ' ';
|
||||
}
|
||||
|
|
@ -125,15 +125,15 @@ string VString::spaceUnprintable(const string& str) {
|
|||
string VString::removeWhitespace(const string& str) {
|
||||
string out;
|
||||
out.reserve(str.size());
|
||||
for (string::const_iterator pos = str.begin(); pos != str.end(); ++pos) {
|
||||
if (!isspace(*pos)) out += *pos;
|
||||
for (const char c : str) {
|
||||
if (!isspace(c)) out += c;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool VString::isWhitespace(const string& str) {
|
||||
for (string::const_iterator pos = str.begin(); pos != str.end(); ++pos) {
|
||||
if (!isspace(*pos)) return false;
|
||||
for (const char c : str) {
|
||||
if (!isspace(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -452,8 +452,7 @@ string VSpellCheck::bestCandidateInfo(const string& goal, EditDistance& distance
|
|||
string bestCandidate;
|
||||
size_t gLen = goal.length();
|
||||
distancer = LENGTH_LIMIT * 10;
|
||||
for (Candidates::const_iterator it = m_candidates.begin(); it != m_candidates.end(); ++it) {
|
||||
const string candidate = *it;
|
||||
for (const string& candidate : m_candidates) {
|
||||
size_t cLen = candidate.length();
|
||||
|
||||
// Min distance must be inserting/deleting to make lengths match
|
||||
|
|
|
|||
|
|
@ -652,9 +652,7 @@ void V3TSP::selfTestString() {
|
|||
expect.push_back("3");
|
||||
|
||||
if (VL_UNCOVERABLE(expect != result)) {
|
||||
for (std::vector<string>::const_iterator it = result.begin(); it != result.end(); ++it) {
|
||||
cout << *it << " ";
|
||||
}
|
||||
for (const string& i : result) cout << i << " ";
|
||||
cout << endl;
|
||||
v3fatalSrc("TSP string self-test fail. Result (above) did not match expectation.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,10 +47,7 @@ void V3Waiver::write(const std::string& filename) {
|
|||
|
||||
if (s_waiverList.size() == 0) { *ofp << "// No waivers needed - great!" << endl; }
|
||||
|
||||
for (V3Waiver::WaiverList::const_iterator it = s_waiverList.begin(); it != s_waiverList.end();
|
||||
++it) {
|
||||
*ofp << "// " << *it << std::endl << endl;
|
||||
}
|
||||
for (const auto& i : s_waiverList) *ofp << "// " << i << std::endl << endl;
|
||||
}
|
||||
|
||||
V3Waiver::WaiverList V3Waiver::s_waiverList;
|
||||
|
|
|
|||
|
|
@ -3234,8 +3234,7 @@ private:
|
|||
AstNode* argp = nodep->exprsp();
|
||||
string txt = nodep->text();
|
||||
string fmt;
|
||||
for (string::const_iterator it = txt.begin(); it != txt.end(); ++it) {
|
||||
char ch = *it;
|
||||
for (char ch : txt) {
|
||||
if (!inPct && ch == '%') {
|
||||
inPct = true;
|
||||
fmt = ch;
|
||||
|
|
|
|||
|
|
@ -636,10 +636,8 @@ static string buildMakeCmd(const string& makefile, const string& target) {
|
|||
} else if (jobs > 1) {
|
||||
cmd << " -j " << jobs;
|
||||
}
|
||||
for (V3StringList::const_iterator it = makeFlags.begin(); it != makeFlags.end(); ++it) {
|
||||
cmd << ' ' << *it;
|
||||
}
|
||||
if (!target.empty()) { cmd << ' ' << target; }
|
||||
for (const string& flag : makeFlags) cmd << ' ' << flag;
|
||||
if (!target.empty()) cmd << ' ' << target;
|
||||
|
||||
return cmd.str();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue