analyzer: style and simplification

This commit is contained in:
hjk
2011-05-18 17:05:49 +02:00
parent a130b98509
commit 68504ab8a8
82 changed files with 508 additions and 583 deletions

View File

@@ -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

View File

@@ -93,7 +93,7 @@ private:
Private *d;
};
} // Callgrind
} // Valgrind
} // namespace Callgrind
} // namespace Valgrind
#endif // VALGRIND_CALLGRIND_CALLGRINDCALLMODEL_H

View File

@@ -267,5 +267,5 @@ void CallgrindController::cleanupTempFile()
m_tempDataFile.clear();
}
}
}
} // namespace Callgrind
} // namespace Valgrind

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 *);

View File

@@ -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

View File

@@ -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

View File

@@ -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 *);

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -675,6 +675,5 @@ ParseData *Parser::takeData()
return data;
}
} //Callgrind
} //Valgrind

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -66,7 +66,7 @@ private:
QStack<const Function *> m_stack;
};
}
}
} // namespace Callgrind
} // namespace Valgrind
#endif // CALLGRINDSTACKBROWSER_H

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -68,7 +68,7 @@ private:
QSharedDataPointer<Private> d;
};
}
}
} // namespace XmlProtocol
} // namespace Valgrind
#endif // LIBVALGRIND_PROTOCOL_ANNOUNCETHREAD_H

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;
};

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -40,10 +40,6 @@
#include <QtCore/QMetaType>
#include <QtCore/QSharedDataPointer>
QT_BEGIN_NAMESPACE
class QString;
QT_END_NAMESPACE
namespace Valgrind {
namespace XmlProtocol {

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
};

View File

@@ -46,6 +46,7 @@ namespace Internal {
class AnalyzerOptionsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
explicit AnalyzerOptionsPage(AbstractAnalyzerSubConfig *config, QObject *parent = 0);
@@ -64,7 +65,6 @@ private:
AbstractAnalyzerSubConfig *m_config;
};
} // namespace Internal
} // namespace Analyzer

View File

@@ -43,7 +43,7 @@
#include <QtGui/QGroupBox>
#include <QtGui/QVBoxLayout>
using namespace Analyzer;
namespace Analyzer {
AnalyzerRunConfigWidget::AnalyzerRunConfigWidget()
: m_detailsWidget(new Utils::DetailsWidget(this))
@@ -79,9 +79,10 @@ void AnalyzerRunConfigWidget::setRunConfiguration(ProjectExplorer::RunConfigurat
// add group boxes for each sub config
QLayout *layout = m_detailsWidget->widget()->layout();
foreach (AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
QGroupBox *box = new QGroupBox(config->displayName());
Q_UNUSED(box)
(void) new QGroupBox(config->displayName());
QWidget *widget = config->createConfigWidget(this);
layout->addWidget(widget);
}
}
} // namespace Analyzer

View File

@@ -46,19 +46,16 @@ class AbstractCallgrindSettings;
class CallgrindConfigWidget : public QWidget
{
Q_OBJECT
public:
CallgrindConfigWidget(AbstractCallgrindSettings *settings, QWidget *parent);
virtual ~CallgrindConfigWidget();
private:
Ui::CallgrindConfigWidget *m_ui;
AbstractCallgrindSettings *m_settings;
};
}
}
} // namespace Internal
} // namespace Callgrind
#endif // ANALYZER_INTERNAL_CALLGRINDCONFIGWIDGET_H

View File

@@ -33,12 +33,4 @@
#ifndef CALLGRINDCONSTANTS_H
#define CALLGRINDCONSTANTS_H
namespace Callgrind {
namespace Constants {
const char * const A_SHOWCOSTSOFFUNCTION = "Analyzer.Callgrind.ShowCostsOfFunction";
}
}
#endif // CALLGRINDCONSTANTS_H

View File

@@ -40,9 +40,8 @@
#include <utils/qtcassert.h>
#include <QtGui/QPainter>
#include <QtGui/QApplication>
#include <QtCore/QDebug>
#include <QtGui/QPainter>
using namespace Valgrind::Callgrind;
@@ -63,10 +62,9 @@ public:
};
CostDelegate::Private::Private()
: m_model(0)
, m_format(CostDelegate::FormatAbsolute)
{
}
: m_model(0)
, m_format(CostDelegate::FormatAbsolute)
{}
int CostDelegate::Private::toNativeRole(CostDelegate::CostFormat format)
{

View File

@@ -40,8 +40,6 @@ namespace Internal {
class CostDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit CostDelegate(QObject *parent = 0);
virtual ~CostDelegate();

View File

@@ -50,10 +50,10 @@ namespace Internal {
//BEGIN CostView::Private
class CostView::Private {
class CostView::Private
{
public:
explicit Private(CostView *qq);
~Private();
CostDelegate *m_costDelegate;
NameDelegate *m_nameDelegate;
@@ -62,12 +62,7 @@ public:
CostView::Private::Private(CostView *qq)
: m_costDelegate(new CostDelegate(qq))
, m_nameDelegate(new NameDelegate(qq))
{
}
CostView::Private::~Private()
{
}
{}
//END CostView::Private
@@ -109,21 +104,21 @@ void CostView::setModel(QAbstractItemModel *model)
headerView->setStretchLastSection(false);
if (qobject_cast<CallModel *>(model)) {
setItemDelegateForColumn(CallModel::CostColumn, d->m_costDelegate);
headerView->setResizeMode(CallModel::CostColumn, QHeaderView::ResizeToContents);
headerView->setResizeMode(CallModel::CallsColumn, QHeaderView::ResizeToContents);
headerView->setResizeMode(CallModel::CalleeColumn, QHeaderView::Stretch);
setItemDelegateForColumn(CallModel::CalleeColumn, d->m_nameDelegate);
headerView->setResizeMode(CallModel::CallerColumn, QHeaderView::Stretch);
headerView->setResizeMode(CallModel::CallsColumn, QHeaderView::ResizeToContents);
headerView->setResizeMode(CallModel::CostColumn, QHeaderView::ResizeToContents);
setItemDelegateForColumn(CallModel::CalleeColumn, d->m_nameDelegate);
setItemDelegateForColumn(CallModel::CallerColumn, d->m_nameDelegate);
setItemDelegateForColumn(CallModel::CostColumn, d->m_costDelegate);
} else if (qobject_cast<DataModel *>(model)) {
setItemDelegateForColumn(DataModel::SelfCostColumn, d->m_costDelegate);
headerView->setResizeMode(DataModel::InclusiveCostColumn, QHeaderView::ResizeToContents);
headerView->setResizeMode(DataModel::LocationColumn, QHeaderView::Stretch);
headerView->setResizeMode(DataModel::NameColumn, QHeaderView::Stretch);
headerView->setResizeMode(DataModel::SelfCostColumn, QHeaderView::ResizeToContents);
setItemDelegateForColumn(DataModel::InclusiveCostColumn, d->m_costDelegate);
headerView->setResizeMode(DataModel::InclusiveCostColumn, QHeaderView::ResizeToContents);
setItemDelegateForColumn(DataModel::NameColumn, d->m_nameDelegate);
headerView->setResizeMode(DataModel::NameColumn, QHeaderView::Stretch);
headerView->setResizeMode(DataModel::LocationColumn, QHeaderView::Stretch);
setItemDelegateForColumn(DataModel::SelfCostColumn, d->m_costDelegate);
}
d->m_costDelegate->setModel(model);

View File

@@ -37,8 +37,6 @@
#include <QtCore/QDebug>
using namespace Analyzer;
using namespace Callgrind::Internal;
using namespace Callgrind;
static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.EnableCacheSim";
static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
@@ -51,10 +49,12 @@ static const char callgrindVisualisationMinimumCostRatioC[] = "Analyzer.Valgrind
static const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
namespace Callgrind {
namespace Internal {
AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent)
: AbstractAnalyzerSubConfig(parent)
{
}
void AbstractCallgrindSettings::setEnableCacheSim(bool enable)
@@ -181,12 +181,6 @@ QWidget *AbstractCallgrindSettings::createConfigWidget(QWidget *parent)
CallgrindGlobalSettings::CallgrindGlobalSettings(QObject *parent)
: AbstractCallgrindSettings(parent)
{
}
CallgrindGlobalSettings::~CallgrindGlobalSettings()
{
}
QVariantMap CallgrindGlobalSettings::defaults() const
@@ -241,10 +235,7 @@ void CallgrindGlobalSettings::setDetectCycles(bool detect)
CallgrindProjectSettings::CallgrindProjectSettings(QObject *parent)
: AbstractCallgrindSettings(parent)
{
}
CallgrindProjectSettings::~CallgrindProjectSettings()
{
}
} // namespace Internal
} // namespace Callgrind

View File

@@ -33,10 +33,11 @@
#ifndef ANALYZER_INTERNAL_CALLGRINDSETTINGS_H
#define ANALYZER_INTERNAL_CALLGRINDSETTINGS_H
#include "callgrindcostdelegate.h"
#include <analyzerbase/analyzersettings.h>
#include <QtCore/QString>
#include "callgrindcostdelegate.h"
namespace Callgrind {
namespace Internal {
@@ -51,17 +52,17 @@ class AbstractCallgrindSettings : public Analyzer::AbstractAnalyzerSubConfig
public:
AbstractCallgrindSettings(QObject *parent = 0);
inline bool enableCacheSim() const { return m_enableCacheSim; }
inline bool enableBranchSim() const { return m_enableBranchSim; }
inline bool collectSystime() const { return m_collectSystime; }
inline bool collectBusEvents() const { return m_collectBusEvents; }
inline bool enableEventToolTips() const { return m_enableEventToolTips; }
bool enableCacheSim() const { return m_enableCacheSim; }
bool enableBranchSim() const { return m_enableBranchSim; }
bool collectSystime() const { return m_collectSystime; }
bool collectBusEvents() const { return m_collectBusEvents; }
bool enableEventToolTips() const { return m_enableEventToolTips; }
/// \return Minimum cost ratio, range [0.0..100.0]
inline double minimumInclusiveCostRatio() const { return m_minimumInclusiveCostRatio; }
double minimumInclusiveCostRatio() const { return m_minimumInclusiveCostRatio; }
/// \return Minimum cost ratio, range [0.0..100.0]
inline double visualisationMinimumInclusiveCostRatio() const { return m_visualisationMinimumInclusiveCostRatio; }
double visualisationMinimumInclusiveCostRatio() const { return m_visualisationMinimumInclusiveCostRatio; }
// abstract virtual methods from base class
virtual bool fromMap(const QVariantMap &map);
@@ -72,7 +73,7 @@ public:
virtual QString displayName() const;
virtual QWidget *createConfigWidget(QWidget *parent);
public Q_SLOTS:
public slots:
void setEnableCacheSim(bool enable);
void setEnableBranchSim(bool enable);
void setCollectSystime(bool collect);
@@ -85,7 +86,7 @@ public Q_SLOTS:
/// \param minimumInclusiveCostRatio Minimum inclusive cost ratio, valid values are [0.0..100.0]
void setVisualisationMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
Q_SIGNALS:
signals:
void enableCacheSimChanged(bool);
void enableBranchSimChanged(bool);
void collectSystimeChanged(bool);
@@ -116,7 +117,6 @@ class CallgrindGlobalSettings : public AbstractCallgrindSettings
public:
CallgrindGlobalSettings(QObject *parent = 0);
virtual ~CallgrindGlobalSettings();
virtual bool fromMap(const QVariantMap &map);
virtual QVariantMap defaults() const;
@@ -145,10 +145,9 @@ class CallgrindProjectSettings : public AbstractCallgrindSettings
public:
CallgrindProjectSettings(QObject *parent = 0);
virtual ~CallgrindProjectSettings();
};
}
}
} // namespace Internal
} // namespace Callgrind
#endif // ANALYZER_INTERNAL_CALLGRINDSETTINGS_H

View File

@@ -53,10 +53,6 @@ CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index,
setPriority(TextEditor::ITextMark::HighPriority);
}
CallgrindTextMark::~CallgrindTextMark()
{
}
void CallgrindTextMark::paint(QPainter *painter, const QRect &paintRect) const
{
if (!m_modelIndex.isValid())
@@ -97,7 +93,7 @@ void CallgrindTextMark::paint(QPainter *painter, const QRect &paintRect) const
painter->restore();
}
const Function* CallgrindTextMark::function() const
const Function *CallgrindTextMark::function() const
{
if (!m_modelIndex.isValid())
return 0;

View File

@@ -37,9 +37,6 @@
#include <QtCore/QPersistentModelIndex>
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
namespace Valgrind {
namespace Callgrind {
class Function;
@@ -62,7 +59,6 @@ public:
*/
explicit CallgrindTextMark(const QPersistentModelIndex &index,
const QString &fileName, int lineNumber);
virtual ~CallgrindTextMark();
const Valgrind::Callgrind::Function *function() const;

View File

@@ -212,7 +212,7 @@ void CallgrindTool::extensionsInitialized()
action = new QAction(tr("Profile Costs of this Function and its Callees"), this);
action->setIcon(QIcon(Analyzer::Constants::ANALYZER_CONTROL_START_ICON));
connect(action, SIGNAL(triggered()), SLOT(handleShowCostsOfFunction()));
cmd = actionManager->registerAction(action, Callgrind::Constants::A_SHOWCOSTSOFFUNCTION,
cmd = actionManager->registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction",
analyzerContext);
editorContextMenu->addAction(cmd);
cmd->setAttribute(Core::Command::CA_Hide);

View File

@@ -62,7 +62,6 @@ namespace Internal {
class CallgrindEngine;
class CallgrindWidgetHandler;
class CallgrindOutputPaneAdapter;
class CallgrindTextMark;
class CallgrindTool : public Analyzer::IAnalyzerTool

View File

@@ -333,36 +333,36 @@ void Visualisation::setMinimumInclusiveCostRatio(double ratio)
d->m_model->setMinimumInclusiveCostRatio(ratio);
}
void Visualisation::setModel(DataModel *model)
void Visualisation::setModel(QAbstractItemModel *model)
{
QTC_ASSERT(!d->m_model->sourceModel() && model, return); // only set once!
d->m_model->setSourceModel(model);
connect(model,
SIGNAL(columnsInserted(const QModelIndex&, int, int)),
SIGNAL(columnsInserted(QModelIndex,int,int)),
SLOT(populateScene()));
connect(model,
SIGNAL(columnsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
SLOT(populateScene()));
connect(model,
SIGNAL(columnsRemoved(const QModelIndex&, int, int)),
SIGNAL(columnsRemoved(QModelIndex,int,int)),
SLOT(populateScene()));
connect(model,
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
SIGNAL(dataChanged(QModelIndex,QModelIndex)),
SLOT(populateScene()));
connect(model,
SIGNAL(headerDataChanged(Qt::Orientation, int, int)),
SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
SLOT(populateScene()));
connect(model, SIGNAL(layoutChanged()), SLOT(populateScene()));
connect(model, SIGNAL(modelReset()), SLOT(populateScene()));
connect(model,
SIGNAL(rowsInserted(const QModelIndex&, int, int)),
SIGNAL(rowsInserted(QModelIndex,int,int)),
SLOT(populateScene()));
connect(model,
SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
SLOT(populateScene()));
connect(model,
SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
SIGNAL(rowsRemoved(QModelIndex,int,int)),
SLOT(populateScene()));
populateScene();
@@ -392,8 +392,7 @@ void Visualisation::populateScene()
typedef QPair<QModelIndex, qreal> Pair;
QLinkedList<Pair> costs;
for (int row=0; row < d->m_model->rowCount(); ++row)
{
for (int row = 0; row < d->m_model->rowCount(); ++row) {
const QModelIndex index = d->m_model->index(row, DataModel::InclusiveCostColumn);
bool ok = false;
@@ -407,9 +406,9 @@ void Visualisation::populateScene()
// item showing the current filter function
QString text;
if (d->m_model->filterFunction())
if (d->m_model->filterFunction()) {
text = d->m_model->filterFunction()->name();
else {
} else {
const float ratioPercent = d->m_model->minimumInclusiveCostRatio() * 100;
QString ratioPercentString = QString::number(ratioPercent);
ratioPercentString.append(QLocale::system().percent());
@@ -419,7 +418,7 @@ void Visualisation::populateScene()
.arg(hiddenFunctions);
}
const qreal height = sceneHeight* (costs.isEmpty() ? 1.0 : 0.1);
const qreal height = sceneHeight * (costs.isEmpty() ? 1.0 : 0.1);
FunctionGraphicsItem *item = new FunctionGraphicsItem(text, 0, 0, sceneWidth, height);
const QColor background = CallgrindHelper::colorForString(text);
item->setBrush(background);
@@ -431,8 +430,7 @@ void Visualisation::populateScene()
// add the canvas elements to the scene
qreal used = sceneHeight * 0.1;
foreach (const Pair &cost, costs)
{
foreach (const Pair &cost, costs) {
const QModelIndex &index = cost.first;
const QString text = index.data().toString();
@@ -468,6 +466,5 @@ void Visualisation::resizeEvent(QResizeEvent *event)
QGraphicsView::resizeEvent(event);
}
} // Internal
} // Callgrind

View File

@@ -43,7 +43,6 @@ QT_END_NAMESPACE
namespace Valgrind {
namespace Callgrind {
class Function;
class DataModel;
}
}
@@ -58,7 +57,7 @@ public:
explicit Visualisation(QWidget *parent = 0);
virtual ~Visualisation();
void setModel(Valgrind::Callgrind::DataModel *model);
void setModel(QAbstractItemModel *model);
const Valgrind::Callgrind::Function *functionForItem(QGraphicsItem *item) const;
QGraphicsItem *itemForFunction(const Valgrind::Callgrind::Function *function) const;

View File

@@ -77,25 +77,25 @@ namespace Callgrind {
namespace Internal {
CallgrindWidgetHandler::CallgrindWidgetHandler(QWidget *parent)
: QObject(parent)
, m_dataModel(new DataModel(this))
, m_dataProxy(new DataProxyModel(this))
, m_stackBrowser(new StackBrowser(this))
, m_callersModel(new CallModel(this))
, m_calleesModel(new CallModel(this))
, m_flatView(0)
, m_callersView(0)
, m_calleesView(0)
, m_visualisation(0)
, m_goToOverview(0)
, m_goBack(0)
, m_searchFilter(0)
, m_filterProjectCosts(0)
, m_costAbsolute(0)
, m_costRelative(0)
, m_costRelativeToParent(0)
, m_eventCombo(0)
, m_updateTimer(new QTimer(this))
: QObject(parent)
, m_dataModel(new DataModel(this))
, m_dataProxy(new DataProxyModel(this))
, m_stackBrowser(new StackBrowser(this))
, m_callersModel(new CallModel(this))
, m_calleesModel(new CallModel(this))
, m_flatView(0)
, m_callersView(0)
, m_calleesView(0)
, m_visualisation(0)
, m_goToOverview(0)
, m_goBack(0)
, m_searchFilter(0)
, m_filterProjectCosts(0)
, m_costAbsolute(0)
, m_costRelative(0)
, m_costRelativeToParent(0)
, m_eventCombo(0)
, m_updateTimer(new QTimer(this))
{
connect(m_stackBrowser, SIGNAL(currentChanged()), this, SLOT(stackBrowserChanged()));
@@ -543,5 +543,5 @@ void CallgrindWidgetHandler::updateEventCombo()
m_eventCombo->addItem(ParseData::prettyStringForEvent(event));
}
}
}
} // namespace Internal
} // namespace Callgrind

View File

@@ -61,7 +61,6 @@ class CallModel;
namespace Callgrind {
namespace Internal {
class CallgrindEngine;
class Visualisation;
class CostView;

View File

@@ -44,7 +44,8 @@
#include <QtGui/QFileDialog>
#include <QtCore/QDebug>
using namespace Memcheck::Internal;
namespace Memcheck {
namespace Internal {
MemcheckConfigWidget::MemcheckConfigWidget(AbstractMemcheckSettings *settings, QWidget *parent)
: QWidget(parent),
@@ -176,3 +177,6 @@ void MemcheckConfigWidget::slotSuppressionSelectionChanged()
{
m_ui->removeSuppression->setEnabled(m_ui->suppressionList->selectionModel()->hasSelection());
}
} // namespace Internal
} // namespace Memcheck

View File

@@ -32,7 +32,6 @@
**
**************************************************************************/
#ifndef ANALYZER_INTERNAL_MEMCHECKCONFIGWIDGET_H
#define ANALYZER_INTERNAL_MEMCHECKCONFIGWIDGET_H
@@ -75,7 +74,7 @@ private:
Ui::MemcheckConfigWidget *m_ui;
};
}
}
} // namespace Internal
} // namespace Memcheck
#endif // ANALYZER_INTERNAL_MEMCHECKCONFIGWIDGET_H

View File

@@ -44,17 +44,17 @@
#include <utils/qtcassert.h>
using namespace Analyzer;
using namespace Memcheck;
using namespace Valgrind::XmlProtocol;
using namespace Memcheck::Internal;
namespace Memcheck {
namespace Internal {
MemcheckEngine::MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
: ValgrindEngine(sp, runConfiguration)
{
connect(&m_parser, SIGNAL(error(const Valgrind::XmlProtocol::Error &)),
SIGNAL(parserError(const Valgrind::XmlProtocol::Error &)));
connect(&m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
SIGNAL(parserError(Valgrind::XmlProtocol::Error)));
connect(&m_parser, SIGNAL(suppressionCount(QString,qint64)),
SIGNAL(suppressionCount(QString,qint64)));
connect(&m_parser, SIGNAL(internalError(QString)),
@@ -143,3 +143,6 @@ void MemcheckEngine::receiveLogMessage(const QByteArray &b)
emit taskToBeAdded(ProjectExplorer::Task::Error, error, file, line);
}
} // namespace Internal
} // namespace Memcheck

View File

@@ -67,10 +67,11 @@
#include <QtGui/QApplication>
#include <QtGui/QMenu>
using namespace Memcheck;
using namespace Memcheck::Internal;
using namespace Valgrind::XmlProtocol;
namespace Memcheck {
namespace Internal {
MemcheckErrorDelegate::MemcheckErrorDelegate(QListView *parent)
: QStyledItemDelegate(parent),
m_detailsWidget(0)
@@ -79,10 +80,6 @@ MemcheckErrorDelegate::MemcheckErrorDelegate(QListView *parent)
SLOT(verticalScrolled()));
}
MemcheckErrorDelegate::~MemcheckErrorDelegate()
{
}
QSize MemcheckErrorDelegate::sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const
{
const QListView *view = qobject_cast<const QListView *>(parent());
@@ -152,10 +149,9 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo,
if (!fn.isEmpty())
return QCoreApplication::translate("Memcheck::Internal", "%1 in %2").arg(Qt::escape(fn), path);
else if (!path.isEmpty())
if (!path.isEmpty())
return path;
else
return QString("0x%1").arg(frame.instructionPointer(), 0, 16);
return QString("0x%1").arg(frame.instructionPointer(), 0, 16);
}
QString relativeToPath()
@@ -179,7 +175,7 @@ QString errorLocation(const QModelIndex &index, const Error &error,
while (!model && proxy) {
model = qobject_cast<const ErrorListModel *>(proxy->sourceModel());
proxy = qobject_cast<const QAbstractProxyModel *>(proxy->sourceModel());
};
}
QTC_ASSERT(model, return QString());
return QCoreApplication::translate("Memcheck::Internal", "in %1").
@@ -448,8 +444,8 @@ MemcheckErrorView::~MemcheckErrorView()
void MemcheckErrorView::setModel(QAbstractItemModel *model)
{
QListView::setModel(model);
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
itemDelegate(), SLOT(currentChanged(QModelIndex, QModelIndex)));
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
itemDelegate(), SLOT(currentChanged(QModelIndex,QModelIndex)));
connect(model, SIGNAL(layoutChanged()),
itemDelegate(), SLOT(layoutChanged()));
@@ -476,7 +472,6 @@ QString MemcheckErrorView::defaultSuppressionFile() const
void MemcheckErrorView::settingsChanged(Analyzer::AnalyzerSettings *settings)
{
QTC_ASSERT(settings, return);
m_settings = settings;
}
@@ -486,7 +481,6 @@ void MemcheckErrorView::contextMenuEvent(QContextMenuEvent *e)
if (indizes.isEmpty())
return;
QList<Error> errors;
foreach (const QModelIndex &index, indizes) {
Error error = model()->data(index, ErrorListModel::ErrorRole).value<Error>();
@@ -513,3 +507,6 @@ void MemcheckErrorView::suppressError()
delete dialog;
}
}
} // namespace Internal
} // namespace Memcheck

View File

@@ -39,13 +39,7 @@
#include <QtGui/QStyledItemDelegate>
#include <QtGui/QLabel>
QT_BEGIN_NAMESPACE
class QListView;
class QVBoxLayout;
QT_END_NAMESPACE
namespace Analyzer
{
namespace Analyzer {
class AnalyzerSettings;
}
@@ -63,8 +57,7 @@ class MemcheckErrorDelegate : public QStyledItemDelegate
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.
MemcheckErrorDelegate(QListView *parent);
virtual ~MemcheckErrorDelegate();
explicit MemcheckErrorDelegate(QListView *parent);
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,

View File

@@ -40,9 +40,6 @@
#include <utils/qtcassert.h>
using namespace Analyzer;
using namespace Memcheck;
using namespace Memcheck::Internal;
static const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
static const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
@@ -55,16 +52,14 @@ static const char visibleErrorKindsC[] = "Analyzer.Valgrind.VisibleErrorKinds";
static const char lastSuppressionDirectoryC[] = "Analyzer.Valgrind.LastSuppressionDirectory";
static const char lastSuppressionHistoryC[] = "Analyzer.Valgrind.LastSuppressionHistory";
namespace Memcheck {
namespace Internal {
AbstractMemcheckSettings::AbstractMemcheckSettings(QObject *parent)
: AbstractAnalyzerSubConfig(parent)
: AbstractAnalyzerSubConfig(parent)
{
}
AbstractMemcheckSettings::~AbstractMemcheckSettings()
{
}
QVariantMap AbstractMemcheckSettings::defaults() const
{
QVariantMap map;
@@ -163,10 +158,6 @@ MemcheckGlobalSettings::MemcheckGlobalSettings(QObject *parent)
{
}
MemcheckGlobalSettings::~MemcheckGlobalSettings()
{
}
QStringList MemcheckGlobalSettings::suppressionFiles() const
{
return m_suppressionFiles;
@@ -244,10 +235,6 @@ MemcheckProjectSettings::MemcheckProjectSettings(QObject *parent)
{
}
MemcheckProjectSettings::~MemcheckProjectSettings()
{
}
QVariantMap MemcheckProjectSettings::defaults() const
{
QVariantMap ret = AbstractMemcheckSettings::defaults();
@@ -302,3 +289,6 @@ QStringList MemcheckProjectSettings::suppressionFiles() const
ret.append(m_addedSuppressionFiles);
return ret;
}
} // namespace Internal
} // namespace Memcheck

View File

@@ -46,9 +46,9 @@ namespace Internal {
class AbstractMemcheckSettings : public Analyzer::AbstractAnalyzerSubConfig
{
Q_OBJECT
public:
AbstractMemcheckSettings(QObject *parent);
virtual ~AbstractMemcheckSettings();
virtual bool fromMap(const QVariantMap &map);
@@ -95,10 +95,8 @@ protected:
*/
class MemcheckGlobalSettings : public AbstractMemcheckSettings
{
Q_OBJECT
public:
MemcheckGlobalSettings(QObject *parent);
virtual ~MemcheckGlobalSettings();
QStringList suppressionFiles() const;
// in the global settings we change the internal list directly
@@ -129,10 +127,8 @@ private:
*/
class MemcheckProjectSettings : public AbstractMemcheckSettings
{
Q_OBJECT
public:
MemcheckProjectSettings(QObject *parent);
virtual ~MemcheckProjectSettings();
QStringList suppressionFiles() const;
// in the project-specific settings we store a diff to the global list
@@ -150,7 +146,7 @@ private:
QStringList m_addedSuppressionFiles;
};
}
}
} // namespace Internal
} // namespace Memcheck
#endif // ANALYZER_INTERNAL_MEMCHECKSETTINGS_H

View File

@@ -32,7 +32,6 @@
**
**************************************************************************/
#include "suppressiondialog.h"
#include "ui_suppressiondialog.h"
@@ -57,12 +56,10 @@
#include <valgrind/xmlprotocol/frame.h>
using namespace Analyzer;
using namespace Memcheck;
using namespace Valgrind::XmlProtocol;
using namespace Memcheck::Internal;
namespace {
QString suppressionText(const Error &error)
{
Suppression sup(error.suppression());
@@ -95,13 +92,13 @@ QString suppressionText(const Error &error)
/// @p error input error, which might get hidden when it has the same stack
/// @p suppressed the error that got suppressed already
static inline bool equalSuppression(const Error &error, const Error &suppressed)
static bool equalSuppression(const Error &error, const Error &suppressed)
{
if (error.kind() != suppressed.kind() || error.suppression().isNull())
return false;
const QVector< SuppressionFrame > errorFrames = error.suppression().frames();
const QVector< SuppressionFrame > suppressedFrames = suppressed.suppression().frames();
const SuppressionFrames errorFrames = error.suppression().frames();
const SuppressionFrames suppressedFrames = suppressed.suppression().frames();
// limit to 23 frames, see: https://bugs.kde.org/show_bug.cgi?id=255822
if (qMin(23, suppressedFrames.size()) > errorFrames.size())
@@ -127,14 +124,17 @@ bool sortIndizesReverse(const QModelIndex &l, const QModelIndex &r)
return l.row() > r.row();
}
}
} // namespace anoe
namespace Memcheck {
namespace Internal {
SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, QWidget *parent, Qt::WindowFlags f)
: QDialog(parent, f),
m_view(view),
m_ui(new Ui::SuppressionDialog),
m_settings(view->settings()),
m_cleanupIfCanceled(false)
: QDialog(parent, f),
m_view(view),
m_ui(new Ui::SuppressionDialog),
m_settings(view->settings()),
m_cleanupIfCanceled(false)
{
m_ui->setupUi(this);
@@ -241,17 +241,19 @@ void SuppressionDialog::accept()
void SuppressionDialog::reject()
{
if (m_cleanupIfCanceled) {
if (m_cleanupIfCanceled)
QFile::remove(m_view->defaultSuppressionFile());
}
QDialog::reject();
}
void SuppressionDialog::validate()
{
bool valid = m_ui->fileChooser->isValid() &&
!m_ui->suppressionEdit->toPlainText().trimmed().isEmpty();
bool valid = m_ui->fileChooser->isValid()
&& !m_ui->suppressionEdit->toPlainText().trimmed().isEmpty();
m_ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(valid);
}
} // namespace Internal
} // namespace Memcheck

View File

@@ -32,7 +32,6 @@
**
**************************************************************************/
#ifndef ANALYZER_VALGRIND_INTERNAL_SUPPRESSIONDIALOG_H
#define ANALYZER_VALGRIND_INTERNAL_SUPPRESSIONDIALOG_H
@@ -40,8 +39,7 @@
#include <valgrind/xmlprotocol/error.h>
namespace Analyzer
{
namespace Analyzer {
class AnalyzerSettings;
}
@@ -77,7 +75,7 @@ private:
QList<Valgrind::XmlProtocol::Error> m_errors;
};
}
}
} // namespace Internal
} // namespace Memcheck
#endif // ANALYZER_VALGRIND_INTERNAL_SUPPRESSIONDIALOG_H

View File

@@ -63,7 +63,7 @@ signals:
void runControlCreated(Analyzer::AnalyzerRunControl *);
};
}
}
} // namespace Internal
} // namespace QmlProfiler
#endif // QMLPROJECTANALYZERRUNCONTROLFACTORY_H

View File

@@ -34,19 +34,12 @@
#ifndef TRACEWINDOW_H
#define TRACEWINDOW_H
#include <QtCore/qpointer.h>
#include <QtGui/qwidget.h>
#include <qmljsdebugclient/qdeclarativedebugclient_p.h>
#include <QtCore/QPointer>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class QTabWidget;
class QSlider;
class QGroupBox;
class QLabel;
class QSpinBox;
class QPushButton;
class QDeclarativeView;
QT_END_NAMESPACE
@@ -60,6 +53,7 @@ class TracePlugin;
class TraceWindow : public QWidget
{
Q_OBJECT
public:
TraceWindow(QWidget *parent = 0);
~TraceWindow();