aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/valgrind
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2018-12-10 08:11:18 +0100
committerAlessandro Portale <alessandro.portale@qt.io>2018-12-10 18:54:02 +0000
commit00ec6dfb5d7e156cb87d0836f841ff9aef963618 (patch)
treec1c2b82e55115b48e0e8fd701ab34eba2e5d6ffd /src/plugins/valgrind
parent390a227df672a227de4539ad44da46cf773d5810 (diff)
Valgrind: Modernize
modernize-* Change-Id: I6db60dce78cf2575e36caa597b1f095adba34fd9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/valgrind')
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcallmodel.cpp6
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcontroller.cpp4
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcostitem.cpp8
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcycledetection.cpp4
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcycledetection.h4
-rw-r--r--src/plugins/valgrind/callgrind/callgrinddatamodel.cpp2
-rw-r--r--src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp18
-rw-r--r--src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp6
-rw-r--r--src/plugins/valgrind/callgrind/callgrindfunctioncycle.h2
-rw-r--r--src/plugins/valgrind/callgrind/callgrindparsedata.cpp2
-rw-r--r--src/plugins/valgrind/callgrind/callgrindparser.cpp12
-rw-r--r--src/plugins/valgrind/callgrind/callgrindproxymodel.cpp5
-rw-r--r--src/plugins/valgrind/callgrind/callgrindproxymodel.h6
-rw-r--r--src/plugins/valgrind/callgrindcostdelegate.cpp13
-rw-r--r--src/plugins/valgrind/callgrindcostdelegate.h10
-rw-r--r--src/plugins/valgrind/callgrindcostview.cpp8
-rw-r--r--src/plugins/valgrind/callgrindcostview.h6
-rw-r--r--src/plugins/valgrind/callgrindnamedelegate.h4
-rw-r--r--src/plugins/valgrind/callgrindtextmark.cpp2
-rw-r--r--src/plugins/valgrind/callgrindtextmark.h2
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp8
-rw-r--r--src/plugins/valgrind/callgrindvisualisation.cpp17
-rw-r--r--src/plugins/valgrind/callgrindvisualisation.h10
-rw-r--r--src/plugins/valgrind/memcheckerrorview.cpp7
-rw-r--r--src/plugins/valgrind/memcheckerrorview.h6
-rw-r--r--src/plugins/valgrind/memchecktool.cpp66
-rw-r--r--src/plugins/valgrind/suppressiondialog.cpp6
-rw-r--r--src/plugins/valgrind/suppressiondialog.h4
-rw-r--r--src/plugins/valgrind/valgrindconfigwidget.cpp2
-rw-r--r--src/plugins/valgrind/valgrindconfigwidget.h2
-rw-r--r--src/plugins/valgrind/valgrindengine.cpp2
-rw-r--r--src/plugins/valgrind/valgrindengine.h2
-rw-r--r--src/plugins/valgrind/valgrindmemcheckparsertest.cpp4
-rw-r--r--src/plugins/valgrind/valgrindplugin.cpp10
-rw-r--r--src/plugins/valgrind/valgrindplugin.h2
-rw-r--r--src/plugins/valgrind/valgrindrunner.cpp2
-rw-r--r--src/plugins/valgrind/valgrindtestrunnertest.cpp2
-rw-r--r--src/plugins/valgrind/valgrindtestrunnertest.h2
-rw-r--r--src/plugins/valgrind/xmlprotocol/announcethread.cpp16
-rw-r--r--src/plugins/valgrind/xmlprotocol/error.cpp30
-rw-r--r--src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp2
-rw-r--r--src/plugins/valgrind/xmlprotocol/errorlistmodel.h4
-rw-r--r--src/plugins/valgrind/xmlprotocol/frame.cpp15
-rw-r--r--src/plugins/valgrind/xmlprotocol/modelhelpers.cpp2
-rw-r--r--src/plugins/valgrind/xmlprotocol/parser.cpp16
-rw-r--r--src/plugins/valgrind/xmlprotocol/parser.h4
-rw-r--r--src/plugins/valgrind/xmlprotocol/stack.cpp19
-rw-r--r--src/plugins/valgrind/xmlprotocol/stackmodel.h16
-rw-r--r--src/plugins/valgrind/xmlprotocol/status.cpp16
-rw-r--r--src/plugins/valgrind/xmlprotocol/suppression.cpp29
-rw-r--r--src/plugins/valgrind/xmlprotocol/suppression.h2
-rw-r--r--src/plugins/valgrind/xmlprotocol/threadedparser.cpp23
-rw-r--r--src/plugins/valgrind/xmlprotocol/threadedparser.h4
53 files changed, 182 insertions, 294 deletions
diff --git a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp
index cf23a94c063..28add4b4256 100644
--- a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp
@@ -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();
}
diff --git a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp
index 66b98f09b28..40a025b5d94 100644
--- a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp
@@ -48,9 +48,7 @@ namespace Callgrind {
const char CALLGRIND_CONTROL_BINARY[] = "callgrind_control";
-CallgrindController::CallgrindController()
-{
-}
+CallgrindController::CallgrindController() = default;
CallgrindController::~CallgrindController()
{
diff --git a/src/plugins/valgrind/callgrind/callgrindcostitem.cpp b/src/plugins/valgrind/callgrind/callgrindcostitem.cpp
index 2ae992e8ce0..91d3eba74cd 100644
--- a/src/plugins/valgrind/callgrind/callgrindcostitem.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcostitem.cpp
@@ -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)
{
}
diff --git a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp
index fa34a708fb5..b47ecb4697d 100644
--- a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp
@@ -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;
diff --git a/src/plugins/valgrind/callgrind/callgrindcycledetection.h b/src/plugins/valgrind/callgrind/callgrindcycledetection.h
index 4894e7227fc..eddc6fee0a3 100644
--- a/src/plugins/valgrind/callgrind/callgrindcycledetection.h
+++ b/src/plugins/valgrind/callgrind/callgrindcycledetection.h
@@ -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
diff --git a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp
index cb2bfe5f76b..89a3e19387a 100644
--- a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp
+++ b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp
@@ -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;
diff --git a/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp b/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp
index 6e4fbf31bf6..ad483a37730 100644
--- a/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindfunctioncall.cpp
@@ -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()
diff --git a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp
index bb68cf75ac9..cadb596a3eb 100644
--- a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h
index 38221b998d7..f24ed40daa7 100644
--- a/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h
+++ b/src/plugins/valgrind/callgrind/callgrindfunctioncycle.h
@@ -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
diff --git a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp
index 683030a2beb..186df0676b0 100644
--- a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp
@@ -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);
diff --git a/src/plugins/valgrind/callgrind/callgrindparser.cpp b/src/plugins/valgrind/callgrind/callgrindparser.cpp
index 7d9123933e7..620734df2f9 100644
--- a/src/plugins/valgrind/callgrind/callgrindparser.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindparser.cpp
@@ -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;
}
diff --git a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp
index c1ac3840622..13809a83d43 100644
--- a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp
@@ -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;
diff --git a/src/plugins/valgrind/callgrind/callgrindproxymodel.h b/src/plugins/valgrind/callgrind/callgrindproxymodel.h
index 822fee2109d..5ca85dd6d67 100644
--- a/src/plugins/valgrind/callgrind/callgrindproxymodel.h
+++ b/src/plugins/valgrind/callgrind/callgrindproxymodel.h
@@ -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
diff --git a/src/plugins/valgrind/callgrindcostdelegate.cpp b/src/plugins/valgrind/callgrindcostdelegate.cpp
index 68309e96429..32fa1e9185e 100644
--- a/src/plugins/valgrind/callgrindcostdelegate.cpp
+++ b/src/plugins/valgrind/callgrindcostdelegate.cpp
@@ -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);
diff --git a/src/plugins/valgrind/callgrindcostdelegate.h b/src/plugins/valgrind/callgrindcostdelegate.h
index 3c0e453b925..e69e4068cfc 100644
--- a/src/plugins/valgrind/callgrindcostdelegate.h
+++ b/src/plugins/valgrind/callgrindcostdelegate.h
@@ -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);
diff --git a/src/plugins/valgrind/callgrindcostview.cpp b/src/plugins/valgrind/callgrindcostview.cpp
index 36a52feecbe..e6a62da6e0a 100644
--- a/src/plugins/valgrind/callgrindcostview.cpp
+++ b/src/plugins/valgrind/callgrindcostview.cpp
@@ -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();
diff --git a/src/plugins/valgrind/callgrindcostview.h b/src/plugins/valgrind/callgrindcostview.h
index fb4b2a72ae1..c9e6b90d7ac 100644
--- a/src/plugins/valgrind/callgrindcostview.h
+++ b/src/plugins/valgrind/callgrindcostview.h
@@ -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.
diff --git a/src/plugins/valgrind/callgrindnamedelegate.h b/src/plugins/valgrind/callgrindnamedelegate.h
index 2533e46a942..89da657273a 100644
--- a/src/plugins/valgrind/callgrindnamedelegate.h
+++ b/src/plugins/valgrind/callgrindnamedelegate.h
@@ -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
diff --git a/src/plugins/valgrind/callgrindtextmark.cpp b/src/plugins/valgrind/callgrindtextmark.cpp
index f0fb48a1768..ab216880134 100644
--- a/src/plugins/valgrind/callgrindtextmark.cpp
+++ b/src/plugins/valgrind/callgrindtextmark.cpp
@@ -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 *>();
}
diff --git a/src/plugins/valgrind/callgrindtextmark.h b/src/plugins/valgrind/callgrindtextmark.h
index fa0a43c915b..abc710e993e 100644
--- a/src/plugins/valgrind/callgrindtextmark.h
+++ b/src/plugins/valgrind/callgrindtextmark.h
@@ -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;
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index b6c67b746ac..73f577125aa 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -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());
diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp
index 4065632df6a..e9fc366a7ed 100644
--- a/src/plugins/valgrind/callgrindvisualisation.cpp
+++ b/src/plugins/valgrind/callgrindvisualisation.cpp
@@ -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));
diff --git a/src/plugins/valgrind/callgrindvisualisation.h b/src/plugins/valgrind/callgrindvisualisation.h
index c6d0d859582..0bb6ada6aea 100644
--- a/src/plugins/valgrind/callgrindvisualisation.h
+++ b/src/plugins/valgrind/callgrindvisualisation.h
@@ -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;
diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp
index 34d400f22e1..3dfa939dddb 100644
--- a/src/plugins/valgrind/memcheckerrorview.cpp
+++ b/src/plugins/valgrind/memcheckerrorview.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/memcheckerrorview.h b/src/plugins/valgrind/memcheckerrorview.h
index 2cc44392683..6a22dbf907d 100644
--- a/src/plugins/valgrind/memcheckerrorview.h
+++ b/src/plugins/valgrind/memcheckerrorview.h
@@ -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
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index cc84a83af19..31fbab64cf9 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -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);
diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp
index c803a7a34f9..52964d97cf4 100644
--- a/src/plugins/valgrind/suppressiondialog.cpp
+++ b/src/plugins/valgrind/suppressiondialog.cpp
@@ -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);
diff --git a/src/plugins/valgrind/suppressiondialog.h b/src/plugins/valgrind/suppressiondialog.h
index 5b1a91720c2..a1ca3f93f7a 100644
--- a/src/plugins/valgrind/suppressiondialog.h
+++ b/src/plugins/valgrind/suppressiondialog.h
@@ -54,8 +54,8 @@ public:
private:
void validate();
- void accept();
- void reject();
+ void accept() override;
+ void reject() override;
MemcheckErrorView *m_view;
ValgrindBaseSettings *m_settings;
diff --git a/src/plugins/valgrind/valgrindconfigwidget.cpp b/src/plugins/valgrind/valgrindconfigwidget.cpp
index 3781dfeba95..7abb0e97d7e 100644
--- a/src/plugins/valgrind/valgrindconfigwidget.cpp
+++ b/src/plugins/valgrind/valgrindconfigwidget.cpp
@@ -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())
diff --git a/src/plugins/valgrind/valgrindconfigwidget.h b/src/plugins/valgrind/valgrindconfigwidget.h
index 82fb590d328..a0e9bb15280 100644
--- a/src/plugins/valgrind/valgrindconfigwidget.h
+++ b/src/plugins/valgrind/valgrindconfigwidget.h
@@ -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;
diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp
index fbdd09591e6..3aa2f78eacf 100644
--- a/src/plugins/valgrind/valgrindengine.cpp
+++ b/src/plugins/valgrind/valgrindengine.cpp
@@ -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);
}
diff --git a/src/plugins/valgrind/valgrindengine.h b/src/plugins/valgrind/valgrindengine.h
index a4f522dd273..8d3b3008939 100644
--- a/src/plugins/valgrind/valgrindengine.h
+++ b/src/plugins/valgrind/valgrindengine.h
@@ -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;
diff --git a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp
index 3071b0345cc..ad2c3c8d2b3 100644
--- a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp
+++ b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp
@@ -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;
}
}
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index 9348c99765c..9512054b4a0 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -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 *)
diff --git a/src/plugins/valgrind/valgrindplugin.h b/src/plugins/valgrind/valgrindplugin.h
index cc41ffab879..5de834d58f1 100644
--- a/src/plugins/valgrind/valgrindplugin.h
+++ b/src/plugins/valgrind/valgrindplugin.h
@@ -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;
diff --git a/src/plugins/valgrind/valgrindrunner.cpp b/src/plugins/valgrind/valgrindrunner.cpp
index f37d641d39d..04fec49f390 100644
--- a/src/plugins/valgrind/valgrindrunner.cpp
+++ b/src/plugins/valgrind/valgrindrunner.cpp
@@ -224,7 +224,7 @@ ValgrindRunner::~ValgrindRunner()
waitForFinished();
}
delete d;
- d = 0;
+ d = nullptr;
}
void ValgrindRunner::setValgrindExecutable(const QString &executable)
diff --git a/src/plugins/valgrind/valgrindtestrunnertest.cpp b/src/plugins/valgrind/valgrindtestrunnertest.cpp
index 4865ea405d3..d4f519e3527 100644
--- a/src/plugins/valgrind/valgrindtestrunnertest.cpp
+++ b/src/plugins/valgrind/valgrindtestrunnertest.cpp
@@ -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();
diff --git a/src/plugins/valgrind/valgrindtestrunnertest.h b/src/plugins/valgrind/valgrindtestrunnertest.h
index 41fbb974102..501cfeb9ae3 100644
--- a/src/plugins/valgrind/valgrindtestrunnertest.h
+++ b/src/plugins/valgrind/valgrindtestrunnertest.h
@@ -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();
diff --git a/src/plugins/valgrind/xmlprotocol/announcethread.cpp b/src/plugins/valgrind/xmlprotocol/announcethread.cpp
index 3ac86371be2..83f7fb5413a 100644
--- a/src/plugins/valgrind/xmlprotocol/announcethread.cpp
+++ b/src/plugins/valgrind/xmlprotocol/announcethread.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/xmlprotocol/error.cpp b/src/plugins/valgrind/xmlprotocol/error.cpp
index 1f7c3065355..efc04f52232 100644
--- a/src/plugins/valgrind/xmlprotocol/error.cpp
+++ b/src/plugins/valgrind/xmlprotocol/error.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp
index 2cb91cab6a1..98126f33a6e 100644
--- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp
+++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp
@@ -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;
}
diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.h b/src/plugins/valgrind/xmlprotocol/errorlistmodel.h
index 722808fe7e8..9d4915147b9 100644
--- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.h
+++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.h
@@ -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);
diff --git a/src/plugins/valgrind/xmlprotocol/frame.cpp b/src/plugins/valgrind/xmlprotocol/frame.cpp
index f16e8d5c9fd..c0bb510c7b9 100644
--- a/src/plugins/valgrind/xmlprotocol/frame.cpp
+++ b/src/plugins/valgrind/xmlprotocol/frame.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
index 6fa7aa81764..48e0a325771 100644
--- a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
+++ b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
@@ -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())
diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp
index e832637ce4b..81208327c03 100644
--- a/src/plugins/valgrind/xmlprotocol/parser.cpp
+++ b/src/plugins/valgrind/xmlprotocol/parser.cpp
@@ -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());
diff --git a/src/plugins/valgrind/xmlprotocol/parser.h b/src/plugins/valgrind/xmlprotocol/parser.h
index 6bc9f1fac0a..4987a6bed8d 100644
--- a/src/plugins/valgrind/xmlprotocol/parser.h
+++ b/src/plugins/valgrind/xmlprotocol/parser.h
@@ -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);
diff --git a/src/plugins/valgrind/xmlprotocol/stack.cpp b/src/plugins/valgrind/xmlprotocol/stack.cpp
index 26148a52c2f..c28ddf2d102 100644
--- a/src/plugins/valgrind/xmlprotocol/stack.cpp
+++ b/src/plugins/valgrind/xmlprotocol/stack.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/xmlprotocol/stackmodel.h b/src/plugins/valgrind/xmlprotocol/stackmodel.h
index 6bcd4b1075e..72a8195d8e5 100644
--- a/src/plugins/valgrind/xmlprotocol/stackmodel.h
+++ b/src/plugins/valgrind/xmlprotocol/stackmodel.h
@@ -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);
diff --git a/src/plugins/valgrind/xmlprotocol/status.cpp b/src/plugins/valgrind/xmlprotocol/status.cpp
index c999cdf3600..f987326f1a7 100644
--- a/src/plugins/valgrind/xmlprotocol/status.cpp
+++ b/src/plugins/valgrind/xmlprotocol/status.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/xmlprotocol/suppression.cpp b/src/plugins/valgrind/xmlprotocol/suppression.cpp
index 92605fbd2f3..14ad429416f 100644
--- a/src/plugins/valgrind/xmlprotocol/suppression.cpp
+++ b/src/plugins/valgrind/xmlprotocol/suppression.cpp
@@ -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)
{
diff --git a/src/plugins/valgrind/xmlprotocol/suppression.h b/src/plugins/valgrind/xmlprotocol/suppression.h
index 3536db1a946..24059fc6344 100644
--- a/src/plugins/valgrind/xmlprotocol/suppression.h
+++ b/src/plugins/valgrind/xmlprotocol/suppression.h
@@ -63,7 +63,7 @@ private:
QSharedDataPointer<Private> d;
};
-typedef QVector<SuppressionFrame> SuppressionFrames;
+using SuppressionFrames = QVector<SuppressionFrame>;
class Suppression
{
diff --git a/src/plugins/valgrind/xmlprotocol/threadedparser.cpp b/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
index d57fdf10c39..52454855065 100644
--- a/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
+++ b/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
@@ -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;
diff --git a/src/plugins/valgrind/xmlprotocol/threadedparser.h b/src/plugins/valgrind/xmlprotocol/threadedparser.h
index 339255d7ad2..379b0f2875e 100644
--- a/src/plugins/valgrind/xmlprotocol/threadedparser.h
+++ b/src/plugins/valgrind/xmlprotocol/threadedparser.h
@@ -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;