Commit 6cf4e6dc authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Port to C++11 range-based for loops

Performed using modernize-loop-convert from clang-tidy.

Manual intervention was needed in MacroValue.cc because of a variable name
capture issue.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html
parent 80d1e1e1
This diff is collapsed.
......@@ -269,12 +269,11 @@ ConfigFile::getConfigFileInfo(const string &config_file)
{
vector<string> tokenizedPath;
split(tokenizedPath, tokenizedLine.back(), is_any_of(":"), token_compress_on);
for (vector<string>::iterator it = tokenizedPath.begin();
it != tokenizedPath.end(); it++)
if (!it->empty())
for (auto & it : tokenizedPath)
if (!it.empty())
{
trim(*it);
includepath.push_back(*it);
trim(it);
includepath.push_back(it);
}
}
else
......@@ -524,11 +523,11 @@ void
ConfigFile::checkPass(WarningConsolidation &warnings) const
{
bool global_init_file_declared = false;
for (vector<Hook *>::const_iterator it = hooks.begin(); it != hooks.end(); it++)
for (auto hook : hooks)
{
const map <string, string> hookmap = (*it)->get_hooks();
for (map <string, string>::const_iterator mapit = hookmap.begin(); mapit != hookmap.end(); mapit++)
if (mapit->first.compare("global_init_file") == 0)
const map <string, string> hookmap = hook->get_hooks();
for (const auto & mapit : hookmap)
if (mapit.first.compare("global_init_file") == 0)
if (global_init_file_declared == true)
{
cerr << "ERROR: Only one global initialization file may be provided." << endl;
......@@ -548,56 +547,55 @@ ConfigFile::checkPass(WarningConsolidation &warnings) const
exit(EXIT_FAILURE);
}
for (map<string, SlaveNode *>::const_iterator it = slave_nodes.begin();
it != slave_nodes.end(); it++)
for (const auto & slave_node : slave_nodes)
{
#if !defined(_WIN32) && !defined(__CYGWIN32__)
//For Linux/Mac, check that cpuNbr starts at 0
if (it->second->minCpuNbr != 0)
if (slave_node.second->minCpuNbr != 0)
warnings << "WARNING: On Unix-based operating systems, you cannot specify the CPU that is "
<< "used in parallel processing. This will be adjusted for you such that the "
<< "same number of CPUs are used." << endl;
#endif
if (!it->second->port.empty())
if (!slave_node.second->port.empty())
try
{
boost::lexical_cast< int >(it->second->port);
boost::lexical_cast< int >(slave_node.second->port);
}
catch (const boost::bad_lexical_cast &)
{
cerr << "ERROR (node " << it->first << "): the port must be an integer." << endl;
cerr << "ERROR (node " << slave_node.first << "): the port must be an integer." << endl;
exit(EXIT_FAILURE);
}
if (!it->second->computerName.compare("localhost")) // We are working locally
if (!slave_node.second->computerName.compare("localhost")) // We are working locally
{
if (!it->second->remoteDrive.empty())
if (!slave_node.second->remoteDrive.empty())
{
cerr << "ERROR (node " << it->first << "): the RemoteDrive option may not be passed for a local node." << endl;
cerr << "ERROR (node " << slave_node.first << "): the RemoteDrive option may not be passed for a local node." << endl;
exit(EXIT_FAILURE);
}
if (!it->second->remoteDirectory.empty())
if (!slave_node.second->remoteDirectory.empty())
{
cerr << "ERROR (node " << it->first << "): the RemoteDirectory option may not be passed for a local node." << endl;
cerr << "ERROR (node " << slave_node.first << "): the RemoteDirectory option may not be passed for a local node." << endl;
exit(EXIT_FAILURE);
}
}
else
{
if (it->second->userName.empty())
if (slave_node.second->userName.empty())
{
cerr << "ERROR (node " << it->first << "): the UserName option must be passed for every remote node." << endl;
cerr << "ERROR (node " << slave_node.first << "): the UserName option must be passed for every remote node." << endl;
exit(EXIT_FAILURE);
}
if (it->second->operatingSystem.compare("windows") == 0)
if (slave_node.second->operatingSystem.compare("windows") == 0)
{
if (it->second->password.empty())
if (slave_node.second->password.empty())
{
cerr << "ERROR (node " << it->first << "): the Password option must be passed under Windows for every remote node." << endl;
cerr << "ERROR (node " << slave_node.first << "): the Password option must be passed under Windows for every remote node." << endl;
exit(EXIT_FAILURE);
}
if (it->second->remoteDrive.empty())
if (slave_node.second->remoteDrive.empty())
{
cerr << "ERROR (node " << it->first << "): the RemoteDrive option must be passed under Windows for every remote node." << endl;
cerr << "ERROR (node " << slave_node.first << "): the RemoteDrive option must be passed under Windows for every remote node." << endl;
exit(EXIT_FAILURE);
}
}
......@@ -616,9 +614,9 @@ ConfigFile::checkPass(WarningConsolidation &warnings) const
}
}
#endif
if (it->second->remoteDirectory.empty())
if (slave_node.second->remoteDirectory.empty())
{
cerr << "ERROR (node " << it->first << "): the RemoteDirectory must be specified for every remote node." << endl;
cerr << "ERROR (node " << slave_node.first << "): the RemoteDirectory must be specified for every remote node." << endl;
exit(EXIT_FAILURE);
}
}
......@@ -637,13 +635,12 @@ ConfigFile::checkPass(WarningConsolidation &warnings) const
exit(EXIT_FAILURE);
}
for (map<string, Cluster *>::const_iterator it = clusters.begin();
it != clusters.end(); it++)
for (member_nodes_t::const_iterator itmn = it->second->member_nodes.begin();
itmn != it->second->member_nodes.end(); itmn++)
for (const auto & cluster : clusters)
for (member_nodes_t::const_iterator itmn = cluster.second->member_nodes.begin();
itmn != cluster.second->member_nodes.end(); itmn++)
if (slave_nodes.find(itmn->first) == slave_nodes.end())
{
cerr << "Error: node " << itmn->first << " specified in cluster " << it->first << " was not found" << endl;
cerr << "Error: node " << itmn->first << " specified in cluster " << cluster.first << " was not found" << endl;
exit(EXIT_FAILURE);
}
}
......@@ -676,21 +673,20 @@ ConfigFile::transformPass()
it != cluster_it->second->member_nodes.end(); it++)
weight_denominator += it->second;
for (member_nodes_t::iterator it = cluster_it->second->member_nodes.begin();
it != cluster_it->second->member_nodes.end(); it++)
it->second /= weight_denominator;
for (auto & member_node : cluster_it->second->member_nodes)
member_node.second /= weight_denominator;
}
vector<string>
ConfigFile::getIncludePaths() const
{
vector<string> include_paths;
for (vector<Path *>::const_iterator it = paths.begin(); it != paths.end(); it++)
for (auto path : paths)
{
map <string, vector<string> > pathmap = (*it)->get_paths();
map <string, vector<string> > pathmap = path->get_paths();
for (map <string, vector<string> >::const_iterator mapit = pathmap.begin(); mapit != pathmap.end(); mapit++)
for (vector<string>::const_iterator vecit = mapit->second.begin(); vecit != mapit->second.end(); vecit++)
include_paths.push_back(*vecit);
for (const auto & vecit : mapit->second)
include_paths.push_back(vecit);
}
return include_paths;
}
......@@ -698,9 +694,9 @@ ConfigFile::getIncludePaths() const
void
ConfigFile::writeHooks(ostream &output) const
{
for (vector<Hook *>::const_iterator it = hooks.begin(); it != hooks.end(); it++)
for (auto hook : hooks)
{
map <string, string> hookmap = (*it)->get_hooks();
map <string, string> hookmap = hook->get_hooks();
for (map <string, string>::const_iterator mapit = hookmap.begin(); mapit != hookmap.end(); mapit++)
output << "options_." << mapit->first << " = '" << mapit->second << "';" << endl;
}
......@@ -719,13 +715,12 @@ ConfigFile::writeCluster(ostream &output) const
cluster_it = clusters.find(cluster_name);
int i = 1;
for (map<string, SlaveNode *>::const_iterator it = slave_nodes.begin();
it != slave_nodes.end(); it++)
for (const auto & slave_node : slave_nodes)
{
bool slave_node_in_member_nodes = false;
for (member_nodes_t::const_iterator itmn = cluster_it->second->member_nodes.begin();
itmn != cluster_it->second->member_nodes.end(); itmn++)
if (!it->first.compare(itmn->first))
if (!slave_node.first.compare(itmn->first))
slave_node_in_member_nodes = true;
if (!slave_node_in_member_nodes)
......@@ -736,25 +731,25 @@ ConfigFile::writeCluster(ostream &output) const
output << "(" << i << ")";
i++;
output << " = struct('Local', ";
if (it->second->computerName.compare("localhost"))
if (slave_node.second->computerName.compare("localhost"))
output << "0, ";
else
output << "1, ";
output << "'ComputerName', '" << it->second->computerName << "', "
<< "'Port', '" << it->second->port << "', "
<< "'CPUnbr', [" << it->second->minCpuNbr << ":" << it->second->maxCpuNbr << "], "
<< "'UserName', '" << it->second->userName << "', "
<< "'Password', '" << it->second->password << "', "
<< "'RemoteDrive', '" << it->second->remoteDrive << "', "
<< "'RemoteDirectory', '" << it->second->remoteDirectory << "', "
<< "'DynarePath', '" << it->second->dynarePath << "', "
<< "'MatlabOctavePath', '" << it->second->matlabOctavePath << "', "
<< "'OperatingSystem', '" << it->second->operatingSystem << "', "
<< "'NodeWeight', '" << (cluster_it->second->member_nodes.find(it->first))->second << "', "
<< "'NumberOfThreadsPerJob', " << it->second->numberOfThreadsPerJob << ", ";
if (it->second->singleCompThread)
output << "'ComputerName', '" << slave_node.second->computerName << "', "
<< "'Port', '" << slave_node.second->port << "', "
<< "'CPUnbr', [" << slave_node.second->minCpuNbr << ":" << slave_node.second->maxCpuNbr << "], "
<< "'UserName', '" << slave_node.second->userName << "', "
<< "'Password', '" << slave_node.second->password << "', "
<< "'RemoteDrive', '" << slave_node.second->remoteDrive << "', "
<< "'RemoteDirectory', '" << slave_node.second->remoteDirectory << "', "
<< "'DynarePath', '" << slave_node.second->dynarePath << "', "
<< "'MatlabOctavePath', '" << slave_node.second->matlabOctavePath << "', "
<< "'OperatingSystem', '" << slave_node.second->operatingSystem << "', "
<< "'NodeWeight', '" << (cluster_it->second->member_nodes.find(slave_node.first))->second << "', "
<< "'NumberOfThreadsPerJob', " << slave_node.second->numberOfThreadsPerJob << ", ";
if (slave_node.second->singleCompThread)
output << "'SingleCompThread', 'true');" << endl;
else
output << "'SingleCompThread', 'false');" << endl;
......
......@@ -46,8 +46,8 @@ DataTree::DataTree(SymbolTable &symbol_table_arg,
DataTree::~DataTree()
{
for (node_list_t::iterator it = node_list.begin(); it != node_list.end(); it++)
delete *it;
for (auto & it : node_list)
delete it;
}
expr_t
......@@ -75,9 +75,8 @@ DataTree::AddVariableInternal(int symb_id, int lag)
bool
DataTree::ParamUsedWithLeadLagInternal() const
{
for (variable_node_map_t::const_iterator it = variable_node_map.begin();
it != variable_node_map.end(); it++)
if (symbol_table.getType(it->first.first) == eParameter && it->first.second != 0)
for (const auto & it : variable_node_map)
if (symbol_table.getType(it.first.first) == eParameter && it.first.second != 0)
return true;
return false;
}
......@@ -588,9 +587,8 @@ DataTree::AddSecondDerivExternalFunction(int top_level_symb_id, const vector<exp
bool
DataTree::isSymbolUsed(int symb_id) const
{
for (variable_node_map_t::const_iterator it = variable_node_map.begin();
it != variable_node_map.end(); it++)
if (it->first.first == symb_id)
for (const auto & it : variable_node_map)
if (it.first.first == symb_id)
return true;
if (local_variables_table.find(symb_id) != local_variables_table.end())
......@@ -637,9 +635,8 @@ DataTree::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException)
bool
DataTree::isUnaryOpUsed(UnaryOpcode opcode) const
{
for (unary_op_node_map_t::const_iterator it = unary_op_node_map.begin();
it != unary_op_node_map.end(); it++)
if (it->first.first.second == opcode)
for (const auto & it : unary_op_node_map)
if (it.first.first.second == opcode)
return true;
return false;
......@@ -648,9 +645,8 @@ DataTree::isUnaryOpUsed(UnaryOpcode opcode) const
bool
DataTree::isBinaryOpUsed(BinaryOpcode opcode) const
{
for (binary_op_node_map_t::const_iterator it = binary_op_node_map.begin();
it != binary_op_node_map.end(); it++)
if (it->first.second == opcode)
for (const auto & it : binary_op_node_map)
if (it.first.second == opcode)
return true;
return false;
......@@ -659,9 +655,8 @@ DataTree::isBinaryOpUsed(BinaryOpcode opcode) const
bool
DataTree::isTrinaryOpUsed(TrinaryOpcode opcode) const
{
for (trinary_op_node_map_t::const_iterator it = trinary_op_node_map.begin();
it != trinary_op_node_map.end(); it++)
if (it->first.second == opcode)
for (const auto & it : trinary_op_node_map)
if (it.first.second == opcode)
return true;
return false;
......@@ -670,9 +665,8 @@ DataTree::isTrinaryOpUsed(TrinaryOpcode opcode) const
bool
DataTree::isExternalFunctionUsed(int symb_id) const
{
for (external_function_node_map_t::const_iterator it = external_function_node_map.begin();
it != external_function_node_map.end(); it++)
if (it->first.second == symb_id)
for (const auto & it : external_function_node_map)
if (it.first.second == symb_id)
return true;
return false;
......@@ -681,9 +675,8 @@ DataTree::isExternalFunctionUsed(int symb_id) const
bool
DataTree::isFirstDerivExternalFunctionUsed(int symb_id) const
{
for (first_deriv_external_function_node_map_t::const_iterator it = first_deriv_external_function_node_map.begin();
it != first_deriv_external_function_node_map.end(); it++)
if (it->first.second == symb_id)
for (const auto & it : first_deriv_external_function_node_map)
if (it.first.second == symb_id)
return true;
return false;
......@@ -692,9 +685,8 @@ DataTree::isFirstDerivExternalFunctionUsed(int symb_id) const
bool
DataTree::isSecondDerivExternalFunctionUsed(int symb_id) const
{
for (second_deriv_external_function_node_map_t::const_iterator it = second_deriv_external_function_node_map.begin();
it != second_deriv_external_function_node_map.end(); it++)
if (it->first.second == symb_id)
for (const auto & it : second_deriv_external_function_node_map)
if (it.first.second == symb_id)
return true;
return false;
......@@ -704,10 +696,9 @@ int
DataTree::minLagForSymbol(int symb_id) const
{
int r = 0;
for (variable_node_map_t::const_iterator it = variable_node_map.begin();
it != variable_node_map.end(); ++it)
if (it->first.first == symb_id && it->first.second < r)
r = it->first.second;
for (const auto & it : variable_node_map)
if (it.first.first == symb_id && it.first.second < r)
r = it.first.second;
return r;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -116,9 +116,8 @@ inline int
ExternalFunctionsTable::get_total_number_of_unique_model_block_external_functions() const
{
int number_of_unique_model_block_external_functions = 0;
for (external_function_table_type::const_iterator it = externalFunctionTable.begin();
it != externalFunctionTable.end(); it++)
if (it->second.nargs > 0)
for (auto it : externalFunctionTable)
if (it.second.nargs > 0)
number_of_unique_model_block_external_functions++;
return number_of_unique_model_block_external_functions;
......
......@@ -48,9 +48,8 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
ModFile::~ModFile()
{
for (vector<Statement *>::iterator it = statements.begin();
it != statements.end(); it++)
delete (*it);
for (auto & statement : statements)
delete statement;
}
void
......@@ -112,9 +111,8 @@ ModFile::addStatementAtFront(Statement *st)
void
ModFile::checkPass(bool nostrict, bool stochastic)
{
for (vector<Statement *>::iterator it = statements.begin();
it != statements.end(); it++)
(*it)->checkPass(mod_file_struct, warnings);
for (auto & statement : statements)
statement->checkPass(mod_file_struct, warnings);
// Check the steady state block
steady_state_model.checkPass(mod_file_struct, warnings);
......@@ -332,8 +330,8 @@ ModFile::checkPass(bool nostrict, bool stochastic)
if (unusedExo.size() > 0)
{
ostringstream unused_exos;
for (set<int>::iterator it = unusedExo.begin(); it != unusedExo.end(); it++)
unused_exos << symbol_table.getName(*it) << " ";
for (int it : unusedExo)
unused_exos << symbol_table.getName(it) << " ";
if (nostrict)
warnings << "WARNING: " << unused_exos.str()
......@@ -358,10 +356,10 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
if (nostrict)
{
set<int> unusedEndogs = dynamic_model.findUnusedEndogenous();
for (set<int>::iterator it = unusedEndogs.begin(); it != unusedEndogs.end(); it++)
for (int unusedEndog : unusedEndogs)
{
symbol_table.changeType(*it, eUnusedEndogenous);
warnings << "WARNING: '" << symbol_table.getName(*it)
symbol_table.changeType(unusedEndog, eUnusedEndogenous);
warnings << "WARNING: '" << symbol_table.getName(unusedEndog)
<< "' not used in model block, removed by nostrict command-line option" << endl;
}
}
......@@ -462,9 +460,9 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
if (mod_file_struct.ramsey_model_present)
{
StaticModel *planner_objective = NULL;
for (vector<Statement *>::iterator it = statements.begin(); it != statements.end(); it++)
for (auto & statement : statements)
{
PlannerObjectiveStatement *pos = dynamic_cast<PlannerObjectiveStatement *>(*it);
PlannerObjectiveStatement *pos = dynamic_cast<PlannerObjectiveStatement *>(statement);
if (pos != NULL)
planner_objective = pos->getPlannerObjective();
}
......@@ -597,9 +595,9 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
}
if (mod_file_struct.ramsey_policy_present)
for (vector<Statement *>::iterator it = statements.begin(); it != statements.end(); it++)
for (auto & statement : statements)
{
RamseyPolicyStatement *rps = dynamic_cast<RamseyPolicyStatement *>(*it);
RamseyPolicyStatement *rps = dynamic_cast<RamseyPolicyStatement *>(statement);
if (rps != NULL)
rps->checkRamseyPolicyList();
}
......@@ -727,9 +725,8 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri
}
}
for (vector<Statement *>::iterator it = statements.begin();
it != statements.end(); it++)
(*it)->computingPass();
for (auto & statement : statements)
statement->computingPass();
}
void
......@@ -848,14 +845,14 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
if (parallel_local_files.size() > 0)
{
mOutputFile << "options_.parallel_info.local_files = {" << endl;
for (size_t i = 0; i < parallel_local_files.size(); i++)
for (const auto & parallel_local_file : parallel_local_files)
{
size_t j = parallel_local_files[i].find_last_of("/\\");
size_t j = parallel_local_file.find_last_of("/\\");
if (j == string::npos)
mOutputFile << "'', '" << parallel_local_files[i] << "';" << endl;
mOutputFile << "'', '" << parallel_local_file << "';" << endl;
else
mOutputFile << "'" << parallel_local_files[i].substr(0, j+1) << "', '"
<< parallel_local_files[i].substr(j+1, string::npos) << "';" << endl;
mOutputFile << "'" << parallel_local_file.substr(0, j+1) << "', '"
<< parallel_local_file.substr(j+1, string::npos) << "';" << endl;
}
mOutputFile << "};" << endl;
}
......@@ -985,14 +982,13 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
// (*it)->writeOutput(mOutputFile, basename, minimal_workspace);
// dynamic_model.writeVarExpectationFunctions(mOutputFile);
for (vector<Statement *>::const_iterator it = statements.begin();
it != statements.end(); it++)
for (auto statement : statements)
{
(*it)->writeOutput(mOutputFile, basename, minimal_workspace);
statement->writeOutput(mOutputFile, basename, minimal_workspace);
/* Special treatment for initval block: insert initial values for the
auxiliary variables and initialize exo det */
InitValStatement *ivs = dynamic_cast<InitValStatement *>(*it);
InitValStatement *ivs = dynamic_cast<InitValStatement *>(statement);
if (ivs != NULL)
{
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
......@@ -1000,17 +996,17 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
}
// Special treatment for endval block: insert initial values for the auxiliary variables
EndValStatement *evs = dynamic_cast<EndValStatement *>(*it);
EndValStatement *evs = dynamic_cast<EndValStatement *>(statement);
if (evs != NULL)
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
// Special treatment for load params and steady state statement: insert initial values for the auxiliary variables
LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(*it);
LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(statement);
if (lpass && !no_static)
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
// Special treatement for Var Models
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(*it);
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(statement);
if (vms != NULL)
vms->createVarModelMFunction(mOutputFile, dynamic_model.getVarExpectationFunctionsToWrite());
}
......@@ -1162,9 +1158,8 @@ ModFile::writeModelC(const string &basename) const
}
// Print statements
for (vector<Statement *>::const_iterator it = statements.begin();
it != statements.end(); it++)
(*it)->writeCOutput(mDriverCFile, basename);
for (auto statement : statements)
statement->writeCOutput(mDriverCFile, basename);
mDriverCFile << "} DynareInfo;" << endl;
mDriverCFile.close();
......@@ -1267,9 +1262,8 @@ ModFile::writeModelCC(const string &basename) const
}
// Print statements
for (vector<Statement *>::const_iterator it = statements.begin();
it != statements.end(); it++)
(*it)->writeCOutput(mDriverCFile, basename);
for (auto statement : statements)
statement->writeCOutput(mDriverCFile, basename);
mDriverCFile << "};" << endl;
mDriverCFile.close();
......@@ -1404,9 +1398,8 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output,
steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, true);
// Print statements (includes parameter values)
for (vector<Statement *>::const_iterator it = statements.begin();
it != statements.end(); it++)
(*it)->writeJuliaOutput(jlOutputFile, basename);
for (auto statement : statements)
statement->writeJuliaOutput(jlOutputFile, basename);
jlOutputFile << "model_.static = " << basename << "Static.static!" << endl
<< "model_.dynamic = " << basename << "Dynamic.dynamic!" << endl
......
This diff is collapsed.
......@@ -106,12 +106,11 @@ InitOrEndValStatement::InitOrEndValStatement(const init_values_t &init_values_ar
void
InitOrEndValStatement::fillEvalContext(eval_context_t &eval_context) const
{
for (init_values_t::const_iterator it = init_values.begin();
it != init_values.end(); it++)
for (const auto & init_value : init_values)
{
try
{
eval_context[it->first] = (it->second)->eval(eval_context);
eval_context[init_value.first] = (init_value.second)->eval(eval_context);
}
catch (ExprNode::EvalException &e)
{
......@@ -138,10 +137,9 @@ InitOrEndValStatement::getUninitializedVariables(SymbolType type)
}
set<int>::iterator sit;
for (init_values_t::const_iterator it = init_values.begin();
it != init_values.end(); it++)
for (const auto & init_value : init_values)
{
sit = unused.find(it->first);
sit = unused.find(init_value.first);
if (sit != unused.end())
unused.erase(sit);
}
......@@ -151,11 +149,10 @@ InitOrEndValStatement::getUninitializedVariables(SymbolType type)
void
InitOrEndValStatement::writeInitValues(ostream &output) const
{
for (init_values_t::const_iterator it = init_values.begin();
it != init_values.end(); it++)
for (const auto & init_value : init_values)
{
const int symb_id = it->first;
const expr_t expression = it->second;
const int symb_id = init_value.first;
const expr_t expression = init_value.second;
SymbolType type = symbol_table.getType(symb_id);
int tsid = symbol_table.getTypeSpecificID(symb_id) + 1;
......@@ -203,16 +200,16 @@ InitValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat
if (endogs.size() > 0)
{