pass parameters by reference where it affects performance
authorPiotr Trojanek <piotr.trojanek@gmail.com>
Thu, 22 Aug 2019 21:12:20 +0000 (23:12 +0200)
committerAndres Noetzli <andres.noetzli@gmail.com>
Tue, 8 Oct 2019 18:03:44 +0000 (11:03 -0700)
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 <piotr.trojanek@gmail.com>
src/expr/record.cpp
src/smt/smt_engine.cpp
src/theory/bv/abstraction.cpp

index 03682c8d473288d63237754d1ac18d9c684d5dbc..0303ff705bf565294530fd267122a6dcebee6281 100644 (file)
@@ -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;
index d72b303a67e7a87c5038c8f9736808f7c852bf85..62b4dc121e2f4c334761d42a4327c6e462c75039 100644 (file)
@@ -170,10 +170,9 @@ class DefinedFunction {
   Node d_formula;
 public:
   DefinedFunction() {}
-  DefinedFunction(Node func, vector<Node> formals, Node formula) :
-    d_func(func),
-    d_formals(formals),
-    d_formula(formula) {
+  DefinedFunction(Node func, vector<Node>& formals, Node formula)
+      : d_func(func), d_formals(formals), d_formula(formula)
+  {
   }
   Node getFunction() const { return d_func; }
   vector<Node> getFormals() const { return d_formals; }
index 16f77f9259233bd1094242fca1201fa19b3912fa..cb829aba6c5727a9f46452d228e6296212664a73 100644 (file)
@@ -755,9 +755,10 @@ Node AbstractionModule::simplifyConflict(TNode conflict) {
   return new_conflict;
 }
 
-
-void DebugPrintInstantiations(const std::vector< std::vector<ArgsVec> >& instantiations,
-                              const std::vector<TNode> functions) {
+void DebugPrintInstantiations(
+    const std::vector<std::vector<ArgsVec> >& instantiations,
+    const std::vector<TNode>& functions)
+{
   // print header
   Debug("bv-abstraction-dbg") <<"[ ";
   for (unsigned i = 0; i < functions.size(); ++i) {