Commit e7c9c26d authored by Sébastien Villemot's avatar Sébastien Villemot

More modernizations with clang-tidy

parent 4f9b3849
Pipeline #576 passed with stage
in 1 minute and 20 seconds
......@@ -683,11 +683,11 @@ ForecastStatement::writeJsonOutput(ostream &output) const
output << "}";
}
DetCondForecast::DetCondForecast(const SymbolList &symbol_list_arg,
DetCondForecast::DetCondForecast(SymbolList symbol_list_arg,
OptionsList options_list_arg,
const bool linear_decomposition_arg) :
options_list{move(options_list_arg)},
symbol_list{symbol_list_arg},
symbol_list{move(symbol_list_arg)},
linear_decomposition{linear_decomposition_arg}
{
......@@ -3427,7 +3427,7 @@ SubsamplesStatement::SubsamplesStatement(string name1_arg,
const SymbolTable &symbol_table_arg) :
name1{move(name1_arg)},
name2{move(name2_arg)},
subsample_declaration_map{subsample_declaration_map_arg},
subsample_declaration_map{move(subsample_declaration_map_arg)},
symbol_table{symbol_table_arg}
{
}
......
......@@ -103,7 +103,7 @@ private:
const SymbolList symbol_list;
const bool linear_decomposition;
public:
DetCondForecast(const SymbolList &symbol_list_arg,
DetCondForecast(SymbolList symbol_list_arg,
OptionsList options_list_arg,
const bool linear_decompositiontion_arg);
//virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
......
......@@ -3333,9 +3333,9 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
tmp_s.str("");
}
vector<int> inter_state_var;
for (auto it_l = local_state_var.begin(); it_l != local_state_var.end(); ++it_l)
for (int & it_l : local_state_var)
for (auto it = state_var.begin(); it != state_var.end(); ++it)
if (*it == *it_l)
if (*it == it_l)
inter_state_var.push_back(it - state_var.begin()+1);
output << "block_structure.block(" << block+1 << ").sorted_col_dr_ghx = [";
for (int it : inter_state_var)
......
......@@ -121,7 +121,7 @@ main(int argc, char **argv)
// Create options list, using first line of mod-file and command line
vector<string> options = parse_options_line(modfile);
for (int arg = 2; arg < argc; arg++)
options.push_back(argv[arg]);
options.emplace_back(argv[arg]);
// Parse options
bool clear_all = true;
......
......@@ -5729,7 +5729,7 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
if (tmp.size() != 0)
return;
BinaryOpNode *multiplicandr = dynamic_cast<BinaryOpNode *>(arg2);
auto *multiplicandr = dynamic_cast<BinaryOpNode *>(arg2);
if (multiplicandr == nullptr
|| multiplicandr->op_code != BinaryOpcode::minus)
return;
......
......@@ -45,11 +45,11 @@ AbstractShocksStatement::writeDetShocks(ostream &output) const
int id = symbol_table.getTypeSpecificID(det_shock.first) + 1;
bool exo_det = (symbol_table.getType(det_shock.first) == SymbolType::exogenousDet);
for (size_t i = 0; i < det_shock.second.size(); i++)
for (const auto &it : det_shock.second)
{
const int &period1 = det_shock.second[i].period1;
const int &period2 = det_shock.second[i].period2;
const expr_t value = det_shock.second[i].value;
const int &period1 = it.period1;
const int &period2 = it.period2;
const expr_t value = it.value;
output << "M_.det_shocks = [ M_.det_shocks;" << endl
<< "struct('exo_det'," << (int) exo_det
......
......@@ -21,10 +21,6 @@
#include <boost/xpressive/xpressive.hpp>
#include <utility>
ModFileStructure::ModFileStructure()
{
}
void
Statement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{
......@@ -120,9 +116,8 @@ OptionsList::writeOutput(ostream &output) const
if (vector_int_option.second.size() > 1)
{
output << "[";
for (auto viit = vector_int_option.second.begin();
viit != vector_int_option.second.end(); viit++)
output << *viit << ";";
for (int viit : vector_int_option.second)
output << viit << ";";
output << "];" << endl;
}
else
......@@ -135,9 +130,8 @@ OptionsList::writeOutput(ostream &output) const
if (vector_str_option.second.size() > 1)
{
output << "{";
for (auto viit = vector_str_option.second.begin();
viit != vector_str_option.second.end(); viit++)
output << "'" << *viit << "';";
for (const auto & viit : vector_str_option.second)
output << "'" << viit << "';";
output << "};" << endl;
}
else
......@@ -181,9 +175,8 @@ OptionsList::writeOutput(ostream &output, const string &option_group) const
if (vector_int_option.second.size() > 1)
{
output << "[";
for (auto viit = vector_int_option.second.begin();
viit != vector_int_option.second.end(); viit++)
output << *viit << ";";
for (int viit : vector_int_option.second)
output << viit << ";";
output << "];" << endl;
}
else
......@@ -196,9 +189,8 @@ OptionsList::writeOutput(ostream &output, const string &option_group) const
if (vector_str_option.second.size() > 1)
{
output << "{";
for (auto viit = vector_str_option.second.begin();
viit != vector_str_option.second.end(); viit++)
output << "'" << *viit << "';";
for (const auto & viit : vector_str_option.second)
output << "'" << viit << "';";
output << "};" << endl;
}
else
......
......@@ -31,7 +31,7 @@
class ModFileStructure
{
public:
ModFileStructure();
ModFileStructure() = default;
//! Whether check is present
bool check_present{false};
//! Whether steady is present
......
......@@ -22,6 +22,7 @@
#include <iostream>
#include <cassert>
#include <boost/algorithm/string/replace.hpp>
#include <utility>
#include "SymbolTable.hh"
......@@ -35,7 +36,7 @@ AuxVarInfo::AuxVarInfo(int symb_id_arg, AuxVarType type_arg, int orig_symb_id_ar
equation_number_for_multiplier{equation_number_for_multiplier_arg},
information_set{information_set_arg},
expr_node{expr_node_arg},
unary_op{unary_op_arg}
unary_op{move(unary_op_arg)}
{
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment