diff options
Diffstat (limited to 'src/libs/valgrind')
54 files changed, 366 insertions, 374 deletions
diff --git a/src/libs/valgrind/callgrind/callgrindcallmodel.cpp b/src/libs/valgrind/callgrind/callgrindcallmodel.cpp index 7e75ce7985..d2be2c250c 100644 --- a/src/libs/valgrind/callgrind/callgrindcallmodel.cpp +++ b/src/libs/valgrind/callgrind/callgrindcallmodel.cpp @@ -45,7 +45,8 @@ namespace Callgrind { //BEGIN CallModel::Private -class CallModel::Private { +class CallModel::Private +{ public: Private(); @@ -56,11 +57,10 @@ public: }; CallModel::Private::Private() -: m_data(0) -, m_event(0) -, m_function(0) + : m_data(0) + , m_event(0) + , m_function(0) { - } //END CallModel::Private @@ -235,5 +235,5 @@ QVariant CallModel::headerData(int section, Qt::Orientation orientation, int rol return QVariant(); } -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindcallmodel.h b/src/libs/valgrind/callgrind/callgrindcallmodel.h index 0241cfbf3a..ecac253723 100644 --- a/src/libs/valgrind/callgrind/callgrindcallmodel.h +++ b/src/libs/valgrind/callgrind/callgrindcallmodel.h @@ -93,7 +93,7 @@ private: Private *d; }; -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind #endif // VALGRIND_CALLGRIND_CALLGRINDCALLMODEL_H diff --git a/src/libs/valgrind/callgrind/callgrindcontroller.cpp b/src/libs/valgrind/callgrind/callgrindcontroller.cpp index 481d5dd2cc..d3532c700a 100644 --- a/src/libs/valgrind/callgrind/callgrindcontroller.cpp +++ b/src/libs/valgrind/callgrind/callgrindcontroller.cpp @@ -267,5 +267,5 @@ void CallgrindController::cleanupTempFile() m_tempDataFile.clear(); } -} -} +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindcontroller.h b/src/libs/valgrind/callgrind/callgrindcontroller.h index c739e11c2d..4a648b571d 100644 --- a/src/libs/valgrind/callgrind/callgrindcontroller.h +++ b/src/libs/valgrind/callgrind/callgrindcontroller.h @@ -52,7 +52,7 @@ namespace Callgrind { class VALGRINDSHARED_EXPORT CallgrindController : public QObject { Q_OBJECT - Q_ENUMS(Option); + Q_ENUMS(Option) public: enum Option { @@ -68,7 +68,7 @@ public: void run(Valgrind::Callgrind::CallgrindController::Option option); void setValgrindProcess(ValgrindProcess *process); - inline ValgrindProcess *valgrindProcess() { return m_valgrindProc; } + ValgrindProcess *valgrindProcess() { return m_valgrindProc; } /** * Make data file available locally, triggers @c localParseDataAvailable. @@ -112,7 +112,7 @@ private: QByteArray m_remoteFile; }; -} -} +} // namespace Callgrind +} // namespace Valgrind #endif // CALLGRINDCONTROLLER_H diff --git a/src/libs/valgrind/callgrind/callgrindcostitem.cpp b/src/libs/valgrind/callgrind/callgrindcostitem.cpp index dbb95bc7d3..a463ee75fa 100644 --- a/src/libs/valgrind/callgrind/callgrindcostitem.cpp +++ b/src/libs/valgrind/callgrind/callgrindcostitem.cpp @@ -32,9 +32,9 @@ #include "callgrindcostitem.h" -#include <QtCore/QVector> #include <QtCore/QString> #include <QtCore/QStringList> +#include <QtCore/QVector> #include "callgrindparsedata.h" #include "callgrindfunctioncall.h" @@ -58,11 +58,11 @@ public: }; 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) + : m_positions(data->positions().size(), 0) + , m_events(data->events().size(), 0) + , m_call(0) + , m_data(data) + , m_differingFileId(-1) { } @@ -76,7 +76,6 @@ CostItem::Private::~Private() CostItem::CostItem(ParseData *data) : d(new Private(data)) { - } CostItem::~CostItem() @@ -142,5 +141,5 @@ void CostItem::setDifferingFile(qint64 fileId) d->m_differingFileId = fileId; } -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindcostitem.h b/src/libs/valgrind/callgrind/callgrindcostitem.h index 06d583ce9a..2bc789e3bb 100644 --- a/src/libs/valgrind/callgrind/callgrindcostitem.h +++ b/src/libs/valgrind/callgrind/callgrindcostitem.h @@ -49,7 +49,8 @@ class ParseData; /** * This class represents the cost(s) at given position(s). */ -class VALGRINDSHARED_EXPORT CostItem { +class VALGRINDSHARED_EXPORT CostItem +{ public: /// @p data the file data this cost item was parsed in. /// required for decompression of string data like differing source file information @@ -90,13 +91,13 @@ public: void setDifferingFile(qint64 fileId); private: - Q_DISABLE_COPY(CostItem); + Q_DISABLE_COPY(CostItem) class Private; Private *d; }; -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind #endif // LIBVALGRIND_CALLGRIND_COSTITEM_H diff --git a/src/libs/valgrind/callgrind/callgrindcycledetection.cpp b/src/libs/valgrind/callgrind/callgrindcycledetection.cpp index 2922747fc9..424bfa182b 100644 --- a/src/libs/valgrind/callgrind/callgrindcycledetection.cpp +++ b/src/libs/valgrind/callgrind/callgrindcycledetection.cpp @@ -37,20 +37,19 @@ #include "callgrindparsedata.h" #include "callgrindfunctioncycle.h" -#include <QtCore/QDebug> - #include <utils/qtcassert.h> +#include <QtCore/QDebug> + namespace Valgrind { namespace Callgrind { namespace Internal { CycleDetection::CycleDetection(ParseData *data) -: m_data(data) -, m_depth(0) -, m_cycle(0) + : m_data(data) + , m_depth(0) + , m_cycle(0) { - } QVector<const Function *> CycleDetection::run(const QVector<const Function *> &input) @@ -119,6 +118,6 @@ void CycleDetection::tarjanForChildNode(Node *node, Node *childNode) } } -} -} -} +} // namespace Internal +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindcycledetection.h b/src/libs/valgrind/callgrind/callgrindcycledetection.h index a16b8c77ec..1420145612 100644 --- a/src/libs/valgrind/callgrind/callgrindcycledetection.h +++ b/src/libs/valgrind/callgrind/callgrindcycledetection.h @@ -52,7 +52,8 @@ namespace Internal { * M. McKusick; Proceedings of the SIGPLAN '82 Symposium on Compiler Construction, * SIGPLAN Notices, Vol. 17, No 6, pp. 120-126, June 1982. */ -class CycleDetection { +class CycleDetection +{ public: explicit CycleDetection(ParseData *data); QVector<const Function *> run(const QVector<const Function *> &input); @@ -77,8 +78,9 @@ private: int m_cycle; }; -} -} -} +} // namespace Internal + +} // namespace Callgrind +} // namespace Valgrind #endif // LIBVALGRIND_CALLGRINDCYCLEDETECTION_H diff --git a/src/libs/valgrind/callgrind/callgrinddatamodel.cpp b/src/libs/valgrind/callgrind/callgrinddatamodel.cpp index 0cd2587a7a..f72d6fae58 100644 --- a/src/libs/valgrind/callgrind/callgrinddatamodel.cpp +++ b/src/libs/valgrind/callgrind/callgrinddatamodel.cpp @@ -36,13 +36,13 @@ #include "callgrindfunction.h" #include "callgrindcostitem.h" -#include <QChar> -#include <QDebug> +#include <utils/qtcassert.h> + +#include <QtCore/QChar> +#include <QtCore/QDebug> #include <QtCore/QStringList> #include <QtCore/QVector> -#include <utils/qtcassert.h> - namespace Valgrind { namespace Callgrind { @@ -60,7 +60,8 @@ namespace { //BEGIN DataModel::Private -class DataModel::Private { +class DataModel::Private +{ public: Private() : m_data(0) @@ -70,10 +71,6 @@ public: { } - ~Private() - { - } - void updateFunctions(); const ParseData *m_data; @@ -110,7 +107,6 @@ void DataModel::Private::updateFunctions() DataModel::DataModel(QObject *parent) : QAbstractItemModel(parent), d(new Private) { - } DataModel::~DataModel() @@ -240,7 +236,7 @@ QVariant DataModel::data(const QModelIndex &index, int role) const else if (role == RelativeParentCostRole || role == RelativeTotalCostRole) { if (index.column() == SelfCostColumn) return (float)selfCost / totalCost; - else if (index.column() == InclusiveCostColumn) + if (index.column() == InclusiveCostColumn) return (float)inclusiveCost / totalCost; } else if (role == LineNumberRole) { @@ -257,13 +253,13 @@ QVariant DataModel::data(const QModelIndex &index, int role) const else if (role == Qt::DisplayRole) { if (index.column() == NameColumn) return func->name(); - else if (index.column() == LocationColumn) + if (index.column() == LocationColumn) return func->location(); - else if (index.column() == CalledColumn) + if (index.column() == CalledColumn) return func->called(); - else if (index.column() == SelfCostColumn) + if (index.column() == SelfCostColumn) return selfCost; - else if (index.column() == InclusiveCostColumn) + if (index.column() == InclusiveCostColumn) return inclusiveCost; } else if (role == Qt::ToolTipRole) { if (!d->m_verboseToolTips) @@ -336,23 +332,22 @@ QVariant DataModel::headerData(int section, Qt::Orientation orientation, int rol return QVariant(); const QString prettyCostStr = ParseData::prettyStringForEvent(d->m_data->events().at(d->m_event)); - if (section == SelfCostColumn) { + if (section == SelfCostColumn) return tr("%1 cost spent in a given function excluding costs from called functions.").arg(prettyCostStr); - } else if (section == InclusiveCostColumn) { + if (section == InclusiveCostColumn) return tr("%1 cost spent in a given function including costs from called functions.").arg(prettyCostStr); - } return QVariant(); } if (section == NameColumn) return tr("Function"); - else if (section == LocationColumn) + if (section == LocationColumn) return tr("Location"); - else if (section == CalledColumn) + if (section == CalledColumn) return tr("Called"); - else if (section == SelfCostColumn) + if (section == SelfCostColumn) return tr("Self Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString()); - else if (section == InclusiveCostColumn) + if (section == InclusiveCostColumn) return tr("Incl. Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString()); return QVariant(); @@ -366,5 +361,5 @@ void DataModel::enableCycleDetection(bool enabled) endResetModel(); } -} -} +} // namespace Valgrind +} // namespace Callgrind diff --git a/src/libs/valgrind/callgrind/callgrinddatamodel.h b/src/libs/valgrind/callgrind/callgrinddatamodel.h index 486539bb20..9035159b67 100644 --- a/src/libs/valgrind/callgrind/callgrinddatamodel.h +++ b/src/libs/valgrind/callgrind/callgrinddatamodel.h @@ -33,12 +33,12 @@ #ifndef VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H #define VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H -#include <QtCore/QAbstractItemModel> - #include "../valgrind_global.h" #include "callgrindabstractmodel.h" +#include <QtCore/QAbstractItemModel> + namespace Valgrind { namespace Callgrind { @@ -101,7 +101,7 @@ private: Private *d; }; -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind #endif // VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H diff --git a/src/libs/valgrind/callgrind/callgrindfunction.cpp b/src/libs/valgrind/callgrind/callgrindfunction.cpp index bb56e070d5..70e6b14790 100644 --- a/src/libs/valgrind/callgrind/callgrindfunction.cpp +++ b/src/libs/valgrind/callgrind/callgrindfunction.cpp @@ -37,26 +37,26 @@ #include "callgrindparsedata.h" #include "callgrindfunction_p.h" +#include <utils/qtcassert.h> + #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QDebug> #include <QtCore/QFileInfo> -#include <utils/qtcassert.h> - namespace Valgrind { namespace Callgrind { //BEGIN Function::Private Function::Private::Private(const ParseData *data) -: m_data(data) -, m_fileId(-1) -, m_objectId(-1) -, m_nameId(-1) -, m_selfCost(data->events().size(), 0) -, m_inclusiveCost(data->events().size(), 0) -, m_called(0) + : m_data(data) + , m_fileId(-1) + , m_objectId(-1) + , m_nameId(-1) + , m_selfCost(data->events().size(), 0) + , m_inclusiveCost(data->events().size(), 0) + , m_called(0) { } @@ -114,15 +114,13 @@ FunctionCall *Function::Private::accumulateCall(const FunctionCall *call, CallTy //BEGIN Function Function::Function(const ParseData *data) -: d(new Private(data)) + : d(new Private(data)) { - } Function::Function(Function::Private *d) -: d(d) + : d(d) { - } Function::~Function() @@ -332,5 +330,5 @@ void Function::finalize() } } -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindfunction.h b/src/libs/valgrind/callgrind/callgrindfunction.h index f5e0b51e91..c52863ff9a 100644 --- a/src/libs/valgrind/callgrind/callgrindfunction.h +++ b/src/libs/valgrind/callgrind/callgrindfunction.h @@ -50,7 +50,8 @@ class FunctionCall; class CostItem; class ParseData; -class VALGRINDSHARED_EXPORT Function { +class VALGRINDSHARED_EXPORT Function +{ public: /// @p data the ParseData for the file this function was part of /// required for the decompression of string data like function name etc. @@ -143,6 +144,7 @@ public: * for example */ void finalize(); + protected: class Private; Private *d; @@ -153,8 +155,8 @@ private: Q_DISABLE_COPY(Function) }; -} -} +} // namespace Callgrind +} // namespace Valgrind Q_DECLARE_METATYPE(const Valgrind::Callgrind::Function *); diff --git a/src/libs/valgrind/callgrind/callgrindfunction_p.h b/src/libs/valgrind/callgrind/callgrindfunction_p.h index 8999c4d43a..b7fac85811 100644 --- a/src/libs/valgrind/callgrind/callgrindfunction_p.h +++ b/src/libs/valgrind/callgrind/callgrindfunction_p.h @@ -44,7 +44,8 @@ namespace Valgrind { namespace Callgrind { -class Function::Private { +class Function::Private +{ public: Private(const ParseData *data); ~Private(); @@ -75,7 +76,7 @@ public: quint64 m_called; }; -} -} +} // namespace Callgrind +} // namespace Valgrind #endif // LIBVALGRIND_CALLGRINDFUNCTION_P_H diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncall.cpp b/src/libs/valgrind/callgrind/callgrindfunctioncall.cpp index 7efdd353e7..69dbce2b7c 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncall.cpp +++ b/src/libs/valgrind/callgrind/callgrindfunctioncall.cpp @@ -34,15 +34,16 @@ #include "callgrindfunction.h" -#include <QtCore/QVector> - #include <utils/qtcassert.h> +#include <QtCore/QVector> + namespace Valgrind { namespace Callgrind { //BEGIN FunctionCall::Private -class FunctionCall::Private { +class FunctionCall::Private +{ public: explicit Private(); @@ -55,20 +56,18 @@ public: }; FunctionCall::Private::Private() -: m_callee(0) -, m_caller(0) -, m_calls(0) -, m_totalInclusiveCost(0) + : m_callee(0) + , m_caller(0) + , m_calls(0) + , m_totalInclusiveCost(0) { - } //BEGIN FunctionCall FunctionCall::FunctionCall() -: d(new Private) + : d(new Private) { - } FunctionCall::~FunctionCall() @@ -137,6 +136,5 @@ void FunctionCall::setCosts(const QVector<quint64> &costs) d->m_costs = costs; } - -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncall.h b/src/libs/valgrind/callgrind/callgrindfunctioncall.h index 8b4c924c9a..e84aa30f5e 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncall.h +++ b/src/libs/valgrind/callgrind/callgrindfunctioncall.h @@ -49,7 +49,8 @@ class Function; /** * This represents a function call. */ -class VALGRINDSHARED_EXPORT FunctionCall { +class VALGRINDSHARED_EXPORT FunctionCall +{ public: explicit FunctionCall(); ~FunctionCall(); @@ -89,8 +90,8 @@ private: Private *d; }; -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind Q_DECLARE_METATYPE(const Valgrind::Callgrind::FunctionCall *); diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp b/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp index 8f24131627..952f6d48d9 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp +++ b/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp @@ -44,16 +44,16 @@ namespace Callgrind { //BEGIN FunctionCycle::Private -class FunctionCycle::Private : public Function::Private { +class FunctionCycle::Private : public Function::Private +{ public: Private(const ParseData *data); QVector<const Function *> m_functions; }; FunctionCycle::Private::Private(const ParseData *data) -: Function::Private(data) + : Function::Private(data) { - } #define CYCLE_D static_cast<FunctionCycle::Private *>(this->d) @@ -61,7 +61,7 @@ FunctionCycle::Private::Private(const ParseData *data) //BEGIN FunctionCycle FunctionCycle::FunctionCycle(const ParseData *data) -: Function(new Private(data)) + : Function(new Private(data)) { } @@ -114,5 +114,5 @@ QVector<const Function *> FunctionCycle::functions() const return CYCLE_D->m_functions; } -} -} +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncycle.h b/src/libs/valgrind/callgrind/callgrindfunctioncycle.h index cc92661bfe..249087efa5 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncycle.h +++ b/src/libs/valgrind/callgrind/callgrindfunctioncycle.h @@ -46,7 +46,8 @@ namespace Callgrind { * excluding calees inside the cycle * inclusive cost of a function cycle: sum of inclusive cost of callees of the cycle (see above) */ -class VALGRINDSHARED_EXPORT FunctionCycle : public Function { +class VALGRINDSHARED_EXPORT FunctionCycle : public Function +{ public: explicit FunctionCycle(const ParseData *data); virtual ~FunctionCycle(); @@ -61,8 +62,7 @@ private: class Private; }; -} -} - +} // namespace Callgrind +} // namespace Valgrind #endif // LIBVALGRIND_CALLGRINDFUNCTIONCYCLE_H diff --git a/src/libs/valgrind/callgrind/callgrindparsedata.cpp b/src/libs/valgrind/callgrind/callgrindparsedata.cpp index a578c6a9fd..3262099cff 100644 --- a/src/libs/valgrind/callgrind/callgrindparsedata.cpp +++ b/src/libs/valgrind/callgrind/callgrindparsedata.cpp @@ -372,5 +372,5 @@ void ParseData::addCompressedFunction(const QString &function, qint64 &id) d->addCompressedString(d->m_functionCompression, function, id); } -} // Callgrind -} // Valgrind +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindparsedata.h b/src/libs/valgrind/callgrind/callgrindparsedata.h index a757385858..5110461a35 100644 --- a/src/libs/valgrind/callgrind/callgrindparsedata.h +++ b/src/libs/valgrind/callgrind/callgrindparsedata.h @@ -49,7 +49,8 @@ class Function; /** * Represents all the information extracted from a callgrind data file. */ -class VALGRINDSHARED_EXPORT ParseData { +class VALGRINDSHARED_EXPORT ParseData +{ public: explicit ParseData(); ~ParseData(); @@ -133,12 +134,13 @@ public: QString stringForFunctionCompression(qint64 id) const; /// @p id if it is -1, an uncompressed string is assumed and it will be compressed internally void addCompressedFunction(const QString &function, qint64 &id); + private: class Private; Private *d; }; -} -} +} // namespace Callgrind +} // namespace Valgrind #endif // LIBVALGRIND_CALLGRIND_PARSEDATA_P_H diff --git a/src/libs/valgrind/callgrind/callgrindparser.cpp b/src/libs/valgrind/callgrind/callgrindparser.cpp index d93f7143c7..50a6a4db3d 100644 --- a/src/libs/valgrind/callgrind/callgrindparser.cpp +++ b/src/libs/valgrind/callgrind/callgrindparser.cpp @@ -675,6 +675,5 @@ ParseData *Parser::takeData() return data; } - } //Callgrind } //Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindparser.h b/src/libs/valgrind/callgrind/callgrindparser.h index 570b812b2a..12629928fd 100644 --- a/src/libs/valgrind/callgrind/callgrindparser.h +++ b/src/libs/valgrind/callgrind/callgrindparser.h @@ -55,10 +55,12 @@ class ParseData; * the rest is assumed to be zero." * */ -class VALGRINDSHARED_EXPORT Parser : public QObject { +class VALGRINDSHARED_EXPORT Parser : public QObject +{ Q_OBJECT + public: - explicit Parser(QObject *parent=0); + explicit Parser(QObject *parent = 0); ~Parser(); // get and take ownership of the parsing results. If this method is not called the repository @@ -81,4 +83,4 @@ private: } // Callgrind } // Valgrind -#endif //LIBVALGRIND_CALLGRIND_PARSER_H +#endif // LIBVALGRIND_CALLGRIND_PARSER_H diff --git a/src/libs/valgrind/callgrind/callgrindproxymodel.cpp b/src/libs/valgrind/callgrind/callgrindproxymodel.cpp index ce042c979e..44318ce406 100644 --- a/src/libs/valgrind/callgrind/callgrindproxymodel.cpp +++ b/src/libs/valgrind/callgrind/callgrindproxymodel.cpp @@ -41,7 +41,8 @@ #include <QDebug> -using namespace Valgrind::Callgrind; +namespace Valgrind { +namespace Callgrind { DataProxyModel::DataProxyModel(QObject *parent) : QSortFilterProxyModel(parent) @@ -163,3 +164,6 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_ return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); } + +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindproxymodel.h b/src/libs/valgrind/callgrind/callgrindproxymodel.h index 9d5b8cccab..a4967584a5 100644 --- a/src/libs/valgrind/callgrind/callgrindproxymodel.h +++ b/src/libs/valgrind/callgrind/callgrindproxymodel.h @@ -33,10 +33,10 @@ #ifndef VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H #define VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H -#include <QSortFilterProxyModel> - #include "../valgrind_global.h" +#include <QSortFilterProxyModel> + namespace Valgrind { namespace Callgrind { @@ -85,7 +85,7 @@ private: double m_minimumInclusiveCostRatio; }; -} -} +} // namespace Callgrind +} // namespace Valgrind #endif // VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H diff --git a/src/libs/valgrind/callgrind/callgrindrunner.cpp b/src/libs/valgrind/callgrind/callgrindrunner.cpp index 029c165c6a..a42b825967 100644 --- a/src/libs/valgrind/callgrind/callgrindrunner.cpp +++ b/src/libs/valgrind/callgrind/callgrindrunner.cpp @@ -31,14 +31,14 @@ **************************************************************************/ #include "callgrindrunner.h" +#include "callgrindparser.h" #include <utils/qtcassert.h> #include <QtCore/QFile> -#include "callgrindparser.h" - -using namespace Valgrind::Callgrind; +namespace Valgrind { +namespace Callgrind { CallgrindRunner::CallgrindRunner(QObject *parent) : ValgrindRunner(parent) @@ -131,3 +131,6 @@ void CallgrindRunner::controllerFinished(CallgrindController::Option option) break; // do nothing } } + +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindstackbrowser.cpp b/src/libs/valgrind/callgrind/callgrindstackbrowser.cpp index 7a0a1928b5..022bad991a 100644 --- a/src/libs/valgrind/callgrind/callgrindstackbrowser.cpp +++ b/src/libs/valgrind/callgrind/callgrindstackbrowser.cpp @@ -32,8 +32,8 @@ #include "callgrindstackbrowser.h" -using namespace Valgrind::Callgrind; - +namespace Valgrind { +namespace Callgrind { StackBrowser::StackBrowser(QObject *parent) : QObject(parent) @@ -73,3 +73,6 @@ void StackBrowser::goBack() m_stack.pop(); emit currentChanged(); } + +} // namespace Callgrind +} // namespace Valgrind diff --git a/src/libs/valgrind/callgrind/callgrindstackbrowser.h b/src/libs/valgrind/callgrind/callgrindstackbrowser.h index 20a4709cd0..144dd11d2d 100644 --- a/src/libs/valgrind/callgrind/callgrindstackbrowser.h +++ b/src/libs/valgrind/callgrind/callgrindstackbrowser.h @@ -66,7 +66,7 @@ private: QStack<const Function *> m_stack; }; -} -} +} // namespace Callgrind +} // namespace Valgrind #endif // CALLGRINDSTACKBROWSER_H diff --git a/src/libs/valgrind/memcheck/memcheckrunner.cpp b/src/libs/valgrind/memcheck/memcheckrunner.cpp index 9322419f8d..f4b00f1247 100644 --- a/src/libs/valgrind/memcheck/memcheckrunner.cpp +++ b/src/libs/valgrind/memcheck/memcheckrunner.cpp @@ -34,24 +34,25 @@ #include "memcheckrunner.h" -#include <xmlprotocol/threadedparser.h> #include <xmlprotocol/error.h> #include <xmlprotocol/status.h> +#include <xmlprotocol/threadedparser.h> #include <utils/qtcassert.h> +#include <QtNetwork/QNetworkInterface> #include <QtNetwork/QTcpServer> #include <QtNetwork/QTcpSocket> -#include <QtNetwork/QNetworkInterface> #include <QtCore/QEventLoop> -#include <QtGui/QDialog> #include <QtGui/QApplication> -#include <QtGui/QVBoxLayout> +#include <QtGui/QDialog> +#include <QtGui/QDialogButtonBox> #include <QtGui/QLabel> #include <QtGui/QListWidget> -#include <QtGui/QDialogButtonBox> +#include <QtGui/QVBoxLayout> -using namespace Valgrind::Memcheck; +namespace Valgrind { +namespace Memcheck { class MemcheckRunner::Private { @@ -228,3 +229,6 @@ void MemcheckRunner::readLogSocket() { emit logMessageReceived(d->logSocket->readAll()); } + +} // namespace Memcheck +} // namespace Valgrind diff --git a/src/libs/valgrind/memcheck/memcheckrunner.h b/src/libs/valgrind/memcheck/memcheckrunner.h index ed09307320..6354ea9b32 100644 --- a/src/libs/valgrind/memcheck/memcheckrunner.h +++ b/src/libs/valgrind/memcheck/memcheckrunner.h @@ -38,15 +38,8 @@ #include <valgrind/valgrind_global.h> #include <valgrind/valgrindrunner.h> -QT_BEGIN_NAMESPACE -class QProcessEnvironment; -QT_END_NAMESPACE - -namespace Utils { -class Environment; -} - namespace Valgrind { + namespace XmlProtocol{ class ThreadedParser; } @@ -73,16 +66,15 @@ private slots: void xmlSocketConnected(); void logSocketConnected(); void readLogSocket(); + private: QString tool() const; - Q_DISABLE_COPY(MemcheckRunner); class Private; Private *d; }; -} - -} +} // namespace Memcheck +} // namespace Valgrind #endif // VALGRIND_PROTOCOL_MEMCHECKRUNNER_H diff --git a/src/libs/valgrind/valgrind_global.h b/src/libs/valgrind/valgrind_global.h index 84a425393e..c09c7814ff 100644 --- a/src/libs/valgrind/valgrind_global.h +++ b/src/libs/valgrind/valgrind_global.h @@ -35,7 +35,7 @@ #ifndef VALGRIND_GLOBAL_H #define VALGRIND_GLOBAL_H -#include <QtCore/qglobal.h> +#include <QtCore/QtGlobal> #if defined(VALGRIND_LIBRARY) # define VALGRINDSHARED_EXPORT Q_DECL_EXPORT diff --git a/src/libs/valgrind/valgrindprocess.cpp b/src/libs/valgrind/valgrindprocess.cpp index 35c30fe58f..16fc5999df 100644 --- a/src/libs/valgrind/valgrindprocess.cpp +++ b/src/libs/valgrind/valgrindprocess.cpp @@ -43,14 +43,8 @@ namespace Valgrind { ValgrindProcess::ValgrindProcess(QObject *parent) -: QObject(parent) + : QObject(parent) { - -} - -ValgrindProcess::~ValgrindProcess() -{ - } //////////////////////// @@ -70,11 +64,6 @@ LocalValgrindProcess::LocalValgrindProcess(QObject *parent) this, SLOT(readyReadStandardOutput())); } -LocalValgrindProcess::~LocalValgrindProcess() -{ - -} - void LocalValgrindProcess::setProcessChannelMode(QProcess::ProcessChannelMode mode) { m_process.setProcessChannelMode(mode); @@ -153,28 +142,19 @@ void LocalValgrindProcess::readyReadStandardOutput() RemoteValgrindProcess::RemoteValgrindProcess(const Utils::SshConnectionParameters &sshParams, QObject *parent) -: ValgrindProcess(parent) -, m_params(sshParams) -, m_error(QProcess::UnknownError) -, m_pid(0) -{ - -} + : ValgrindProcess(parent) + , m_params(sshParams) + , m_error(QProcess::UnknownError) + , m_pid(0) +{} RemoteValgrindProcess::RemoteValgrindProcess(const Utils::SshConnection::Ptr &connection, QObject *parent) -: ValgrindProcess(parent) -, m_params(connection->connectionParameters()) -, m_connection(connection) -, m_error(QProcess::UnknownError) -, m_pid(0) -{ - -} - -RemoteValgrindProcess::~RemoteValgrindProcess() -{ - -} + : ValgrindProcess(parent) + , m_params(connection->connectionParameters()) + , m_connection(connection) + , m_error(QProcess::UnknownError) + , m_pid(0) +{} bool RemoteValgrindProcess::isRunning() const { @@ -368,4 +348,4 @@ Q_PID RemoteValgrindProcess::pid() const return m_pid; } -} +} // namespace Valgrind diff --git a/src/libs/valgrind/valgrindprocess.h b/src/libs/valgrind/valgrindprocess.h index e6cb4a37f5..0e4552d35c 100644 --- a/src/libs/valgrind/valgrindprocess.h +++ b/src/libs/valgrind/valgrindprocess.h @@ -35,12 +35,12 @@ #ifndef VALGRIND_RUNNER_P_H #define VALGRIND_RUNNER_P_H +#include "valgrind_global.h" + #include <utils/qtcprocess.h> #include <utils/ssh/sshremoteprocess.h> #include <utils/ssh/sshconnection.h> -#include "valgrind_global.h" - namespace Valgrind { /** @@ -49,9 +49,9 @@ namespace Valgrind { class VALGRINDSHARED_EXPORT ValgrindProcess : public QObject { Q_OBJECT + public: explicit ValgrindProcess(QObject *parent = 0); - virtual ~ValgrindProcess(); virtual bool isRunning() const = 0; @@ -86,7 +86,6 @@ class VALGRINDSHARED_EXPORT LocalValgrindProcess : public ValgrindProcess public: explicit LocalValgrindProcess(QObject *parent = 0); - virtual ~LocalValgrindProcess(); virtual bool isRunning() const; @@ -125,7 +124,6 @@ public: QObject *parent = 0); explicit RemoteValgrindProcess(const Utils::SshConnection::Ptr &connection, QObject *parent = 0); - virtual ~RemoteValgrindProcess(); virtual bool isRunning() const; @@ -167,6 +165,6 @@ private: Utils::SshRemoteProcess::Ptr m_findPID; }; -} +} // namespace Valgrind #endif // VALGRIND_RUNNER_P_H diff --git a/src/libs/valgrind/valgrindrunner.cpp b/src/libs/valgrind/valgrindrunner.cpp index 4e9223d80b..18263846e3 100644 --- a/src/libs/valgrind/valgrindrunner.cpp +++ b/src/libs/valgrind/valgrindrunner.cpp @@ -43,7 +43,7 @@ #include <QtCore/QEventLoop> -using namespace Valgrind; +namespace Valgrind { class ValgrindRunner::Private { @@ -256,3 +256,5 @@ ValgrindProcess *ValgrindRunner::valgrindProcess() const { return d->process; } + +} // namespace Valgrind diff --git a/src/libs/valgrind/valgrindrunner.h b/src/libs/valgrind/valgrindrunner.h index 52c2a3d0c9..9a588bc482 100644 --- a/src/libs/valgrind/valgrindrunner.h +++ b/src/libs/valgrind/valgrindrunner.h @@ -39,10 +39,6 @@ #include "valgrind_global.h" -QT_BEGIN_NAMESPACE -class QProcessEnvironment; -QT_END_NAMESPACE - namespace Utils { class Environment; class SshConnectionParameters; @@ -101,11 +97,10 @@ protected slots: virtual void processFinished(int, QProcess::ExitStatus); private: - Q_DISABLE_COPY(ValgrindRunner); class Private; Private *d; }; -} +} // namespace Valgrind #endif // VALGRIND_RUNNER_H diff --git a/src/libs/valgrind/xmlprotocol/announcethread.cpp b/src/libs/valgrind/xmlprotocol/announcethread.cpp index b2d4949912..c4219652b0 100644 --- a/src/libs/valgrind/xmlprotocol/announcethread.cpp +++ b/src/libs/valgrind/xmlprotocol/announcethread.cpp @@ -40,8 +40,8 @@ #include <algorithm> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; +namespace Valgrind { +namespace XmlProtocol { class AnnounceThread::Private : public QSharedData { @@ -106,3 +106,6 @@ void AnnounceThread::setStack(const QVector<Frame> &stack) { d->stack = stack; } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/announcethread.h b/src/libs/valgrind/xmlprotocol/announcethread.h index 6ff0b51b2f..c46c90ebc5 100644 --- a/src/libs/valgrind/xmlprotocol/announcethread.h +++ b/src/libs/valgrind/xmlprotocol/announcethread.h @@ -68,7 +68,7 @@ private: QSharedDataPointer<Private> d; }; -} -} +} // namespace XmlProtocol +} // namespace Valgrind #endif // LIBVALGRIND_PROTOCOL_ANNOUNCETHREAD_H diff --git a/src/libs/valgrind/xmlprotocol/error.cpp b/src/libs/valgrind/xmlprotocol/error.cpp index f9aabca648..3742456142 100644 --- a/src/libs/valgrind/xmlprotocol/error.cpp +++ b/src/libs/valgrind/xmlprotocol/error.cpp @@ -44,10 +44,11 @@ #include <QtCore/QtAlgorithms> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; +namespace Valgrind { +namespace XmlProtocol { -class Error::Private : public QSharedData { +class Error::Private : public QSharedData +{ public: explicit Private() : unique(0), @@ -260,3 +261,6 @@ QString Error::toXml() const return xml; } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/error.h b/src/libs/valgrind/xmlprotocol/error.h index a49796c619..4275924d4e 100644 --- a/src/libs/valgrind/xmlprotocol/error.h +++ b/src/libs/valgrind/xmlprotocol/error.h @@ -55,7 +55,8 @@ class Suppression; /** * Error kinds, specific to memcheck */ -enum MemcheckErrorKind { +enum MemcheckErrorKind +{ InvalidFree, MismatchedFree, InvalidRead, @@ -74,14 +75,16 @@ enum MemcheckErrorKind { MemcheckErrorKindCount }; -enum PtrcheckErrorKind { +enum PtrcheckErrorKind +{ SorG, Heap, Arith, SysParam }; -enum HelgrindErrorKind { +enum HelgrindErrorKind +{ Race, UnlockUnlocked, UnlockForeign, @@ -91,9 +94,9 @@ enum HelgrindErrorKind { Misc }; -class VALGRINDSHARED_EXPORT Error { +class VALGRINDSHARED_EXPORT Error +{ public: - Error(); ~Error(); @@ -146,4 +149,4 @@ private: Q_DECLARE_METATYPE(Valgrind::XmlProtocol::Error) -#endif +#endif // LIBVALGRIND_PROTOCOL_ERROR_H diff --git a/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp b/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp index 42fe7721e0..08794bd742 100644 --- a/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp +++ b/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp @@ -37,13 +37,14 @@ #include "frame.h" #include "stack.h" #include "modelhelpers.h" + #include <utils/qtcassert.h> #include <QtCore/QDir> #include <QtCore/QVector> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; +namespace Valgrind { +namespace XmlProtocol { class ErrorListModel::Private { @@ -54,7 +55,6 @@ public: Frame findRelevantFrame(const Error &error) const; QString formatAbsoluteFilePath(const Error &error) const; QString formatLocation(const Error &error) const; - }; ErrorListModel::ErrorListModel(QObject *parent) @@ -96,7 +96,6 @@ QModelIndex ErrorListModel::parent(const QModelIndex &child) const { QTC_ASSERT(!child.isValid() || child.model() == this, return QModelIndex()); return QModelIndex(); - } Frame ErrorListModel::Private::findRelevantFrame(const Error &error) const @@ -110,8 +109,7 @@ Frame ErrorListModel::Private::findRelevantFrame(const Error &error) const const QVector<Frame> frames = stack.frames(); if (!frames.isEmpty()) return frames.first(); - else - return Frame(); + return Frame(); } QString ErrorListModel::Private::formatAbsoluteFilePath(const Error &error) const @@ -119,8 +117,7 @@ QString ErrorListModel::Private::formatAbsoluteFilePath(const Error &error) cons const Frame f = findRelevantFrame(error); if (!f.directory().isEmpty() && !f.file().isEmpty()) return QString(f.directory() + QDir::separator() + f.file()); - else - return QString(); + return QString(); } QString ErrorListModel::Private::formatLocation(const Error &error) const @@ -133,8 +130,7 @@ QString ErrorListModel::Private::formatLocation(const Error &error) const const qint64 line = frame.line(); if (line > 0) return QString::fromLatin1("%1:%2").arg(file, QString::number(frame.line())); - else - return file; + return file; } return frame.object(); } @@ -290,8 +286,7 @@ Error ErrorListModel::error(const QModelIndex &index) const const int r = index.row(); if (r < 0 || r >= d->errors.size()) return Error(); - else - return d->errors[r]; + return d->errors[r]; } void ErrorListModel::clear() @@ -300,3 +295,6 @@ void ErrorListModel::clear() d->errors.clear(); endResetModel(); } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/errorlistmodel.h b/src/libs/valgrind/xmlprotocol/errorlistmodel.h index cf20d13c47..e524ab4ce9 100644 --- a/src/libs/valgrind/xmlprotocol/errorlistmodel.h +++ b/src/libs/valgrind/xmlprotocol/errorlistmodel.h @@ -78,7 +78,7 @@ public: virtual Frame findRelevant(const Error &error) const = 0; }; - explicit ErrorListModel(QObject *parent=0); + explicit ErrorListModel(QObject *parent = 0); ~ErrorListModel(); QSharedPointer<const RelevantFrameFinder> relevantFrameFinder() const; @@ -106,7 +106,7 @@ private: Private *const d; }; -} -} +} // namespace XmlProtocol +} // namespace Valgrind #endif // LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H diff --git a/src/libs/valgrind/xmlprotocol/frame.cpp b/src/libs/valgrind/xmlprotocol/frame.cpp index 02d9896a03..9b36a4a368 100644 --- a/src/libs/valgrind/xmlprotocol/frame.cpp +++ b/src/libs/valgrind/xmlprotocol/frame.cpp @@ -37,10 +37,11 @@ #include <QtCore/QString> #include <QtCore/QtAlgorithms> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; +namespace Valgrind { +namespace XmlProtocol { -class Frame::Private : public QSharedData { +class Frame::Private : public QSharedData +{ public: explicit Private() : ip(0), line( -1 ) @@ -158,3 +159,6 @@ void Frame::setLine(int line) { d->line = line; } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/modelhelpers.cpp b/src/libs/valgrind/xmlprotocol/modelhelpers.cpp index d7b970a034..bb8151485b 100644 --- a/src/libs/valgrind/xmlprotocol/modelhelpers.cpp +++ b/src/libs/valgrind/xmlprotocol/modelhelpers.cpp @@ -45,44 +45,44 @@ namespace XmlProtocol { QString toolTipForFrame(const Frame &frame) { - QString location; - if (!frame.file().isEmpty()) { - location = frame.directory() + QDir::separator() + frame.file(); - if (frame.line() > 0) - location += ':' + QString::number(frame.line()); - } + QString location; + if (!frame.file().isEmpty()) { + location = frame.directory() + QDir::separator() + frame.file(); + if (frame.line() > 0) + location += ':' + QString::number(frame.line()); + } - typedef QPair<QString, QString> StringPair; - QList<StringPair> lines; + typedef QPair<QString, QString> StringPair; + QList<StringPair> lines; - if (!frame.functionName().isEmpty()) - lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Function:"), - frame.functionName()); - if (!location.isEmpty()) - lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Location:"), - location); - if (frame.instructionPointer()) - lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", - "Instruction pointer:"), - QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16)); - if (!frame.object().isEmpty()) - lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object()); + if (!frame.functionName().isEmpty()) + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Function:"), + frame.functionName()); + if (!location.isEmpty()) + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Location:"), + location); + if (frame.instructionPointer()) + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", + "Instruction pointer:"), + QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16)); + if (!frame.object().isEmpty()) + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object()); - QString html = "<html>" - "<head>" - "<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n" - "<body><dl>"; + QString html = "<html>" + "<head>" + "<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n" + "<body><dl>"; - foreach (const StringPair &pair, lines) { - html += QLatin1String("<dt>"); - html += pair.first; - html += QLatin1String("</dt><dd>"); - html += pair.second; - html += QLatin1String("</dd>\n"); - } - html += "</dl></body></html>"; - return html; + foreach (const StringPair &pair, lines) { + html += QLatin1String("<dt>"); + html += pair.first; + html += QLatin1String("</dt><dd>"); + html += pair.second; + html += QLatin1String("</dd>\n"); + } + html += "</dl></body></html>"; + return html; } -} -} +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/modelhelpers.h b/src/libs/valgrind/xmlprotocol/modelhelpers.h index 76bb83c69e..2792771841 100644 --- a/src/libs/valgrind/xmlprotocol/modelhelpers.h +++ b/src/libs/valgrind/xmlprotocol/modelhelpers.h @@ -35,14 +35,12 @@ #ifndef LIBVALGRIND_PROTOCOL_MODELHELPERS_H #define LIBVALGRIND_PROTOCOL_MODELHELPERS_H -#include <QtCore/QtGlobal> +#include "../valgrind_global.h" QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE -#include "../valgrind_global.h" - namespace Valgrind { namespace XmlProtocol { @@ -50,7 +48,7 @@ class Frame; VALGRINDSHARED_EXPORT QString toolTipForFrame(const Frame &frame); -} -} +} // namespace XmlProtocol +} // namespace Valgrind #endif // LIBVALGRIND_PROTOCOL_MODELHELPERS_H diff --git a/src/libs/valgrind/xmlprotocol/parser.cpp b/src/libs/valgrind/xmlprotocol/parser.cpp index 502e4f5492..6d602c9602 100644 --- a/src/libs/valgrind/xmlprotocol/parser.cpp +++ b/src/libs/valgrind/xmlprotocol/parser.cpp @@ -49,39 +49,25 @@ #include <QtCore/QThread> #include <QtCore/QXmlStreamReader> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; - namespace { - class Exception { + + class ParserException + { public: - explicit Exception(const QString &msg) - : m_message(msg) - { - } + explicit ParserException(const QString &message) + : m_message(message) + {} - ~Exception() throw() {} + ~ParserException() throw() {} - QString message() const - { - return m_message; - } + QString message() const { return m_message; } private: QString m_message; }; - class ParserException : public Exception { - public: - explicit ParserException(const QString &message) - : Exception(message) - { - } - - ~ParserException() throw() {} - }; - - struct XWhat { + struct XWhat + { XWhat() : leakedblocks(0), leakedbytes(0), hthreadid(-1) {} QString text; qint64 leakedblocks; @@ -89,12 +75,10 @@ namespace { qint64 hthreadid; }; - struct XauxWhat { + struct XauxWhat + { XauxWhat() : line(-1), hthreadid(-1) {} - void clear() - { - *this = XauxWhat(); - } + void clear() { *this = XauxWhat(); } QString text; QString file; @@ -102,20 +86,24 @@ namespace { qint64 line; qint64 hthreadid; }; -} -class Parser::Private { +} // namespace anon + +namespace Valgrind { +namespace XmlProtocol { + +class Parser::Private +{ Parser *const q; public: - explicit Private(Parser *qq); void parse(QIODevice *device); void parse_error(); - QVector<Frame> parse_stack(); - Suppression parse_suppression(); - SuppressionFrame parse_suppFrame(); + QVector<Frame> parseStack(); + Suppression parseSuppression(); + SuppressionFrame parseSuppressionFrame(); Frame parse_frame(); void parse_status(); void parse_errorcounts(); @@ -425,7 +413,7 @@ void Parser::Private::reportInternalError(const QString &e) emit q->internalError(e); } -static Stack makeStack( const XauxWhat &xauxwhat, const QVector<Frame> &frames) +static Stack makeStack(const XauxWhat &xauxwhat, const QVector<Frame> &frames) { Stack s; s.setFrames(frames); @@ -458,7 +446,7 @@ void Parser::Private::parse_error() else if (reader.name() == QLatin1String("kind")) //TODO this is memcheck-specific: e.setKind(parseErrorKind(blockingReadElementText())); else if (reader.name() == QLatin1String("suppression")) - e.setSuppression(parse_suppression()); + e.setSuppression(parseSuppression()); else if (reader.name() == QLatin1String("xwhat")) { const XWhat xw = parseXWhat(); e.setWhat(xw.text); @@ -489,7 +477,7 @@ void Parser::Private::parse_error() lastAuxWhat = 0; } else if (reader.name() == QLatin1String("stack")) { - frames.push_back(parse_stack()); + frames.push_back(parseStack()); } else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -552,7 +540,7 @@ void Parser::Private::parse_announcethread() if (reader.name() == QLatin1String("hthreadid")) at.setHelgrindThreadId(parseInt64(blockingReadElementText(), QLatin1String("announcethread/hthreadid"))); else if (reader.name() == QLatin1String("stack")) - at.setStack(parse_stack()); + at.setStack(parseStack()); else if (reader.isStartElement()) reader.skipCurrentElement(); } @@ -645,7 +633,7 @@ void Parser::Private::parse_status() emit q->status(s); } -QVector<Frame> Parser::Private::parse_stack() +QVector<Frame> Parser::Private::parseStack() { QVector<Frame> frames; while (notAtEnd()) { @@ -661,7 +649,7 @@ QVector<Frame> Parser::Private::parse_stack() return frames; } -SuppressionFrame Parser::Private::parse_suppFrame() +SuppressionFrame Parser::Private::parseSuppressionFrame() { SuppressionFrame frame; @@ -682,10 +670,10 @@ SuppressionFrame Parser::Private::parse_suppFrame() return frame; } -Suppression Parser::Private::parse_suppression() +Suppression Parser::Private::parseSuppression() { Suppression supp; - QVector<SuppressionFrame> frames; + SuppressionFrames frames; while (notAtEnd()) { blockingReadNext(); if (reader.isEndElement()) @@ -700,7 +688,7 @@ Suppression Parser::Private::parse_suppression() else if (reader.name() == QLatin1String("rawtext")) supp.setRawText(blockingReadElementText()); else if (reader.name() == QLatin1String("sframe")) - frames.push_back(parse_suppFrame()); + frames.push_back(parseSuppressionFrame()); } } @@ -760,3 +748,6 @@ void Parser::parse(QIODevice *device) { d->parse(device); } + +} // namespace XmlParser +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/parser.h b/src/libs/valgrind/xmlprotocol/parser.h index 0539365190..ca68a0d69f 100644 --- a/src/libs/valgrind/xmlprotocol/parser.h +++ b/src/libs/valgrind/xmlprotocol/parser.h @@ -44,7 +44,6 @@ class QIODevice; QT_END_NAMESPACE namespace Valgrind { - namespace XmlProtocol { class AnnounceThread; @@ -54,8 +53,10 @@ class Status; /** * Parser for the Valgrind Output XML Protocol 4 */ -class VALGRINDSHARED_EXPORT Parser : public QObject { +class VALGRINDSHARED_EXPORT Parser : public QObject +{ Q_OBJECT + public: enum Tool { Unknown, @@ -82,8 +83,6 @@ Q_SIGNALS: void finished(); private: - Q_DISABLE_COPY(Parser) - class Private; Private *const d; }; diff --git a/src/libs/valgrind/xmlprotocol/stack.cpp b/src/libs/valgrind/xmlprotocol/stack.cpp index 1663e101ac..8c2de28ff3 100644 --- a/src/libs/valgrind/xmlprotocol/stack.cpp +++ b/src/libs/valgrind/xmlprotocol/stack.cpp @@ -41,8 +41,8 @@ #include <algorithm> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; +namespace Valgrind { +namespace XmlProtocol { class Stack::Private : public QSharedData { @@ -156,3 +156,6 @@ void Stack::setHelgrindThreadId(qint64 id) { d->hthreadid = id; } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/stack.h b/src/libs/valgrind/xmlprotocol/stack.h index c252bf1222..b26d733d79 100644 --- a/src/libs/valgrind/xmlprotocol/stack.h +++ b/src/libs/valgrind/xmlprotocol/stack.h @@ -48,7 +48,8 @@ namespace XmlProtocol { class Frame; -class VALGRINDSHARED_EXPORT Stack { +class VALGRINDSHARED_EXPORT Stack +{ public: Stack(); Stack(const Stack &other); @@ -82,7 +83,7 @@ private: QSharedDataPointer<Private> d; }; -} -} +} // namespace XmlProtocol +} // namespace Stack #endif // LIBVALGRIND_PROTOCOL_STACK_H diff --git a/src/libs/valgrind/xmlprotocol/stackmodel.cpp b/src/libs/valgrind/xmlprotocol/stackmodel.cpp index 6fcfbe134b..ef20cd940a 100644 --- a/src/libs/valgrind/xmlprotocol/stackmodel.cpp +++ b/src/libs/valgrind/xmlprotocol/stackmodel.cpp @@ -43,8 +43,8 @@ #include <QtCore/QDir> #include <QtCore/QVector> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; +namespace Valgrind { +namespace XmlProtocol { class StackModel::Private { @@ -70,8 +70,7 @@ static QString makeName(const Frame &frame) if (!d.isEmpty() && !f.isEmpty()) return frame.line() > 0 ? QString::fromLatin1("%1%2%3:%4").arg(d, QDir::separator(), f, QString::number(frame.line())) : QString::fromLatin1("%1%2%3").arg(d, QDir::separator(), f); - else - return frame.object(); + return frame.object(); } StackModel::StackModel(QObject *parent) @@ -187,8 +186,8 @@ QModelIndex StackModel::index(int row, int column, const QModelIndex &parent) co if (parent.isValid()) { QTC_ASSERT(parent.model() == this, return QModelIndex()); return createIndex(row, column, parent.row()); - } else - return createIndex(row, column, -1); + } + return createIndex(row, column, -1); } QModelIndex StackModel::parent(const QModelIndex &child) const @@ -197,8 +196,7 @@ QModelIndex StackModel::parent(const QModelIndex &child) const if (child.internalId() == -1) return QModelIndex(); - else - return createIndex(child.internalId(), 0, -1); + return createIndex(child.internalId(), 0, -1); } int StackModel::rowCount(const QModelIndex &parent) const @@ -212,11 +210,11 @@ int StackModel::rowCount(const QModelIndex &parent) const if (!gp.isValid()) return d->stack(parent.row()).frames().size(); - else - return 0; + return 0; } -int StackModel::columnCount(const QModelIndex &parent) const { +int StackModel::columnCount(const QModelIndex &parent) const +{ QTC_ASSERT(!parent.isValid() || parent.model() == this, return 0); return ColumnCount; } @@ -235,3 +233,6 @@ void StackModel::clear() d->error = Error(); endResetModel(); } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/stackmodel.h b/src/libs/valgrind/xmlprotocol/stackmodel.h index 38f1edbbed..e9e6662e3b 100644 --- a/src/libs/valgrind/xmlprotocol/stackmodel.h +++ b/src/libs/valgrind/xmlprotocol/stackmodel.h @@ -49,7 +49,7 @@ class VALGRINDSHARED_EXPORT StackModel : public QAbstractItemModel Q_OBJECT public: enum Column { - NameColumn=0, + NameColumn = 0, FunctionNameColumn, DirectoryColumn, FileColumn, @@ -60,14 +60,14 @@ public: }; enum Role { - ObjectRole=Qt::UserRole, + ObjectRole = Qt::UserRole, FunctionNameRole, DirectoryRole, FileRole, LineRole }; - explicit StackModel(QObject *parent=0); + explicit StackModel(QObject *parent = 0); ~StackModel(); QVariant data(const QModelIndex &index, int role) const; @@ -87,7 +87,7 @@ private: Private *const d; }; -} -} +} // namespace XmlProtocol +} // namespace Valgrind #endif // LIBVALGRIND_PROTOCOL_STACKMODEL_H diff --git a/src/libs/valgrind/xmlprotocol/status.cpp b/src/libs/valgrind/xmlprotocol/status.cpp index c279522c24..2991dd3d2f 100644 --- a/src/libs/valgrind/xmlprotocol/status.cpp +++ b/src/libs/valgrind/xmlprotocol/status.cpp @@ -37,8 +37,8 @@ #include <QtCore/QSharedData> #include <QtCore/QString> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; +namespace Valgrind { +namespace XmlProtocol { class Status::Private : public QSharedData { @@ -102,3 +102,6 @@ QString Status::time() const { return d->time; } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/status.h b/src/libs/valgrind/xmlprotocol/status.h index 0da018a569..bc3def7264 100644 --- a/src/libs/valgrind/xmlprotocol/status.h +++ b/src/libs/valgrind/xmlprotocol/status.h @@ -40,10 +40,6 @@ #include <QtCore/QMetaType> #include <QtCore/QSharedDataPointer> -QT_BEGIN_NAMESPACE -class QString; -QT_END_NAMESPACE - namespace Valgrind { namespace XmlProtocol { diff --git a/src/libs/valgrind/xmlprotocol/suppression.cpp b/src/libs/valgrind/xmlprotocol/suppression.cpp index dd66c92d08..3720c41999 100644 --- a/src/libs/valgrind/xmlprotocol/suppression.cpp +++ b/src/libs/valgrind/xmlprotocol/suppression.cpp @@ -129,7 +129,7 @@ public: QString kind; QString auxkind; QString rawText; - QVector<SuppressionFrame> frames; + SuppressionFrames frames; }; Suppression::Suppression() @@ -216,13 +216,13 @@ QString Suppression::rawText() const return d->rawText; } -void Suppression::setFrames(const QVector<SuppressionFrame> &frames) +void Suppression::setFrames(const SuppressionFrames &frames) { d->isNull = false; d->frames = frames; } -QVector<SuppressionFrame> Suppression::frames() const +SuppressionFrames Suppression::frames() const { return d->frames; } @@ -236,9 +236,8 @@ QString Suppression::toString() const stream << "{\n"; stream << indent << d->name << '\n'; stream << indent << d->kind << '\n'; - foreach (const SuppressionFrame &frame, d->frames) { + foreach (const SuppressionFrame &frame, d->frames) stream << indent << frame.toString() << '\n'; - } stream << "}\n"; return ret; } diff --git a/src/libs/valgrind/xmlprotocol/suppression.h b/src/libs/valgrind/xmlprotocol/suppression.h index 47d56ce085..eb7456a6b9 100644 --- a/src/libs/valgrind/xmlprotocol/suppression.h +++ b/src/libs/valgrind/xmlprotocol/suppression.h @@ -47,7 +47,8 @@ QT_END_NAMESPACE namespace Valgrind { namespace XmlProtocol { -class VALGRINDSHARED_EXPORT SuppressionFrame { +class VALGRINDSHARED_EXPORT SuppressionFrame +{ public: SuppressionFrame(); SuppressionFrame(const SuppressionFrame &other); @@ -73,12 +74,16 @@ private: QSharedDataPointer<Private> d; }; -class VALGRINDSHARED_EXPORT Suppression { +typedef QVector<SuppressionFrame> SuppressionFrames; + +class VALGRINDSHARED_EXPORT Suppression +{ public: Suppression(); Suppression(const Suppression &other); ~Suppression(); Suppression &operator=(const Suppression &other); + void swap(Suppression &other); bool operator==(const Suppression &other) const; @@ -96,8 +101,8 @@ public: QString rawText() const; void setRawText(const QString &text); - QVector<SuppressionFrame> frames() const; - void setFrames(const QVector<SuppressionFrame> &frames); + SuppressionFrames frames() const; + void setFrames(const SuppressionFrames &frames); QString toString() const; diff --git a/src/libs/valgrind/xmlprotocol/threadedparser.cpp b/src/libs/valgrind/xmlprotocol/threadedparser.cpp index b2de9e1e58..29968356af 100644 --- a/src/libs/valgrind/xmlprotocol/threadedparser.cpp +++ b/src/libs/valgrind/xmlprotocol/threadedparser.cpp @@ -44,21 +44,15 @@ #include <QtCore/QThread> #include <QtCore/QSharedPointer> -using namespace Valgrind; -using namespace Valgrind::XmlProtocol; - namespace { -class Thread : public QThread { +class Thread : public QThread +{ public: - Thread() - : QThread() - , parser(0) - , device(0) - { - } + Thread() : parser(0) , device(0) {} - void run() { + void run() + { QTC_ASSERT(QThread::currentThread() == this, return); parser->parse(device); delete parser; @@ -67,10 +61,16 @@ public: device = 0; } - XmlProtocol::Parser *parser; + Valgrind::XmlProtocol::Parser *parser; QIODevice *device; }; -} + +} // namespace anon + + +namespace Valgrind { +namespace XmlProtocol { + class ThreadedParser::Private { public: @@ -146,7 +146,11 @@ void ThreadedParser::slotInternalError(const QString &errorString) d->errorString = errorString; emit internalError(errorString); } + bool ThreadedParser::waitForFinished() { return d->parserThread ? d->parserThread.data()->wait() : true; } + +} // namespace XmlProtocol +} // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/threadedparser.h b/src/libs/valgrind/xmlprotocol/threadedparser.h index 70a4d78d5b..0cb274fa8d 100644 --- a/src/libs/valgrind/xmlprotocol/threadedparser.h +++ b/src/libs/valgrind/xmlprotocol/threadedparser.h @@ -52,10 +52,12 @@ class Status; /** * ThreadedParser for the Valgrind Output XmlProtocol 4 */ -class VALGRINDSHARED_EXPORT ThreadedParser : public QObject { +class VALGRINDSHARED_EXPORT ThreadedParser : public QObject +{ Q_OBJECT + public: - explicit ThreadedParser(QObject *parent=0); + explicit ThreadedParser(QObject *parent = 0); ~ThreadedParser(); QString errorString() const; @@ -81,8 +83,6 @@ Q_SIGNALS: void finished(); private: - Q_DISABLE_COPY(ThreadedParser) - class Private; Private *const d; }; |