From 2781e3e6f63a4ba053d73adf508b6701f089c22a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 10 Feb 2021 16:48:46 +0100
Subject: [PATCH] A few modernizations using clang-tidy

---
 src/DynamicModel.cc       | 4 ++--
 src/ModelEquationBlock.cc | 4 ++--
 src/macro/Environment.hh  | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 39e7935e..b3a7d690 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -5995,8 +5995,8 @@ DynamicModel::writeJsonVariableMapping(ostream &output) const
       auto [var, eqs] = *it;
       output << R"({"name": ")" << symbol_table.getName(var) << R"(", "equations":[)";
       bool first_eq = true;
-      for (auto it2 = eqs.begin(); it2 != eqs.end(); ++it2)
-        if (auto tmp = equation_tags.getTagValueByEqnAndKey(*it2, "name");
+      for (int it2 : eqs)
+        if (auto tmp = equation_tags.getTagValueByEqnAndKey(it2, "name");
             !tmp.empty())
           {
             if (first_eq)
diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc
index c136805f..96d09c64 100644
--- a/src/ModelEquationBlock.cc
+++ b/src/ModelEquationBlock.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2019 Dynare Team
+ * Copyright © 2010-2021 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -274,7 +274,7 @@ SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComput
         }
       if (symb_ids.size() > 1)
         output << "]";
-      output << ", \"rhs\":\"";
+      output << R"(, "rhs":")";
       def_table[i].second->writeJsonOutput(output, {}, {}, false);
       output << "\"}" << endl;
     }
diff --git a/src/macro/Environment.hh b/src/macro/Environment.hh
index 7c4bed3f..a02e2704 100644
--- a/src/macro/Environment.hh
+++ b/src/macro/Environment.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2021 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -30,11 +30,11 @@ namespace macro
   class Environment
   {
   private:
-    const Environment *parent;
+    const Environment *parent{nullptr};
     map<string, ExpressionPtr> variables;
     map<string, tuple<FunctionPtr, ExpressionPtr>> functions;
   public:
-    Environment() : parent{nullptr} { }
+    Environment() = default;
     Environment(const Environment *parent_arg) : parent{parent_arg} { }
     void define(VariablePtr var, ExpressionPtr value);
     void define(FunctionPtr func, ExpressionPtr value);
-- 
GitLab