From 09b1fe3f209b8014758f9cc3b0c3784d7ea1cadd Mon Sep 17 00:00:00 2001
From: Ulf Hermann <ulf.hermann@qt.io>
Date: Tue, 31 May 2016 14:50:16 +0200
Subject: [PATCH] QmlProfiler: Drop some unreachable code

The model manager will make sure that the flame graph model doesn't get
any events it doesn't accept.

Change-Id: Ibe6e06c558d138cebe6be5dbc76e8f51e9e1fd95
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
---
 src/plugins/qmlprofiler/flamegraphmodel.cpp | 7 ++-----
 src/plugins/qmlprofiler/flamegraphmodel.h   | 1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/plugins/qmlprofiler/flamegraphmodel.cpp b/src/plugins/qmlprofiler/flamegraphmodel.cpp
index f9d0f365f47..7d9c2d41350 100644
--- a/src/plugins/qmlprofiler/flamegraphmodel.cpp
+++ b/src/plugins/qmlprofiler/flamegraphmodel.cpp
@@ -51,7 +51,6 @@ FlameGraphModel::FlameGraphModel(QmlProfilerModelManager *modelManager,
             this, [this](int typeId, int, int){loadNotes(typeId, true);});
     m_modelId = modelManager->registerModelProxy();
 
-    m_acceptedTypes << Compiling << Creating << Binding << HandlingSignal << Javascript;
     modelManager->announceFeatures(Constants::QML_JS_RANGE_FEATURES,
                                    [this](const QmlEvent &event, const QmlEventType &type) {
         loadEvent(event, type);
@@ -95,8 +94,7 @@ void FlameGraphModel::loadNotes(int typeIndex, bool emitSignal)
 
 void FlameGraphModel::loadEvent(const QmlEvent &event, const QmlEventType &type)
 {
-    if (!m_acceptedTypes.contains(type.rangeType))
-        return;
+    Q_UNUSED(type);
 
     if (m_stackBottom.children.isEmpty())
         beginResetModel();
@@ -132,13 +130,12 @@ void FlameGraphModel::onModelManagerStateChanged()
 static QString nameForType(RangeType typeNumber)
 {
     switch (typeNumber) {
-    case Painting: return FlameGraphModel::tr("Paint");
     case Compiling: return FlameGraphModel::tr("Compile");
     case Creating: return FlameGraphModel::tr("Create");
     case Binding: return FlameGraphModel::tr("Binding");
     case HandlingSignal: return FlameGraphModel::tr("Signal");
     case Javascript: return FlameGraphModel::tr("JavaScript");
-    default: return QString();
+    default: Q_UNREACHABLE();
     }
 }
 
diff --git a/src/plugins/qmlprofiler/flamegraphmodel.h b/src/plugins/qmlprofiler/flamegraphmodel.h
index 3b130faaa1c..b01cd5fa233 100644
--- a/src/plugins/qmlprofiler/flamegraphmodel.h
+++ b/src/plugins/qmlprofiler/flamegraphmodel.h
@@ -108,7 +108,6 @@ private:
     int m_modelId;
     QmlProfilerModelManager *m_modelManager;
 
-    QList<RangeType> m_acceptedTypes;
     QSet<int> m_typeIdsWithNotes;
 };
 
-- 
GitLab