From: Piotr Trojanek Date: Thu, 22 Aug 2019 21:12:20 +0000 (+0200) Subject: pass parameters by reference where it affects performance X-Git-Tag: cvc5-1.0.0~3906 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=788212a3783affa634dc685b6f1b086f292c2528;p=cvc5.git pass parameters by reference where it affects performance Detected with cppcheck static analyser, which said: (performance) Function parameter should be passed by reference. Reformat with clang-format as needed. Signed-off-by: Piotr Trojanek --- diff --git a/src/expr/record.cpp b/src/expr/record.cpp index 03682c8d4..0303ff705 100644 --- a/src/expr/record.cpp +++ b/src/expr/record.cpp @@ -24,7 +24,9 @@ namespace CVC4 { -static Record::FieldVector::const_iterator find(const Record::FieldVector& fields, std::string name){ +static Record::FieldVector::const_iterator find( + const Record::FieldVector& fields, const std::string& name) +{ for(Record::FieldVector::const_iterator i = fields.begin(), i_end = fields.end(); i != i_end; ++i){ if((*i).first == name) { return i; diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index d72b303a6..62b4dc121 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -170,10 +170,9 @@ class DefinedFunction { Node d_formula; public: DefinedFunction() {} - DefinedFunction(Node func, vector formals, Node formula) : - d_func(func), - d_formals(formals), - d_formula(formula) { + DefinedFunction(Node func, vector& formals, Node formula) + : d_func(func), d_formals(formals), d_formula(formula) + { } Node getFunction() const { return d_func; } vector getFormals() const { return d_formals; } diff --git a/src/theory/bv/abstraction.cpp b/src/theory/bv/abstraction.cpp index 16f77f925..cb829aba6 100644 --- a/src/theory/bv/abstraction.cpp +++ b/src/theory/bv/abstraction.cpp @@ -755,9 +755,10 @@ Node AbstractionModule::simplifyConflict(TNode conflict) { return new_conflict; } - -void DebugPrintInstantiations(const std::vector< std::vector >& instantiations, - const std::vector functions) { +void DebugPrintInstantiations( + const std::vector >& instantiations, + const std::vector& functions) +{ // print header Debug("bv-abstraction-dbg") <<"[ "; for (unsigned i = 0; i < functions.size(); ++i) {