From a1ade2dd7d0b5ab60372f3a3cb02c2b27a5aa5c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 14 Mar 2019 19:57:58 +0100 Subject: [PATCH] Refactoring: Use range for --- lib/symboldatabase.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 707e6be6f..e2c14e95f 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1261,14 +1261,13 @@ void SymbolDatabase::createSymbolDatabaseEnums() void SymbolDatabase::createSymbolDatabaseUnknownArrayDimensions() { // set all unknown array dimensions - for (std::size_t i = 1; i <= mTokenizer->varIdCount(); i++) { + for (const Variable *var : mVariableList) { // check each array variable - if (!mVariableList[i] || !mVariableList[i]->isArray()) + if (!var || !var->isArray()) continue; // check each array dimension - const std::vector& dimensions = mVariableList[i]->dimensions(); - for (std::size_t j = 0; j < dimensions.size(); j++) { - Dimension &dimension = const_cast(dimensions[j]); + for (const Dimension &const_dimension : var->dimensions()) { + Dimension &dimension = const_cast(const_dimension); if (dimension.num != 0) continue; dimension.known = false;