Remove some unneeded object copies

Automatically detected by clang-tidy using performance-unnecessary-value-param
check.
master
Sébastien Villemot 2023-12-13 10:28:54 +01:00
parent cd86b1895d
commit 3d94f1956c
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
5 changed files with 7 additions and 7 deletions

View File

@ -844,7 +844,7 @@ public:
void
set_arg_func_name(string arg_arg_func_name)
{
arg_func_name = arg_arg_func_name;
arg_func_name = move(arg_arg_func_name);
};
string
get_arg_func_name()

View File

@ -109,7 +109,7 @@ ModelTree::copyHelper(const ModelTree& m)
blocks_derivatives.push_back(v);
}
auto convert_vector_tt = [f](vector<temporary_terms_t> vtt) {
auto convert_vector_tt = [f](const vector<temporary_terms_t>& vtt) {
vector<temporary_terms_t> vtt2;
for (const auto& tt : vtt)
{
@ -1927,7 +1927,7 @@ ModelTree::initializeMEXCompilationWorkers(int numworkers, const filesystem::pat
cout << "Spawning " << numworkers << " threads for compiling MEX files." << endl;
for (int i {0}; i < numworkers; i++)
mex_compilation_workers.emplace_back([](stop_token stoken) {
mex_compilation_workers.emplace_back([](const stop_token& stoken) {
unique_lock<mutex> lk {mex_compilation_mut};
filesystem::path output;
string cmd;

View File

@ -626,7 +626,7 @@ SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, string unary_op,
}
aux_vars.emplace_back(symb_id, AuxVarType::unaryOp, move(orig_symb_id), move(orig_lag), 0, 0,
expr_arg, unary_op);
expr_arg, move(unary_op));
return symb_id;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2019-2022 Dynare Team
* Copyright © 2019-2023 Dynare Team
*
* This file is part of Dynare.
*
@ -25,7 +25,7 @@
using namespace macro;
void
Environment::define(VariablePtr var, ExpressionPtr value)
Environment::define(const VariablePtr& var, const ExpressionPtr& value)
{
string name = var->getName();
if (functions.contains(name))

View File

@ -40,7 +40,7 @@ public:
Environment(const Environment* parent_arg) : parent {parent_arg}
{
}
void define(VariablePtr var, ExpressionPtr value);
void define(const VariablePtr& var, const ExpressionPtr& value);
void define(FunctionPtr func, ExpressionPtr value);
/* The following two functions are not marked [[nodiscard]], because they are used without output
to check whether they return an exception or not. */