diff --git a/src/Bytecode.hh b/src/Bytecode.hh index 6bb2f78de0daac00e9d4f27031c19357891dac66..9b74c53bb20a19861d1a9bf09d0e09a5a143201e 100644 --- a/src/Bytecode.hh +++ b/src/Bytecode.hh @@ -1022,7 +1022,7 @@ public: Block_contain_type bc; read_member(bc.Variable); read_member(bc.Equation); - Block_Contain_.push_back(move(bc)); + Block_Contain_.push_back(bc); } if (type == BlockSimulationType::solveTwoBoundariesSimple || type == BlockSimulationType::solveTwoBoundariesComplete diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc index c77f314234dc70a44739118d449ad03b277a57c8..a6f9f915cc4dc32aa0102c7aefbd40e5d9070fb2 100644 --- a/src/ComputingTasks.cc +++ b/src/ComputingTasks.cc @@ -3347,10 +3347,9 @@ ConditionalForecastStatement::writeJsonOutput(ostream& output) const } PlotConditionalForecastStatement::PlotConditionalForecastStatement( - optional<int> periods_arg, SymbolList symbol_list_arg, const SymbolTable& symbol_table_arg) : - periods {move(periods_arg)}, - symbol_list {move(symbol_list_arg)}, - symbol_table {symbol_table_arg} + const optional<int>& periods_arg, SymbolList symbol_list_arg, + const SymbolTable& symbol_table_arg) : + periods {periods_arg}, symbol_list {move(symbol_list_arg)}, symbol_table {symbol_table_arg} { } diff --git a/src/ComputingTasks.hh b/src/ComputingTasks.hh index 05772bfcb10dace287f31e4fe439c6ec2a12fe30..e9d5c88e55b5f4022f99e220ae47d44c769a6724 100644 --- a/src/ComputingTasks.hh +++ b/src/ComputingTasks.hh @@ -929,7 +929,7 @@ private: const SymbolTable& symbol_table; public: - PlotConditionalForecastStatement(optional<int> periods_arg, SymbolList symbol_list_arg, + PlotConditionalForecastStatement(const optional<int>& periods_arg, SymbolList symbol_list_arg, const SymbolTable& symbol_table_arg); void checkPass(ModFileStructure& mod_file_struct, WarningConsolidation& warnings) override; void writeOutput(ostream& output, const string& basename, bool minimal_workspace) const override; diff --git a/src/DataTree.cc b/src/DataTree.cc index b21e63c8dcb3367a6140f784e9f11d871dc9ae2a..49303d68f4d3f5b125fed238e421d3f92862750e 100644 --- a/src/DataTree.cc +++ b/src/DataTree.cc @@ -946,10 +946,10 @@ DataTree::strsplit(string_view str, char delim) } filesystem::path -DataTree::packageDir(string_view package) +DataTree::packageDir(const string_view& package) { filesystem::path d; - for (const auto& it : strsplit(move(package), '.')) + for (const auto& it : strsplit(package, '.')) d /= "+" + it; return d; } diff --git a/src/DataTree.hh b/src/DataTree.hh index 7968e20c47a8ded308d2f6dc6f4be9466111e8b6..8502f3a82f3f0cdb476d8092c3edbecfe0ef9a48 100644 --- a/src/DataTree.hh +++ b/src/DataTree.hh @@ -384,7 +384,7 @@ public: and returns the path to the corresponding filesystem directory. In practice the package nesting is used for the planner_objective (stored inside +objective subdir). */ - static filesystem::path packageDir(string_view package); + static filesystem::path packageDir(const string_view& package); }; inline expr_t diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 601d9e331e435adfce8055daf7202080f7015a22..bc403a0f5d1bdc964d612daf1eb8ad297680096f 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -1212,7 +1212,7 @@ DynamicModel::updateVarAndTrendModel() const exit(EXIT_FAILURE); } } - trend_var.push_back(move(trend_var_symb_id)); + trend_var.push_back(trend_var_symb_id); } } @@ -1906,7 +1906,7 @@ DynamicModel::analyzePacEquationStructure(const string& name, map<string, string exit(EXIT_FAILURE); } pac_equation_info[name] = {lhs, - move(optim_share_index), + optim_share_index, move(ar_params_and_vars), move(ec_params_and_vars), move(non_optim_vars_params_and_constants), @@ -3575,14 +3575,15 @@ DynamicModel::fillEvalContext(eval_context_t& eval_context) const } void -DynamicModel::addStaticOnlyEquation(expr_t eq, optional<int> lineno, map<string, string> eq_tags) +DynamicModel::addStaticOnlyEquation(expr_t eq, const optional<int>& lineno, + map<string, string> eq_tags) { auto beq = dynamic_cast<BinaryOpNode*>(eq); assert(beq && beq->op_code == BinaryOpcode::equal); static_only_equations_equation_tags.add(static_only_equations.size(), move(eq_tags)); static_only_equations.push_back(beq); - static_only_equations_lineno.push_back(move(lineno)); + static_only_equations_lineno.push_back(lineno); } size_t @@ -3598,7 +3599,7 @@ DynamicModel::dynamicOnlyEquationsNbr() const } void -DynamicModel::addOccbinEquation(expr_t eq, optional<int> lineno, map<string, string> eq_tags, +DynamicModel::addOccbinEquation(expr_t eq, const optional<int>& lineno, map<string, string> eq_tags, const vector<string>& regimes_bind, const vector<string>& regimes_relax) { diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh index e57efbafe90240b3be9b6ea9e60c0f57b1e54778..7d77e34419740e70fc147f09d5fdcfbfbd726a0f 100644 --- a/src/DynamicModel.hh +++ b/src/DynamicModel.hh @@ -428,7 +428,7 @@ public: void replaceMyEquations(DynamicModel& dynamic_model) const; //! Adds an equation marked as [static] - void addStaticOnlyEquation(expr_t eq, optional<int> lineno, map<string, string> eq_tags); + void addStaticOnlyEquation(expr_t eq, const optional<int>& lineno, map<string, string> eq_tags); //! Returns number of static only equations size_t staticOnlyEquationsNbr() const; @@ -441,7 +441,7 @@ public: auxiliary parameters have already been added to the symbol table. It also assumes that the “bind” and “relax” tags have been cleared from eq_tags. */ - void addOccbinEquation(expr_t eq, optional<int> lineno, map<string, string> eq_tags, + void addOccbinEquation(expr_t eq, const optional<int>& lineno, map<string, string> eq_tags, const vector<string>& regimes_bind, const vector<string>& regimes_relax); //! Writes LaTeX file with the equations of the dynamic model diff --git a/src/ExprNode.cc b/src/ExprNode.cc index 78cf5bbac77d45fb8e93742b29fc3fb5fb85ee0d..a4c6ae77a4df8e5819870f8f43bf06f1faa7034c 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -5697,7 +5697,7 @@ BinaryOpNode::getPacAREC( { // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) auto [vid, lag, pid, constant] = term->matchVariableTimesConstantTimesParam(true); - linear_combination.emplace_back(vid.value(), lag, move(pid), constant); + linear_combination.emplace_back(vid.value(), lag, pid, constant); } catch (MatchFailureException& e) { @@ -9102,7 +9102,7 @@ ExprNode::matchVariableTimesConstantTimesParam(bool variable_obligatory) const matchVTCTPHelper(variable_id, lag, param_id, constant, false); if (variable_obligatory && !variable_id) throw MatchFailureException {"No variable in this expression"}; - return {move(variable_id), lag, move(param_id), constant}; + return {variable_id, lag, param_id, constant}; } void @@ -9194,7 +9194,7 @@ ExprNode::matchLinearCombinationOfVariables() const auto [variable_id, lag, param_id, constant] = term->matchVariableTimesConstantTimesParam(true); constant *= sign; - result.emplace_back(variable_id.value(), lag, move(param_id), constant); + result.emplace_back(variable_id.value(), lag, param_id, constant); } return result; } diff --git a/src/ModelTree.cc b/src/ModelTree.cc index c81824d441791cbce318f095a93cc9a0318adbea..bcd7de8b5161bd7b0b1f01d8196e11cf3d9f3831 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -1394,13 +1394,13 @@ ModelTree::writeLatexModelFile(const string& mod_basename, const string& latex_b } void -ModelTree::addEquation(expr_t eq, optional<int> lineno) +ModelTree::addEquation(expr_t eq, const optional<int>& lineno) { auto beq = dynamic_cast<BinaryOpNode*>(eq); assert(beq && beq->op_code == BinaryOpcode::equal); equations.push_back(beq); - equations_lineno.push_back(move(lineno)); + equations_lineno.push_back(lineno); } void @@ -1412,10 +1412,10 @@ ModelTree::findConstantEquationsWithoutMcpTag(map<VariableNode*, NumConstNode*>& } void -ModelTree::addEquation(expr_t eq, optional<int> lineno, map<string, string> eq_tags) +ModelTree::addEquation(expr_t eq, const optional<int>& lineno, map<string, string> eq_tags) { equation_tags.add(equations.size(), move(eq_tags)); - addEquation(eq, move(lineno)); + addEquation(eq, lineno); } void diff --git a/src/ModelTree.hh b/src/ModelTree.hh index dc6f0378425e2e4318945f0fcd0cc5279d9e1ff5..24655ac1f712473edd9680a2b40542c64f5da112 100644 --- a/src/ModelTree.hh +++ b/src/ModelTree.hh @@ -650,9 +650,9 @@ public: //! Absolute value under which a number is considered to be zero double cutoff {1e-15}; //! Declare a node as an equation of the model; also give its line number - void addEquation(expr_t eq, optional<int> lineno); + void addEquation(expr_t eq, const optional<int>& lineno); //! Declare a node as an equation of the model, also giving its tags - void addEquation(expr_t eq, optional<int> lineno, map<string, string> eq_tags); + void addEquation(expr_t eq, const optional<int>& lineno, map<string, string> eq_tags); //! Declare a node as an auxiliary equation of the model, adding it at the end of the list of //! auxiliary equations void addAuxEquation(expr_t eq); diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc index 972ce1fb9b55875b2f4b07b78257475493c2c26e..8af7f2ead3dfac90d5fc5eefb5178c795e477291 100644 --- a/src/ParsingDriver.cc +++ b/src/ParsingDriver.cc @@ -2127,7 +2127,7 @@ ParsingDriver::set_optim_weights(string name, expr_t value) check_symbol_is_endogenous(name); if (var_weights.contains(name)) error("optim_weights: " + name + " declared twice"); - var_weights[move(name)] = move(value); + var_weights[move(name)] = value; } void @@ -2594,8 +2594,8 @@ ParsingDriver::plot_conditional_forecast(const optional<string>& periods, optional<int> iperiods; if (periods) iperiods = stoi(*periods); - mod_file->addStatement(make_unique<PlotConditionalForecastStatement>( - move(iperiods), move(symbol_list), mod_file->symbol_table)); + mod_file->addStatement(make_unique<PlotConditionalForecastStatement>(iperiods, move(symbol_list), + mod_file->symbol_table)); } void diff --git a/src/SymbolTable.cc b/src/SymbolTable.cc index 6b78152f55ba2c096a73291d4dcad3b8f8ce3921..d836566dc08272978d9f77e79f1bfc5f4095b897 100644 --- a/src/SymbolTable.cc +++ b/src/SymbolTable.cc @@ -585,8 +585,8 @@ SymbolTable::addDiffLeadAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_i } int -SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, optional<int> orig_symb_id, - optional<int> orig_lag) noexcept(false) +SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, const optional<int>& orig_symb_id, + const optional<int>& orig_lag) noexcept(false) { string varname {"AUX_DIFF_" + to_string(index)}; int symb_id; @@ -601,16 +601,15 @@ SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, optional<int> orig_ exit(EXIT_FAILURE); } - aux_vars.emplace_back(symb_id, AuxVarType::diff, move(orig_symb_id), move(orig_lag), 0, 0, - expr_arg, ""); + aux_vars.emplace_back(symb_id, AuxVarType::diff, orig_symb_id, orig_lag, 0, 0, expr_arg, ""); return symb_id; } int SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, string unary_op, - optional<int> orig_symb_id, - optional<int> orig_lag) noexcept(false) + const optional<int>& orig_symb_id, + const optional<int>& orig_lag) noexcept(false) { string varname {"AUX_UOP_" + to_string(index)}; int symb_id; @@ -625,8 +624,8 @@ SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, string unary_op, exit(EXIT_FAILURE); } - aux_vars.emplace_back(symb_id, AuxVarType::unaryOp, move(orig_symb_id), move(orig_lag), 0, 0, - expr_arg, move(unary_op)); + aux_vars.emplace_back(symb_id, AuxVarType::unaryOp, orig_symb_id, orig_lag, 0, 0, expr_arg, + move(unary_op)); return symb_id; } diff --git a/src/SymbolTable.hh b/src/SymbolTable.hh index 908914a542dc20d2dfb85b4d1c3950eb2aa8af33..01bbf91fe62051f1f0e3a1c49b6c093f8bb95fcb 100644 --- a/src/SymbolTable.hh +++ b/src/SymbolTable.hh @@ -297,8 +297,8 @@ public: diffLead increases it). */ [[nodiscard]] pair<int, int> unrollDiffLeadLagChain(int symb_id, int lag) const noexcept(false); //! Adds an auxiliary variable when the diff operator is encountered - int addDiffAuxiliaryVar(int index, expr_t expr_arg, optional<int> orig_symb_id = nullopt, - optional<int> orig_lag = nullopt) noexcept(false); + int addDiffAuxiliaryVar(int index, expr_t expr_arg, const optional<int>& orig_symb_id = nullopt, + const optional<int>& orig_lag = nullopt) noexcept(false); //! Takes care of timing between diff statements int addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) noexcept(false); @@ -307,8 +307,8 @@ public: int orig_lead) noexcept(false); //! An Auxiliary variable for a unary op int addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, string unary_op, - optional<int> orig_symb_id = nullopt, - optional<int> orig_lag = nullopt) noexcept(false); + const optional<int>& orig_symb_id = nullopt, + const optional<int>& orig_lag = nullopt) noexcept(false); //! An auxiliary variable for a pac_expectation operator int addPacExpectationAuxiliaryVar(const string& name, expr_t expr_arg); //! An auxiliary variable for a pac_target_nonstationary operator diff --git a/src/macro/Expressions.hh b/src/macro/Expressions.hh index 1545291c2a2c681074951f41802e8c356f6892dd..2426038868ac97aac3070a67a0be6aa7d33a137f 100644 --- a/src/macro/Expressions.hh +++ b/src/macro/Expressions.hh @@ -1135,7 +1135,7 @@ private: public: UnaryOp(codes::UnaryOp op_code_arg, ExpressionPtr arg_arg, Tokenizer::location location_arg) : - Expression(move(location_arg)), op_code {move(op_code_arg)}, arg {move(arg_arg)} + Expression(move(location_arg)), op_code {op_code_arg}, arg {move(arg_arg)} { } [[nodiscard]] string to_string() const noexcept override;