From fbf932539535f43cc80849c2710bd98878aea124 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Sat, 5 Aug 2023 10:55:52 +0200 Subject: [PATCH] ValgrindPlugin: Use QList instead of QVector Change-Id: Ib1bd223b73d1f7399008f91a3c26ff515ab03a0c Reviewed-by: Qt CI Bot Reviewed-by: hjk Reviewed-by: --- .../valgrind/callgrind/callgrindcallmodel.cpp | 8 ++++---- .../valgrind/callgrind/callgrindcallmodel.h | 4 ++-- .../valgrind/callgrind/callgrindcostitem.cpp | 10 +++++----- .../valgrind/callgrind/callgrindcostitem.h | 6 +++--- .../callgrind/callgrindcycledetection.cpp | 6 +++--- .../callgrind/callgrindcycledetection.h | 4 ++-- .../valgrind/callgrind/callgrinddatamodel.cpp | 4 ++-- .../valgrind/callgrind/callgrindfunction.cpp | 14 ++++++------- .../valgrind/callgrind/callgrindfunction.h | 10 +++++----- .../valgrind/callgrind/callgrindfunction_p.h | 18 ++++++++--------- .../callgrind/callgrindfunctioncall.cpp | 14 ++++++------- .../callgrind/callgrindfunctioncall.h | 10 +++++----- .../callgrind/callgrindfunctioncycle.cpp | 10 +++++----- .../callgrind/callgrindfunctioncycle.h | 4 ++-- .../valgrind/callgrind/callgrindparsedata.cpp | 17 ++++++++-------- .../valgrind/callgrind/callgrindparsedata.h | 4 ++-- .../valgrind/callgrind/callgrindparser.cpp | 14 ++++++------- .../callgrind/callgrindproxymodel.cpp | 2 +- src/plugins/valgrind/callgrindtool.cpp | 2 +- .../valgrind/callgrindvisualisation.cpp | 4 ++-- src/plugins/valgrind/memchecktool.cpp | 6 +++--- .../valgrind/valgrindmemcheckparsertest.cpp | 20 +++++++++---------- .../valgrind/xmlprotocol/announcethread.cpp | 8 ++++---- .../valgrind/xmlprotocol/announcethread.h | 6 +++--- src/plugins/valgrind/xmlprotocol/error.cpp | 10 +++++----- src/plugins/valgrind/xmlprotocol/error.h | 6 +++--- .../valgrind/xmlprotocol/errorlistmodel.cpp | 16 +++++++-------- src/plugins/valgrind/xmlprotocol/parser.cpp | 16 +++++++-------- src/plugins/valgrind/xmlprotocol/stack.cpp | 8 ++++---- src/plugins/valgrind/xmlprotocol/stack.h | 6 +++--- .../valgrind/xmlprotocol/stackmodel.cpp | 4 ++-- .../valgrind/xmlprotocol/suppression.cpp | 1 - .../valgrind/xmlprotocol/suppression.h | 4 ++-- 33 files changed, 137 insertions(+), 139 deletions(-) diff --git a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp index 31c00067f13..b341e29d5d1 100644 --- a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp @@ -10,7 +10,7 @@ #include -#include +#include namespace Valgrind::Callgrind { @@ -18,7 +18,7 @@ class CallModel::Private { public: const ParseData *m_data = nullptr; - QVector m_calls; + QList m_calls; int m_event = 0; const Function *m_function = nullptr; }; @@ -41,7 +41,7 @@ void CallModel::clear() endResetModel(); } -void CallModel::setCalls(const QVector &calls, const Function *function) +void CallModel::setCalls(const QList &calls, const Function *function) { beginResetModel(); d->m_function = function; @@ -49,7 +49,7 @@ void CallModel::setCalls(const QVector &calls, const Funct endResetModel(); } -QVector CallModel::calls() const +QList CallModel::calls() const { return d->m_calls; } diff --git a/src/plugins/valgrind/callgrind/callgrindcallmodel.h b/src/plugins/valgrind/callgrind/callgrindcallmodel.h index 8a45671de67..4b8e6f631e4 100644 --- a/src/plugins/valgrind/callgrind/callgrindcallmodel.h +++ b/src/plugins/valgrind/callgrind/callgrindcallmodel.h @@ -32,8 +32,8 @@ public: virtual void setParseData(const ParseData *data); virtual const ParseData *parseData() const; - void setCalls(const QVector &calls, const Function *function); - QVector calls() const; + void setCalls(const QList &calls, const Function *function); + QList calls() const; const Function *function() const; int rowCount(const QModelIndex &parent = QModelIndex()) const override; diff --git a/src/plugins/valgrind/callgrind/callgrindcostitem.cpp b/src/plugins/valgrind/callgrind/callgrindcostitem.cpp index 3bbf71fc419..40aa56de31e 100644 --- a/src/plugins/valgrind/callgrind/callgrindcostitem.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcostitem.cpp @@ -6,9 +6,9 @@ #include "callgrindparsedata.h" #include "callgrindfunctioncall.h" +#include #include #include -#include namespace Valgrind::Callgrind { @@ -18,8 +18,8 @@ public: Private(ParseData *data); ~Private(); - QVector m_positions; - QVector m_events; + QList m_positions; + QList m_events; const FunctionCall *m_call = nullptr; const ParseData *m_data = nullptr; @@ -60,7 +60,7 @@ void CostItem::setPosition(int posIdx, quint64 position) d->m_positions[posIdx] = position; } -QVector< quint64 > CostItem::positions() const +QList CostItem::positions() const { return d->m_positions; } @@ -75,7 +75,7 @@ void CostItem::setCost(int event, quint64 cost) d->m_events[event] = cost; } -QVector< quint64 > CostItem::costs() const +QList CostItem::costs() const { return d->m_events; } diff --git a/src/plugins/valgrind/callgrind/callgrindcostitem.h b/src/plugins/valgrind/callgrind/callgrindcostitem.h index 3b69d688925..3cc54df1dab 100644 --- a/src/plugins/valgrind/callgrind/callgrindcostitem.h +++ b/src/plugins/valgrind/callgrind/callgrindcostitem.h @@ -3,7 +3,7 @@ #pragma once -#include +#include namespace Valgrind::Callgrind { @@ -27,7 +27,7 @@ public: */ quint64 position(int posIdx) const; void setPosition(int posIdx, quint64 position); - QVector positions() const; + QList positions() const; /** * Cost data for the given event-index @p event @@ -35,7 +35,7 @@ public: */ quint64 cost(int event) const; void setCost(int event, quint64 cost); - QVector costs() const; + QList costs() const; /** * If this cost item represents a function call, this will return the @c Callee. diff --git a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp index ef8ab008091..c32e0ec9b7b 100644 --- a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp @@ -19,7 +19,7 @@ CycleDetection::CycleDetection(ParseData *data) { } -QVector CycleDetection::run(const QVector &input) +QList CycleDetection::run(const QList &input) { for (const Function *function : input) { Node *node = new Node; @@ -45,12 +45,12 @@ void CycleDetection::tarjan(Node *node) m_depth++; m_stack.push(node); - const QVector calls = node->function->outgoingCalls(); + const QList calls = node->function->outgoingCalls(); for (const FunctionCall *call : calls) tarjanForChildNode(node, m_nodes.value(call->callee())); if (node->dfs == node->lowlink) { - QVector functions; + QList functions; Node *n; do { n = m_stack.pop(); diff --git a/src/plugins/valgrind/callgrind/callgrindcycledetection.h b/src/plugins/valgrind/callgrind/callgrindcycledetection.h index 68eead96083..f38412fe549 100644 --- a/src/plugins/valgrind/callgrind/callgrindcycledetection.h +++ b/src/plugins/valgrind/callgrind/callgrindcycledetection.h @@ -25,7 +25,7 @@ class CycleDetection { public: explicit CycleDetection(ParseData *data); - QVector run(const QVector &input); + QList run(const QList &input); private: ParseData *m_data; @@ -41,7 +41,7 @@ private: QHash m_nodes; QStack m_stack; - QVector m_ret; + QList m_ret; int m_depth = 0; int m_cycle = 0; diff --git a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp index d5e9f370421..49d26262471 100644 --- a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp @@ -13,9 +13,9 @@ #include #include +#include #include #include -#include namespace Valgrind { namespace Callgrind { @@ -30,7 +30,7 @@ public: bool m_verboseToolTips = true; bool m_cycleDetection = false; bool m_shortenTemplates = false; - QVector m_functions; + QList m_functions; }; void DataModel::Private::updateFunctions() diff --git a/src/plugins/valgrind/callgrind/callgrindfunction.cpp b/src/plugins/valgrind/callgrind/callgrindfunction.cpp index ef10ec2ed98..0ec72d095d8 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunction.cpp +++ b/src/plugins/valgrind/callgrind/callgrindfunction.cpp @@ -39,7 +39,7 @@ Function::Private::~Private() qDeleteAll(m_outgoingCalls); } -void Function::Private::accumulateCost(QVector &base, const QVector &add) +void Function::Private::accumulateCost(QList &base, const QList &add) { if (base.isEmpty()) { base = add; @@ -72,7 +72,7 @@ FunctionCall *Function::Private::accumulateCall(const FunctionCall *call, CallTy accumulatedCall->setCosts(call->costs()); } else { - QVector costs = accumulatedCall->costs(); + QList costs = accumulatedCall->costs(); accumulateCost(costs, call->costs()); accumulatedCall->setCosts(costs); } @@ -206,7 +206,7 @@ quint64 Function::selfCost(int event) const return d->m_selfCost.at(event); } -QVector< quint64 > Function::selfCosts() const +QList Function::selfCosts() const { return d->m_selfCost; } @@ -216,7 +216,7 @@ quint64 Function::inclusiveCost(int event) const return d->m_inclusiveCost.at(event) + d->m_selfCost.at(event); } -QVector Function::outgoingCalls() const +QList Function::outgoingCalls() const { return d->m_outgoingCalls; } @@ -228,7 +228,7 @@ void Function::addOutgoingCall(const FunctionCall *call) d->accumulateCall(call, Private::Outgoing); } -QVector Function::incomingCalls() const +QList Function::incomingCalls() const { return d->m_incomingCalls; } @@ -245,7 +245,7 @@ quint64 Function::called() const return d->m_called; } -QVector Function::costItems() const +QList Function::costItems() const { return d->m_costItems; } @@ -281,7 +281,7 @@ void Function::finalize() d->m_inclusiveCost.fill(0); for (const FunctionCall *call : std::as_const(d->m_incomingCalls)) { if (call->caller() != this) { - const QVector costItems = call->caller()->costItems(); + const QList costItems = call->caller()->costItems(); for (const CostItem *costItem : costItems) { if (costItem->call() && costItem->call()->callee() == this) d->accumulateCost(d->m_inclusiveCost, costItem->costs()); diff --git a/src/plugins/valgrind/callgrind/callgrindfunction.h b/src/plugins/valgrind/callgrind/callgrindfunction.h index 57d757cbbd6..491ee53dedd 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunction.h +++ b/src/plugins/valgrind/callgrind/callgrindfunction.h @@ -3,8 +3,8 @@ #pragma once +#include #include -#include namespace Valgrind { namespace Callgrind { @@ -67,7 +67,7 @@ public: * @see ParseData::events() */ quint64 selfCost(int event) const; - QVector selfCosts() const; + QList selfCosts() const; /** * total accumulated inclusive cost of @p event @@ -76,7 +76,7 @@ public: quint64 inclusiveCost(int event) const; /// calls from other functions to this function - QVector incomingCalls() const; + QList incomingCalls() const; void addIncomingCall(const FunctionCall *call); /// @return how often this function was called in total quint64 called() const; @@ -86,7 +86,7 @@ public: * a detailed view of the function's source code annotated with * cost per line. */ - QVector costItems() const; + QList costItems() const; /** * Add parsed @c CostItem @p item to this function. @@ -98,7 +98,7 @@ public: /** * Function calls from this function to others. */ - QVector outgoingCalls() const; + QList outgoingCalls() const; void addOutgoingCall(const FunctionCall *call); /** diff --git a/src/plugins/valgrind/callgrind/callgrindfunction_p.h b/src/plugins/valgrind/callgrind/callgrindfunction_p.h index bc648cc0249..8ec54200c76 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunction_p.h +++ b/src/plugins/valgrind/callgrind/callgrindfunction_p.h @@ -3,13 +3,13 @@ #pragma once -#include "callgrindfunction.h" -#include "callgrindparsedata.h" #include "callgrindcostitem.h" +#include "callgrindfunction.h" #include "callgrindfunctioncall.h" +#include "callgrindparsedata.h" -#include #include +#include namespace Valgrind { namespace Callgrind { @@ -20,7 +20,7 @@ public: Private(const ParseData *data); virtual ~Private(); - static void accumulateCost(QVector &base, const QVector &add); + static void accumulateCost(QList &base, const QList &add); enum CallType { Incoming, Outgoing @@ -33,16 +33,16 @@ public: qint64 m_objectId = -1; qint64 m_nameId = -1; - QVector m_selfCost; - QVector m_inclusiveCost; + QList m_selfCost; + QList m_inclusiveCost; - QVector m_costItems; + QList m_costItems; // used to accumulate, hence values not const QHash m_outgoingCallMap; QHash m_incomingCallMap; // used in public api, hence const - QVector m_outgoingCalls; - QVector m_incomingCalls; + QList m_outgoingCalls; + QList m_incomingCalls; quint64 m_called = 0; }; diff --git a/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp b/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp index 190edc23e10..aa59a2a1cc8 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp +++ b/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp @@ -7,7 +7,7 @@ #include -#include +#include namespace Valgrind { namespace Callgrind { @@ -20,8 +20,8 @@ public: const Function *m_caller = nullptr; quint64 m_calls = 0; quint64 m_totalInclusiveCost = 0; - QVector m_destinations; - QVector m_costs; + QList m_destinations; + QList m_costs; }; //BEGIN FunctionCall @@ -71,12 +71,12 @@ quint64 FunctionCall::destination(int posIdx) const return d->m_destinations.at(posIdx); } -QVector FunctionCall::destinations() const +QList FunctionCall::destinations() const { return d->m_destinations; } -void FunctionCall::setDestinations(const QVector &destinations) +void FunctionCall::setDestinations(const QList &destinations) { d->m_destinations = destinations; } @@ -87,12 +87,12 @@ quint64 FunctionCall::cost(int event) const return d->m_costs.at(event); } -QVector FunctionCall::costs() const +QList FunctionCall::costs() const { return d->m_costs; } -void FunctionCall::setCosts(const QVector &costs) +void FunctionCall::setCosts(const QList &costs) { d->m_costs = costs; } diff --git a/src/plugins/valgrind/callgrind/callgrindfunctioncall.h b/src/plugins/valgrind/callgrind/callgrindfunctioncall.h index 961e71cb624..817e221ee98 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunctioncall.h +++ b/src/plugins/valgrind/callgrind/callgrindfunctioncall.h @@ -4,7 +4,7 @@ #pragma once #include -#include +#include namespace Valgrind { namespace Callgrind { @@ -37,16 +37,16 @@ public: * @see ParseData::positions() */ quint64 destination(int posIdx) const; - QVector destinations() const; - void setDestinations(const QVector &destinations); + QList destinations() const; + void setDestinations(const QList &destinations); /** * Inclusive cost of the function call. * @see ParseData::events() */ quint64 cost(int event) const; - QVector costs() const; - void setCosts(const QVector &costs); + QList costs() const; + void setCosts(const QList &costs); private: Q_DISABLE_COPY(FunctionCall) diff --git a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp index 92f4938b82e..f4d3fdfdedc 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp +++ b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp @@ -19,7 +19,7 @@ class FunctionCycle::Private : public Function::Private { public: Private(const ParseData *data); - QVector m_functions; + QList m_functions; }; FunctionCycle::Private::Private(const ParseData *data) @@ -39,7 +39,7 @@ FunctionCycle::FunctionCycle(const ParseData *data) // d should be deleted by Function::~Function() FunctionCycle::~FunctionCycle() = default; -void FunctionCycle::setFunctions(const QVector &functions) +void FunctionCycle::setFunctions(const QList &functions) { Private *d = CYCLE_D; @@ -55,13 +55,13 @@ void FunctionCycle::setFunctions(const QVector &functions) // just add up self cost Private::accumulateCost(d->m_selfCost, func->selfCosts()); // add outgoing calls to functions that are not part of the cycle - const QVector calls = func->outgoingCalls(); + const QList calls = func->outgoingCalls(); for (const FunctionCall *call : calls) { if (!functions.contains(call->callee())) d->accumulateCall(call, Function::Private::Outgoing); } // add incoming calls from functions that are not part of the cycle - const QVector inCalls = func->incomingCalls(); + const QList inCalls = func->incomingCalls(); for (const FunctionCall *call : inCalls) { if (!functions.contains(call->caller())) { d->accumulateCall(call, Function::Private::Incoming); @@ -80,7 +80,7 @@ void FunctionCycle::setFunctions(const QVector &functions) } } -QVector FunctionCycle::functions() const +QList FunctionCycle::functions() const { return CYCLE_D->m_functions; } diff --git a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h index d25b54a7660..320219bc167 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h +++ b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h @@ -24,9 +24,9 @@ public: /// sets the list of functions that make up this cycle /// NOTE: ownership is *not* transferred to the cycle - void setFunctions(const QVector &functions); + void setFunctions(const QList &functions); /// @return the functions that make up this cycle - QVector functions() const; + QList functions() const; private: class Private; diff --git a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp index 0f6f8285f64..7b7f2a3e672 100644 --- a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp @@ -3,17 +3,16 @@ #include "callgrindparsedata.h" -#include "callgrindfunction.h" #include "callgrindcycledetection.h" +#include "callgrindfunction.h" #include "callgrindfunctioncycle.h" #include "../valgrindtr.h" #include -#include -#include -#include #include +#include +#include namespace Valgrind { namespace Callgrind { @@ -32,8 +31,8 @@ public: QString m_fileName; QStringList m_events; QStringList m_positions; - QVector m_totalCosts; - QVector m_functions; + QList m_totalCosts; + QList m_functions; QString m_command; quint64 m_pid = 0; int m_lineNumberPositionIndex = -1; @@ -43,7 +42,7 @@ public: QStringList m_descriptions; QString m_creator; - QHash > > functionLookup; + QHash>> functionLookup; using NameLookupTable = QHash; QString stringForCompression(const NameLookupTable &lookup, qint64 id); @@ -55,7 +54,7 @@ public: void cycleDetection(); void cleanupFunctionCycles(); - QVector m_cycleCache; + QList m_cycleCache; ParseData *m_q; }; @@ -233,7 +232,7 @@ void ParseData::setTotalCost(uint event, quint64 cost) d->m_totalCosts[event] = cost; } -QVector ParseData::functions(bool detectCycles) const +QList ParseData::functions(bool detectCycles) const { if (detectCycles) { d->cycleDetection(); diff --git a/src/plugins/valgrind/callgrind/callgrindparsedata.h b/src/plugins/valgrind/callgrind/callgrindparsedata.h index d74efa4b169..84a3b327a30 100644 --- a/src/plugins/valgrind/callgrind/callgrindparsedata.h +++ b/src/plugins/valgrind/callgrind/callgrindparsedata.h @@ -3,7 +3,7 @@ #pragma once -#include +#include QT_BEGIN_NAMESPACE class QString; @@ -53,7 +53,7 @@ public: * * @return All functions that where reported in the data file. */ - QVector functions(bool detectCycles = false) const; + QList functions(bool detectCycles = false) const; /// NOTE: The @c ParseData will take ownership. void addFunction(const Function *function); diff --git a/src/plugins/valgrind/callgrind/callgrindparser.cpp b/src/plugins/valgrind/callgrind/callgrindparser.cpp index 4d22fcb695f..434e7751083 100644 --- a/src/plugins/valgrind/callgrind/callgrindparser.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparser.cpp @@ -12,10 +12,10 @@ #include #include -#include -#include -#include #include +#include +#include +#include // #define DEBUG_PARSER @@ -162,13 +162,13 @@ public: FunctionCall *call = nullptr; }; CallData currentCallData; - QVector callDestinations; + QList callDestinations; // we can only resolve callees after parsing the whole file so save that data here for now - QVector pendingCallees; + QList pendingCallees; // id(s) for the ??? file - QVector unknownFiles; + QList unknownFiles; // functions which call themselves QSet recursiveFunctions; @@ -197,7 +197,7 @@ void Parser::Private::parse(const FilePath &filePath) // build fast lookup of functions by their nameId QHash > functionLookup; - const QVector functions = data->functions(); + const QList functions = data->functions(); for (const Function *function : functions) { functionLookup[function->nameId()].append(function); } diff --git a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp index d13ec0c06e1..9d0c8353e6d 100644 --- a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp @@ -108,7 +108,7 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_ // check if the function from this index is a child of (called by) the filter function if (m_function) { bool isValid = false; - const QVector calls = func->incomingCalls(); + const QList calls = func->incomingCalls(); for (const FunctionCall *call : calls) { if (call->caller() == m_function) { isValid = true; diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 6062b95ea40..fb16a4441ef 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -187,7 +187,7 @@ public: QTimer m_updateTimer; - QVector m_textMarks; + QList m_textMarks; QAction *m_startAction = nullptr; QAction *m_stopAction = nullptr; diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp index 4120dc53de2..d0673bbf849 100644 --- a/src/plugins/valgrind/callgrindvisualisation.cpp +++ b/src/plugins/valgrind/callgrindvisualisation.cpp @@ -18,11 +18,11 @@ #include #include #include +#include #include #include #include #include -#include #define VISUALISATION_DEBUG 0 // Margin from hardcoded value in: @@ -345,7 +345,7 @@ void Visualization::populateScene() qreal total = 0; using Pair = QPair; - QVector costs; + QList costs; for (int row = 0; row < d->m_model->rowCount(); ++row) { const QModelIndex index = d->m_model->index(row, DataModel::InclusiveCostColumn); diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 192791d5569..4a353f7e908 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -245,11 +245,11 @@ static ErrorListModel::RelevantFrameFinder makeFrameFinder(const QStringList &pr { return [projectFiles](const Error &error) { const Frame defaultFrame = Frame(); - const QVector stacks = error.stacks(); + const QList stacks = error.stacks(); if (stacks.isEmpty()) return defaultFrame; const Stack &stack = stacks[0]; - const QVector frames = stack.frames(); + const QList frames = stack.frames(); if (frames.isEmpty()) return defaultFrame; @@ -348,7 +348,7 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel } } - const QVector frames = error.stacks().constFirst().frames(); + const QList frames = error.stacks().constFirst().frames(); const int framesToLookAt = qMin(6, frames.size()); diff --git a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp index 7c5a9725119..5b6aeaa96a2 100644 --- a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp +++ b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp @@ -212,7 +212,7 @@ void ValgrindMemcheckParserTest::testHelgrindSample1() frame12.setDirectory("/home/frank/source/tarballs/qt-4.6.3-build/src/corelib/../../include/QtCore/../../src/corelib/thread"); frame12.setFileName("qmutex.h"); frame12.setLine(120); - stack1.setFrames(QVector() << frame11 << frame12); + stack1.setFrames(QList() << frame11 << frame12); Stack stack2; stack2.setAuxWhat("Required order was established by acquisition of lock at 0xA39C270"); @@ -230,7 +230,7 @@ void ValgrindMemcheckParserTest::testHelgrindSample1() frame22.setDirectory("/home/frank/source/tarballs/qt-4.6.3-build/src/corelib/../../include/QtCore/../../src/corelib/thread"); frame22.setFileName("qmutex.h"); frame22.setLine(121); - stack2.setFrames(QVector() << frame21 << frame22); + stack2.setFrames(QList() << frame21 << frame22); Stack stack3; stack3.setAuxWhat("followed by a later acquisition of lock at 0xA3AC010"); @@ -249,8 +249,8 @@ void ValgrindMemcheckParserTest::testHelgrindSample1() frame32.setFileName("qmutex.h"); frame32.setLine(122); - stack3.setFrames(QVector() << frame31 << frame32); - error1.setStacks(QVector() << stack1 << stack2 << stack3); + stack3.setFrames(QList() << frame31 << frame32); + error1.setStacks(QList() << stack1 << stack2 << stack3); expectedErrors.append(error1); } @@ -316,14 +316,14 @@ void ValgrindMemcheckParserTest::testMemcheckSample1() f4.setLine(4396); Stack s1; s1.setAuxWhat("Address 0x11527cb8 is not stack'd, malloc'd or (recently) free'd"); - s1.setFrames(QVector() << f1 << f2 << f3 << f4); - error.setStacks( QVector() << s1 ); + s1.setFrames(QList() << f1 << f2 << f3 << f4); + error.setStacks(QList() << s1); expectedErrors << error; } - const QVector> expectedErrorCounts{{9, 2}}; - const QVector> expectedSuppCounts{ + const QList> expectedErrorCounts{{9, 2}}; + const QList> expectedSuppCounts{ {QString("X on SUSE11 writev uninit padding"), 12}, {QString("dl-hack3-cond-1"), 2}, {QString("glibc-2.5.x-on-SUSE-10.2-(PPC)-2a"), 2}}; @@ -375,7 +375,7 @@ void ValgrindMemcheckParserTest::testMemcheckSample2() //the first auxwhat should be assigned to the _second_ stack. const QList errors = rec.errors; QCOMPARE(errors.size(), 1); - const QVector stacks = errors.first().stacks(); + const QList stacks = errors.first().stacks(); QCOMPARE(stacks.size(), 2); QCOMPARE(stacks.first().auxWhat(), QString()); QCOMPARE(stacks.last().auxWhat(), "Address 0x11b66c50 is 0 bytes inside a block of size 16 free'd"); @@ -404,7 +404,7 @@ void ValgrindMemcheckParserTest::testMemcheckSample3() { const Error error = errors.at(0); - const QVector stacks = error.stacks(); + const QList stacks = error.stacks(); QCOMPARE(error.unique(), 0x1ll); QCOMPARE(error.what(), "Conditional jump or move depends on uninitialised value(s)"); diff --git a/src/plugins/valgrind/xmlprotocol/announcethread.cpp b/src/plugins/valgrind/xmlprotocol/announcethread.cpp index 6d4b33b40ed..c693005adcd 100644 --- a/src/plugins/valgrind/xmlprotocol/announcethread.cpp +++ b/src/plugins/valgrind/xmlprotocol/announcethread.cpp @@ -5,7 +5,7 @@ #include "frame.h" #include -#include +#include #include @@ -16,7 +16,7 @@ class AnnounceThread::Private : public QSharedData { public: qint64 hThreadId = -1; - QVector stack; + QList stack; }; AnnounceThread::AnnounceThread() @@ -56,12 +56,12 @@ void AnnounceThread::setHelgrindThreadId(qint64 id) d->hThreadId = id; } -QVector AnnounceThread::stack() const +QList AnnounceThread::stack() const { return d->stack; } -void AnnounceThread::setStack(const QVector &stack) +void AnnounceThread::setStack(const QList &stack) { d->stack = stack; } diff --git a/src/plugins/valgrind/xmlprotocol/announcethread.h b/src/plugins/valgrind/xmlprotocol/announcethread.h index 6e427d4ab20..ac5f9cab993 100644 --- a/src/plugins/valgrind/xmlprotocol/announcethread.h +++ b/src/plugins/valgrind/xmlprotocol/announcethread.h @@ -4,7 +4,7 @@ #pragma once #include -#include +#include namespace Valgrind { namespace XmlProtocol { @@ -23,8 +23,8 @@ public: qint64 helgrindThreadId() const; void setHelgrindThreadId(qint64 id); - QVector stack() const; - void setStack(const QVector &stack); + QList stack() const; + void setStack(const QList &stack); private: class Private; diff --git a/src/plugins/valgrind/xmlprotocol/error.cpp b/src/plugins/valgrind/xmlprotocol/error.cpp index a062eb1693d..3b67ce76d11 100644 --- a/src/plugins/valgrind/xmlprotocol/error.cpp +++ b/src/plugins/valgrind/xmlprotocol/error.cpp @@ -6,10 +6,10 @@ #include "stack.h" #include "suppression.h" +#include #include #include #include -#include #include @@ -23,7 +23,7 @@ public: qint64 tid = 0; QString what; int kind = 0; - QVector stacks; + QList stacks; Suppression suppression; quint64 leakedBytes = 0; qint64 leakedBlocks = 0; @@ -144,12 +144,12 @@ void Error::setKind(int k) d->kind = k; } -QVector Error::stacks() const +QList Error::stacks() const { return d->stacks; } -void Error::setStacks(const QVector &stacks) +void Error::setStacks(const QList &stacks) { d->stacks = stacks; } @@ -187,7 +187,7 @@ QString Error::toXml() const stream << " " << stack.auxWhat() << "\n"; stream << " \n"; - const QVector frames = stack.frames(); + const QList frames = stack.frames(); for (const Frame &frame : frames) { stream << " \n"; stream << " 0x" << QString::number(frame.instructionPointer(), 16) << "\n"; diff --git a/src/plugins/valgrind/xmlprotocol/error.h b/src/plugins/valgrind/xmlprotocol/error.h index 758091c8d91..d3bf646d188 100644 --- a/src/plugins/valgrind/xmlprotocol/error.h +++ b/src/plugins/valgrind/xmlprotocol/error.h @@ -3,9 +3,9 @@ #pragma once +#include #include #include -#include QT_BEGIN_NAMESPACE class QString; @@ -89,8 +89,8 @@ public: int kind() const; void setKind(int kind); - QVector stacks() const; - void setStacks(const QVector &stacks); + QList stacks() const; + void setStacks(const QList &stacks); Suppression suppression() const; void setSuppression(const Suppression &suppression); diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp index a44aa73a35a..aa5fa1c016a 100644 --- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp +++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include @@ -72,11 +72,11 @@ Frame ErrorListModel::findRelevantFrame(const Error &error) const { if (m_relevantFrameFinder) return m_relevantFrameFinder(error); - const QVector stacks = error.stacks(); + const QList stacks = error.stacks(); if (stacks.isEmpty()) return Frame(); const Stack &stack = stacks[0]; - const QVector frames = stack.frames(); + const QList frames = stack.frames(); if (!frames.isEmpty()) return frames.first(); return Frame(); @@ -142,11 +142,11 @@ ErrorItem::ErrorItem(const ErrorListModel *model, const Error &error) // just annoy the user. // The same goes for the frame level. if (m_error.stacks().count() > 1) { - const QVector stacks = m_error.stacks(); + const QList stacks = m_error.stacks(); for (const Stack &s : stacks) appendChild(new StackItem(s)); } else if (m_error.stacks().constFirst().frames().count() > 1) { - const QVector frames = m_error.stacks().constFirst().frames(); + const QList frames = m_error.stacks().constFirst().frames(); for (const Frame &f : frames) appendChild(new FrameItem(f)); } @@ -176,12 +176,12 @@ QVariant ErrorItem::data(int column, int role) const << m_model->errorLocation(m_error) << "\n"; - const QVector stacks = m_error.stacks(); + const QList stacks = m_error.stacks(); for (const Stack &stack : stacks) { if (!stack.auxWhat().isEmpty()) stream << stack.auxWhat(); int i = 1; - const QVector frames = stack.frames(); + const QList frames = stack.frames(); for (const Frame &frame : frames) stream << " " << i++ << ": " << makeFrameName(frame, true) << "\n"; } @@ -210,7 +210,7 @@ QVariant ErrorItem::data(int column, int role) const StackItem::StackItem(const Stack &stack) : m_stack(stack) { - const QVector frames = m_stack.frames(); + const QList frames = m_stack.frames(); for (const Frame &f : frames) appendChild(new FrameItem(f)); } diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp index f498fcf4fa5..96813fd11b4 100644 --- a/src/plugins/valgrind/xmlprotocol/parser.cpp +++ b/src/plugins/valgrind/xmlprotocol/parser.cpp @@ -76,7 +76,7 @@ public: private: void parseError(); - QVector parseStack(); + QList parseStack(); Suppression parseSuppression(); SuppressionFrame parseSuppressionFrame(); Frame parseFrame(); @@ -318,7 +318,7 @@ void Parser::Private::reportInternalError(const QString &e) emit q->internalError(e); } -static Stack makeStack(const XauxWhat &xauxwhat, const QVector &frames) +static Stack makeStack(const XauxWhat &xauxwhat, const QList &frames) { Stack s; s.setFrames(frames); @@ -333,9 +333,9 @@ static Stack makeStack(const XauxWhat &xauxwhat, const QVector &frames) void Parser::Private::parseError() { Error e; - QVector > frames; + QList> frames; XauxWhat currentAux; - QVector auxs; + QList auxs; int lastAuxWhat = -1; while (notAtEnd()) { @@ -396,9 +396,9 @@ void Parser::Private::parseError() //add empty stacks until sizes match while (frames.size() < auxs.size()) - frames.push_back(QVector()); + frames.push_back({}); - QVector stacks; + QList stacks; for (int i = 0; i < auxs.size(); ++i) stacks.append(makeStack(auxs[i], frames[i])); e.setStacks(stacks); @@ -543,9 +543,9 @@ void Parser::Private::parseStatus() emit q->status(s); } -QVector Parser::Private::parseStack() +QList Parser::Private::parseStack() { - QVector frames; + QList frames; while (notAtEnd()) { blockingReadNext(); if (reader.isEndElement()) diff --git a/src/plugins/valgrind/xmlprotocol/stack.cpp b/src/plugins/valgrind/xmlprotocol/stack.cpp index 5d977bbad12..973aaf9b2a2 100644 --- a/src/plugins/valgrind/xmlprotocol/stack.cpp +++ b/src/plugins/valgrind/xmlprotocol/stack.cpp @@ -4,9 +4,9 @@ #include "stack.h" #include "frame.h" +#include #include #include -#include namespace Valgrind { namespace XmlProtocol { @@ -19,7 +19,7 @@ public: QString dir; qint64 line = -1; qint64 hthreadid = -1; - QVector frames; + QList frames; }; Stack::Stack() @@ -62,12 +62,12 @@ void Stack::setAuxWhat(const QString &auxwhat) d->auxwhat = auxwhat; } -QVector Stack::frames() const +QList Stack::frames() const { return d->frames; } -void Stack::setFrames(const QVector &frames) +void Stack::setFrames(const QList &frames) { d->frames = frames; } diff --git a/src/plugins/valgrind/xmlprotocol/stack.h b/src/plugins/valgrind/xmlprotocol/stack.h index 8945984186b..333c1dc3201 100644 --- a/src/plugins/valgrind/xmlprotocol/stack.h +++ b/src/plugins/valgrind/xmlprotocol/stack.h @@ -3,8 +3,8 @@ #pragma once +#include #include -#include namespace Valgrind { namespace XmlProtocol { @@ -24,8 +24,8 @@ public: QString auxWhat() const; void setAuxWhat(const QString &auxwhat); - QVector frames() const; - void setFrames(const QVector &frames); + QList frames() const; + void setFrames(const QList &frames); //memcheck, ptrcheck, helgrind: QString file() const; diff --git a/src/plugins/valgrind/xmlprotocol/stackmodel.cpp b/src/plugins/valgrind/xmlprotocol/stackmodel.cpp index fceee892bb4..99ff1cacb25 100644 --- a/src/plugins/valgrind/xmlprotocol/stackmodel.cpp +++ b/src/plugins/valgrind/xmlprotocol/stackmodel.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include namespace Valgrind { namespace XmlProtocol { @@ -76,7 +76,7 @@ QVariant StackModel::data(const QModelIndex &index, int role) const } } else { const Stack stack = d->stack(index.parent().row()); - const QVector frames = stack.frames(); + const QList frames = stack.frames(); const int fidx = index.row(); if (fidx < 0 || fidx >= frames.size()) return QVariant(); diff --git a/src/plugins/valgrind/xmlprotocol/suppression.cpp b/src/plugins/valgrind/xmlprotocol/suppression.cpp index 5d86d9a0db1..c76caf7bed5 100644 --- a/src/plugins/valgrind/xmlprotocol/suppression.cpp +++ b/src/plugins/valgrind/xmlprotocol/suppression.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include diff --git a/src/plugins/valgrind/xmlprotocol/suppression.h b/src/plugins/valgrind/xmlprotocol/suppression.h index 328166ca23f..60f40cd638b 100644 --- a/src/plugins/valgrind/xmlprotocol/suppression.h +++ b/src/plugins/valgrind/xmlprotocol/suppression.h @@ -3,8 +3,8 @@ #pragma once +#include #include -#include QT_BEGIN_NAMESPACE class QString; @@ -40,7 +40,7 @@ private: QSharedDataPointer d; }; -using SuppressionFrames = QVector; +using SuppressionFrames = QList; class Suppression {