ValgrindPlugin: Use QList instead of QVector

Change-Id: Ib1bd223b73d1f7399008f91a3c26ff515ab03a0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-08-05 10:55:52 +02:00
parent 00a34e60fc
commit fbf9325395
33 changed files with 137 additions and 139 deletions

View File

@@ -10,7 +10,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QVector> #include <QList>
namespace Valgrind::Callgrind { namespace Valgrind::Callgrind {
@@ -18,7 +18,7 @@ class CallModel::Private
{ {
public: public:
const ParseData *m_data = nullptr; const ParseData *m_data = nullptr;
QVector<const FunctionCall *> m_calls; QList<const FunctionCall *> m_calls;
int m_event = 0; int m_event = 0;
const Function *m_function = nullptr; const Function *m_function = nullptr;
}; };
@@ -41,7 +41,7 @@ void CallModel::clear()
endResetModel(); endResetModel();
} }
void CallModel::setCalls(const QVector<const FunctionCall *> &calls, const Function *function) void CallModel::setCalls(const QList<const FunctionCall *> &calls, const Function *function)
{ {
beginResetModel(); beginResetModel();
d->m_function = function; d->m_function = function;
@@ -49,7 +49,7 @@ void CallModel::setCalls(const QVector<const FunctionCall *> &calls, const Funct
endResetModel(); endResetModel();
} }
QVector<const FunctionCall *> CallModel::calls() const QList<const FunctionCall *> CallModel::calls() const
{ {
return d->m_calls; return d->m_calls;
} }

View File

@@ -32,8 +32,8 @@ public:
virtual void setParseData(const ParseData *data); virtual void setParseData(const ParseData *data);
virtual const ParseData *parseData() const; virtual const ParseData *parseData() const;
void setCalls(const QVector<const FunctionCall *> &calls, const Function *function); void setCalls(const QList<const FunctionCall *> &calls, const Function *function);
QVector<const FunctionCall *> calls() const; QList<const FunctionCall *> calls() const;
const Function *function() const; const Function *function() const;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override;

View File

@@ -6,9 +6,9 @@
#include "callgrindparsedata.h" #include "callgrindparsedata.h"
#include "callgrindfunctioncall.h" #include "callgrindfunctioncall.h"
#include <QList>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QVector>
namespace Valgrind::Callgrind { namespace Valgrind::Callgrind {
@@ -18,8 +18,8 @@ public:
Private(ParseData *data); Private(ParseData *data);
~Private(); ~Private();
QVector<quint64> m_positions; QList<quint64> m_positions;
QVector<quint64> m_events; QList<quint64> m_events;
const FunctionCall *m_call = nullptr; const FunctionCall *m_call = nullptr;
const ParseData *m_data = nullptr; const ParseData *m_data = nullptr;
@@ -60,7 +60,7 @@ void CostItem::setPosition(int posIdx, quint64 position)
d->m_positions[posIdx] = position; d->m_positions[posIdx] = position;
} }
QVector< quint64 > CostItem::positions() const QList<quint64> CostItem::positions() const
{ {
return d->m_positions; return d->m_positions;
} }
@@ -75,7 +75,7 @@ void CostItem::setCost(int event, quint64 cost)
d->m_events[event] = cost; d->m_events[event] = cost;
} }
QVector< quint64 > CostItem::costs() const QList<quint64> CostItem::costs() const
{ {
return d->m_events; return d->m_events;
} }

View File

