From 55cbc64d1eedcde9347d1a64c27215ab63b2867e Mon Sep 17 00:00:00 2001 From: Nikos Nikoleris Date: Thu, 17 Sep 2020 18:09:32 +0100 Subject: [PATCH] mem: Fix some reference use in range loops This change fixes two cases of range loops, one where we can't use lvalue reference, and one more where we have to use an lvalue reference as we can't create a copy. In both cases clang would warn. Change-Id: I760aa094af66be32a150bad37acc21d6fd512a65 Signed-off-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34776 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/mem/ruby/common/BoolVec.cc | 4 ++-- src/mem/ruby/slicc_interface/RubySlicc_Util.hh | 4 ++-- src/mem/ruby/system/Sequencer.cc | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mem/ruby/common/BoolVec.cc b/src/mem/ruby/common/BoolVec.cc index 603f714ce..1c2953288 100644 --- a/src/mem/ruby/common/BoolVec.cc +++ b/src/mem/ruby/common/BoolVec.cc @@ -41,8 +41,8 @@ #include std::ostream& operator<<(std::ostream& os, const BoolVec& myvector) { - for (const auto& it: myvector) { - os << " " << it; + for (const bool e: myvector) { + os << " " << e; } return os; } diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh index 8ff8884aa..155d134df 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh @@ -256,8 +256,8 @@ inline int countBoolVec(BoolVec bVec) { int count = 0; - for (const auto &it: bVec) { - if (it) { + for (const bool e: bVec) { + if (e) { count++; } } diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index 75c58d600..dbc85c418 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -167,7 +167,7 @@ Sequencer::wakeup() int total_outstanding = 0; for (const auto &table_entry : m_RequestTable) { - for (const auto seq_req : table_entry.second) { + for (const auto &seq_req : table_entry.second) { if (current_time - seq_req.issue_time < m_deadlock_threshold) continue; -- 2.30.2