From dc6b28366c971b9f1cb0b2c5f665c01b3ba47d68 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@digia.com>
Date: Mon, 16 Dec 2013 15:54:02 +0100
Subject: [PATCH] Avoid value-list creation when iterating over maps.

Change-Id: I704ba93d01ffababb405bc801f07a845631930cc
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
---
 .../coreplugin/actionmanager/actionmanager.cpp       |  2 +-
 src/plugins/cpptools/cpptoolseditorsupport.cpp       |  2 +-
 src/plugins/projectexplorer/kit.cpp                  |  2 +-
 src/plugins/projectexplorer/targetsetuppage.cpp      |  8 ++++----
 src/plugins/qmlprofiler/qv8profilerdatamodel.cpp     | 12 ++++++------
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
index a4b2080e938..b57c5fbfee6 100644
--- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp
+++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
@@ -336,7 +336,7 @@ QList<Command *> ActionManager::commands()
 {
     // transform list of CommandPrivate into list of Command
     QList<Command *> result;
-    foreach (Command *cmd, d->m_idCmdMap.values())
+    foreach (Command *cmd, d->m_idCmdMap)
         result << cmd;
     return result;
 }
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index c2a3792c93f..fc6b6204b51 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -411,7 +411,7 @@ void CppEditorSupport::onDiagnosticsChanged()
     QList<Document::DiagnosticMessage> allDiagnostics;
     {
         QMutexLocker locker(&m_diagnosticsMutex);
-        foreach (const QList<Document::DiagnosticMessage> &msgs, m_allDiagnostics.values())
+        foreach (const QList<Document::DiagnosticMessage> &msgs, m_allDiagnostics)
             allDiagnostics.append(msgs);
     }
 
diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp
index 1676d4a30e6..844ae4e3885 100644
--- a/src/plugins/projectexplorer/kit.cpp
+++ b/src/plugins/projectexplorer/kit.cpp
@@ -433,7 +433,7 @@ QVariantMap Kit::toMap() const
     data.insert(QLatin1String(ICON_KEY), d->m_iconPath.toString());
 
     QStringList mutableInfo;
-    foreach (const Core::Id &id, d->m_mutable.values())
+    foreach (const Core::Id &id, d->m_mutable)
         mutableInfo << id.toString();
     data.insert(QLatin1String(MUTABLE_INFO_KEY), mutableInfo);
 
diff --git a/src/plugins/projectexplorer/targetsetuppage.cpp b/src/plugins/projectexplorer/targetsetuppage.cpp
index b47da13ed39..c91d80b9ca9 100644
--- a/src/plugins/projectexplorer/targetsetuppage.cpp
+++ b/src/plugins/projectexplorer/targetsetuppage.cpp
@@ -246,7 +246,7 @@ void TargetSetupPage::setKitSelected(Core::Id id, bool selected)
 
 bool TargetSetupPage::isComplete() const
 {
-    foreach (TargetSetupWidget *widget, m_widgets.values())
+    foreach (TargetSetupWidget *widget, m_widgets)
         if (widget->isKitSelected())
             return true;
     return false;
@@ -275,7 +275,7 @@ void TargetSetupPage::setupWidgets()
 
 void TargetSetupPage::reset()
 {
-    foreach (TargetSetupWidget *widget, m_widgets.values()) {
+    foreach (TargetSetupWidget *widget, m_widgets) {
         Kit *k = widget->kit();
         if (!k)
             continue;
@@ -386,7 +386,7 @@ void TargetSetupPage::handleKitUpdate(Kit *k)
 void TargetSetupPage::selectAtLeastOneKit()
 {
     bool atLeastOneKitSelected = false;
-    foreach (TargetSetupWidget *w, m_widgets.values()) {
+    foreach (TargetSetupWidget *w, m_widgets) {
         if (w->isKitSelected()) {
             atLeastOneKitSelected = true;
             break;
@@ -514,7 +514,7 @@ TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
 bool TargetSetupPage::setupProject(Project *project)
 {
     QList<const BuildInfo *> toSetUp; // Pointers are managed by the widgets!
-    foreach (TargetSetupWidget *widget, m_widgets.values()) {
+    foreach (TargetSetupWidget *widget, m_widgets) {
         if (!widget->isKitSelected())
             continue;
 
diff --git a/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp b/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp
index fd45bc0e476..6ce3e54d153 100644
--- a/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp
+++ b/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp
@@ -138,7 +138,7 @@ bool QV8ProfilerDataModel::isEmpty() const
 
 QV8EventData *QV8ProfilerDataModel::v8EventDescription(int eventId) const
 {
-    foreach (QV8EventData *event, d->v8EventHash.values()) {
+    foreach (QV8EventData *event, d->v8EventHash) {
         if (event->eventId == eventId)
             return event;
     }
@@ -235,7 +235,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::collectV8Statistics()
     if (!v8EventHash.isEmpty()) {
         double totalTimes = v8MeasuredTime;
         double selfTimes = 0;
-        foreach (QV8EventData *v8event, v8EventHash.values()) {
+        foreach (const QV8EventData *v8event, v8EventHash) {
             selfTimes += v8event->selfTime;
         }
 
@@ -261,7 +261,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::collectV8Statistics()
             *v8EventHash[rootEventHash] = v8RootEvent;
         }
 
-        foreach (QV8EventData *v8event, v8EventHash.values()) {
+        foreach (QV8EventData *v8event, v8EventHash) {
             v8event->totalPercent = v8event->totalTime * 100.0 / totalTimes;
             v8event->SelfTimeInPercent = v8event->selfTime * 100.0 / selfTimes;
         }
@@ -300,7 +300,7 @@ void QV8ProfilerDataModel::save(QXmlStreamWriter &stream)
 {
     stream.writeStartElement(QLatin1String("v8profile")); // v8 profiler output
     stream.writeAttribute(QLatin1String("totalTime"), QString::number(d->v8MeasuredTime));
-    foreach (QV8EventData *v8event, d->v8EventHash.values()) {
+    foreach (const QV8EventData *v8event, d->v8EventHash) {
         stream.writeStartElement(QLatin1String("event"));
         stream.writeAttribute(QLatin1String("index"),
                               QString::number(
@@ -319,7 +319,7 @@ void QV8ProfilerDataModel::save(QXmlStreamWriter &stream)
             QStringList childrenIndexes;
             QStringList childrenTimes;
             QStringList parentTimes;
-            foreach (QV8EventSub *v8child, v8event->childrenHash.values()) {
+            foreach (const QV8EventSub *v8child, v8event->childrenHash) {
                 childrenIndexes << QString::number(v8child->reference->eventId);
                 childrenTimes << QString::number(v8child->totalTime);
                 parentTimes << QString::number(v8child->totalTime);
@@ -468,7 +468,7 @@ void QV8ProfilerDataModel::load(QXmlStreamReader &stream)
         }
     }
     // store v8 events
-    foreach (QV8EventData *storedV8Event, v8eventBuffer.values()) {
+    foreach (QV8EventData *storedV8Event, v8eventBuffer) {
         storedV8Event->eventHashStr =
                 getHashStringForV8Event(
                     storedV8Event->displayName, storedV8Event->functionName);
-- 
GitLab