diff --git a/src/V3Options.cpp b/src/V3Options.cpp index dee87bee05..ae32fdf3de 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -418,24 +418,23 @@ string V3Options::allArgsStringForHierBlock(bool forTop, bool forCMake) const { string out; bool stripArg = false; bool stripArgIfNum = false; - for (std::list::const_iterator it = m_impp->m_lineArgs.begin(); - it != m_impp->m_lineArgs.end(); ++it) { + for (const string& arg : m_impp->m_lineArgs) { if (stripArg) { stripArg = false; continue; } if (stripArgIfNum) { stripArgIfNum = false; - if (isdigit((*it)[0])) continue; + if (isdigit(arg[0])) continue; } int skip = 0; - if (it->length() >= 2 && (*it)[0] == '-' && (*it)[1] == '-') { + if (arg.length() >= 2 && arg[0] == '-' && arg[1] == '-') { skip = 2; - } else if (it->length() >= 1 && (*it)[0] == '-') { + } else if (arg.length() >= 1 && arg[0] == '-') { skip = 1; } - if (skip > 0) { // *it is an option - const string opt = it->substr(skip); // Remove '-' in the beginning + if (skip > 0) { // arg is an option + const string opt = arg.substr(skip); // Remove '-' in the beginning const int numStrip = stripOptionsForChildRun(opt, forTop); if (numStrip) { UASSERT(0 <= numStrip && numStrip <= 3, "should be one of 0, 1, 2, 3"); @@ -444,15 +443,15 @@ string V3Options::allArgsStringForHierBlock(bool forTop, bool forCMake) const { continue; } } else { // Not an option - if ((forCMake && vFiles.find(*it) != vFiles.end()) // Remove HDL - || m_cppFiles.find(*it) != m_cppFiles.end()) { // Remove C++ + if ((forCMake && vFiles.find(arg) != vFiles.end()) // Remove HDL + || m_cppFiles.find(arg) != m_cppFiles.end()) { // Remove C++ continue; } } if (out != "") out += " "; - // Don't use opt here because '-' is removed in it - // Use double quote because *it may contain whitespaces - out += '"' + VString::quoteAny(*it, '"', '\\') + '"'; + // Don't use opt here because '-' is removed in arg + // Use double quote because arg may contain whitespaces + out += '"' + VString::quoteAny(arg, '"', '\\') + '"'; } return out; } diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index 1a8076be4a..df44d53a5b 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -271,8 +271,8 @@ void V3ParseImp::preprocDumps(std::ostream& os, bool forInputs) { for (auto& buf : m_ppBuffers) { if (noblanks) { bool blank = true; - for (string::iterator its = buf.begin(); its != buf.end(); ++its) { - if (!std::isspace(*its) && *its != '\n') { + for (const char ch : buf) { + if (!std::isspace(ch) && ch != '\n') { blank = false; break; }