Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201)

diff --git a/source/val/validate.cpp b/source/val/validate.cpp
index 7f4b0dc..168968d 100644
--- a/source/val/validate.cpp
+++ b/source/val/validate.cpp
@@ -142,7 +142,7 @@
   for (const auto other_id : _.entry_points()) {
     if (other_id == id) continue;
     const auto other_id_names = CalculateNamesForEntryPoint(_, other_id);
-    for (const auto other_id_name : other_id_names) {
+    for (const auto& other_id_name : other_id_names) {
       if (names.find(other_id_name) != names.end()) {
         return _.diag(SPV_ERROR_INVALID_BINARY, _.FindDef(id))
                << "Entry point name \"" << other_id_name
@@ -431,7 +431,7 @@
   if (auto error = ValidateBuiltIns(*vstate)) return error;
   // These checks must be performed after individual opcode checks because
   // those checks register the limitation checked here.
-  for (const auto inst : vstate->ordered_instructions()) {
+  for (const auto& inst : vstate->ordered_instructions()) {
     if (auto error = ValidateExecutionLimitations(*vstate, &inst)) return error;
     if (auto error = ValidateSmallTypeUses(*vstate, &inst)) return error;
   }
diff --git a/source/val/validation_state.cpp b/source/val/validation_state.cpp
index 51aebbe..0739148 100644
--- a/source/val/validation_state.cpp
+++ b/source/val/validation_state.cpp
@@ -1052,7 +1052,7 @@
 }
 
 void ValidationState_t::ComputeRecursiveEntryPoints() {
-  for (const Function func : functions()) {
+  for (const Function& func : functions()) {
     std::stack<uint32_t> call_stack;
     std::set<uint32_t> visited;