Fix copying into for-loop variables

Clang 10 got a new warning for this.

Change-Id: Ibfc911c2153dae5fa20b862b3c204b97a474d462
diff --git a/src/ast_path.cpp b/src/ast_path.cpp
index e3e45d4..0aa839c 100644
--- a/src/ast_path.cpp
+++ b/src/ast_path.cpp
@@ -165,7 +165,7 @@
         res = "/";
     }
 
-    for (const auto it : path.m_nodes) {
+    for (const auto& it : path.m_nodes) {
         if (it.m_prefix)
             res = joinPaths(res, it.m_prefix.value().m_name + ":" + boost::apply_visitor(nodeToDataStringVisitor(), it.m_suffix));
         else
@@ -182,7 +182,7 @@
         res = "/";
     }
 
-    for (const auto it : path.m_nodes) {
+    for (const auto& it : path.m_nodes) {
         if (it.m_prefix)
             res = joinPaths(res, it.m_prefix.value().m_name + ":" + boost::apply_visitor(nodeToSchemaStringVisitor(), it.m_suffix));
         else
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 5a34e4f..2719bc6 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -334,7 +334,7 @@
         nodes = node->child_instantiables(0);
     }
 
-    for (const auto node : nodes) {
+    for (const auto& node : nodes) {
         if (node->module()->name() == "ietf-yang-library"sv)
             continue;
         // FIXME: This is a temporary fix to filter out RPC nodes in
@@ -367,9 +367,9 @@
 
     std::vector<libyang::S_Schema_Node> nodes;
 
-    for (const auto node : yangModule->data_instantiables(0)) {
+    for (const auto& node : yangModule->data_instantiables(0)) {
         if (recursion == Recursion::Recursive) {
-            for (const auto it : node->tree_dfs()) {
+            for (const auto& it : node->tree_dfs()) {
                 res.insert(it->path(LYS_PATH_FIRST_PREFIX));
             }
         } else {