base: Use a const auto & in a range based for loop.
authorGabe Black <gabeblack@google.com>
Mon, 10 Feb 2020 03:30:47 +0000 (19:30 -0800)
committerGabe Black <gabeblack@google.com>
Mon, 10 Feb 2020 22:32:06 +0000 (22:32 +0000)
clang 11 complains otherwise which breaks the build, and this way
is less verbose and more efficient since it doesn't require copying
a vector of strings for each element of the loop.

Change-Id: I005fa5fdf19ddba2114e98413e3609b0a91c1ec5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25226
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/base/match.cc

index 7c2c0cf58d08bb3a75db67eb73720b6160bd94eb..bfbdbf0b118dec528477bf1ecdcdc59055217666 100644 (file)
@@ -109,7 +109,7 @@ std::vector<std::vector<std::string> >
 ObjectMatch::getExpressions()
 {
     std::vector<std::vector<std::string> > to_return;
-    for (const std::vector<std::string> expression : tokens) {
+    for (const auto &expression: tokens) {
         std::vector<std::string> to_add;
         to_add.insert(to_add.end(), expression.begin(), expression.end());
         to_return.push_back(to_add);