From 7b3ba73a018d0fcc642674cc8878bd3274b907f9 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 5 Aug 2011 18:03:37 +0200 Subject: [PATCH] analyzer: code cosmetics Change-Id: Id00cf1be9d07e47f7b61b8cc7e940629c84a48c1 Reviewed-on: http://codereview.qt.nokia.com/2707 Reviewed-by: hjk --- src/plugins/valgrind/memcheckerrorview.cpp | 65 +++++-- src/plugins/valgrind/memcheckerrorview.h | 39 ----- .../valgrind/xmlprotocol/errorlistmodel.cpp | 38 ++-- .../valgrind/xmlprotocol/errorlistmodel.h | 7 +- src/plugins/valgrind/xmlprotocol/parser.cpp | 164 ++++++++++-------- src/plugins/valgrind/xmlprotocol/stack.cpp | 5 +- src/plugins/valgrind/xmlprotocol/stack.h | 8 +- 7 files changed, 163 insertions(+), 163 deletions(-) diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp index 31fcd884fa2..daf6fdcb95f 100644 --- a/src/plugins/valgrind/memcheckerrorview.cpp +++ b/src/plugins/valgrind/memcheckerrorview.cpp @@ -44,33 +44,65 @@ #include "xmlprotocol/modelhelpers.h" #include "xmlprotocol/suppression.h" -#include - +#include #include #include -#include - +#include #include #include #include +#include +#include +#include #include #include +#include #include #include #include +#include #include -#include -#include -#include -#include using namespace Valgrind::XmlProtocol; namespace Valgrind { namespace Internal { +class MemcheckErrorDelegate : public QStyledItemDelegate +{ + Q_OBJECT + +public: + /// This delegate can only work on one view at a time, parent. parent will also be the parent + /// in the QObject parent-child system. + explicit MemcheckErrorDelegate(QListView *parent); + + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + +public slots: + void currentChanged(const QModelIndex &now, const QModelIndex &previous); + void viewResized(); + void layoutChanged(); + void copy(); + +private slots: + void verticalScrolled(); + void openLinkInEditor(const QString &link); + +private: + // the constness of this method is a necessary lie because it is called from paint() const. + QWidget *createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const; + + static const int s_itemMargin = 2; + mutable QPersistentModelIndex m_detailsIndex; + mutable QWidget *m_detailsWidget; + mutable int m_detailsWidgetHeight; +}; + MemcheckErrorDelegate::MemcheckErrorDelegate(QListView *parent) : QStyledItemDelegate(parent), m_detailsWidget(0) @@ -84,8 +116,7 @@ QSize MemcheckErrorDelegate::sizeHint(const QStyleOptionViewItem &opt, const QMo const QListView *view = qobject_cast(parent()); const int viewportWidth = view->viewport()->width(); const bool isSelected = view->selectionModel()->currentIndex() == index; - - int dy = 2 * s_itemMargin; + const int dy = 2 * s_itemMargin; if (!isSelected) { QFontMetrics fm(opt.font); @@ -153,20 +184,20 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo, return QString("0x%1").arg(frame.instructionPointer(), 0, 16); } -QString relativeToPath() +static QString relativeToPath() { - // project for which we insert the snippet + // The project for which we insert the snippet. const ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject(); - QString relativeTo( project ? project->projectDirectory() : QDir::homePath() ); + QString relativeTo(project ? project->projectDirectory() : QDir::homePath()); if (!relativeTo.endsWith(QDir::separator())) relativeTo.append(QDir::separator()); return relativeTo; } -QString errorLocation(const QModelIndex &index, const Error &error, +static QString errorLocation(const QModelIndex &index, const Error &error, bool link = false, const QString &linkAttr = QString()) { const ErrorListModel *model = 0; @@ -190,9 +221,7 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorInde // don't include frameName here as it should wrap if required and pre-line is not supported // by Qt yet it seems const QString displayTextTemplate = QString("%1: %2"); - - QString relativeTo = relativeToPath(); - + const QString relativeTo = relativeToPath(); const Error error = errorIndex.data(ErrorListModel::ErrorRole).value(); QLabel *errorLabel = new QLabel(); @@ -541,3 +570,5 @@ void MemcheckErrorView::setCurrentRow(int row) } // namespace Internal } // namespace Valgrind + +#include "memcheckerrorview.moc" diff --git a/src/plugins/valgrind/memcheckerrorview.h b/src/plugins/valgrind/memcheckerrorview.h index f64bc5bd06b..46c8176f1a6 100644 --- a/src/plugins/valgrind/memcheckerrorview.h +++ b/src/plugins/valgrind/memcheckerrorview.h @@ -36,53 +36,14 @@ #define MEMCHECKERRORVIEW_H #include -#include -#include namespace Analyzer { class AnalyzerSettings; } -namespace ProjectExplorer { -class Project; -} - namespace Valgrind { namespace Internal { -class MemcheckErrorDelegate : public QStyledItemDelegate -{ - Q_OBJECT - -public: - /// This delegate can only work on one view at a time, parent. parent will also be the parent - /// in the QObject parent-child system. - explicit MemcheckErrorDelegate(QListView *parent); - - virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; - virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - -public slots: - void currentChanged(const QModelIndex &now, const QModelIndex &previous); - void viewResized(); - void layoutChanged(); - void copy(); - -private slots: - void verticalScrolled(); - void openLinkInEditor(const QString &link); - -private: - // the constness of this method is a necessary lie because it is called from paint() const. - QWidget *createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const; - - static const int s_itemMargin = 2; - mutable QPersistentModelIndex m_detailsIndex; - mutable QWidget *m_detailsWidget; - mutable int m_detailsWidgetHeight; -}; - class MemcheckErrorView : public QListView { Q_OBJECT diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp index 08794bd7429..cd731b3a170 100644 --- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp +++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp @@ -137,17 +137,23 @@ QString ErrorListModel::Private::formatLocation(const Error &error) const QVariant ErrorListModel::Private::errorData(int row, int column, int role) const { + // A dummy entry. + if (row == 0 && errors.isEmpty()) { + if (role == Qt::DisplayRole) + return tr("No errors found"); + if (role == ErrorRole) + return tr("No errors found"); + return QVariant(); + } + if (row < 0 || row >= errors.size()) return QVariant(); - const Error &error = errors[row]; - const QVector stacks = error.stacks(); - const Stack stack = !stacks.isEmpty() ? stacks.first() : Stack(); + const Error &error = errors.at(row); if (error.stacks().count()) switch (role) { - case Qt::DisplayRole: - { + case Qt::DisplayRole: { switch (column) { case WhatColumn: return error.what(); @@ -155,8 +161,7 @@ QVariant ErrorListModel::Private::errorData(int row, int column, int role) const return formatLocation(error); case AbsoluteFilePathColumn: return formatAbsoluteFilePath(error); - case LineColumn: - { + case LineColumn: { const qint64 line = findRelevantFrame(error).line(); return line > 0 ? line : QVariant(); } @@ -177,17 +182,14 @@ QVariant ErrorListModel::Private::errorData(int row, int column, int role) const } } case Qt::ToolTipRole: - { return toolTipForFrame(findRelevantFrame(error)); - } case ErrorRole: return QVariant::fromValue(error); case AbsoluteFilePathRole: return formatAbsoluteFilePath(error); case FileRole: return findRelevantFrame(error).file(); - case LineRole: - { + case LineRole: { const qint64 line = findRelevantFrame(error).line(); return line > 0 ? line : QVariant(); } @@ -200,8 +202,6 @@ QVariant ErrorListModel::data(const QModelIndex &index, int role) const if (!index.isValid()) return QVariant(); - QTC_ASSERT(index.model() == this, return QVariant()); - if (!index.parent().isValid()) return d->errorData(index.row(), index.column(), role); @@ -241,13 +241,9 @@ QVariant ErrorListModel::headerData(int section, Qt::Orientation orientation, in int ErrorListModel::rowCount(const QModelIndex &parent) const { - //root - if (!parent.isValid()) - return d->errors.count(); - - QTC_ASSERT(parent.model() == this, return 0); - - return 0; + if (parent.isValid()) + return 0; + return qMax(1, d->errors.count()); } int ErrorListModel::columnCount(const QModelIndex &parent) const @@ -286,7 +282,7 @@ Error ErrorListModel::error(const QModelIndex &index) const const int r = index.row(); if (r < 0 || r >= d->errors.size()) return Error(); - return d->errors[r]; + return d->errors.at(r); } void ErrorListModel::clear() diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.h b/src/plugins/valgrind/xmlprotocol/errorlistmodel.h index fe758ed01a7..388f50cf846 100644 --- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.h +++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.h @@ -47,9 +47,10 @@ class Frame; class ErrorListModel : public QAbstractItemModel { Q_OBJECT + public: enum Column { - WhatColumn=0, + WhatColumn = 0, LocationColumn, AbsoluteFilePathColumn, LineColumn, @@ -63,7 +64,7 @@ public: }; enum Role { - ErrorRole=Qt::UserRole, + ErrorRole = Qt::UserRole, AbsoluteFilePathRole, FileRole, LineRole @@ -96,7 +97,7 @@ public: void clear(); -public Q_SLOTS: +public slots: void addError(const Valgrind::XmlProtocol::Error &error); private: diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp index 6d602c96024..ca7edcd2ea9 100644 --- a/src/plugins/valgrind/xmlprotocol/parser.cpp +++ b/src/plugins/valgrind/xmlprotocol/parser.cpp @@ -94,21 +94,22 @@ namespace XmlProtocol { class Parser::Private { - Parser *const q; public: explicit Private(Parser *qq); void parse(QIODevice *device); + QString errorString; - void parse_error(); +private: + void parseError(); QVector parseStack(); Suppression parseSuppression(); SuppressionFrame parseSuppressionFrame(); - Frame parse_frame(); - void parse_status(); - void parse_errorcounts(); - void parse_suppcounts(); - void parse_announcethread(); + Frame parseFrame(); + void parseStatus(); + void parseErrorCounts(); + void parseSuppressionCounts(); + void parseAnnounceThread(); void checkProtocolVersion(const QString &versionStr); void checkTool(const QString &tool); XWhat parseXWhat(); @@ -124,12 +125,14 @@ public: QString blockingReadElementText(); Tool tool; - QString errorString; QXmlStreamReader reader; - QHash errorKindsByName_memcheck; - QHash errorKindsByName_helgrind; - QHash errorKindsByName_ptrcheck; - QHash toolsByName; + QHash errorKindsByName_memcheck; + QHash errorKindsByName_helgrind; + QHash errorKindsByName_ptrcheck; + QHash toolsByName; + +private: + Parser *const q; }; #undef ADD_ENUM @@ -137,9 +140,9 @@ public: Parser::Private::Private(Parser *qq) - : q(qq), - tool(Parser::Unknown) + : q(qq) { + tool = Parser::Unknown; toolsByName.insert(QLatin1String("memcheck"), Parser::Memcheck); toolsByName.insert(QLatin1String("ptrcheck"), Parser::Ptrcheck); toolsByName.insert(QLatin1String("exp-ptrcheck"), Parser::Ptrcheck); @@ -311,13 +314,14 @@ XWhat Parser::Private::parseXWhat() blockingReadNext(); if (reader.isEndElement()) break; - if (reader.name() == QLatin1String("text")) + const QStringRef name = reader.name(); + if (name == QLatin1String("text")) what.text = blockingReadElementText(); - else if (reader.name() == QLatin1String("leakedbytes")) + else if (name == QLatin1String("leakedbytes")) what.leakedbytes = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedbytes")); - else if (reader.name() == QLatin1String("leakedblocks")) + else if (name == QLatin1String("leakedblocks")) what.leakedblocks = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedblocks")); - else if (reader.name() == QLatin1String("hthreadid")) + else if (name == QLatin1String("hthreadid")) what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/hthreadid")); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -332,15 +336,16 @@ XauxWhat Parser::Private::parseXauxWhat() blockingReadNext(); if (reader.isEndElement()) break; - if (reader.name() == QLatin1String("text")) + const QStringRef name = reader.name(); + if (name == QLatin1String("text")) what.text = blockingReadElementText(); - else if (reader.name() == QLatin1String("file")) + else if (name == QLatin1String("file")) what.file = blockingReadElementText(); - else if (reader.name() == QLatin1String("dir")) + else if (name == QLatin1String("dir")) what.dir = blockingReadElementText(); - else if (reader.name() == QLatin1String("line")) + else if (name == QLatin1String("line")) what.line = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/line")); - else if (reader.name() == QLatin1String("hthreadid")) + else if (name == QLatin1String("hthreadid")) what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/hthreadid")); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -425,7 +430,7 @@ static Stack makeStack(const XauxWhat &xauxwhat, const QVector &frames) return s; } -void Parser::Private::parse_error() +void Parser::Private::parseError() { Error e; QVector > frames; @@ -439,29 +444,30 @@ void Parser::Private::parse_error() break; if (reader.isStartElement()) lastAuxWhat++; - if (reader.name() == QLatin1String("unique")) + const QStringRef name = reader.name(); + if (name == QLatin1String("unique")) e.setUnique(parseHex(blockingReadElementText(), QLatin1String("unique"))); - else if ( reader.name() == QLatin1String("tid")) + else if (name == QLatin1String("tid")) e.setTid(parseInt64(blockingReadElementText(), QLatin1String("error/tid"))); - else if (reader.name() == QLatin1String("kind")) //TODO this is memcheck-specific: + else if (name == QLatin1String("kind")) //TODO this is memcheck-specific: e.setKind(parseErrorKind(blockingReadElementText())); - else if (reader.name() == QLatin1String("suppression")) + else if (name == QLatin1String("suppression")) e.setSuppression(parseSuppression()); - else if (reader.name() == QLatin1String("xwhat")) { + else if (name == QLatin1String("xwhat")) { const XWhat xw = parseXWhat(); e.setWhat(xw.text); e.setLeakedBlocks(xw.leakedblocks); e.setLeakedBytes(xw.leakedbytes); e.setHelgrindThreadId(xw.hthreadid); } - else if (reader.name() == QLatin1String("what")) + else if (name == QLatin1String("what")) e.setWhat(blockingReadElementText()); - else if (reader.name() == QLatin1String("xauxwhat")) { + else if (name == QLatin1String("xauxwhat")) { if (!currentAux.text.isEmpty()) auxs.push_back(currentAux); currentAux = parseXauxWhat(); } - else if (reader.name() == QLatin1String("auxwhat")) { + else if (name == QLatin1String("auxwhat")) { const QString aux = blockingReadElementText(); //concatenate multiple consecutive tags if (lastAuxWhat > 1) { @@ -476,7 +482,7 @@ void Parser::Private::parse_error() } lastAuxWhat = 0; } - else if (reader.name() == QLatin1String("stack")) { + else if (name == QLatin1String("stack")) { frames.push_back(parseStack()); } else if (reader.isStartElement()) @@ -499,7 +505,7 @@ void Parser::Private::parse_error() emit q->error(e); } -Frame Parser::Private::parse_frame() +Frame Parser::Private::parseFrame() { Frame frame; @@ -508,17 +514,18 @@ Frame Parser::Private::parse_frame() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == QLatin1String("ip")) + const QStringRef name = reader.name(); + if (name == QLatin1String("ip")) frame.setInstructionPointer(parseHex(blockingReadElementText(), QLatin1String("error/frame/ip"))); - else if (reader.name() == QLatin1String("obj")) + else if (name == QLatin1String("obj")) frame.setObject(blockingReadElementText()); - else if (reader.name() == QLatin1String("fn")) + else if (name == QLatin1String("fn")) frame.setFunctionName( blockingReadElementText()); - else if (reader.name() == QLatin1String("dir")) + else if (name == QLatin1String("dir")) frame.setDirectory(blockingReadElementText()); - else if (reader.name() == QLatin1String("file")) + else if (name == QLatin1String("file")) frame.setFile( blockingReadElementText()); - else if (reader.name() == QLatin1String("line")) + else if (name == QLatin1String("line")) frame.setLine(parseInt64(blockingReadElementText(), QLatin1String("error/frame/line"))); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -528,7 +535,7 @@ Frame Parser::Private::parse_frame() return frame; } -void Parser::Private::parse_announcethread() +void Parser::Private::parseAnnounceThread() { AnnounceThread at; @@ -537,9 +544,10 @@ void Parser::Private::parse_announcethread() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == QLatin1String("hthreadid")) + const QStringRef name = reader.name(); + if (name == QLatin1String("hthreadid")) at.setHelgrindThreadId(parseInt64(blockingReadElementText(), QLatin1String("announcethread/hthreadid"))); - else if (reader.name() == QLatin1String("stack")) + else if (name == QLatin1String("stack")) at.setStack(parseStack()); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -549,7 +557,7 @@ void Parser::Private::parse_announcethread() emit q->announceThread(at); } -void Parser::Private::parse_errorcounts() +void Parser::Private::parseErrorCounts() { while (notAtEnd()) { blockingReadNext(); @@ -564,9 +572,10 @@ void Parser::Private::parse_errorcounts() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == QLatin1String("unique")) + const QStringRef name = reader.name(); + if (name == QLatin1String("unique")) unique = parseHex(blockingReadElementText(), QLatin1String("errorcounts/pair/unique")); - else if (reader.name() == QLatin1String("count")) + else if (name == QLatin1String("count")) count = parseInt64(blockingReadElementText(), QLatin1String("errorcounts/pair/count")); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -581,7 +590,7 @@ void Parser::Private::parse_errorcounts() } -void Parser::Private::parse_suppcounts() +void Parser::Private::parseSuppressionCounts() { while (notAtEnd()) { blockingReadNext(); @@ -589,22 +598,23 @@ void Parser::Private::parse_suppcounts() break; if (reader.isStartElement()) { if (reader.name() == QLatin1String("pair")) { - QString name; + QString pairName; qint64 count = 0; while (notAtEnd()) { blockingReadNext(); if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == QLatin1String("name")) - name = blockingReadElementText(); - else if (reader.name() == QLatin1String("count")) + const QStringRef name = reader.name(); + if (name == QLatin1String("name")) + pairName = blockingReadElementText(); + else if (name == QLatin1String("count")) count = parseInt64(blockingReadElementText(), QLatin1String("suppcounts/pair/count")); else if (reader.isStartElement()) reader.skipCurrentElement(); } } - emit q->suppressionCount(name, count); + emit q->suppressionCount(pairName, count); } else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -612,7 +622,7 @@ void Parser::Private::parse_suppcounts() } } -void Parser::Private::parse_status() +void Parser::Private::parseStatus() { Status s; @@ -621,9 +631,10 @@ void Parser::Private::parse_status() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == QLatin1String("state")) + const QStringRef name = reader.name(); + if (name == QLatin1String("state")) s.setState(parseState(blockingReadElementText())); - else if (reader.name() == QLatin1String("time")) + else if (name == QLatin1String("time")) s.setTime(blockingReadElementText()); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -642,7 +653,7 @@ QVector Parser::Private::parseStack() break; if (reader.isStartElement()) { if (reader.name() == QLatin1String("frame")) - frames.append(parse_frame()); + frames.append(parseFrame()); } } @@ -658,9 +669,10 @@ SuppressionFrame Parser::Private::parseSuppressionFrame() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == QLatin1String("obj")) + const QStringRef name = reader.name(); + if (name == QLatin1String("obj")) frame.setObject(blockingReadElementText()); - else if (reader.name() == QLatin1String("fun")) + else if (name == QLatin1String("fun")) frame.setFunction( blockingReadElementText()); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -679,15 +691,16 @@ Suppression Parser::Private::parseSuppression() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == QLatin1String("sname")) + const QStringRef name = reader.name(); + if (name == QLatin1String("sname")) supp.setName(blockingReadElementText()); - else if (reader.name() == QLatin1String("skind")) + else if (name == QLatin1String("skind")) supp.setKind(blockingReadElementText()); - else if (reader.name() == QLatin1String("skaux")) + else if (name == QLatin1String("skaux")) supp.setAuxKind(blockingReadElementText()); - else if (reader.name() == QLatin1String("rawtext")) + else if (name == QLatin1String("rawtext")) supp.setRawText(blockingReadElementText()); - else if (reader.name() == QLatin1String("sframe")) + else if (name == QLatin1String("sframe")) frames.push_back(parseSuppressionFrame()); } } @@ -704,19 +717,20 @@ void Parser::Private::parse(QIODevice *device) try { while (notAtEnd()) { blockingReadNext(); - if (reader.name() == QLatin1String("error")) - parse_error(); - else if (reader.name() == QLatin1String("announcethread")) - parse_announcethread(); - else if (reader.name() == QLatin1String("status")) - parse_status(); - else if (reader.name() == QLatin1String("errorcounts")) - parse_errorcounts(); - else if (reader.name() == QLatin1String("suppcounts")) - parse_suppcounts(); - else if (reader.name() == QLatin1String("protocolversion")) + QStringRef name = reader.name(); + if (name == QLatin1String("error")) + parseError(); + else if (name == QLatin1String("announcethread")) + parseAnnounceThread(); + else if (name == QLatin1String("status")) + parseStatus(); + else if (name == QLatin1String("errorcounts")) + parseErrorCounts(); + else if (name == QLatin1String("suppcounts")) + parseSuppressionCounts(); + else if (name == QLatin1String("protocolversion")) checkProtocolVersion(blockingReadElementText()); - else if (reader.name() == QLatin1String("protocoltool")) + else if (name == QLatin1String("protocoltool")) checkTool(blockingReadElementText()); } } catch (const ParserException &e) { diff --git a/src/plugins/valgrind/xmlprotocol/stack.cpp b/src/plugins/valgrind/xmlprotocol/stack.cpp index 8c2de28ff34..2c47e42e9b2 100644 --- a/src/plugins/valgrind/xmlprotocol/stack.cpp +++ b/src/plugins/valgrind/xmlprotocol/stack.cpp @@ -39,8 +39,6 @@ #include #include -#include - namespace Valgrind { namespace XmlProtocol { @@ -80,11 +78,10 @@ void Stack::swap(Stack &other) qSwap(d, other.d); } -Stack &Stack::operator=(const Stack &other) +void Stack::operator=(const Stack &other) { Stack tmp(other); swap(tmp); - return *this; } bool Stack::operator==(const Stack &other) const diff --git a/src/plugins/valgrind/xmlprotocol/stack.h b/src/plugins/valgrind/xmlprotocol/stack.h index 72330007f1b..09d4c54961f 100644 --- a/src/plugins/valgrind/xmlprotocol/stack.h +++ b/src/plugins/valgrind/xmlprotocol/stack.h @@ -32,8 +32,8 @@ ** **************************************************************************/ -#ifndef LIBVALGRIND_PROTOCOL_STACK_H -#define LIBVALGRIND_PROTOCOL_STACK_H +#ifndef VALGRIND_PROTOCOL_STACK_H +#define VALGRIND_PROTOCOL_STACK_H #include @@ -52,7 +52,7 @@ public: Stack(); Stack(const Stack &other); ~Stack(); - Stack &operator=(const Stack &other); + void operator=(const Stack &other); void swap(Stack &other); bool operator==(const Stack &other) const; @@ -84,4 +84,4 @@ private: } // namespace XmlProtocol } // namespace Stack -#endif // LIBVALGRIND_PROTOCOL_STACK_H +#endif // VALGRIND_PROTOCOL_STACK_H