forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <QSharedData>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user