From 788212a3783affa634dc685b6f1b086f292c2528 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Thu, 22 Aug 2019 23:12:20 +0200 Subject: [PATCH] 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 --- src/expr/record.cpp | 4 +++- src/smt/smt_engine.cpp | 7 +++---- src/theory/bv/abstraction.cpp | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) 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) { -- 2.30.2