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

View File

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

View File

@@ -6,9 +6,9 @@
#include "callgrindparsedata.h"
#include "callgrindfunctioncall.h"
#include <QList>
#include <QString>
#include <QStringList>
#include <QVector>
namespace Valgrind::Callgrind {
@@ -18,8 +18,8 @@ public:
Private(ParseData *data);
~Private();
QVector<quint64> m_positions;
QVector<quint64> m_events;
QList<quint64> m_positions;
QList<quint64> 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<quint64> 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<quint64> CostItem::costs() const
{
return d->m_events;
}

View File

@@ -3,7 +3,7 @@
#pragma once
#include <QVector>
#include <QList>
namespace Valgrind::Callgrind {
@@ -27,7 +27,7 @@ public:
*/
quint64 position(int posIdx) const;
void setPosition(int posIdx, quint64 position);
QVector<quint64> positions() const;
QList<quint64> 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<quint64> costs() const;
QList<quint64> costs() const;
/**
* 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) {
Node *node = new Node;
@@ -45,12 +45,12 @@ void CycleDetection::tarjan(Node *node)
m_depth++;
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)
tarjanForChildNode(node, m_nodes.value(call->callee()));
if (node->dfs == node->lowlink) {
QVector<const Function *> functions;
QList<const Function *> functions;
Node *n;
do {
n = m_stack.pop();

View File

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

View File

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

View File

@@ -39,7 +39,7 @@ Function::Private::~Private()
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()) {
base = add;
@@ -72,7 +72,7 @@ FunctionCall *Function::Private::accumulateCall(const FunctionCall *call, CallTy
accumulatedCall->setCosts(call->costs());
} else {
QVector<quint64> costs = accumulatedCall->costs();
QList<quint64> 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<quint64> 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<const FunctionCall *> Function::outgoingCalls() const
QList<const FunctionCall *> Function::outgoingCalls() const
{
return d->m_outgoingCalls;
}
@@ -228,7 +228,7 @@ void Function::addOutgoingCall(const FunctionCall *call)
d->accumulateCall(call, Private::Outgoing);
}
QVector<const FunctionCall *> Function::incomingCalls() const
QList<const FunctionCall *> Function::incomingCalls() const
{
return d->m_incomingCalls;
}
@@ -245,7 +245,7 @@ quint64 Function::called() const
return d->m_called;
}
QVector<const CostItem *> Function::costItems() const
QList<const CostItem *> 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<const CostItem *> costItems = call->caller()->costItems();
const QList<const CostItem *> costItems = call->caller()->costItems();
for (const CostItem *costItem : costItems) {
if (costItem->call() && costItem->call()->callee() == this)
d->accumulateCost(d->m_inclusiveCost, costItem->costs());

View File

@@ -3,8 +3,8 @@
#pragma once
#include <QList>
#include <QMetaType>
#include <QVector>
namespace Valgrind {
namespace Callgrind {
@@ -67,7 +67,7 @@ public:
* @see ParseData::events()
*/
quint64 selfCost(int event) const;
QVector<quint64> selfCosts() const;
QList<quint64> 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<const FunctionCall *> incomingCalls() const;
QList<const FunctionCall *> 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<const CostItem *> costItems() const;
QList<const CostItem *> costItems() const;
/**
* Add parsed @c CostItem @p item to this function.
@@ -98,7 +98,7 @@ public:
/**
* Function calls from this function to others.
*/
QVector<const FunctionCall *> outgoingCalls() const;
QList<const FunctionCall *> outgoingCalls() const;
void addOutgoingCall(const FunctionCall *call);
/**

View File

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

View File

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

View File

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

View File

@@ -19,7 +19,7 @@ class FunctionCycle::Private : public Function::Private
{
public:
Private(const ParseData *data);
QVector<const Function *> m_functions;
QList<const Function *> 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<const Function *> &functions)
void FunctionCycle::setFunctions(const QList<const Function *> &functions)
{
Private *d = CYCLE_D;
@@ -55,13 +55,13 @@ void FunctionCycle::setFunctions(const QVector<const Function *> &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<const FunctionCall *> calls = func->outgoingCalls();
const QList<const FunctionCall *> 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<const FunctionCall *> inCalls = func->incomingCalls();
const QList<const FunctionCall *> 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<const Function *> &functions)
}
}
QVector<const Function *> FunctionCycle::functions() const
QList<const Function *> FunctionCycle::functions() const
{
return CYCLE_D->m_functions;
}

View File

@@ -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<const Function *> &functions);
void setFunctions(const QList<const Function *> &functions);
/// @return the functions that make up this cycle
QVector<const Function *> functions() const;
QList<const Function *> functions() const;
private:
class Private;

View File

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

View File

@@ -3,7 +3,7 @@
#pragma once
#include <QVector>
#include <QList>
QT_BEGIN_NAMESPACE
class QString;
@@ -53,7 +53,7 @@ public:
*
* @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.
void addFunction(const Function *function);

View File

@@ -12,10 +12,10 @@
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <QHash>
#include <QVector>
#include <QStringList>
#include <QDebug>
#include <QHash>
#include <QList>
#include <QStringList>
// #define DEBUG_PARSER
@@ -162,13 +162,13 @@ public:
FunctionCall *call = nullptr;
};
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
QVector<CallData> pendingCallees;
QList<CallData> pendingCallees;
// id(s) for the ??? file
QVector<quint64> unknownFiles;
QList<quint64> unknownFiles;
// functions which call themselves
QSet<Function *> recursiveFunctions;
@@ -197,7 +197,7 @@ void Parser::Private::parse(const FilePath &filePath)
// build fast lookup of functions by their nameId
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) {
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
if (m_function) {
bool isValid = false;
const QVector<const FunctionCall *> calls = func->incomingCalls();
const QList<const FunctionCall *> calls = func->incomingCalls();
for (const FunctionCall *call : calls) {
if (call->caller() == m_function) {
isValid = true;

View File

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

View File

@@ -18,11 +18,11 @@
#include <QGraphicsRectItem>
#include <QGraphicsScene>
#include <QGraphicsSimpleTextItem>
#include <QList>
#include <QMouseEvent>
#include <QPair>
#include <QStaticText>
#include <QStyleOptionGraphicsItem>
#include <QVector>
#define VISUALISATION_DEBUG 0
// Margin from hardcoded value in:
@@ -345,7 +345,7 @@ void Visualization::populateScene()
qreal total = 0;
using Pair = QPair<QModelIndex, qreal>;
QVector<Pair> costs;
QList<Pair> costs;
for (int row = 0; row < d->m_model->rowCount(); ++row) {
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) {
const Frame defaultFrame = Frame();
const QVector<Stack> stacks = error.stacks();
const QList<Stack> stacks = error.stacks();
if (stacks.isEmpty())
return defaultFrame;
const Stack &stack = stacks[0];
const QVector<Frame> frames = stack.frames();
const QList<Frame> frames = stack.frames();
if (frames.isEmpty())
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());

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.setFileName("qmutex.h");
frame12.setLine(120);
stack1.setFrames(QVector<Frame>() << frame11 << frame12);
stack1.setFrames(QList<Frame>() << 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<Frame>() << frame21 << frame22);
stack2.setFrames(QList<Frame>() << 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<Frame>() << frame31 << frame32);
error1.setStacks(QVector<Stack>() << stack1 << stack2 << stack3);
stack3.setFrames(QList<Frame>() << frame31 << frame32);
error1.setStacks(QList<Stack>() << 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<Frame>() << f1 << f2 << f3 << f4);
error.setStacks( QVector<Stack>() << s1 );
s1.setFrames(QList<Frame>() << f1 << f2 << f3 << f4);
error.setStacks(QList<Stack>() << s1);
expectedErrors << error;
}
const QVector<QPair<qint64,qint64>> expectedErrorCounts{{9, 2}};
const QVector<QPair<QString,qint64>> expectedSuppCounts{
const QList<QPair<qint64, qint64>> expectedErrorCounts{{9, 2}};
const QList<QPair<QString, qint64>> 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<Error> errors = rec.errors;
QCOMPARE(errors.size(), 1);
const QVector<Stack> stacks = errors.first().stacks();
const QList<Stack> 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<Stack> stacks = error.stacks();
const QList<Stack> stacks = error.stacks();
QCOMPARE(error.unique(), 0x1ll);
QCOMPARE(error.what(), "Conditional jump or move depends on uninitialised value(s)");

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,7 +13,7 @@
#include <QCoreApplication>
#include <QDir>
#include <QVector>
#include <QList>
#include <cmath>
@@ -72,11 +72,11 @@ Frame ErrorListModel::findRelevantFrame(const Error &error) const
{
if (m_relevantFrameFinder)
return m_relevantFrameFinder(error);
const QVector<Stack> stacks = error.stacks();
const QList<Stack> stacks = error.stacks();
if (stacks.isEmpty())
return Frame();
const Stack &stack = stacks[0];
const QVector<Frame> frames = stack.frames();
const QList<Frame> 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<Stack> stacks = m_error.stacks();
const QList<Stack> stacks = m_error.stacks();
for (const Stack &s : stacks)
appendChild(new StackItem(s));
} 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)
appendChild(new FrameItem(f));
}
@@ -176,12 +176,12 @@ QVariant ErrorItem::data(int column, int role) const
<< m_model->errorLocation(m_error)
<< "\n";
const QVector<Stack> stacks = m_error.stacks();
const QList<Stack> stacks = m_error.stacks();
for (const Stack &stack : stacks) {
if (!stack.auxWhat().isEmpty())
stream << stack.auxWhat();
int i = 1;
const QVector<Frame> frames = stack.frames();
const QList<Frame> 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<Frame> frames = m_stack.frames();
const QList<Frame> frames = m_stack.frames();
for (const Frame &f : frames)
appendChild(new FrameItem(f));
}

View File

@@ -76,7 +76,7 @@ public:
private:
void parseError();
QVector<Frame> parseStack();
QList<Frame> 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<Frame> &frames)
static Stack makeStack(const XauxWhat &xauxwhat, const QList<Frame> &frames)
{
Stack s;
s.setFrames(frames);
@@ -333,9 +333,9 @@ static Stack makeStack(const XauxWhat &xauxwhat, const QVector<Frame> &frames)
void Parser::Private::parseError()
{
Error e;
QVector<QVector<Frame> > frames;
QList<QList<Frame>> frames;
XauxWhat currentAux;
QVector<XauxWhat> auxs;
QList<XauxWhat> 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<Frame>());
frames.push_back({});
QVector<Stack> stacks;
QList<Stack> 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<Frame> Parser::Private::parseStack()
QList<Frame> Parser::Private::parseStack()
{
QVector<Frame> frames;
QList<Frame> frames;
while (notAtEnd()) {
blockingReadNext();
if (reader.isEndElement())

View File

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

View File

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

View File

@@ -11,7 +11,7 @@
#include <utils/qtcassert.h>
#include <QDir>
#include <QVector>
#include <QList>
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<Frame> frames = stack.frames();
const QList<Frame> frames = stack.frames();
const int fidx = index.row();
if (fidx < 0 || fidx >= frames.size())
return QVariant();

View File

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

View File

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