@@ -3,7 +3,7 @@
#pragma once #pragma once
#include <QVector> #include <QList>
namespace Valgrind::Callgrind { namespace Valgrind::Callgrind {
@@ -27,7 +27,7 @@ public:
*/ */
quint64 position(int posIdx) const; quint64 position(int posIdx) const;
void setPosition(int posIdx, quint64 position); void setPosition(int posIdx, quint64 position);
QVector<quint64> positions() const; QList<quint64> positions() const;
/** /**
* Cost data for the given event-index @p event * Cost data for the given event-index @p event
@@ -35,7 +35,7 @@ public:
*/ */
quint64 cost(int event) const; quint64 cost(int event) const;
void setCost(int event, quint64 cost); void setCost(int event, quint64 cost);
QVector<quint64> costs() const; QList<quint64> costs() const;
/** /**
* If this cost item represents a function call, this will return the @c Callee. * If this cost item represents a function call, this will return the @c Callee.

View File

@@ -19,7 +19,7 @@ CycleDetection::CycleDetection(ParseData *data)
{ {
} }
QVector<const Function *> CycleDetection::run(const QVector<const Function *> &input) QList<const Function *> CycleDetection::run(const QList<const Function *> &input)
{ {
for (const Function *function : input) { for (const Function *function : input) {
Node *node = new Node; Node *node = new Node;
@@ -45,12 +45,12 @@ void CycleDetection::tarjan(Node *node)
m_depth++; m_depth++;
m_stack.push(node); m_stack.push(node);
const QVector<const FunctionCall *> calls = node->function->outgoingCalls(); const QList<const FunctionCall *> calls = node->function->outgoingCalls();
for (const FunctionCall *call : calls) for (const FunctionCall *call : calls)
tarjanForChildNode(node, m_nodes.value(call->callee())); tarjanForChildNode(node, m_nodes.value(call->callee()));
if (node->dfs == node->lowlink) { if (node->dfs == node->lowlink) {
QVector<const Function *> functions; QList<const Function *> functions;
Node *n; Node *n;
do { do {
n = m_stack.pop(); n = m_stack.pop();

View File

@@ -25,7 +25,7 @@ class CycleDetection
{ {
public: public:
explicit CycleDetection(ParseData *data); explicit CycleDetection(ParseData *data);
QVector<const Function *> run(const QVector<const Function *> &input); QList<const Function *> run(const QList<const Function *> &input);
private: private:
ParseData *m_data; ParseData *m_data;
@@ -41,7 +41,7 @@ private:
QHash<const Function *, Node *> m_nodes; QHash<const Function *, Node *> m_nodes;
QStack<Node *> m_stack; QStack<Node *> m_stack;
QVector<const Function *> m_ret; QList<const Function *> m_ret;
int m_depth = 0; int m_depth = 0;
int m_cycle = 0; int m_cycle = 0;

View File

@@ -13,9 +13,9 @@
#include <QChar> #include <QChar>
#include <QDebug> #include <QDebug>
#include <QList>
#include <QStringList> #include <QStringList>
#include <QTextDocument> #include <QTextDocument>
#include <QVector>
namespace Valgrind { namespace Valgrind {
namespace Callgrind { namespace Callgrind {
@@ -30,7 +30,7 @@ public:
bool m_verboseToolTips = true; bool m_verboseToolTips = true;
bool m_cycleDetection = false; bool m_cycleDetection = false;
bool m_shortenTemplates = false; bool m_shortenTemplates = false;
QVector<const Function *> m_functions; QList<const Function *> m_functions;
}; };
void DataModel::Private::updateFunctions() void DataModel::Private::updateFunctions()

View File

@@ -39,7 +39,7 @@ Function::Private::~Private()
qDeleteAll(m_outgoingCalls); qDeleteAll(m_outgoingCalls);
} }
void Function::Private::accumulateCost(QVector<quint64> &base, const QVector<quint64> &add) void Function::Private::accumulateCost(QList<quint64> &base, const QList<quint64> &add)
{ {
if (base.isEmpty()) { if (base.isEmpty()) {
base = add; base = add;
@@ -72,7 +72,7 @@ FunctionCall *Function::Private::accumulateCall(const FunctionCall *call, CallTy
accumulatedCall->setCosts(call->costs()); accumulatedCall->setCosts(call->costs());
} else { } else {
QVector<quint64> costs = accumulatedCall->costs(); QList<quint64> costs = accumulatedCall->costs();
accumulateCost(costs, call->costs()); accumulateCost(costs, call->costs());
accumulatedCall->setCosts(costs); accumulatedCall->setCosts(costs);
} }
@@ -206,7 +206,7 @@ quint64 Function::selfCost(int event) const
return d->m_selfCost.at(event); return d->m_selfCost.at(event);
} }
QVector< quint64 > Function::selfCosts() const QList<quint64> Function::selfCosts() const
{ {
return d->m_selfCost; 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); return d->m_inclusiveCost.at(event) + d->m_selfCost.at(event);
} }
QVector<const FunctionCall *> Function::outgoingCalls() const QList<const FunctionCall *> Function::outgoingCalls() const
{ {
return d->m_outgoingCalls; return d->m_outgoingCalls;
} }
@@ -228,7 +228,7 @@ void Function::addOutgoingCall(const FunctionCall *call)
d->accumulateCall(call, Private::Outgoing); d->accumulateCall(call, Private::Outgoing);
} }
QVector<const FunctionCall *> Function::incomingCalls() const QList<const FunctionCall *> Function::incomingCalls() const
{ {
return d->m_incomingCalls; return d->m_incomingCalls;
} }
@@ -245,7 +245,7 @@ quint64 Function::called() const
return d->m_called; return d->m_called;
} }
QVector<const CostItem *> Function::costItems() const QList<const CostItem *> Function::costItems() const
{ {
return d->m_costItems; return d->m_costItems;
} }
@@ -281,7 +281,7 @@ void Function::finalize()
d->m_inclusiveCost.fill(0); d->m_inclusiveCost.fill(0);
for (const FunctionCall *call : std::as_const(d->m_incomingCalls)) { for (const FunctionCall *call : std::as_const(d->m_incomingCalls)) {
if (call->caller() != this) { if (call->caller() != this) {
const QVector<const CostItem *> costItems = call->caller()->costItems(); const QList<const CostItem *> costItems = call->caller()->costItems();
for (const CostItem *costItem : costItems) { for (const CostItem *costItem : costItems) {
if (costItem->call() && costItem->call()->callee() == this) if (costItem->call() && costItem->call()->callee() == this)
d->accumulateCost(d->m_inclusiveCost, costItem->costs()); d->accumulateCost(d->m_inclusiveCost, costItem->costs());

View File

@@ -3,8 +3,8 @@
#pragma once #pragma once
#include <QList>
#include <QMetaType> #include <QMetaType>
#include <QVector>
namespace Valgrind { namespace Valgrind {
namespace Callgrind { namespace Callgrind {
@@ -67,7 +67,7 @@ public:
* @see ParseData::events() * @see ParseData::events()
*/ */
quint64 selfCost(int event) const; quint64 selfCost(int event) const;
QVector<quint64> selfCosts() const; QList<quint64> selfCosts() const;
/** /**
* total accumulated inclusive cost of @p event * total accumulated inclusive cost of @p event
@@ -76,7 +76,7 @@ public:
quint64 inclusiveCost(int event) const; quint64 inclusiveCost(int event) const;
/// calls from other functions to this function /// calls from other functions to this function
QVector<const FunctionCall *> incomingCalls() const; QList<const FunctionCall *> incomingCalls() const;
void addIncomingCall(const FunctionCall *call); void addIncomingCall(const FunctionCall *call);
/// @return how often this function was called in total /// @return how often this function was called in total
quint64 called() const; quint64 called() const;
@@ -86,7 +86,7 @@ public:
* a detailed view of the function's source code annotated with * a detailed view of the function's source code annotated with
* cost per line. * cost per line.
*/ */
QVector<const CostItem *> costItems() const; QList<const CostItem *> costItems() const;
/** /**
* Add parsed @c CostItem @p item to this function. * Add parsed @c CostItem @p item to this function.
@@ -98,7 +98,7 @@ public:
/** /**
* Function calls from this function to others. * Function calls from this function to others.
*/ */
QVector<const FunctionCall *> outgoingCalls() const; QList<const FunctionCall *> outgoingCalls() const;
void addOutgoingCall(const FunctionCall *call); void addOutgoingCall(const FunctionCall *call);
/** /**

View File

@@ -3,13 +3,13 @@
#pragma once #pragma once
#include "callgrindfunction.h"
#include "callgrindparsedata.h"
#include "callgrindcostitem.h" #include "callgrindcostitem.h"
#include "callgrindfunction.h"
#include "callgrindfunctioncall.h" #include "callgrindfunctioncall.h"
#include "callgrindparsedata.h"
#include <QVector>
#include <QHash> #include <QHash>
#include <QList>
namespace Valgrind { namespace Valgrind {
namespace Callgrind { namespace Callgrind {
@@ -20,7 +20,7 @@ public:
Private(const ParseData *data); Private(const ParseData *data);
virtual ~Private(); virtual ~Private();
static void accumulateCost(QVector<quint64> &base, const QVector<quint64> &add); static void accumulateCost(QList<quint64> &base, const QList<quint64> &add);
enum CallType { enum CallType {
Incoming, Incoming,
Outgoing Outgoing
@@ -33,16 +33,16 @@ public:
qint64 m_objectId = -1; qint64 m_objectId = -1;
qint64 m_nameId = -1; qint64 m_nameId = -1;
QVector<quint64> m_selfCost; QList<quint64> m_selfCost;
QVector<quint64> m_inclusiveCost; QList<quint64> m_inclusiveCost;
QVector<const CostItem *> m_costItems; QList<const CostItem *> m_costItems;
// used to accumulate, hence values not const // used to accumulate, hence values not const
QHash<const Function *, FunctionCall *> m_outgoingCallMap; QHash<const Function *, FunctionCall *> m_outgoingCallMap;
QHash<const Function *, FunctionCall *> m_incomingCallMap; QHash<const Function *, FunctionCall *> m_incomingCallMap;
// used in public api, hence const // used in public api, hence const
QVector<const FunctionCall *> m_outgoingCalls; QList<const FunctionCall *> m_outgoingCalls;
QVector<const FunctionCall *> m_incomingCalls; QList<const FunctionCall *> m_incomingCalls;
quint64 m_called = 0; quint64 m_called = 0;
}; };

View File

@@ -7,7 +7,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QVector> #include <QList>
namespace Valgrind { namespace Valgrind {
namespace Callgrind { namespace Callgrind {
@@ -20,8 +20,8 @@ public:
const Function *m_caller = nullptr; const Function *m_caller = nullptr;
quint64 m_calls = 0; quint64 m_calls = 0;
quint64 m_totalInclusiveCost = 0; quint64 m_totalInclusiveCost = 0;
QVector<quint64> m_destinations; QList<quint64> m_destinations;
QVector<quint64> m_costs; QList<quint64> m_costs;
}; };
//BEGIN FunctionCall //BEGIN FunctionCall
@@ -71,12 +71,12 @@ quint64 FunctionCall::destination(int posIdx) const
return d->m_destinations.at(posIdx); return d->m_destinations.at(posIdx);
} }
QVector<quint64> FunctionCall::destinations() const QList<quint64> FunctionCall::destinations() const
{ {
return d->m_destinations; return d->m_destinations;
} }
void FunctionCall::setDestinations(const QVector<quint64> &destinations) void FunctionCall::setDestinations(const QList<quint64> &destinations)
{ {
d->m_destinations = destinations; d->m_destinations = destinations;
} }
@@ -87,12 +87,12 @@ quint64 FunctionCall::cost(int event) const
return d->m_costs.at(event); return d->m_costs.at(event);
} }
QVector<quint64> FunctionCall::costs() const QList<quint64> FunctionCall::costs() const
{ {
return d->m_costs; return d->m_costs;
} }
void FunctionCall::setCosts(const QVector<quint64> &costs) void FunctionCall::setCosts(const QList<quint64> &costs)
{ {
d->m_costs = costs; d->m_costs = costs;
} }

View File

@@ -4,7 +4,7 @@
#pragma once #pragma once
#include <QMetaType> #include <QMetaType>
#include <QVector> #include <QList>
namespace Valgrind { namespace Valgrind {
namespace Callgrind { namespace Callgrind {
@@ -37,16 +37,16 @@ public:
* @see ParseData::positions() * @see ParseData::positions()
*/ */
quint64 destination(int posIdx) const; quint64 destination(int posIdx) const;
QVector<quint64> destinations() const; QList<quint64> destinations() const;
void setDestinations(const QVector<quint64> &destinations); void setDestinations(const QList<quint64> &destinations);
/** /**
* Inclusive cost of the function call. * Inclusive cost of the function call.
* @see ParseData::events() * @see ParseData::events()
*/ */
quint64 cost(int event) const; quint64 cost(int event) const;
QVector<quint64> costs() const; QList<quint64> costs() const;
void setCosts(const QVector<quint64> &costs); void setCosts(const QList<quint64> &costs);
private: private:
Q_DISABLE_COPY(FunctionCall) Q_DISABLE_COPY(FunctionCall)

View File

@@ -19,7 +19,7 @@ class FunctionCycle::Private : public Function::Private
{ {
public: public:
Private(const ParseData *data); Private(const ParseData *data);
QVector<const Function *> m_functions; QList<const Function *> m_functions;
}; };
FunctionCycle::Private::Private(const ParseData *data) FunctionCycle::Private::Private(const ParseData *data)
@@ -39,7 +39,7 @@ FunctionCycle::FunctionCycle(const ParseData *data)
// d should be deleted by Function::~Function() // d should be deleted by Function::~Function()
FunctionCycle::~FunctionCycle() = default; FunctionCycle::~FunctionCycle() = default;
void FunctionCycle::setFunctions(const QVector<const Function *> &functions) void FunctionCycle::setFunctions(const QList<const Function *> &functions)
{ {
Private *d = CYCLE_D; Private *d = CYCLE_D;
@@ -55,13 +55,13 @@ void FunctionCycle::setFunctions(const QVector<const Function *> &functions)
// just add up self cost // just add up self cost
Private::accumulateCost(d->m_selfCost, func->selfCosts()); Private::accumulateCost(d->m_selfCost, func->selfCosts());
// add outgoing calls to functions that are not part of the cycle // add outgoing calls to functions that are not part of the cycle
const QVector<const FunctionCall *> calls = func->outgoingCalls(); const QList<const FunctionCall *> calls = func->outgoingCalls();
for (const FunctionCall *call : calls) { for (const FunctionCall *call : calls) {
if (!functions.contains(call->callee())) if (!functions.contains(call->callee()))
d->accumulateCall(call, Function::Private::Outgoing); d->accumulateCall(call, Function::Private::Outgoing);
} }
// add incoming calls from functions that are not part of the cycle // add incoming calls from functions that are not part of the cycle
const QVector<const FunctionCall *> inCalls = func->incomingCalls(); const QList<const FunctionCall *> inCalls = func->incomingCalls();
for (const FunctionCall *call : inCalls) { for (const FunctionCall *call : inCalls) {
if (!functions.contains(call->caller())) { if (!functions.contains(call->caller())) {
d->accumulateCall(call, Function::Private::Incoming); d->accumulateCall(call, Function::Private::Incoming);
@@ -80,7 +80,7 @@ void FunctionCycle::setFunctions(const QVector<const Function *> &functions)
} }
} }
QVector<const Function *> FunctionCycle::functions() const QList<const Function *> FunctionCycle::functions() const
{ {
return CYCLE_D->m_functions; return CYCLE_D->m_functions;
} }

View File

@@ -24,9 +24,9 @@ public:
/// sets the list of functions that make up this cycle /// sets the list of functions that make up this cycle
/// NOTE: ownership is *not* transferred to the cycle /// NOTE: ownership is *not* transferred to the cycle
void setFunctions(const QVector<const Function *> &functions); void setFunctions(const QList<const Function *> &functions);
/// @return the functions that make up this cycle /// @return the functions that make up this cycle
QVector<const Function *> functions() const; QList<const Function *> functions() const;
private: private:
class Private; class Private;

View File

@@ -3,17 +3,16 @@
#include "callgrindparsedata.h" #include "callgrindparsedata.h"
#include "callgrindfunction.h"
#include "callgrindcycledetection.h" #include "callgrindcycledetection.h"
#include "callgrindfunction.h"
#include "callgrindfunctioncycle.h" #include "callgrindfunctioncycle.h"
#include "../valgrindtr.h" #include "../valgrindtr.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QStringList>
#include <QVector>
#include <QHash>
#include <QCoreApplication> #include <QCoreApplication>
#include <QHash>
#include <QStringList>
namespace Valgrind { namespace Valgrind {
namespace Callgrind { namespace Callgrind {
@@ -32,8 +31,8 @@ public:
QString m_fileName; QString m_fileName;
QStringList m_events; QStringList m_events;
QStringList m_positions; QStringList m_positions;
QVector<quint64> m_totalCosts; QList<quint64> m_totalCosts;
QVector<const Function *> m_functions; QList<const Function *> m_functions;
QString m_command; QString m_command;
quint64 m_pid = 0; quint64 m_pid = 0;
int m_lineNumberPositionIndex = -1; int m_lineNumberPositionIndex = -1;
@@ -43,7 +42,7 @@ public:
QStringList m_descriptions; QStringList m_descriptions;
QString m_creator; QString m_creator;
QHash<qint64, QHash<qint64, QVector<Function *> > > functionLookup; QHash<qint64, QHash<qint64, QList<Function *>>> functionLookup;
using NameLookupTable = QHash<qint64, QString>; using NameLookupTable = QHash<qint64, QString>;
QString stringForCompression(const NameLookupTable &lookup, qint64 id); QString stringForCompression(const NameLookupTable &lookup, qint64 id);
@@ -55,7 +54,7 @@ public:
void cycleDetection(); void cycleDetection();
void cleanupFunctionCycles(); void cleanupFunctionCycles();
QVector<const Function *> m_cycleCache; QList<const Function *> m_cycleCache;
ParseData *m_q; ParseData *m_q;
}; };
@@ -233,7 +232,7 @@ void ParseData::setTotalCost(uint event, quint64 cost)
d->m_totalCosts[event] = cost; d->m_totalCosts[event] = cost;
} }
QVector<const Function *> ParseData::functions(bool detectCycles) const QList<const Function *> ParseData::functions(bool detectCycles) const
{ {
if (detectCycles) { if (detectCycles) {
d->cycleDetection(); d->cycleDetection();

View File

@@ -3,7 +3,7 @@
#pragma once #pragma once
#include <QVector> #include <QList>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QString; class QString;
@@ -53,7 +53,7 @@ public:
* *
* @return All functions that where reported in the data file. * @return All functions that where reported in the data file.
*/ */
QVector<const Function *> functions(bool detectCycles = false) const; QList<const Function *> functions(bool detectCycles = false) const;
/// NOTE: The @c ParseData will take ownership. /// NOTE: The @c ParseData will take ownership.
void addFunction(const Function *function); void addFunction(const Function *function);

View File

@@ -12,10 +12,10 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <QHash>
#include <QVector>
#include <QStringList>
#include <QDebug> #include <QDebug>
#include <QHash>
#include <QList>
#include <QStringList>
// #define DEBUG_PARSER // #define DEBUG_PARSER
@@ -162,13 +162,13 @@ public:
FunctionCall *call = nullptr; FunctionCall *call = nullptr;
}; };
CallData currentCallData; CallData currentCallData;
QVector<quint64> callDestinations; QList<quint64> callDestinations;
// we can only resolve callees after parsing the whole file so save that data here for now // we can only resolve callees after parsing the whole file so save that data here for now
QVector<CallData> pendingCallees; QList<CallData> pendingCallees;
// id(s) for the ??? file // id(s) for the ??? file
QVector<quint64> unknownFiles; QList<quint64> unknownFiles;
// functions which call themselves // functions which call themselves
QSet<Function *> recursiveFunctions; QSet<Function *> recursiveFunctions;
@@ -197,7 +197,7 @@ void Parser::Private::parse(const FilePath &filePath)
// build fast lookup of functions by their nameId // build fast lookup of functions by their nameId
QHash<qint64, QList<const Function *> > functionLookup; QHash<qint64, QList<const Function *> > functionLookup;
const QVector<const Function *> functions = data->functions(); const QList<const Function *> functions = data->functions();
for (const Function *function : functions) { for (const Function *function : functions) {
functionLookup[function->nameId()].append(function); functionLookup[function->nameId()].append(function);
} }

View File

@@ -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 // check if the function from this index is a child of (called by) the filter function
if (m_function) { if (m_function) {
bool isValid = false; bool isValid = false;
const QVector<const FunctionCall *> calls = func->incomingCalls(); const QList<const FunctionCall *> calls = func->incomingCalls();
for (const FunctionCall *call : calls) { for (const FunctionCall *call : calls) {
if (call->caller() == m_function) { if (call->caller() == m_function) {
isValid = true; isValid = true;

View File

@@ -187,7 +187,7 @@ public:
QTimer m_updateTimer; QTimer m_updateTimer;
QVector<CallgrindTextMark *> m_textMarks; QList<CallgrindTextMark *> m_textMarks;
QAction *m_startAction = nullptr; QAction *m_startAction = nullptr;
QAction *m_stopAction = nullptr; QAction *m_stopAction = nullptr;

View File

@@ -18,11 +18,11 @@
#include <QGraphicsRectItem> #include <QGraphicsRectItem>
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QGraphicsSimpleTextItem> #include <QGraphicsSimpleTextItem>
#include <QList>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPair> #include <QPair>
#include <QStaticText> #include <QStaticText>
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
#include <QVector>
#define VISUALISATION_DEBUG 0 #define VISUALISATION_DEBUG 0
// Margin from hardcoded value in: // Margin from hardcoded value in:
@@ -345,7 +345,7 @@ void Visualization::populateScene()
qreal total = 0; qreal total = 0;
using Pair = QPair<QModelIndex, qreal>; using Pair = QPair<QModelIndex, qreal>;
QVector<Pair> costs; QList<Pair> costs;
for (int row = 0; row < d->m_model->rowCount(); ++row) { for (int row = 0; row < d->m_model->rowCount(); ++row) {
const QModelIndex index = d->m_model->index(row, DataModel::InclusiveCostColumn); const QModelIndex index = d->m_model->index(row, DataModel::InclusiveCostColumn);

View File

@@ -245,11 +245,11 @@ static ErrorListModel::RelevantFrameFinder makeFrameFinder(const QStringList &pr
{ {
return [projectFiles](const Error &error) { return [projectFiles](const Error &error) {
const Frame defaultFrame = Frame(); const Frame defaultFrame = Frame();
const QVector<Stack> stacks = error.stacks(); const QList<Stack> stacks = error.stacks();
if (stacks.isEmpty()) if (stacks.isEmpty())
return defaultFrame; return defaultFrame;
const Stack &stack = stacks[0]; const Stack &stack = stacks[0];
const QVector<Frame> frames = stack.frames(); const QList<Frame> frames = stack.frames();
if (frames.isEmpty()) if (frames.isEmpty())
return defaultFrame; return defaultFrame;
@@ -348,7 +348,7 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel
} }
} }
const QVector<Frame> frames = error.stacks().constFirst().frames(); const QList<Frame> frames = error.stacks().constFirst().frames();
const int framesToLookAt = qMin(6, frames.size()); const int framesToLookAt = qMin(6, frames.size());

View File

@@ -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.setDirectory("/home/frank/source/tarballs/qt-4.6.3-build/src/corelib/../../include/QtCore/../../src/corelib/thread");
frame12.setFileName("qmutex.h"); frame12.setFileName("qmutex.h");
frame12.setLine(120); frame12.setLine(120);
stack1.setFrames(QVector<Frame>() << frame11 << frame12); stack1.setFrames(QList<Frame>() << frame11 << frame12);
Stack stack2; Stack stack2;
stack2.setAuxWhat("Required order was established by acquisition of lock at 0xA39C270"); 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.setDirectory("/home/frank/source/tarballs/qt-4.6.3-build/src/corelib/../../include/QtCore/../../src/corelib/thread");
frame22.setFileName("qmutex.h"); frame22.setFileName("qmutex.h");
frame22.setLine(121); frame22.setLine(121);
stack2.setFrames(QVector<Frame>() << frame21 << frame22); stack2.setFrames(QList<Frame>() << frame21 << frame22);
Stack stack3; Stack stack3;
stack3.setAuxWhat("followed by a later acquisition of lock at 0xA3AC010"); stack3.setAuxWhat("followed by a later acquisition of lock at 0xA3AC010");
@@ -249,8 +249,8 @@ void ValgrindMemcheckParserTest::testHelgrindSample1()
frame32.setFileName("qmutex.h"); frame32.setFileName("qmutex.h");
frame32.setLine(122); frame32.setLine(122);
stack3.setFrames(QVector<Frame>() << frame31 << frame32); stack3.setFrames(QList<Frame>() << frame31 << frame32);
error1.setStacks(QVector<Stack>() << stack1 << stack2 << stack3); error1.setStacks(QList<Stack>() << stack1 << stack2 << stack3);
expectedErrors.append(error1); expectedErrors.append(error1);
} }
@@ -316,14 +316,14 @@ void ValgrindMemcheckParserTest::testMemcheckSample1()
f4.setLine(4396); f4.setLine(4396);
Stack s1; Stack s1;
s1.setAuxWhat("Address 0x11527cb8 is not stack'd, malloc'd or (recently) free'd"); s1.setAuxWhat("Address 0x11527cb8 is not stack'd, malloc'd or (recently) free'd");
s1.setFrames(QVector<Frame>() << f1 << f2 << f3 << f4); s1.setFrames(QList<Frame>() << f1 << f2 << f3 << f4);
error.setStacks( QVector<Stack>() << s1 ); error.setStacks(QList<Stack>() << s1);
expectedErrors << error; expectedErrors << error;
} }
const QVector<QPair<qint64,qint64>> expectedErrorCounts{{9, 2}}; const QList<QPair<qint64, qint64>> expectedErrorCounts{{9, 2}};
const QVector<QPair<QString,qint64>> expectedSuppCounts{ const QList<QPair<QString, qint64>> expectedSuppCounts{
{QString("X on SUSE11 writev uninit padding"), 12}, {QString("X on SUSE11 writev uninit padding"), 12},
{QString("dl-hack3-cond-1"), 2}, {QString("dl-hack3-cond-1"), 2},
{QString("glibc-2.5.x-on-SUSE-10.2-(PPC)-2a"), 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. //the first auxwhat should be assigned to the _second_ stack.
const QList<Error> errors = rec.errors; const QList<Error> errors = rec.errors;
QCOMPARE(errors.size(), 1); QCOMPARE(errors.size(), 1);
const QVector<Stack> stacks = errors.first().stacks(); const QList<Stack> stacks = errors.first().stacks();
QCOMPARE(stacks.size(), 2); QCOMPARE(stacks.size(), 2);
QCOMPARE(stacks.first().auxWhat(), QString()); QCOMPARE(stacks.first().auxWhat(), QString());
QCOMPARE(stacks.last().auxWhat(), "Address 0x11b66c50 is 0 bytes inside a block of size 16 free'd"); 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 Error error = errors.at(0);
const QVector<Stack> stacks = error.stacks(); const QList<Stack> stacks = error.stacks();
QCOMPARE(error.unique(), 0x1ll); QCOMPARE(error.unique(), 0x1ll);
QCOMPARE(error.what(), "Conditional jump or move depends on uninitialised value(s)"); QCOMPARE(error.what(), "Conditional jump or move depends on uninitialised value(s)");

View File

@@ -5,7 +5,7 @@
#include "frame.h" #include "frame.h"
#include <QSharedData> #include <QSharedData>
#include <QVector> #include <QList>
#include <algorithm> #include <algorithm>
@@ -16,7 +16,7 @@ class AnnounceThread::Private : public QSharedData
{ {
public: public:
qint64 hThreadId = -1; qint64 hThreadId = -1;
QVector<Frame> stack; QList<Frame> stack;
}; };
AnnounceThread::AnnounceThread() AnnounceThread::AnnounceThread()
@@ -56,12 +56,12 @@ void AnnounceThread::setHelgrindThreadId(qint64 id)
d->hThreadId = id; d->hThreadId = id;
} }
QVector<Frame> AnnounceThread::stack() const QList<Frame> AnnounceThread::stack() const
{ {
return d->stack; return d->stack;
} }
void AnnounceThread::setStack(const QVector<Frame> &stack) void AnnounceThread::setStack(const QList<Frame> &stack)
{ {
d->stack = stack; d->stack = stack;
} }

View File

@@ -4,7 +4,7 @@
#pragma once #pragma once
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QVector> #include <QList>
namespace Valgrind { namespace Valgrind {
namespace XmlProtocol { namespace XmlProtocol {
@@ -23,8 +23,8 @@ public:
qint64 helgrindThreadId() const; qint64 helgrindThreadId() const;
void setHelgrindThreadId(qint64 id); void setHelgrindThreadId(qint64 id);
QVector<Frame> stack() const; QList<Frame> stack() const;
void setStack(const QVector<Frame> &stack); void setStack(const QList<Frame> &stack);
private: private:
class Private; class Private;

View File

@@ -6,10 +6,10 @@
#include "stack.h" #include "stack.h"
#include "suppression.h" #include "suppression.h"
#include <QList>
#include <QSharedData> #include <QSharedData>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include <QVector>
#include <algorithm> #include <algorithm>
@@ -23,7 +23,7 @@ public:
qint64 tid = 0; qint64 tid = 0;
QString what; QString what;
int kind = 0; int kind = 0;
QVector<Stack> stacks; QList<Stack> stacks;
Suppression suppression; Suppression suppression;
quint64 leakedBytes = 0; quint64 leakedBytes = 0;
qint64 leakedBlocks = 0; qint64 leakedBlocks = 0;
@@ -144,12 +144,12 @@ void Error::setKind(int k)
d->kind = k; d->kind = k;
} }
QVector<Stack> Error::stacks() const QList<Stack> Error::stacks() const
{ {
return d->stacks; return d->stacks;
} }
void Error::setStacks(const QVector<Stack> &stacks) void Error::setStacks(const QList<Stack> &stacks)
{ {
d->stacks = stacks; d->stacks = stacks;
} }
@@ -187,7 +187,7 @@ QString Error::toXml() const
stream << " <auxwhat>" << stack.auxWhat() << "</auxwhat>\n"; stream << " <auxwhat>" << stack.auxWhat() << "</auxwhat>\n";
stream << " <stack>\n"; stream << " <stack>\n";
const QVector<Frame> frames = stack.frames(); const QList<Frame> frames = stack.frames();
for (const Frame &frame : frames) { for (const Frame &frame : frames) {
stream << " <frame>\n"; stream << " <frame>\n";
stream << " <ip>0x" << QString::number(frame.instructionPointer(), 16) << "</ip>\n"; stream << " <ip>0x" << QString::number(frame.instructionPointer(), 16) << "</ip>\n";

View File

@@ -3,9 +3,9 @@
#pragma once #pragma once
#include <QList>
#include <QMetaType> #include <QMetaType>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QVector>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QString; class QString;
@@ -89,8 +89,8 @@ public:
int kind() const; int kind() const;
void setKind(int kind); void setKind(int kind);
QVector<Stack> stacks() const; QList<Stack> stacks() const;
void setStacks(const QVector<Stack> &stacks); void setStacks(const QList<Stack> &stacks);
Suppression suppression() const; Suppression suppression() const;
void setSuppression(const Suppression &suppression); void setSuppression(const Suppression &suppression);

View File

@@ -13,7 +13,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QVector> #include <QList>
#include <cmath> #include <cmath>
@@ -72,11 +72,11 @@ Frame ErrorListModel::findRelevantFrame(const Error &error) const
{ {
if (m_relevantFrameFinder) if (m_relevantFrameFinder)
return m_relevantFrameFinder(error); return m_relevantFrameFinder(error);
const QVector<Stack> stacks = error.stacks(); const QList<Stack> stacks = error.stacks();
if (stacks.isEmpty()) if (stacks.isEmpty())
return Frame(); return Frame();
const Stack &stack = stacks[0]; const Stack &stack = stacks[0];
const QVector<Frame> frames = stack.frames(); const QList<Frame> frames = stack.frames();
if (!frames.isEmpty()) if (!frames.isEmpty())
return frames.first(); return frames.first();
return Frame(); return Frame();
@@ -142,11 +142,11 @@ ErrorItem::ErrorItem(const ErrorListModel *model, const Error &error)
// just annoy the user. // just annoy the user.
// The same goes for the frame level. // The same goes for the frame level.
if (m_error.stacks().count() > 1) { if (m_error.stacks().count() > 1) {
const QVector<Stack> stacks = m_error.stacks(); const QList<Stack> stacks = m_error.stacks();
for (const Stack &s : stacks) for (const Stack &s : stacks)
appendChild(new StackItem(s)); appendChild(new StackItem(s));
} else if (m_error.stacks().constFirst().frames().count() > 1) { } else if (m_error.stacks().constFirst().frames().count() > 1) {
const QVector<Frame> frames = m_error.stacks().constFirst().frames(); const QList<Frame> frames = m_error.stacks().constFirst().frames();
for (const Frame &f : frames) for (const Frame &f : frames)
appendChild(new FrameItem(f)); appendChild(new FrameItem(f));
} }
@@ -176,12 +176,12 @@ QVariant ErrorItem::data(int column, int role) const
<< m_model->errorLocation(m_error) << m_model->errorLocation(m_error)
<< "\n"; << "\n";
const QVector<Stack> stacks = m_error.stacks(); const QList<Stack> stacks = m_error.stacks();
for (const Stack &stack : stacks) { for (const Stack &stack : stacks) {
if (!stack.auxWhat().isEmpty()) if (!stack.auxWhat().isEmpty())
stream << stack.auxWhat(); stream << stack.auxWhat();
int i = 1; int i = 1;
const QVector<Frame> frames = stack.frames(); const QList<Frame> frames = stack.frames();
for (const Frame &frame : frames) for (const Frame &frame : frames)
stream << " " << i++ << ": " << makeFrameName(frame, true) << "\n"; 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) StackItem::StackItem(const Stack &stack) : m_stack(stack)
{ {
const QVector<Frame> frames = m_stack.frames(); const QList<Frame> frames = m_stack.frames();
for (const Frame &f : frames) for (const Frame &f : frames)
appendChild(new FrameItem(f)); appendChild(new FrameItem(f));
} }

View File

@@ -76,7 +76,7 @@ public:
private: private:
void parseError(); void parseError();
QVector<Frame> parseStack(); QList<Frame> parseStack();
Suppression parseSuppression(); Suppression parseSuppression();
SuppressionFrame parseSuppressionFrame(); SuppressionFrame parseSuppressionFrame();
Frame parseFrame(); Frame parseFrame();
@@ -318,7 +318,7 @@ void Parser::Private::reportInternalError(const QString &e)
emit q->internalError(e); emit q->internalError(e);
} }
static Stack makeStack(const XauxWhat &xauxwhat, const QVector<Frame> &frames) static Stack makeStack(const XauxWhat &xauxwhat, const QList<Frame> &frames)
{ {
Stack s; Stack s;
s.setFrames(frames); s.setFrames(frames);
@@ -333,9 +333,9 @@ static Stack makeStack(const XauxWhat &xauxwhat, const QVector<Frame> &frames)
void Parser::Private::parseError() void Parser::Private::parseError()
{ {
Error e; Error e;
QVector<QVector<Frame> > frames; QList<QList<Frame>> frames;
XauxWhat currentAux; XauxWhat currentAux;
QVector<XauxWhat> auxs; QList<XauxWhat> auxs;
int lastAuxWhat = -1; int lastAuxWhat = -1;
while (notAtEnd()) { while (notAtEnd()) {
@@ -396,9 +396,9 @@ void Parser::Private::parseError()
//add empty stacks until sizes match //add empty stacks until sizes match
while (frames.size() < auxs.size()) while (frames.size() < auxs.size())
frames.push_back(QVector<Frame>()); frames.push_back({});
QVector<Stack> stacks; QList<Stack> stacks;
for (int i = 0; i < auxs.size(); ++i) for (int i = 0; i < auxs.size(); ++i)
stacks.append(makeStack(auxs[i], frames[i])); stacks.append(makeStack(auxs[i], frames[i]));
e.setStacks(stacks); e.setStacks(stacks);
@@ -543,9 +543,9 @@ void Parser::Private::parseStatus()
emit q->status(s); emit q->status(s);
} }
QVector<Frame> Parser::Private::parseStack() QList<Frame> Parser::Private::parseStack()
{ {
QVector<Frame> frames; QList<Frame> frames;
while (notAtEnd()) { while (notAtEnd()) {
blockingReadNext(); blockingReadNext();
if (reader.isEndElement()) if (reader.isEndElement())

View File

@@ -4,9 +4,9 @@
#include "stack.h" #include "stack.h"
#include "frame.h" #include "frame.h"
#include <QList>
#include <QSharedData> #include <QSharedData>
#include <QString> #include <QString>
#include <QVector>
namespace Valgrind { namespace Valgrind {
namespace XmlProtocol { namespace XmlProtocol {
@@ -19,7 +19,7 @@ public:
QString dir; QString dir;
qint64 line = -1; qint64 line = -1;
qint64 hthreadid = -1; qint64 hthreadid = -1;
QVector<Frame> frames; QList<Frame> frames;
}; };
Stack::Stack() Stack::Stack()
@@ -62,12 +62,12 @@ void Stack::setAuxWhat(const QString &auxwhat)
d->auxwhat = auxwhat; d->auxwhat = auxwhat;
} }
QVector<Frame> Stack::frames() const QList<Frame> Stack::frames() const
{ {
return d->frames; return d->frames;
} }
void Stack::setFrames(const QVector<Frame> &frames) void Stack::setFrames(const QList<Frame> &frames)
{ {
d->frames = frames; d->frames = frames;
} }

View File

@@ -3,8 +3,8 @@
#pragma once #pragma once
#include <QList>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QVector>
namespace Valgrind { namespace Valgrind {
namespace XmlProtocol { namespace XmlProtocol {
@@ -24,8 +24,8 @@ public:
QString auxWhat() const; QString auxWhat() const;
void setAuxWhat(const QString &auxwhat); void setAuxWhat(const QString &auxwhat);
QVector<Frame> frames() const; QList<Frame> frames() const;
void setFrames(const QVector<Frame> &frames); void setFrames(const QList<Frame> &frames);
//memcheck, ptrcheck, helgrind: //memcheck, ptrcheck, helgrind:
QString file() const; QString file() const;

View File

@@ -11,7 +11,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir> #include <QDir>
#include <QVector> #include <QList>
namespace Valgrind { namespace Valgrind {
namespace XmlProtocol { namespace XmlProtocol {
@@ -76,7 +76,7 @@ QVariant StackModel::data(const QModelIndex &index, int role) const
} }
} else { } else {
const Stack stack = d->stack(index.parent().row()); const Stack stack = d->stack(index.parent().row());
const QVector<Frame> frames = stack.frames(); const QList<Frame> frames = stack.frames();
const int fidx = index.row(); const int fidx = index.row();
if (fidx < 0 || fidx >= frames.size()) if (fidx < 0 || fidx >= frames.size())
return QVariant(); return QVariant();

View File

@@ -5,7 +5,6 @@
#include <QSharedData> #include <QSharedData>
#include <QString> #include <QString>
#include <QVector>
#include <QTextStream> #include <QTextStream>
#include <algorithm> #include <algorithm>

View File

@@ -3,8 +3,8 @@
#pragma once #pragma once
#include <QList>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QVector>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QString; class QString;
@@ -40,7 +40,7 @@ private:
QSharedDataPointer<Private> d; QSharedDataPointer<Private> d;
}; };
using SuppressionFrames = QVector<SuppressionFrame>; using SuppressionFrames = QList<SuppressionFrame>;
class Suppression class Suppression
{ {