forked from qt-creator/qt-creator
Valgrind: Modernize
modernize-* Change-Id: I6db60dce78cf2575e36caa597b1f095adba34fd9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -39,10 +39,10 @@ namespace Callgrind {
|
||||
class CallModel::Private
|
||||
{
|
||||
public:
|
||||
const ParseData *m_data = 0;
|
||||
const ParseData *m_data = nullptr;
|
||||
QVector<const FunctionCall *> m_calls;
|
||||
int m_event = 0;
|
||||
const Function *m_function = 0;
|
||||
const Function *m_function = nullptr;
|
||||
};
|
||||
|
||||
CallModel::CallModel()
|
||||
@@ -58,7 +58,7 @@ CallModel::~CallModel()
|
||||
void CallModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
d->m_function = 0;
|
||||
d->m_function = nullptr;
|
||||
d->m_calls.clear();
|
||||
endResetModel();
|
||||
}
|
||||
|
@@ -48,9 +48,7 @@ namespace Callgrind {
|
||||
|
||||
const char CALLGRIND_CONTROL_BINARY[] = "callgrind_control";
|
||||
|
||||
CallgrindController::CallgrindController()
|
||||
{
|
||||
}
|
||||
CallgrindController::CallgrindController() = default;
|
||||
|
||||
CallgrindController::~CallgrindController()
|
||||
{
|
||||
|
@@ -44,18 +44,16 @@ public:
|
||||
|
||||
QVector<quint64> m_positions;
|
||||
QVector<quint64> m_events;
|
||||
const FunctionCall *m_call;
|
||||
const FunctionCall *m_call = nullptr;
|
||||
|
||||
const ParseData *m_data;
|
||||
qint64 m_differingFileId;
|
||||
const ParseData *m_data = nullptr;
|
||||
qint64 m_differingFileId = -1;
|
||||
};
|
||||
|
||||
CostItem::Private::Private(ParseData *data)
|
||||
: m_positions(data->positions().size(), 0)
|
||||
, m_events(data->events().size(), 0)
|
||||
, m_call(0)
|
||||
, m_data(data)
|
||||
, m_differingFileId(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -40,8 +40,6 @@ namespace Internal {
|
||||
|
||||
CycleDetection::CycleDetection(ParseData *data)
|
||||
: m_data(data)
|
||||
, m_depth(0)
|
||||
, m_cycle(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -87,7 +85,7 @@ void CycleDetection::tarjan(Node *node)
|
||||
m_ret.append(node->function);
|
||||
} else {
|
||||
// actual cycle
|
||||
FunctionCycle *cycle = new FunctionCycle(m_data);
|
||||
auto cycle = new FunctionCycle(m_data);
|
||||
cycle->setFile(node->function->fileId());
|
||||
m_cycle++;
|
||||
qint64 id = -1;
|
||||
|
@@ -65,9 +65,9 @@ private:
|
||||
QHash<const Function *, Node *> m_nodes;
|
||||
QStack<Node *> m_stack;
|
||||
QVector<const Function *> m_ret;
|
||||
int m_depth;
|
||||
int m_depth = 0;
|
||||
|
||||
int m_cycle;
|
||||
int m_cycle = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -46,7 +46,7 @@ class DataModel::Private
|
||||
public:
|
||||
void updateFunctions();
|
||||
|
||||
const ParseData *m_data = 0;
|
||||
const ParseData *m_data = nullptr;
|
||||
int m_event = 0;
|
||||
bool m_verboseToolTips = true;
|
||||
bool m_cycleDetection = false;
|
||||
|
@@ -38,24 +38,14 @@ namespace Callgrind {
|
||||
class FunctionCall::Private
|
||||
{
|
||||
public:
|
||||
explicit Private();
|
||||
|
||||
const Function *m_callee;
|
||||
const Function *m_caller;
|
||||
quint64 m_calls;
|
||||
quint64 m_totalInclusiveCost;
|
||||
const Function *m_callee = nullptr;
|
||||
const Function *m_caller = nullptr;
|
||||
quint64 m_calls = 0;
|
||||
quint64 m_totalInclusiveCost = 0;
|
||||
QVector<quint64> m_destinations;
|
||||
QVector<quint64> m_costs;
|
||||
};
|
||||
|
||||
FunctionCall::Private::Private()
|
||||
: m_callee(0)
|
||||
, m_caller(0)
|
||||
, m_calls(0)
|
||||
, m_totalInclusiveCost(0)
|
||||
{
|
||||
}
|
||||
|
||||
//BEGIN FunctionCall
|
||||
|
||||
FunctionCall::FunctionCall()
|
||||
|
@@ -58,10 +58,8 @@ FunctionCycle::FunctionCycle(const ParseData *data)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionCycle::~FunctionCycle()
|
||||
{
|
||||
// d should be deleted by Function::~Function()
|
||||
}
|
||||
// d should be deleted by Function::~Function()
|
||||
FunctionCycle::~FunctionCycle() = default;
|
||||
|
||||
void FunctionCycle::setFunctions(const QVector<const Function *> &functions)
|
||||
{
|
||||
|
@@ -42,7 +42,7 @@ class FunctionCycle : public Function
|
||||
{
|
||||
public:
|
||||
explicit FunctionCycle(const ParseData *data);
|
||||
virtual ~FunctionCycle();
|
||||
~FunctionCycle() override;
|
||||
|
||||
/// sets the list of functions that make up this cycle
|
||||
/// NOTE: ownership is *not* transferred to the cycle
|
||||
|
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
QHash<qint64, QHash<qint64, QVector<Function *> > > functionLookup;
|
||||
|
||||
typedef QHash<qint64, QString> NameLookupTable;
|
||||
using NameLookupTable = QHash<qint64, QString>;
|
||||
QString stringForCompression(const NameLookupTable &lookup, qint64 id);
|
||||
void addCompressedString(NameLookupTable &lookup, const QString &string, qint64 &id);
|
||||
|
||||
|
@@ -152,7 +152,7 @@ public:
|
||||
void parse(QIODevice *device);
|
||||
void parseHeader(QIODevice *device);
|
||||
|
||||
typedef QPair<qint64, QString> NamePair;
|
||||
using NamePair = QPair<qint64, QString>;
|
||||
NamePair parseName(const char *begin, const char *end);
|
||||
|
||||
void dispatchLine(const QByteArray &line);
|
||||
@@ -252,7 +252,7 @@ void Parser::Private::parse(QIODevice *device)
|
||||
callData.call->setCallee(calledFunction);
|
||||
calledFunction->addIncomingCall(callData.call);
|
||||
|
||||
Function *caller = const_cast<Function *>(callData.call->caller());
|
||||
auto caller = const_cast<Function *>(callData.call->caller());
|
||||
caller->addOutgoingCall(callData.call);
|
||||
pendingFunctions.insert(caller);
|
||||
}
|
||||
@@ -440,9 +440,9 @@ void Parser::Private::parseCostItem(const char *begin, const char *end)
|
||||
const char *current = begin;
|
||||
|
||||
QTC_ASSERT(currentDifferingFile == -1 || currentDifferingFile != currentFunction->fileId(), return);
|
||||
CostItem *costItem = new CostItem(data);
|
||||
auto costItem = new CostItem(data);
|
||||
costItem->setDifferingFile(currentDifferingFile);
|
||||
FunctionCall *call = 0;
|
||||
FunctionCall *call = nullptr;
|
||||
if (isParsingFunctionCall) {
|
||||
call = new FunctionCall;
|
||||
call->setCaller(currentFunction);
|
||||
@@ -477,7 +477,7 @@ void Parser::Private::parseCostItem(const char *begin, const char *end)
|
||||
currentCallData = CallData();
|
||||
}
|
||||
|
||||
const CostItem *lastCostItem = 0;
|
||||
const CostItem *lastCostItem = nullptr;
|
||||
if (!currentFunction->costItems().isEmpty())
|
||||
lastCostItem = currentFunction->costItems().last();
|
||||
|
||||
@@ -652,7 +652,7 @@ Parser::~Parser()
|
||||
ParseData *Parser::takeData()
|
||||
{
|
||||
ParseData *data = d->data;
|
||||
d->data = 0;
|
||||
d->data = nullptr;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@@ -39,9 +39,6 @@ namespace Callgrind {
|
||||
|
||||
DataProxyModel::DataProxyModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
, m_function(0)
|
||||
, m_maxRows(0)
|
||||
, m_minimumInclusiveCostRatio(0.0)
|
||||
{
|
||||
setDynamicSortFilter(true);
|
||||
}
|
||||
@@ -119,7 +116,7 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_
|
||||
if (m_maxRows > 0 && source_row > m_maxRows)
|
||||
return false;
|
||||
|
||||
const Function *func = source_index.data(DataModel::FunctionRole).value<const Function *>();
|
||||
auto func = source_index.data(DataModel::FunctionRole).value<const Function *>();
|
||||
|
||||
if (!func)
|
||||
return false;
|
||||
|
@@ -69,9 +69,9 @@ private:
|
||||
DataModel *dataModel() const;
|
||||
|
||||
QString m_baseDir;
|
||||
const Function *m_function;
|
||||
int m_maxRows;
|
||||
double m_minimumInclusiveCostRatio;
|
||||
const Function *m_function = nullptr;
|
||||
int m_maxRows = 0;
|
||||
double m_minimumInclusiveCostRatio = 0;
|
||||
};
|
||||
|
||||
} // namespace Callgrind
|
||||
|
@@ -44,20 +44,13 @@ namespace Internal {
|
||||
class CostDelegate::Private
|
||||
{
|
||||
public:
|
||||
Private();
|
||||
|
||||
QAbstractItemModel *m_model;
|
||||
CostDelegate::CostFormat m_format;
|
||||
QAbstractItemModel *m_model = nullptr;
|
||||
CostDelegate::CostFormat m_format = CostDelegate::FormatAbsolute;
|
||||
|
||||
float relativeCost(const QModelIndex &index) const;
|
||||
QString displayText(const QModelIndex &index, const QLocale &locale) const;
|
||||
};
|
||||
|
||||
CostDelegate::Private::Private()
|
||||
: m_model(0)
|
||||
, m_format(CostDelegate::FormatAbsolute)
|
||||
{}
|
||||
|
||||
static int toNativeRole(CostDelegate::CostFormat format)
|
||||
{
|
||||
switch (format)
|
||||
@@ -145,7 +138,7 @@ void CostDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
|
||||
// Draw text.
|
||||
QLocale loc = opt.locale;
|
||||
loc.setNumberOptions(0);
|
||||
loc.setNumberOptions(nullptr);
|
||||
const QString text = d->displayText(index, loc);
|
||||
const QBrush &textBrush = (option.state & QStyle::State_Selected ? opt.palette.highlightedText() : opt.palette.text());
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
@@ -33,12 +33,12 @@ namespace Internal {
|
||||
class CostDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
explicit CostDelegate(QObject *parent = 0);
|
||||
virtual ~CostDelegate();
|
||||
explicit CostDelegate(QObject *parent = nullptr);
|
||||
~CostDelegate() override;
|
||||
|
||||
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
void setModel(QAbstractItemModel *model);
|
||||
|
||||
|
@@ -55,16 +55,14 @@ CostView::CostView(QWidget *parent)
|
||||
setRootIsDecorated(false);
|
||||
}
|
||||
|
||||
CostView::~CostView()
|
||||
{
|
||||
}
|
||||
CostView::~CostView() = default;
|
||||
|
||||
void CostView::setModel(QAbstractItemModel *model)
|
||||
{
|
||||
QTreeView::setModel(model);
|
||||
BaseTreeView::setModel(model);
|
||||
|
||||
forever {
|
||||
QAbstractProxyModel *proxy = qobject_cast<QAbstractProxyModel *>(model);
|
||||
auto proxy = qobject_cast<const QAbstractProxyModel *>(model);
|
||||
if (!proxy)
|
||||
break;
|
||||
model = proxy->sourceModel();
|
||||
|
@@ -40,14 +40,14 @@ class CostView : public Utils::BaseTreeView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CostView(QWidget *parent = 0);
|
||||
~CostView();
|
||||
explicit CostView(QWidget *parent = nullptr);
|
||||
~CostView() override;
|
||||
|
||||
/**
|
||||
* Overload automatically updates the cost delegate
|
||||
* and sets it for the cost columns of DataModel and CallModel.
|
||||
*/
|
||||
void setModel(QAbstractItemModel *model);
|
||||
void setModel(QAbstractItemModel *model) override;
|
||||
|
||||
/**
|
||||
* How to format cost data columns in the view.
|
||||
|
@@ -33,10 +33,10 @@ namespace Internal {
|
||||
class NameDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
explicit NameDelegate(QObject *parent = 0);
|
||||
explicit NameDelegate(QObject *parent = nullptr);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
const QModelIndex &index) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -92,7 +92,7 @@ void CallgrindTextMark::paintIcon(QPainter *painter, const QRect &paintRect) con
|
||||
const Function *CallgrindTextMark::function() const
|
||||
{
|
||||
if (!m_modelIndex.isValid())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return m_modelIndex.data(DataModel::FunctionRole).value<const Function *>();
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
const Valgrind::Callgrind::Function *function() const;
|
||||
|
||||
virtual void paintIcon(QPainter *painter, const QRect &paintRect) const;
|
||||
void paintIcon(QPainter *painter, const QRect &paintRect) const override;
|
||||
|
||||
private:
|
||||
QPersistentModelIndex m_modelIndex;
|
||||
|
@@ -112,7 +112,7 @@ class CallgrindTool : public QObject
|
||||
|
||||
public:
|
||||
CallgrindTool();
|
||||
~CallgrindTool();
|
||||
~CallgrindTool() override;
|
||||
|
||||
void setupRunner(CallgrindToolRunner *runner);
|
||||
|
||||
@@ -682,7 +682,7 @@ void CallgrindTool::handleFilterProjectCosts()
|
||||
|
||||
void CallgrindTool::dataFunctionSelected(const QModelIndex &index)
|
||||
{
|
||||
const Function *func = index.data(DataModel::FunctionRole).value<const Function *>();
|
||||
auto func = index.data(DataModel::FunctionRole).value<const Function *>();
|
||||
QTC_ASSERT(func, return);
|
||||
|
||||
selectFunction(func);
|
||||
@@ -690,7 +690,7 @@ void CallgrindTool::dataFunctionSelected(const QModelIndex &index)
|
||||
|
||||
void CallgrindTool::calleeFunctionSelected(const QModelIndex &index)
|
||||
{
|
||||
const FunctionCall *call = index.data(CallModel::FunctionCallRole).value<const FunctionCall *>();
|
||||
auto call = index.data(CallModel::FunctionCallRole).value<const FunctionCall *>();
|
||||
QTC_ASSERT(call, return);
|
||||
|
||||
selectFunction(call->callee());
|
||||
@@ -698,7 +698,7 @@ void CallgrindTool::calleeFunctionSelected(const QModelIndex &index)
|
||||
|
||||
void CallgrindTool::callerFunctionSelected(const QModelIndex &index)
|
||||
{
|
||||
const FunctionCall *call = index.data(CallModel::FunctionCallRole).value<const FunctionCall *>();
|
||||
auto call = index.data(CallModel::FunctionCallRole).value<const FunctionCall *>();
|
||||
QTC_ASSERT(call, return);
|
||||
|
||||
selectFunction(call->caller());
|
||||
|
@@ -80,14 +80,14 @@ public:
|
||||
};
|
||||
|
||||
FunctionGraphicsItem(const QString &text, qreal x, qreal y,
|
||||
qreal width, qreal height, QGraphicsItem *parent = 0);
|
||||
qreal width, qreal height, QGraphicsItem *parent = nullptr);
|
||||
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
FunctionGraphicsTextItem *textItem() const;
|
||||
|
||||
private:
|
||||
FunctionGraphicsTextItem *m_text;
|
||||
FunctionGraphicsTextItem *m_text = nullptr;
|
||||
};
|
||||
|
||||
FunctionGraphicsTextItem::FunctionGraphicsTextItem(const QString &text,
|
||||
@@ -97,7 +97,7 @@ FunctionGraphicsTextItem::FunctionGraphicsTextItem(const QString &text,
|
||||
, m_previousViewportDimension(0)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
setAcceptedMouseButtons(0); // do not steal focus from parent item
|
||||
setAcceptedMouseButtons(nullptr); // do not steal focus from parent item
|
||||
setToolTip(text);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,6 @@ QRectF FunctionGraphicsTextItem::boundingRect() const
|
||||
FunctionGraphicsItem::FunctionGraphicsItem(const QString &text,
|
||||
qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parent)
|
||||
: QGraphicsRectItem(x, y, width, height, parent)
|
||||
, m_text(0)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsSelectable);
|
||||
setFlag(QGraphicsItem::ItemClipsToShape);
|
||||
@@ -237,7 +236,7 @@ void Visualization::Private::handleMousePressEvent(QMouseEvent *event,
|
||||
bool doubleClicked)
|
||||
{
|
||||
// find the first item that accepts mouse presses under the cursor position
|
||||
QGraphicsItem *itemAtPos = 0;
|
||||
QGraphicsItem *itemAtPos = nullptr;
|
||||
foreach (QGraphicsItem *item, q->items(event->pos())) {
|
||||
if (!(item->acceptedMouseButtons() & event->button()))
|
||||
continue;
|
||||
@@ -297,7 +296,7 @@ QGraphicsItem *Visualization::itemForFunction(const Function *function) const
|
||||
if (functionForItem(item) == function)
|
||||
return item;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Visualization::setFunction(const Function *function)
|
||||
@@ -364,7 +363,7 @@ void Visualization::populateScene()
|
||||
// cache costs of each element, calculate total costs
|
||||
qreal total = 0;
|
||||
|
||||
typedef QPair<QModelIndex, qreal> Pair;
|
||||
using Pair = QPair<QModelIndex, qreal>;
|
||||
QLinkedList<Pair> costs;
|
||||
for (int row = 0; row < d->m_model->rowCount(); ++row) {
|
||||
const QModelIndex index = d->m_model->index(row, DataModel::InclusiveCostColumn);
|
||||
@@ -392,7 +391,7 @@ void Visualization::populateScene()
|
||||
}
|
||||
|
||||
const qreal height = sceneHeight * (costs.isEmpty() ? 1.0 : 0.1);
|
||||
FunctionGraphicsItem *item = new FunctionGraphicsItem(text, 0, 0, sceneWidth, height);
|
||||
auto item = new FunctionGraphicsItem(text, 0, 0, sceneWidth, height);
|
||||
const QColor background = CallgrindHelper::colorForString(text);
|
||||
item->setBrush(background);
|
||||
item->setData(FunctionGraphicsItem::FunctionCallKey, QVariant::fromValue(d->m_model->filterFunction()));
|
||||
@@ -409,7 +408,7 @@ void Visualization::populateScene()
|
||||
|
||||
const qreal height = (sceneHeight * 0.9 * cost.second) / total;
|
||||
|
||||
FunctionGraphicsItem *item = new FunctionGraphicsItem(text, 0, used, sceneWidth, height);
|
||||
auto item = new FunctionGraphicsItem(text, 0, used, sceneWidth, height);
|
||||
const QColor background = CallgrindHelper::colorForString(text);
|
||||
item->setBrush(background);
|
||||
item->setData(FunctionGraphicsItem::FunctionCallKey, index.data(DataModel::FunctionRole));
|
||||
|
@@ -43,8 +43,8 @@ class Visualization : public QGraphicsView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Visualization(QWidget *parent = 0);
|
||||
virtual ~Visualization();
|
||||
explicit Visualization(QWidget *parent = nullptr);
|
||||
~Visualization() override;
|
||||
|
||||
void setModel(QAbstractItemModel *model);
|
||||
|
||||
@@ -64,9 +64,9 @@ signals:
|
||||
|
||||
protected:
|
||||
void populateScene();
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
class Private;
|
||||
|
@@ -52,8 +52,7 @@ namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
MemcheckErrorView::MemcheckErrorView(QWidget *parent)
|
||||
: Debugger::DetailedErrorView(parent),
|
||||
m_settings(0)
|
||||
: Debugger::DetailedErrorView(parent)
|
||||
{
|
||||
m_suppressAction = new QAction(this);
|
||||
m_suppressAction->setText(tr("Suppress Error"));
|
||||
@@ -68,9 +67,7 @@ MemcheckErrorView::MemcheckErrorView(QWidget *parent)
|
||||
addAction(m_suppressAction);
|
||||
}
|
||||
|
||||
MemcheckErrorView::~MemcheckErrorView()
|
||||
{
|
||||
}
|
||||
MemcheckErrorView::~MemcheckErrorView() = default;
|
||||
|
||||
void MemcheckErrorView::setDefaultSuppressionFile(const QString &suppFile)
|
||||
{
|
||||
|
@@ -40,8 +40,8 @@ class MemcheckErrorView : public Debugger::DetailedErrorView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemcheckErrorView(QWidget *parent = 0);
|
||||
~MemcheckErrorView();
|
||||
MemcheckErrorView(QWidget *parent = nullptr);
|
||||
~MemcheckErrorView() override;
|
||||
|
||||
void setDefaultSuppressionFile(const QString &suppFile);
|
||||
QString defaultSuppressionFile() const;
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
|
||||
QAction *m_suppressAction;
|
||||
QString m_defaultSuppFile;
|
||||
ValgrindBaseSettings *m_settings;
|
||||
ValgrindBaseSettings *m_settings = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -294,7 +294,7 @@ class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
|
||||
public:
|
||||
void setAcceptedKinds(const QList<int> &acceptedKinds);
|
||||
void setFilterExternalIssues(bool filter);
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
|
||||
private:
|
||||
QList<int> m_acceptedKinds;
|
||||
@@ -388,7 +388,7 @@ class MemcheckTool : public QObject
|
||||
|
||||
public:
|
||||
MemcheckTool();
|
||||
~MemcheckTool();
|
||||
~MemcheckTool() override;
|
||||
|
||||
void setupRunner(MemcheckToolRunner *runTool);
|
||||
void loadShowXmlLogFile(const QString &filePath, const QString &exitMsg);
|
||||
@@ -418,7 +418,7 @@ private:
|
||||
|
||||
private:
|
||||
ValgrindBaseSettings *m_settings;
|
||||
QMenu *m_filterMenu = 0;
|
||||
QMenu *m_filterMenu = nullptr;
|
||||
|
||||
Valgrind::XmlProtocol::ErrorListModel m_errorModel;
|
||||
MemcheckErrorFilterProxyModel m_errorProxyModel;
|
||||
@@ -453,7 +453,7 @@ public:
|
||||
bool attach() const;
|
||||
QString path() const;
|
||||
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private:
|
||||
void updateEnabled();
|
||||
@@ -479,7 +479,7 @@ class HeobData : public QObject
|
||||
|
||||
public:
|
||||
HeobData(MemcheckTool *mcTool, const QString &xmlPath, Kit *kit, bool attach);
|
||||
~HeobData();
|
||||
~HeobData() override;
|
||||
|
||||
bool createErrorPipe(DWORD heobPid);
|
||||
void readExitData();
|
||||
@@ -829,7 +829,7 @@ void MemcheckTool::heobAction()
|
||||
memset(&si, 0, sizeof(STARTUPINFO));
|
||||
si.cb = sizeof(STARTUPINFO);
|
||||
if (!CreateProcess(reinterpret_cast<LPCWSTR>(heobPath.utf16()),
|
||||
reinterpret_cast<LPWSTR>(argumentsCopy.data()), 0, 0, FALSE,
|
||||
reinterpret_cast<LPWSTR>(argumentsCopy.data()), NULL, NULL, FALSE,
|
||||
CREATE_UNICODE_ENVIRONMENT | CREATE_SUSPENDED | CREATE_NEW_CONSOLE, envPtr,
|
||||
reinterpret_cast<LPCWSTR>(workingDirectory.utf16()), &si, &pi)) {
|
||||
DWORD e = GetLastError();
|
||||
@@ -840,7 +840,7 @@ void MemcheckTool::heobAction()
|
||||
}
|
||||
|
||||
// heob finished signal handler
|
||||
HeobData *hd = new HeobData(this, xmlPath, kit, dialog.attach());
|
||||
auto hd = new HeobData(this, xmlPath, kit, dialog.attach());
|
||||
if (!hd->createErrorPipe(pi.dwProcessId)) {
|
||||
delete hd;
|
||||
hd = nullptr;
|
||||
@@ -911,7 +911,7 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
|
||||
{
|
||||
updateRunActions();
|
||||
|
||||
ValgrindBaseSettings *settings = 0;
|
||||
ValgrindBaseSettings *settings = nullptr;
|
||||
if (Project *project = SessionManager::startupProject())
|
||||
if (Target *target = project->activeTarget())
|
||||
if (RunConfiguration *rc = target->activeRunConfiguration())
|
||||
@@ -1000,7 +1000,7 @@ void MemcheckTool::loadExternalXmlLogFile()
|
||||
|
||||
void MemcheckTool::loadXmlLogFile(const QString &filePath)
|
||||
{
|
||||
QFile *logFile = new QFile(filePath);
|
||||
auto logFile = new QFile(filePath);
|
||||
if (!logFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
delete logFile;
|
||||
QString msg = tr("Memcheck: Failed to open file for reading: %1").arg(filePath);
|
||||
@@ -1021,7 +1021,7 @@ void MemcheckTool::loadXmlLogFile(const QString &filePath)
|
||||
updateFromSettings();
|
||||
}
|
||||
|
||||
ThreadedParser *parser = new ThreadedParser;
|
||||
auto parser = new ThreadedParser;
|
||||
connect(parser, &ThreadedParser::error, this, &MemcheckTool::parserError);
|
||||
connect(parser, &ThreadedParser::internalError, this, &MemcheckTool::internalParserError);
|
||||
connect(parser, &ThreadedParser::finished, this, &MemcheckTool::loadingExternalXmlLogFileFinished);
|
||||
@@ -1090,13 +1090,13 @@ void MemcheckTool::engineFinished()
|
||||
|
||||
const int issuesFound = updateUiAfterFinishedHelper();
|
||||
Debugger::showPermanentStatusMessage(
|
||||
tr("Memory Analyzer Tool finished. %n issues were found.", 0, issuesFound));
|
||||
tr("Memory Analyzer Tool finished. %n issues were found.", nullptr, issuesFound));
|
||||
}
|
||||
|
||||
void MemcheckTool::loadingExternalXmlLogFileFinished()
|
||||
{
|
||||
const int issuesFound = updateUiAfterFinishedHelper();
|
||||
QString statusMessage = tr("Log file processed. %n issues were found.", 0, issuesFound);
|
||||
QString statusMessage = tr("Log file processed. %n issues were found.", nullptr, issuesFound);
|
||||
if (!m_exitMsg.isEmpty())
|
||||
statusMessage += ' ' + m_exitMsg;
|
||||
Debugger::showPermanentStatusMessage(statusMessage);
|
||||
@@ -1195,20 +1195,20 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
||||
path = QFileInfo(heobPath).path();
|
||||
}
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
auto layout = new QVBoxLayout;
|
||||
// disable resizing
|
||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
QHBoxLayout *xmlLayout = new QHBoxLayout;
|
||||
QLabel *xmlLabel = new QLabel(tr("XML output file:"));
|
||||
auto xmlLayout = new QHBoxLayout;
|
||||
auto xmlLabel = new QLabel(tr("XML output file:"));
|
||||
xmlLayout->addWidget(xmlLabel);
|
||||
m_xmlEdit = new QLineEdit;
|
||||
m_xmlEdit->setText(xml);
|
||||
xmlLayout->addWidget(m_xmlEdit);
|
||||
layout->addLayout(xmlLayout);
|
||||
|
||||
QHBoxLayout *handleExceptionLayout = new QHBoxLayout;
|
||||
QLabel *handleExceptionLabel = new QLabel(tr("Handle exceptions:"));
|
||||
auto handleExceptionLayout = new QHBoxLayout;
|
||||
auto handleExceptionLabel = new QLabel(tr("Handle exceptions:"));
|
||||
handleExceptionLayout->addWidget(handleExceptionLabel);
|
||||
m_handleExceptionCombo = new QComboBox;
|
||||
m_handleExceptionCombo->addItem(tr("Off"));
|
||||
@@ -1220,8 +1220,8 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
||||
handleExceptionLayout->addWidget(m_handleExceptionCombo);
|
||||
layout->addLayout(handleExceptionLayout);
|
||||
|
||||
QHBoxLayout *pageProtectionLayout = new QHBoxLayout;
|
||||
QLabel *pageProtectionLabel = new QLabel(tr("Page protection:"));
|
||||
auto pageProtectionLayout = new QHBoxLayout;
|
||||
auto pageProtectionLabel = new QLabel(tr("Page protection:"));
|
||||
pageProtectionLayout->addWidget(pageProtectionLabel);
|
||||
m_pageProtectionCombo = new QComboBox;
|
||||
m_pageProtectionCombo->addItem(tr("Off"));
|
||||
@@ -1241,8 +1241,8 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
||||
m_breakpointCheck->setChecked(breakpoint);
|
||||
layout->addWidget(m_breakpointCheck);
|
||||
|
||||
QHBoxLayout *leakDetailLayout = new QHBoxLayout;
|
||||
QLabel *leakDetailLabel = new QLabel(tr("Leak details:"));
|
||||
auto leakDetailLayout = new QHBoxLayout;
|
||||
auto leakDetailLabel = new QLabel(tr("Leak details:"));
|
||||
leakDetailLayout->addWidget(leakDetailLabel);
|
||||
m_leakDetailCombo = new QComboBox;
|
||||
m_leakDetailCombo->addItem(tr("None"));
|
||||
@@ -1257,8 +1257,8 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
||||
leakDetailLayout->addWidget(m_leakDetailCombo);
|
||||
layout->addLayout(leakDetailLayout);
|
||||
|
||||
QHBoxLayout *leakSizeLayout = new QHBoxLayout;
|
||||
QLabel *leakSizeLabel = new QLabel(tr("Minimum leak size:"));
|
||||
auto leakSizeLayout = new QHBoxLayout;
|
||||
auto leakSizeLabel = new QLabel(tr("Minimum leak size:"));
|
||||
leakSizeLayout->addWidget(leakSizeLabel);
|
||||
m_leakSizeSpin = new QSpinBox;
|
||||
m_leakSizeSpin->setMinimum(0);
|
||||
@@ -1268,8 +1268,8 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
||||
leakSizeLayout->addWidget(m_leakSizeSpin);
|
||||
layout->addLayout(leakSizeLayout);
|
||||
|
||||
QHBoxLayout *leakRecordingLayout = new QHBoxLayout;
|
||||
QLabel *leakRecordingLabel = new QLabel(tr("Control leak recording:"));
|
||||
auto leakRecordingLayout = new QHBoxLayout;
|
||||
auto leakRecordingLabel = new QLabel(tr("Control leak recording:"));
|
||||
leakRecordingLayout->addWidget(leakRecordingLabel);
|
||||
m_leakRecordingCombo = new QComboBox;
|
||||
m_leakRecordingCombo->addItem(tr("Off"));
|
||||
@@ -1283,16 +1283,16 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
||||
m_attachCheck->setChecked(attach);
|
||||
layout->addWidget(m_attachCheck);
|
||||
|
||||
QHBoxLayout *extraArgsLayout = new QHBoxLayout;
|
||||
QLabel *extraArgsLabel = new QLabel(tr("Extra arguments:"));
|
||||
auto extraArgsLayout = new QHBoxLayout;
|
||||
auto extraArgsLabel = new QLabel(tr("Extra arguments:"));
|
||||
extraArgsLayout->addWidget(extraArgsLabel);
|
||||
m_extraArgsEdit = new QLineEdit;
|
||||
m_extraArgsEdit->setText(extraArgs);
|
||||
extraArgsLayout->addWidget(m_extraArgsEdit);
|
||||
layout->addLayout(extraArgsLayout);
|
||||
|
||||
QHBoxLayout *pathLayout = new QHBoxLayout;
|
||||
QLabel *pathLabel = new QLabel(tr("Heob path:"));
|
||||
auto pathLayout = new QHBoxLayout;
|
||||
auto pathLabel = new QLabel(tr("Heob path:"));
|
||||
pathLabel->setToolTip(tr("The location of heob32.exe and heob64.exe."));
|
||||
pathLayout->addWidget(pathLabel);
|
||||
m_pathChooser = new PathChooser;
|
||||
@@ -1300,18 +1300,18 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
||||
pathLayout->addWidget(m_pathChooser);
|
||||
layout->addLayout(pathLayout);
|
||||
|
||||
QHBoxLayout *saveLayout = new QHBoxLayout;
|
||||
auto saveLayout = new QHBoxLayout;
|
||||
saveLayout->addStretch(1);
|
||||
QToolButton *saveButton = new QToolButton;
|
||||
auto saveButton = new QToolButton;
|
||||
saveButton->setToolTip(tr("Save current settings as default."));
|
||||
saveButton->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
|
||||
connect(saveButton, &QAbstractButton::clicked, this, &HeobDialog::saveOptions);
|
||||
saveLayout->addWidget(saveButton);
|
||||
layout->addLayout(saveLayout);
|
||||
|
||||
QHBoxLayout *okLayout = new QHBoxLayout;
|
||||
auto okLayout = new QHBoxLayout;
|
||||
okLayout->addStretch(1);
|
||||
QPushButton *okButton = new QPushButton(tr("OK"));
|
||||
auto okButton = new QPushButton(tr("OK"));
|
||||
okButton->setDefault(true);
|
||||
connect(okButton, &QAbstractButton::clicked, this, &QDialog::accept);
|
||||
okLayout->addWidget(okButton);
|
||||
|
@@ -123,9 +123,9 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
|
||||
{
|
||||
setWindowTitle(tr("Save Suppression"));
|
||||
|
||||
QLabel *fileLabel = new QLabel(tr("Suppression File:"), this);
|
||||
auto fileLabel = new QLabel(tr("Suppression File:"), this);
|
||||
|
||||
QLabel *suppressionsLabel = new QLabel(tr("Suppression:"), this);
|
||||
auto suppressionsLabel = new QLabel(tr("Suppression:"), this);
|
||||
suppressionsLabel->setBuddy(m_suppressionEdit);
|
||||
|
||||
QFont font;
|
||||
@@ -135,7 +135,7 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
|
||||
m_buttonBox = new QDialogButtonBox(this);
|
||||
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout(this);
|
||||
auto formLayout = new QFormLayout(this);
|
||||
formLayout->addRow(fileLabel, m_fileChooser);
|
||||
formLayout->addRow(suppressionsLabel);
|
||||
formLayout->addRow(m_suppressionEdit);
|
||||
|
@@ -54,8 +54,8 @@ public:
|
||||
|
||||
private:
|
||||
void validate();
|
||||
void accept();
|
||||
void reject();
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
MemcheckErrorView *m_view;
|
||||
ValgrindBaseSettings *m_settings;
|
||||
|
@@ -151,7 +151,7 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings, bool
|
||||
|
||||
if (!global) {
|
||||
// In project settings we want a flat vertical list.
|
||||
QVBoxLayout *l = new QVBoxLayout;
|
||||
auto l = new QVBoxLayout;
|
||||
while (layout()->count()) {
|
||||
QLayoutItem *item = layout()->takeAt(0);
|
||||
if (QWidget *w = item->widget())
|
||||
|
@@ -45,7 +45,7 @@ class ValgrindConfigWidget : public QWidget
|
||||
|
||||
public:
|
||||
ValgrindConfigWidget(ValgrindBaseSettings *settings, bool global);
|
||||
virtual ~ValgrindConfigWidget();
|
||||
~ValgrindConfigWidget() override;
|
||||
|
||||
void setSuppressions(const QStringList &files);
|
||||
QStringList suppressions() const;
|
||||
|
@@ -190,7 +190,7 @@ void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::P
|
||||
return;
|
||||
|
||||
QObject *obj = ExtensionSystem::PluginManager::getObjectByName("AppOutputPane");
|
||||
if (IOutputPane *pane = qobject_cast<IOutputPane *>(obj))
|
||||
if (auto pane = qobject_cast<IOutputPane *>(obj))
|
||||
pane->popup(IOutputPane::NoModeSwitch);
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ protected:
|
||||
virtual QString progressTitle() const = 0;
|
||||
virtual QStringList toolArguments() const = 0;
|
||||
|
||||
ValgrindBaseSettings *m_settings = 0;
|
||||
ValgrindBaseSettings *m_settings = nullptr;
|
||||
QFutureInterface<void> m_progress;
|
||||
ValgrindRunner m_runner;
|
||||
|
||||
|
@@ -145,11 +145,11 @@ void ValgrindMemcheckParserTest::cleanup()
|
||||
{
|
||||
if (m_socket) {
|
||||
delete m_socket;
|
||||
m_socket = 0;
|
||||
m_socket = nullptr;
|
||||
}
|
||||
if (m_process) {
|
||||
delete m_process;
|
||||
m_process = 0;
|
||||
m_process = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ using namespace ProjectExplorer;
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
static ValgrindGlobalSettings *theGlobalSettings = 0;
|
||||
static ValgrindGlobalSettings *theGlobalSettings = nullptr;
|
||||
|
||||
class ValgrindOptionsPage : public IOptionsPage
|
||||
{
|
||||
@@ -68,19 +68,19 @@ public:
|
||||
setCategoryIcon(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
}
|
||||
|
||||
QWidget *widget()
|
||||
QWidget *widget() override
|
||||
{
|
||||
if (!m_widget)
|
||||
m_widget = new ValgrindConfigWidget(theGlobalSettings, true);
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void apply()
|
||||
void apply() override
|
||||
{
|
||||
theGlobalSettings->writeSettings();
|
||||
}
|
||||
|
||||
void finish()
|
||||
void finish() override
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
ValgrindPlugin::~ValgrindPlugin()
|
||||
{
|
||||
delete theGlobalSettings;
|
||||
theGlobalSettings = 0;
|
||||
theGlobalSettings = nullptr;
|
||||
}
|
||||
|
||||
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
|
@@ -40,7 +40,7 @@ class ValgrindPlugin : public ExtensionSystem::IPlugin
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Valgrind.json")
|
||||
|
||||
public:
|
||||
ValgrindPlugin() {}
|
||||
ValgrindPlugin() = default;
|
||||
~ValgrindPlugin() override;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||
|
@@ -224,7 +224,7 @@ ValgrindRunner::~ValgrindRunner()
|
||||
waitForFinished();
|
||||
}
|
||||
delete d;
|
||||
d = 0;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
void ValgrindRunner::setValgrindExecutable(const QString &executable)
|
||||
|
@@ -114,7 +114,7 @@ void ValgrindTestRunnerTest::cleanup()
|
||||
{
|
||||
Q_ASSERT(m_runner);
|
||||
delete m_runner;
|
||||
m_runner = 0;
|
||||
m_runner = nullptr;
|
||||
|
||||
m_logMessages.clear();
|
||||
m_errors.clear();
|
||||
|
@@ -42,7 +42,7 @@ class ValgrindTestRunnerTest : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ValgrindTestRunnerTest(QObject *parent = 0);
|
||||
explicit ValgrindTestRunnerTest(QObject *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void init();
|
||||
|
@@ -38,12 +38,7 @@ namespace XmlProtocol {
|
||||
class AnnounceThread::Private : public QSharedData
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: hThreadId( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
qint64 hThreadId;
|
||||
qint64 hThreadId = -1;
|
||||
QVector<Frame> stack;
|
||||
};
|
||||
|
||||
@@ -52,14 +47,9 @@ AnnounceThread::AnnounceThread()
|
||||
{
|
||||
}
|
||||
|
||||
AnnounceThread::AnnounceThread(const AnnounceThread &other)
|
||||
: d(other.d)
|
||||
{
|
||||
}
|
||||
AnnounceThread::AnnounceThread(const AnnounceThread &other) = default;
|
||||
|
||||
AnnounceThread::~AnnounceThread()
|
||||
{
|
||||
}
|
||||
AnnounceThread::~AnnounceThread() = default;
|
||||
|
||||
void AnnounceThread::swap(AnnounceThread &other)
|
||||
{
|
||||
|
@@ -42,24 +42,15 @@ namespace XmlProtocol {
|
||||
class Error::Private : public QSharedData
|
||||
{
|
||||
public:
|
||||
explicit Private() :
|
||||
unique(0),
|
||||
tid(0),
|
||||
kind(0),
|
||||
leakedBytes(0),
|
||||
leakedBlocks(0),
|
||||
hThreadId(-1)
|
||||
{}
|
||||
|
||||
qint64 unique;
|
||||
qint64 tid;
|
||||
qint64 unique = 0;
|
||||
qint64 tid = 0;
|
||||
QString what;
|
||||
int kind;
|
||||
int kind = 0;
|
||||
QVector<Stack> stacks;
|
||||
Suppression suppression;
|
||||
quint64 leakedBytes;
|
||||
qint64 leakedBlocks;
|
||||
qint64 hThreadId;
|
||||
quint64 leakedBytes = 0;
|
||||
qint64 leakedBlocks = 0;
|
||||
qint64 hThreadId = -1;
|
||||
|
||||
bool operator==(const Private &other) const
|
||||
{
|
||||
@@ -80,14 +71,9 @@ Error::Error() :
|
||||
{
|
||||
}
|
||||
|
||||
Error::~Error()
|
||||
{
|
||||
}
|
||||
Error::~Error() = default;
|
||||
|
||||
Error::Error(const Error &other) :
|
||||
d( other.d )
|
||||
{
|
||||
}
|
||||
Error::Error(const Error &other) = default;
|
||||
|
||||
void Error::swap(Error &other)
|
||||
{
|
||||
|
@@ -288,7 +288,7 @@ QVariant FrameItem::data(int column, int role) const
|
||||
const ErrorItem *FrameItem::getErrorItem() const
|
||||
{
|
||||
for (const TreeItem *parentItem = parent(); parentItem; parentItem = parentItem->parent()) {
|
||||
const ErrorItem * const errorItem = dynamic_cast<const ErrorItem *>(parentItem);
|
||||
auto const errorItem = dynamic_cast<const ErrorItem *>(parentItem);
|
||||
if (errorItem)
|
||||
return errorItem;
|
||||
}
|
||||
|
@@ -46,9 +46,9 @@ public:
|
||||
ErrorRole = Debugger::DetailedErrorView::FullTextRole + 1,
|
||||
};
|
||||
|
||||
explicit ErrorListModel(QObject *parent = 0);
|
||||
explicit ErrorListModel(QObject *parent = nullptr);
|
||||
|
||||
typedef std::function<Frame(const Error &)> RelevantFrameFinder;
|
||||
using RelevantFrameFinder = std::function<Frame (const Error &)>;
|
||||
RelevantFrameFinder relevantFrameFinder() const;
|
||||
void setRelevantFrameFinder(const RelevantFrameFinder &relevantFrameFinder);
|
||||
|
||||
|
@@ -36,8 +36,6 @@ namespace XmlProtocol {
|
||||
class Frame::Private : public QSharedData
|
||||
{
|
||||
public:
|
||||
Private() : ip(0), line(-1) {}
|
||||
|
||||
bool operator==(const Private &other) const
|
||||
{
|
||||
return ip == other.ip
|
||||
@@ -48,26 +46,21 @@ public:
|
||||
&& line == other.line;
|
||||
}
|
||||
|
||||
quint64 ip;
|
||||
quint64 ip = 0;
|
||||
QString object;
|
||||
QString functionName;
|
||||
QString fileName;
|
||||
QString directory;
|
||||
int line;
|
||||
int line = -1;
|
||||
};
|
||||
|
||||
Frame::Frame() : d(new Private)
|
||||
{
|
||||
}
|
||||
|
||||
Frame::~Frame()
|
||||
{
|
||||
}
|
||||
Frame::~Frame() = default;
|
||||
|
||||
Frame::Frame(const Frame &other) :
|
||||
d(other.d)
|
||||
{
|
||||
}
|
||||
Frame::Frame(const Frame &other) = default;
|
||||
|
||||
Frame &Frame::operator=(const Frame &other)
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ QString toolTipForFrame(const Frame &frame)
|
||||
location += ':' + QString::number(frame.line());
|
||||
}
|
||||
|
||||
typedef QPair<QString, QString> StringPair;
|
||||
using StringPair = QPair<QString, QString>;
|
||||
QList<StringPair> lines;
|
||||
|
||||
if (!frame.functionName().isEmpty())
|
||||
|
@@ -50,7 +50,7 @@ namespace {
|
||||
: m_message(message)
|
||||
{}
|
||||
|
||||
~ParserException() throw() {}
|
||||
~ParserException() noexcept = default;
|
||||
|
||||
QString message() const { return m_message; }
|
||||
|
||||
@@ -60,23 +60,21 @@ namespace {
|
||||
|
||||
struct XWhat
|
||||
{
|
||||
XWhat() : leakedblocks(0), leakedbytes(0), hthreadid(-1) {}
|
||||
QString text;
|
||||
qint64 leakedblocks;
|
||||
qint64 leakedbytes;
|
||||
qint64 hthreadid;
|
||||
qint64 leakedblocks = 0;
|
||||
qint64 leakedbytes = 0;
|
||||
qint64 hthreadid = -1;
|
||||
};
|
||||
|
||||
struct XauxWhat
|
||||
{
|
||||
XauxWhat() : line(-1), hthreadid(-1) {}
|
||||
void clear() { *this = XauxWhat(); }
|
||||
|
||||
QString text;
|
||||
QString file;
|
||||
QString dir;
|
||||
qint64 line;
|
||||
qint64 hthreadid;
|
||||
qint64 line = -1;
|
||||
qint64 hthreadid = -1;
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
@@ -215,7 +213,7 @@ QXmlStreamReader::TokenType Parser::Private::blockingReadNext()
|
||||
// ...so we fall back to knowing it might be a QAbstractSocket.
|
||||
|
||||
QIODevice *dev = reader.device();
|
||||
QAbstractSocket *sock = qobject_cast<QAbstractSocket *>(dev);
|
||||
auto sock = qobject_cast<const QAbstractSocket *>(dev);
|
||||
|
||||
if (!sock || sock->state() != QAbstractSocket::ConnectedState)
|
||||
throw ParserException(dev->errorString());
|
||||
|
@@ -54,8 +54,8 @@ public:
|
||||
Helgrind
|
||||
};
|
||||
|
||||
explicit Parser(QObject *parent=0);
|
||||
~Parser();
|
||||
explicit Parser(QObject *parent = nullptr);
|
||||
~Parser() override;
|
||||
|
||||
QString errorString() const;
|
||||
void parse(QIODevice *stream);
|
||||
|
@@ -37,17 +37,11 @@ namespace XmlProtocol {
|
||||
class Stack::Private : public QSharedData
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: line(-1)
|
||||
, hthreadid(-1)
|
||||
{
|
||||
}
|
||||
|
||||
QString auxwhat;
|
||||
QString file;
|
||||
QString dir;
|
||||
qint64 line;
|
||||
qint64 hthreadid;
|
||||
qint64 line = -1;
|
||||
qint64 hthreadid = -1;
|
||||
QVector<Frame> frames;
|
||||
};
|
||||
|
||||
@@ -56,14 +50,9 @@ Stack::Stack()
|
||||
{
|
||||
}
|
||||
|
||||
Stack::Stack(const Stack &other)
|
||||
: d(other.d)
|
||||
{
|
||||
}
|
||||
Stack::Stack(const Stack &other) = default;
|
||||
|
||||
Stack::~Stack()
|
||||
{
|
||||
}
|
||||
Stack::~Stack() = default;
|
||||
|
||||
void Stack::swap(Stack &other)
|
||||
{
|
||||
|
@@ -56,15 +56,15 @@ public:
|
||||
LineRole
|
||||
};
|
||||
|
||||
explicit StackModel(QObject *parent = 0);
|
||||
~StackModel();
|
||||
explicit StackModel(QObject *parent = nullptr);
|
||||
~StackModel() override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &child) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &child) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
void clear();
|
||||
void setError(const Valgrind::XmlProtocol::Error &error);
|
||||
|
@@ -35,12 +35,7 @@ namespace XmlProtocol {
|
||||
class Status::Private : public QSharedData
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: state(Running)
|
||||
{
|
||||
}
|
||||
|
||||
State state;
|
||||
State state = Running;
|
||||
QString time;
|
||||
};
|
||||
|
||||
@@ -49,14 +44,9 @@ Status::Status()
|
||||
{
|
||||
}
|
||||
|
||||
Status::Status(const Status &other)
|
||||
: d(other.d)
|
||||
{
|
||||
}
|
||||
Status::Status(const Status &other) = default;
|
||||
|
||||
Status::~Status()
|
||||
{
|
||||
}
|
||||
Status::~Status() = default;
|
||||
|
||||
void Status::swap(Status &other)
|
||||
{
|
||||
|
@@ -39,10 +39,6 @@ using namespace Valgrind::XmlProtocol;
|
||||
class SuppressionFrame::Private : public QSharedData
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
{
|
||||
}
|
||||
|
||||
QString obj;
|
||||
QString fun;
|
||||
};
|
||||
@@ -52,14 +48,9 @@ SuppressionFrame::SuppressionFrame()
|
||||
{
|
||||
}
|
||||
|
||||
SuppressionFrame::SuppressionFrame(const SuppressionFrame &other)
|
||||
: d(other.d)
|
||||
{
|
||||
}
|
||||
SuppressionFrame::SuppressionFrame(const SuppressionFrame &other) = default;
|
||||
|
||||
SuppressionFrame::~SuppressionFrame()
|
||||
{
|
||||
}
|
||||
SuppressionFrame::~SuppressionFrame() = default;
|
||||
|
||||
void SuppressionFrame::swap(SuppressionFrame &other)
|
||||
{
|
||||
@@ -110,12 +101,7 @@ QString SuppressionFrame::toString() const
|
||||
class Suppression::Private : public QSharedData
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: isNull(true)
|
||||
{
|
||||
}
|
||||
|
||||
bool isNull;
|
||||
bool isNull = true;
|
||||
QString name;
|
||||
QString kind;
|
||||
QString auxkind;
|
||||
@@ -128,14 +114,9 @@ Suppression::Suppression()
|
||||
{
|
||||
}
|
||||
|
||||
Suppression::Suppression(const Suppression &other)
|
||||
: d(other.d)
|
||||
{
|
||||
}
|
||||
Suppression::Suppression(const Suppression &other) = default;
|
||||
|
||||
Suppression::~Suppression()
|
||||
{
|
||||
}
|
||||
Suppression::~Suppression() = default;
|
||||
|
||||
void Suppression::swap(Suppression &other)
|
||||
{
|
||||
|
@@ -63,7 +63,7 @@ private:
|
||||
QSharedDataPointer<Private> d;
|
||||
};
|
||||
|
||||
typedef QVector<SuppressionFrame> SuppressionFrames;
|
||||
using SuppressionFrames = QVector<SuppressionFrame>;
|
||||
|
||||
class Suppression
|
||||
{
|
||||
|
@@ -42,20 +42,18 @@ namespace {
|
||||
class Thread : public QThread
|
||||
{
|
||||
public:
|
||||
Thread() : parser(0) , device(0) {}
|
||||
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
QTC_ASSERT(QThread::currentThread() == this, return);
|
||||
parser->parse(device);
|
||||
delete parser;
|
||||
parser = 0;
|
||||
parser = nullptr;
|
||||
delete device;
|
||||
device = 0;
|
||||
device = nullptr;
|
||||
}
|
||||
|
||||
Valgrind::XmlProtocol::Parser *parser;
|
||||
QIODevice *device;
|
||||
Valgrind::XmlProtocol::Parser *parser = nullptr;
|
||||
QIODevice *device = nullptr;
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
@@ -67,9 +65,6 @@ namespace XmlProtocol {
|
||||
class ThreadedParser::Private
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
{}
|
||||
|
||||
QPointer<Thread> parserThread;
|
||||
QString errorString;
|
||||
};
|
||||
@@ -93,14 +88,14 @@ QString ThreadedParser::errorString() const
|
||||
|
||||
bool ThreadedParser::isRunning() const
|
||||
{
|
||||
return d->parserThread ? d->parserThread.data()->isRunning() : 0;
|
||||
return d->parserThread ? d->parserThread.data()->isRunning() : false;
|
||||
}
|
||||
|
||||
void ThreadedParser::parse(QIODevice *device)
|
||||
{
|
||||
QTC_ASSERT(!d->parserThread, return);
|
||||
|
||||
Parser *parser = new Parser;
|
||||
auto parser = new Parser;
|
||||
qRegisterMetaType<Valgrind::XmlProtocol::Status>();
|
||||
qRegisterMetaType<Valgrind::XmlProtocol::Error>();
|
||||
connect(parser, &Parser::status,
|
||||
@@ -123,11 +118,11 @@ void ThreadedParser::parse(QIODevice *device)
|
||||
Qt::QueuedConnection);
|
||||
|
||||
|
||||
Thread *thread = new Thread;
|
||||
auto thread = new Thread;
|
||||
d->parserThread = thread;
|
||||
connect(thread, &QThread::finished,
|
||||
thread, &QObject::deleteLater);
|
||||
device->setParent(0);
|
||||
device->setParent(nullptr);
|
||||
device->moveToThread(thread);
|
||||
parser->moveToThread(thread);
|
||||
thread->device = device;
|
||||
|
@@ -46,8 +46,8 @@ class ThreadedParser : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ThreadedParser(QObject *parent = 0);
|
||||
~ThreadedParser();
|
||||
explicit ThreadedParser(QObject *parent = nullptr);
|
||||
~ThreadedParser() override;
|
||||
|
||||
QString errorString() const;
|
||||
|
||||
|
Reference in New Issue
Block a user