Debugger: Modernize

modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: I91a6874f0d7b94e9079ab4ef07c23c60c80be9c0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2018-07-23 22:28:49 +02:00
parent babf038ce8
commit 0558db7b54
104 changed files with 718 additions and 820 deletions

View File

@@ -43,8 +43,8 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::IRunConfigurat
m_aspect = aspect; m_aspect = aspect;
m_config = aspect->projectSettings(); m_config = aspect->projectSettings();
QWidget *globalSetting = new QWidget; auto globalSetting = new QWidget;
QHBoxLayout *globalSettingLayout = new QHBoxLayout(globalSetting); auto globalSettingLayout = new QHBoxLayout(globalSetting);
globalSettingLayout->setContentsMargins(0, 0, 0, 0); globalSettingLayout->setContentsMargins(0, 0, 0, 0);
m_settingsCombo = new QComboBox(globalSetting); m_settingsCombo = new QComboBox(globalSetting);
@@ -65,7 +65,7 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::IRunConfigurat
QWidget *innerPane = new QWidget; QWidget *innerPane = new QWidget;
m_configWidget = m_config->createConfigWidget(innerPane); m_configWidget = m_config->createConfigWidget(innerPane);
QVBoxLayout *layout = new QVBoxLayout(innerPane); auto layout = new QVBoxLayout(innerPane);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(globalSetting); layout->addWidget(globalSetting);
layout->addWidget(m_configWidget); layout->addWidget(m_configWidget);
@@ -73,7 +73,7 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::IRunConfigurat
m_details = new Utils::DetailsWidget; m_details = new Utils::DetailsWidget;
m_details->setWidget(innerPane); m_details->setWidget(innerPane);
QVBoxLayout *outerLayout = new QVBoxLayout(this); auto outerLayout = new QVBoxLayout(this);
outerLayout->addWidget(m_details); outerLayout->addWidget(m_details);
outerLayout->setContentsMargins(0, 0, 0, 0); outerLayout->setContentsMargins(0, 0, 0, 0);

View File

@@ -58,7 +58,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
{ {
TextEditor::TextEditorWidget *widget = TextEditor::TextEditorWidget::currentTextEditorWidget(); TextEditor::TextEditorWidget *widget = TextEditor::TextEditorWidget::currentTextEditorWidget();
if (!widget) if (!widget)
return 0; return nullptr;
QTextCursor tc = widget->textCursor(); QTextCursor tc = widget->textCursor();
int line = 0; int line = 0;
@@ -68,7 +68,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManager::instance()->snapshot(); const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManager::instance()->snapshot();
CPlusPlus::Document::Ptr doc = snapshot.document(widget->textDocument()->filePath()); CPlusPlus::Document::Ptr doc = snapshot.document(widget->textDocument()->filePath());
QTC_ASSERT(doc, return 0); QTC_ASSERT(doc, return nullptr);
// fetch the expression's code // fetch the expression's code
CPlusPlus::ExpressionUnderCursor expressionUnderCursor(doc->languageFeatures()); CPlusPlus::ExpressionUnderCursor expressionUnderCursor(doc->languageFeatures());
@@ -80,7 +80,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
typeOfExpression.init(doc, snapshot); typeOfExpression.init(doc, snapshot);
const QList<CPlusPlus::LookupItem> &lookupItems = typeOfExpression(expression.toUtf8(), scope); const QList<CPlusPlus::LookupItem> &lookupItems = typeOfExpression(expression.toUtf8(), scope);
if (lookupItems.isEmpty()) if (lookupItems.isEmpty())
return 0; return nullptr;
const CPlusPlus::LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate. const CPlusPlus::LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate.
return lookupItem.declaration(); return lookupItem.declaration();

View File

@@ -72,9 +72,7 @@ DetailedErrorView::DetailedErrorView(QWidget *parent) :
addAction(m_copyAction); addAction(m_copyAction);
} }
DetailedErrorView::~DetailedErrorView() DetailedErrorView::~DetailedErrorView() = default;
{
}
void DetailedErrorView::contextMenuEvent(QContextMenuEvent *e) void DetailedErrorView::contextMenuEvent(QContextMenuEvent *e)
{ {

View File

@@ -27,9 +27,7 @@
namespace Debugger { namespace Debugger {
DiagnosticLocation::DiagnosticLocation() : line(0), column(0) DiagnosticLocation::DiagnosticLocation() = default;
{
}
DiagnosticLocation::DiagnosticLocation(const QString &filePath, int line, int column) DiagnosticLocation::DiagnosticLocation(const QString &filePath, int line, int column)
: filePath(filePath), line(line), column(column) : filePath(filePath), line(line), column(column)

View File

@@ -44,8 +44,8 @@ public:
QString filePath; QString filePath;
// Both values start at 1. // Both values start at 1.
int line; int line = 0;
int column; int column = 0;
}; };
DEBUGGER_EXPORT bool operator==(const DiagnosticLocation &first, const DiagnosticLocation &second); DEBUGGER_EXPORT bool operator==(const DiagnosticLocation &first, const DiagnosticLocation &second);

View File

@@ -74,14 +74,14 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent)
d->buttonBox->setOrientation(Qt::Horizontal); d->buttonBox->setOrientation(Qt::Horizontal);
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
QFormLayout *formLayout = new QFormLayout; auto formLayout = new QFormLayout;
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
formLayout->addRow(tr("Kit:"), d->kitChooser); formLayout->addRow(tr("Kit:"), d->kitChooser);
formLayout->addRow(tr("Executable:"), d->executable); formLayout->addRow(tr("Executable:"), d->executable);
formLayout->addRow(tr("Arguments:"), d->arguments); formLayout->addRow(tr("Arguments:"), d->arguments);
formLayout->addRow(tr("Working directory:"), d->workingDirectory); formLayout->addRow(tr("Working directory:"), d->workingDirectory);
QVBoxLayout *verticalLayout = new QVBoxLayout(this); auto verticalLayout = new QVBoxLayout(this);
verticalLayout->addLayout(formLayout); verticalLayout->addLayout(formLayout);
verticalLayout->addWidget(d->buttonBox); verticalLayout->addWidget(d->buttonBox);

View File

@@ -107,9 +107,9 @@ class BreakpointItem : public QObject, public TypedTreeItem<LocationItem>
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::BreakHandler) Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::BreakHandler)
public: public:
~BreakpointItem(); ~BreakpointItem() override;
QVariant data(int column, int role) const; QVariant data(int column, int role) const override;
QIcon icon() const; QIcon icon() const;
@@ -168,28 +168,28 @@ public:
setIcon(b->icon()); setIcon(b->icon());
} }
void removedFromEditor() void removedFromEditor() override
{ {
if (m_bp) if (m_bp)
m_bp->removeBreakpoint(); m_bp->removeBreakpoint();
} }
void updateLineNumber(int lineNumber) void updateLineNumber(int lineNumber) override
{ {
TextMark::updateLineNumber(lineNumber); TextMark::updateLineNumber(lineNumber);
m_bp->updateLineNumberFromMarker(lineNumber); m_bp->updateLineNumberFromMarker(lineNumber);
} }
void updateFileName(const FileName &fileName) void updateFileName(const FileName &fileName) override
{ {
TextMark::updateFileName(fileName); TextMark::updateFileName(fileName);
m_bp->updateFileNameFromMarker(fileName.toString()); m_bp->updateFileNameFromMarker(fileName.toString());
} }
bool isDraggable() const { return true; } bool isDraggable() const override { return true; }
void dragToLine(int line) { m_bp->changeLineNumberFromMarker(line); } void dragToLine(int line) override { m_bp->changeLineNumberFromMarker(line); }
bool isClickable() const { return true; } bool isClickable() const override { return true; }
void clicked() { m_bp->removeBreakpoint(); } void clicked() override { m_bp->removeBreakpoint(); }
public: public:
BreakpointItem *m_bp; BreakpointItem *m_bp;
@@ -269,7 +269,7 @@ static QString typeToString(BreakpointType type)
class LeftElideDelegate : public QStyledItemDelegate class LeftElideDelegate : public QStyledItemDelegate
{ {
public: public:
LeftElideDelegate() {} LeftElideDelegate() = default;
void paint(QPainter *pain, const QStyleOptionViewItem &option, const QModelIndex &index) const override void paint(QPainter *pain, const QStyleOptionViewItem &option, const QModelIndex &index) const override
{ {
@@ -283,8 +283,8 @@ class SmallTextEdit : public QTextEdit
{ {
public: public:
explicit SmallTextEdit(QWidget *parent) : QTextEdit(parent) {} explicit SmallTextEdit(QWidget *parent) : QTextEdit(parent) {}
QSize sizeHint() const { return QSize(QTextEdit::sizeHint().width(), 100); } QSize sizeHint() const override { return QSize(QTextEdit::sizeHint().width(), 100); }
QSize minimumSizeHint() const { return sizeHint(); } QSize minimumSizeHint() const override { return sizeHint(); }
}; };
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@@ -669,7 +669,7 @@ void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data)
data->functionName = m_lineEditFunction->text(); data->functionName = m_lineEditFunction->text();
if (partsMask & AddressPart) if (partsMask & AddressPart)
data->address = m_lineEditAddress->text().toULongLong(0, 0); data->address = m_lineEditAddress->text().toULongLong(nullptr, 0);
if (partsMask & ExpressionPart) if (partsMask & ExpressionPart)
data->expression = m_lineEditExpression->text(); data->expression = m_lineEditExpression->text();
@@ -1378,7 +1378,7 @@ QIcon Breakpoint::icon() const { return b ? b->icon() : QIcon(); }
DebuggerEngine *Breakpoint::engine() const DebuggerEngine *Breakpoint::engine() const
{ {
return b ? b->m_engine : 0; return b ? b->m_engine : nullptr;
} }
const BreakpointResponse &Breakpoint::response() const const BreakpointResponse &Breakpoint::response() const
@@ -1610,7 +1610,7 @@ void Breakpoint::notifyBreakpointReleased()
b->removeChildren(); b->removeChildren();
//QTC_ASSERT(b->m_state == BreakpointChangeProceeding, qDebug() << b->m_state); //QTC_ASSERT(b->m_state == BreakpointChangeProceeding, qDebug() << b->m_state);
b->m_state = BreakpointNew; b->m_state = BreakpointNew;
b->m_engine = 0; b->m_engine = nullptr;
b->m_response = BreakpointResponse(); b->m_response = BreakpointResponse();
b->destroyMarker(); b->destroyMarker();
b->updateMarker(); b->updateMarker();
@@ -1673,7 +1673,7 @@ void BreakHandler::appendBreakpointInternal(const BreakpointParameters &params)
return; return;
} }
BreakpointItem *b = new BreakpointItem(this); auto b = new BreakpointItem(this);
b->m_params = params; b->m_params = params;
b->updateMarker(); b->updateMarker();
rootItem()->appendChild(b); rootItem()->appendChild(b);
@@ -1839,7 +1839,7 @@ const Breakpoints BreakHandler::allBreakpoints() const
const Breakpoints BreakHandler::unclaimedBreakpoints() const const Breakpoints BreakHandler::unclaimedBreakpoints() const
{ {
return engineBreakpoints(0); return engineBreakpoints(nullptr);
} }
const Breakpoints BreakHandler::engineBreakpoints(DebuggerEngine *engine) const const Breakpoints BreakHandler::engineBreakpoints(DebuggerEngine *engine) const
@@ -2161,7 +2161,7 @@ void BreakHandler::editBreakpoints(const Breakpoints &bps, QWidget *parent)
static int currentId = 0; static int currentId = 0;
BreakpointItem::BreakpointItem(BreakHandler *handler) BreakpointItem::BreakpointItem(BreakHandler *handler)
: m_handler(handler), m_id(++currentId), m_state(BreakpointNew), m_engine(0), m_marker(0) : m_handler(handler), m_id(++currentId), m_state(BreakpointNew), m_engine(nullptr), m_marker(nullptr)
{} {}
BreakpointItem::~BreakpointItem() BreakpointItem::~BreakpointItem()
@@ -2173,8 +2173,8 @@ void BreakpointItem::destroyMarker()
{ {
if (m_marker) { if (m_marker) {
BreakpointMarker *m = m_marker; BreakpointMarker *m = m_marker;
m->m_bp = 0; m->m_bp = nullptr;
m_marker = 0; m_marker = nullptr;
delete m; delete m;
} }
} }

View File

@@ -50,10 +50,10 @@ class Breakpoint
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::BreakHandler) Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::BreakHandler)
public: public:
Breakpoint() {} Breakpoint() = default;
bool isValid() const; bool isValid() const;
operator const void *() const { return isValid() ? this : 0; } operator const void *() const { return isValid() ? this : nullptr; }
bool operator!() const { return !isValid(); } bool operator!() const { return !isValid(); }
uint hash() const; uint hash() const;
@@ -157,7 +157,7 @@ private:
inline uint qHash(const Debugger::Internal::Breakpoint &b) { return b.hash(); } inline uint qHash(const Debugger::Internal::Breakpoint &b) { return b.hash(); }
typedef QList<Breakpoint> Breakpoints; using Breakpoints = QList<Breakpoint>;
using BreakModel = Utils::TreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, LocationItem>; using BreakModel = Utils::TreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, LocationItem>;

View File

@@ -40,13 +40,13 @@ namespace Internal {
class BreakpointIdBase class BreakpointIdBase
{ {
public: public:
BreakpointIdBase() : m_majorPart(0), m_minorPart(0) {} BreakpointIdBase() = default;
bool isValid() const { return m_majorPart != 0; } bool isValid() const { return m_majorPart != 0; }
bool isMajor() const { return m_majorPart != 0 && m_minorPart == 0; } bool isMajor() const { return m_majorPart != 0 && m_minorPart == 0; }
bool isMinor() const { return m_majorPart != 0 && m_minorPart != 0; } bool isMinor() const { return m_majorPart != 0 && m_minorPart != 0; }
bool operator!() const { return !isValid(); } bool operator!() const { return !isValid(); }
operator const void*() const { return isValid() ? this : 0; } operator const void*() const { return isValid() ? this : nullptr; }
quint32 toInternalId() const { return m_majorPart | (m_minorPart << 16); } quint32 toInternalId() const { return m_majorPart | (m_minorPart << 16); }
QString toString() const; QString toString() const;
bool operator==(const BreakpointIdBase &id) const bool operator==(const BreakpointIdBase &id) const
@@ -55,8 +55,8 @@ public:
quint16 minorPart() const { return m_minorPart; } quint16 minorPart() const { return m_minorPart; }
protected: protected:
quint16 m_majorPart; quint16 m_majorPart = 0;
quint16 m_minorPart; quint16 m_minorPart = 0;
}; };
class BreakpointModelId : public BreakpointIdBase class BreakpointModelId : public BreakpointIdBase

View File

@@ -155,7 +155,7 @@ static const char localsPrefixC[] = "local.";
class CdbCommand class CdbCommand
{ {
public: public:
CdbCommand() {} CdbCommand() = default;
CdbCommand(CdbEngine::CommandHandler h) : handler(h) {} CdbCommand(CdbEngine::CommandHandler h) : handler(h) {}
CdbEngine::CommandHandler handler; CdbEngine::CommandHandler handler;
@@ -267,9 +267,7 @@ void CdbEngine::init()
QTC_ASSERT(m_process.state() != QProcess::Running, SynchronousProcess::stopProcess(m_process)); QTC_ASSERT(m_process.state() != QProcess::Running, SynchronousProcess::stopProcess(m_process));
} }
CdbEngine::~CdbEngine() CdbEngine::~CdbEngine() = default;
{
}
void CdbEngine::operateByInstructionTriggered(bool operateByInstruction) void CdbEngine::operateByInstructionTriggered(bool operateByInstruction)
{ {

View File

@@ -46,8 +46,8 @@ class CdbEngine : public DebuggerEngine
Q_OBJECT Q_OBJECT
public: public:
typedef QSharedPointer<CdbCommand> CdbCommandPtr; using CdbCommandPtr = QSharedPointer<CdbCommand>;
typedef std::function<void(const DebuggerResponse &)> CommandHandler; using CommandHandler = std::function<void (const DebuggerResponse &)>;
explicit CdbEngine(); explicit CdbEngine();
~CdbEngine() override; ~CdbEngine() override;
@@ -119,8 +119,8 @@ private:
void handleDoInterruptInferior(const QString &errorMessage); void handleDoInterruptInferior(const QString &errorMessage);
typedef QHash<BreakpointModelId, BreakpointResponse> PendingBreakPointMap; using PendingBreakPointMap = QHash<BreakpointModelId, BreakpointResponse>;
typedef QPair<QString, QString> SourcePathMapping; using SourcePathMapping = QPair<QString, QString>;
struct NormalizedSourceFileName // Struct for caching mapped/normalized source files. struct NormalizedSourceFileName // Struct for caching mapped/normalized source files.
{ {
NormalizedSourceFileName(const QString &fn = QString(), bool e = false) : fileName(fn), exists(e) {} NormalizedSourceFileName(const QString &fn = QString(), bool e = false) : fileName(fn), exists(e) {}

View File

@@ -77,14 +77,14 @@ CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent)
{ {
// 1 column with checkboxes only, // 1 column with checkboxes only,
// further columns with checkbox + parameter // further columns with checkbox + parameter
QHBoxLayout *mainLayout = new QHBoxLayout; auto mainLayout = new QHBoxLayout;
mainLayout->setMargin(0); mainLayout->setMargin(0);
QVBoxLayout *leftLayout = new QVBoxLayout; auto leftLayout = new QVBoxLayout;
QFormLayout *parameterLayout = nullptr; QFormLayout *parameterLayout = nullptr;
mainLayout->addLayout(leftLayout); mainLayout->addLayout(leftLayout);
const size_t eventCount = sizeof(eventDescriptions) / sizeof(EventsDescription); const size_t eventCount = sizeof(eventDescriptions) / sizeof(EventsDescription);
for (size_t e = 0; e < eventCount; e++) { for (size_t e = 0; e < eventCount; e++) {
QCheckBox *cb = new QCheckBox(tr(eventDescriptions[e].description)); auto cb = new QCheckBox(tr(eventDescriptions[e].description));
QLineEdit *le = nullptr; QLineEdit *le = nullptr;
if (eventDescriptions[e].hasParameter) { if (eventDescriptions[e].hasParameter) {
if (!parameterLayout) { if (!parameterLayout) {
@@ -95,7 +95,7 @@ CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent)
le = new QLineEdit; le = new QLineEdit;
parameterLayout->addRow(cb, le); parameterLayout->addRow(cb, le);
if (parameterLayout->count() >= 6) // New column if (parameterLayout->count() >= 6) // New column
parameterLayout = 0; parameterLayout = nullptr;
} else { } else {
leftLayout->addWidget(cb); leftLayout->addWidget(cb);
} }
@@ -168,7 +168,7 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent)
m_ui.startupFormLayout->setContentsMargins(margins); m_ui.startupFormLayout->setContentsMargins(margins);
QVBoxLayout *eventLayout = new QVBoxLayout; auto eventLayout = new QVBoxLayout;
eventLayout->setContentsMargins(margins); eventLayout->setContentsMargins(margins);
eventLayout->addWidget(m_breakEventWidget); eventLayout->addWidget(m_breakEventWidget);
m_ui.eventGroupBox->setLayout(eventLayout); m_ui.eventGroupBox->setLayout(eventLayout);
@@ -203,9 +203,7 @@ CdbOptionsPage::CdbOptionsPage()
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
} }
CdbOptionsPage::~CdbOptionsPage() CdbOptionsPage::~CdbOptionsPage() = default;
{
}
QWidget *CdbOptionsPage::widget() QWidget *CdbOptionsPage::widget()
{ {
@@ -248,19 +246,19 @@ public:
CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) : CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
QVBoxLayout *layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
QString title = tr("Symbol Paths"); QString title = tr("Symbol Paths");
QGroupBox* gbSymbolPath = new QGroupBox(this); auto gbSymbolPath = new QGroupBox(this);
gbSymbolPath->setTitle(title); gbSymbolPath->setTitle(title);
QVBoxLayout *gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath); auto gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath);
m_symbolPathListEditor = new CdbSymbolPathListEditor(gbSymbolPath); m_symbolPathListEditor = new CdbSymbolPathListEditor(gbSymbolPath);
gbSymbolPathLayout->addWidget(m_symbolPathListEditor); gbSymbolPathLayout->addWidget(m_symbolPathListEditor);
title = tr("Source Paths"); title = tr("Source Paths");
QGroupBox* gbSourcePath = new QGroupBox(this); auto gbSourcePath = new QGroupBox(this);
gbSourcePath->setTitle(title); gbSourcePath->setTitle(title);
QVBoxLayout *gbSourcePathLayout = new QVBoxLayout(gbSourcePath); auto gbSourcePathLayout = new QVBoxLayout(gbSourcePath);
m_sourcePathListEditor = new Utils::PathListEditor(gbSourcePath); m_sourcePathListEditor = new Utils::PathListEditor(gbSourcePath);
gbSourcePathLayout->addWidget(m_sourcePathListEditor); gbSourcePathLayout->addWidget(m_sourcePathListEditor);
@@ -272,16 +270,14 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
} }
CdbPathsPage::CdbPathsPage() CdbPathsPage::CdbPathsPage()
: m_widget(0) : m_widget(nullptr)
{ {
setId("F.Debugger.Cdb"); setId("F.Debugger.Cdb");
setDisplayName(tr("CDB Paths")); setDisplayName(tr("CDB Paths"));
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
} }
CdbPathsPage::~CdbPathsPage() CdbPathsPage::~CdbPathsPage() = default;
{
}
QWidget *CdbPathsPage::widget() QWidget *CdbPathsPage::widget()
{ {

View File

@@ -92,12 +92,12 @@ class CdbOptionsPage : public Core::IOptionsPage
public: public:
explicit CdbOptionsPage(); explicit CdbOptionsPage();
virtual ~CdbOptionsPage(); ~CdbOptionsPage() override;
// IOptionsPage // IOptionsPage
QWidget *widget(); QWidget *widget() override;
void apply(); void apply() override;
void finish(); void finish() override;
static const char *crtDbgReport; static const char *crtDbgReport;
@@ -112,14 +112,14 @@ class CdbPathsPage : public Core::IOptionsPage
public: public:
explicit CdbPathsPage(); explicit CdbPathsPage();
virtual ~CdbPathsPage(); ~CdbPathsPage() override;
static CdbPathsPage *instance(); static CdbPathsPage *instance();
// IOptionsPage // IOptionsPage
QWidget *widget(); QWidget *widget() override;
void apply(); void apply() override;
void finish(); void finish() override;
private: private:
QPointer<CdbPathsPageWidget> m_widget; QPointer<CdbPathsPageWidget> m_widget;

View File

@@ -55,7 +55,7 @@ QString cdbSourcePathMapping(QString fileName,
const QList<QPair<QString, QString> > &sourcePathMapping, const QList<QPair<QString, QString> > &sourcePathMapping,
SourcePathMode mode) SourcePathMode mode)
{ {
typedef QPair<QString, QString> SourcePathMapping; using SourcePathMapping = QPair<QString, QString>;
if (fileName.isEmpty() || sourcePathMapping.isEmpty()) if (fileName.isEmpty() || sourcePathMapping.isEmpty())
return fileName; return fileName;
@@ -286,7 +286,7 @@ void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
r->fileName = sourceFileName.data(); r->fileName = sourceFileName.data();
const GdbMi lineNumber = gdbmi["srcline"]; const GdbMi lineNumber = gdbmi["srcline"];
if (lineNumber.isValid()) if (lineNumber.isValid())
r->lineNumber = lineNumber.data().toULongLong(0, 0); r->lineNumber = lineNumber.data().toULongLong(nullptr, 0);
} }
if (expression) { if (expression) {
const GdbMi expressionG = gdbmi["expression"]; const GdbMi expressionG = gdbmi["expression"];
@@ -295,7 +295,7 @@ void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
} }
const GdbMi addressG = gdbmi["address"]; const GdbMi addressG = gdbmi["address"];
if (addressG.isValid()) if (addressG.isValid())
r->address = addressG.data().toULongLong(0, 0); r->address = addressG.data().toULongLong(nullptr, 0);
if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount))) if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount)))
r->ignoreCount--; r->ignoreCount--;
gdbmiChildToInt(gdbmi, "thread", &(r->threadSpec)); gdbmiChildToInt(gdbmi, "thread", &(r->threadSpec));
@@ -347,11 +347,7 @@ QString debugByteArray(const QByteArray &a)
return rc; return rc;
} }
WinException::WinException() : WinException::WinException() = default;
exceptionCode(0), exceptionFlags(0), exceptionAddress(0),
info1(0),info2(0), firstChance(false), lineNumber(0)
{
}
void WinException::fromGdbMI(const GdbMi &gdbmi) void WinException::fromGdbMI(const GdbMi &gdbmi)
{ {
@@ -448,7 +444,7 @@ bool parseCdbDisassemblerFunctionLine(const QString &l,
const int offsetPos = l.indexOf(QLatin1String("+0x")); const int offsetPos = l.indexOf(QLatin1String("+0x"));
if (offsetPos > 0) { if (offsetPos > 0) {
*currentFunction = l.left(offsetPos); *currentFunction = l.left(offsetPos);
*functionOffset = l.mid(offsetPos + 3, functionEnd - offsetPos - 3).trimmed().toULongLong(0, 16); *functionOffset = l.mid(offsetPos + 3, functionEnd - offsetPos - 3).trimmed().toULongLong(nullptr, 16);
} else { // No offset, directly at beginning. } else { // No offset, directly at beginning.
*currentFunction = l.left(functionEnd); *currentFunction = l.left(functionEnd);
*functionOffset = 0; *functionOffset = 0;

View File

@@ -82,14 +82,14 @@ struct WinException
void fromGdbMI(const GdbMi &); void fromGdbMI(const GdbMi &);
QString toString(bool includeLocation = false) const; QString toString(bool includeLocation = false) const;
unsigned exceptionCode; unsigned exceptionCode = 0;
unsigned exceptionFlags; unsigned exceptionFlags = 0;
quint64 exceptionAddress; quint64 exceptionAddress = 0;
quint64 info1; quint64 info1 = 0;
quint64 info2; quint64 info2 = 0;
bool firstChance; bool firstChance = false;
QString file; QString file;
int lineNumber; int lineNumber = 0;
QString function; QString function;
}; };

View File

@@ -31,7 +31,7 @@ namespace Debugger {
namespace Internal { namespace Internal {
StringInputStream::StringInputStream(QString &str) : StringInputStream::StringInputStream(QString &str) :
m_target(str), m_integerBase(10), m_hexPrefix(false), m_width(0) m_target(str)
{ {
} }

View File

@@ -35,7 +35,7 @@ class StringInputStream
Q_DISABLE_COPY(StringInputStream) Q_DISABLE_COPY(StringInputStream)
public: public:
typedef void (ModifierFunc)(StringInputStream &s); using ModifierFunc = void (StringInputStream &);
explicit StringInputStream(QString &str); explicit StringInputStream(QString &str);
@@ -62,9 +62,9 @@ private:
template <class IntType> void appendInt(IntType i); template <class IntType> void appendInt(IntType i);
QString &m_target; QString &m_target;
int m_integerBase; int m_integerBase = 10;
bool m_hexPrefix; bool m_hexPrefix = false;
int m_width; int m_width = 0;
}; };
template <class IntType> template <class IntType>

View File

@@ -223,21 +223,21 @@ QWidget *CommonOptionsPage::widget()
checkBoxKeepEditorStationaryWhileStepping); checkBoxKeepEditorStationaryWhileStepping);
m_group.insert(action(FontSizeFollowsEditor), m_group.insert(action(FontSizeFollowsEditor),
checkBoxFontSizeFollowsEditor); checkBoxFontSizeFollowsEditor);
m_group.insert(action(AutoDerefPointers), 0); m_group.insert(action(AutoDerefPointers), nullptr);
m_group.insert(action(UseToolTipsInLocalsView), 0); m_group.insert(action(UseToolTipsInLocalsView), nullptr);
m_group.insert(action(AlwaysAdjustColumnWidths), 0); m_group.insert(action(AlwaysAdjustColumnWidths), nullptr);
m_group.insert(action(UseToolTipsInBreakpointsView), 0); m_group.insert(action(UseToolTipsInBreakpointsView), nullptr);
m_group.insert(action(UseToolTipsInStackView), 0); m_group.insert(action(UseToolTipsInStackView), nullptr);
m_group.insert(action(UseAddressInBreakpointsView), 0); m_group.insert(action(UseAddressInBreakpointsView), nullptr);
m_group.insert(action(UseAddressInStackView), 0); m_group.insert(action(UseAddressInStackView), nullptr);
m_group.insert(action(MaximalStackDepth), spinBoxMaximalStackDepth); m_group.insert(action(MaximalStackDepth), spinBoxMaximalStackDepth);
m_group.insert(action(ShowStdNamespace), 0); m_group.insert(action(ShowStdNamespace), nullptr);
m_group.insert(action(ShowQtNamespace), 0); m_group.insert(action(ShowQtNamespace), nullptr);
m_group.insert(action(ShowQObjectNames), 0); m_group.insert(action(ShowQObjectNames), nullptr);
m_group.insert(action(SortStructMembers), 0); m_group.insert(action(SortStructMembers), nullptr);
m_group.insert(action(LogTimeStamps), 0); m_group.insert(action(LogTimeStamps), nullptr);
m_group.insert(action(BreakOnThrow), 0); m_group.insert(action(BreakOnThrow), nullptr);
m_group.insert(action(BreakOnCatch), 0); m_group.insert(action(BreakOnCatch), nullptr);
if (HostOsInfo::isWindowsHost()) { if (HostOsInfo::isWindowsHost()) {
SavedAction *registerAction = action(RegisterForPostMortem); SavedAction *registerAction = action(RegisterForPostMortem);
m_group.insert(registerAction, checkBoxRegisterForPostMortem); m_group.insert(registerAction, checkBoxRegisterForPostMortem);

View File

@@ -63,7 +63,7 @@ Console::Console()
m_consoleWidget->setWindowTitle(displayName()); m_consoleWidget->setWindowTitle(displayName());
m_consoleWidget->setEnabled(true); m_consoleWidget->setEnabled(true);
QVBoxLayout *vbox = new QVBoxLayout(m_consoleWidget); auto vbox = new QVBoxLayout(m_consoleWidget);
vbox->setMargin(0); vbox->setMargin(0);
vbox->setSpacing(0); vbox->setSpacing(0);
@@ -92,7 +92,7 @@ Console::Console()
itemDelegate, &ConsoleItemDelegate::currentChanged); itemDelegate, &ConsoleItemDelegate::currentChanged);
m_consoleView->setItemDelegate(itemDelegate); m_consoleView->setItemDelegate(itemDelegate);
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate(); auto aggregate = new Aggregation::Aggregate();
aggregate->add(m_consoleView); aggregate->add(m_consoleView);
aggregate->add(new Core::ItemViewFind(m_consoleView)); aggregate->add(new Core::ItemViewFind(m_consoleView));
@@ -189,7 +189,7 @@ bool Console::canFocus() const
bool Console::hasFocus() const bool Console::hasFocus() const
{ {
for (QWidget *widget = m_consoleWidget->window()->focusWidget(); widget != 0; for (QWidget *widget = m_consoleWidget->window()->focusWidget(); widget != nullptr;
widget = widget->parentWidget()) { widget = widget->parentWidget()) {
if (widget == m_consoleWidget) if (widget == m_consoleWidget)
return true; return true;

View File

@@ -43,7 +43,7 @@ namespace Utils { class SavedAction; }
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
typedef std::function<void(QString)> ScriptEvaluator; using ScriptEvaluator = std::function<void (QString)>;
class ConsoleItemModel; class ConsoleItemModel;
class ConsoleView; class ConsoleView;

View File

@@ -41,8 +41,8 @@ public:
QString getCurrentScript() const; QString getCurrentScript() const;
protected: protected:
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e) override;
void focusOutEvent(QFocusEvent *e); void focusOutEvent(QFocusEvent *e) override;
signals: signals:
void editingFinished(); void editingFinished();

View File

@@ -44,7 +44,7 @@ ConsoleItem::ConsoleItem(ItemType itemType, const QString &expression, const QSt
ConsoleItem::ConsoleItem(ConsoleItem::ItemType itemType, const QString &expression, ConsoleItem::ConsoleItem(ConsoleItem::ItemType itemType, const QString &expression,
std::function<void(ConsoleItem *)> doFetch) : std::function<void(ConsoleItem *)> doFetch) :
m_itemType(itemType), m_text(addZeroWidthSpace(expression)), m_line(-1), m_doFetch(doFetch) m_itemType(itemType), m_text(addZeroWidthSpace(expression)), m_doFetch(doFetch)
{} {}
ConsoleItem::ItemType ConsoleItem::itemType() const ConsoleItem::ItemType ConsoleItem::itemType() const
@@ -144,7 +144,7 @@ void ConsoleItem::fetchMore()
} }
for (TreeItem *child : *this) { for (TreeItem *child : *this) {
ConsoleItem *item = static_cast<ConsoleItem *>(child); auto item = static_cast<ConsoleItem*>(child);
if (item->m_doFetch) { if (item->m_doFetch) {
item->m_doFetch(item); item->m_doFetch(item);
item->m_doFetch = m_doFetch; item->m_doFetch = m_doFetch;

View File

@@ -75,7 +75,7 @@ private:
ItemType m_itemType; ItemType m_itemType;
QString m_text; QString m_text;
QString m_file; QString m_file;
int m_line; int m_line = -1;
std::function<void(ConsoleItem *)> m_doFetch; std::function<void(ConsoleItem *)> m_doFetch;
}; };

View File

@@ -57,8 +57,7 @@ ConsoleItemDelegate::ConsoleItemDelegate(ConsoleItemModel *model, QObject *paren
m_expandIcon(Utils::Icons::EXPAND.icon()), m_expandIcon(Utils::Icons::EXPAND.icon()),
m_collapseIcon(Utils::Icons::COLLAPSE.icon()), m_collapseIcon(Utils::Icons::COLLAPSE.icon()),
m_prompt(Utils::Icon({{QLatin1String(":/utils/images/next.png"), m_prompt(Utils::Icon({{QLatin1String(":/utils/images/next.png"),
Utils::Theme::TextColorNormal}}, Utils::Icon::Tint).icon()), Utils::Theme::TextColorNormal}}, Utils::Icon::Tint).icon())
m_cachedHeight(0)
{ {
} }
@@ -124,7 +123,7 @@ void ConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
bool(opt.state & QStyle::State_Selected)); bool(opt.state & QStyle::State_Selected));
// Calculate positions // Calculate positions
const QTreeView *view = qobject_cast<const QTreeView *>(opt.widget); const auto view = qobject_cast<const QTreeView*>(opt.widget);
int level = 0; int level = 0;
QModelIndex idx(index); QModelIndex idx(index);
while (idx.parent() != QModelIndex()) { while (idx.parent() != QModelIndex()) {
@@ -219,7 +218,7 @@ QSize ConsoleItemDelegate::sizeHint(const QStyleOptionViewItem &option,
QStyleOptionViewItem opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QTreeView *view = qobject_cast<const QTreeView *>(opt.widget); const auto view = qobject_cast<const QTreeView*>(opt.widget);
int level = 0; int level = 0;
QModelIndex idx(index); QModelIndex idx(index);
while (idx.parent() != QModelIndex()) { while (idx.parent() != QModelIndex()) {
@@ -268,7 +267,7 @@ QWidget *ConsoleItemDelegate::createEditor(QWidget *parent,
const QModelIndex &index) const const QModelIndex &index) const
{ {
ConsoleEdit *editor = new ConsoleEdit(index, parent); auto editor = new ConsoleEdit(index, parent);
// Make the background transparent so that the prompt shines through // Make the background transparent so that the prompt shines through
editor->setStyleSheet(QLatin1String("QTextEdit {" editor->setStyleSheet(QLatin1String("QTextEdit {"
"margin-left: 24px;" "margin-left: 24px;"
@@ -286,7 +285,7 @@ QWidget *ConsoleItemDelegate::createEditor(QWidget *parent,
void ConsoleItemDelegate::setEditorData(QWidget *editor, void ConsoleItemDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const const QModelIndex &index) const
{ {
ConsoleEdit *edtr = qobject_cast<ConsoleEdit *>(editor); auto edtr = qobject_cast<ConsoleEdit*>(editor);
edtr->insertPlainText(index.data(ConsoleItem::ExpressionRole).toString()); edtr->insertPlainText(index.data(ConsoleItem::ExpressionRole).toString());
} }
@@ -294,7 +293,7 @@ void ConsoleItemDelegate::setModelData(QWidget *editor,
QAbstractItemModel *model, QAbstractItemModel *model,
const QModelIndex &index) const const QModelIndex &index) const
{ {
ConsoleEdit *edtr = qobject_cast<ConsoleEdit *>(editor); auto edtr = qobject_cast<ConsoleEdit*>(editor);
model->setData(index, edtr->getCurrentScript(), ConsoleItem::ExpressionRole); model->setData(index, edtr->getCurrentScript(), ConsoleItem::ExpressionRole);
model->setData(index, ConsoleItem::InputType, ConsoleItem::TypeRole); model->setData(index, ConsoleItem::InputType, ConsoleItem::TypeRole);
} }

View File

@@ -48,16 +48,17 @@ public:
protected: protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option, void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const; const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, QSize sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const; const QModelIndex &index) const override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const; const QModelIndex &index) const override;
void setEditorData(QWidget *editor, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const; const QModelIndex &index) const override;
private: private:
qreal layoutText(QTextLayout &tl, int width, bool *success = nullptr) const; qreal layoutText(QTextLayout &tl, int width, bool *success = nullptr) const;
@@ -70,7 +71,7 @@ private:
const QIcon m_expandIcon; const QIcon m_expandIcon;
const QIcon m_collapseIcon; const QIcon m_collapseIcon;
const QIcon m_prompt; const QIcon m_prompt;
mutable int m_cachedHeight; mutable int m_cachedHeight = 0;
mutable QFont m_cachedFont; mutable QFont m_cachedFont;
}; };
@@ -95,8 +96,6 @@ public:
m_width(rect.width()), m_width(rect.width()),
m_top(rect.top()), m_top(rect.top()),
m_bottom(rect.bottom()), m_bottom(rect.bottom()),
m_maxFileLength(0),
m_maxLineLength(0),
m_showTaskIconArea(showTaskIconArea), m_showTaskIconArea(showTaskIconArea),
m_showExpandableIconArea(showExpandableIconArea) m_showExpandableIconArea(showExpandableIconArea)
{ {

View File

@@ -38,8 +38,7 @@ namespace Internal {
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
ConsoleItemModel::ConsoleItemModel(QObject *parent) : ConsoleItemModel::ConsoleItemModel(QObject *parent) :
Utils::TreeModel<>(new ConsoleItem, parent), Utils::TreeModel<>(new ConsoleItem, parent)
m_maxSizeOfFileName(0), m_canFetchMore(false)
{ {
clear(); clear();
} }

View File

@@ -60,8 +60,8 @@ signals:
void selectEditableRow(const QModelIndex &index, QItemSelectionModel::SelectionFlags flags); void selectEditableRow(const QModelIndex &index, QItemSelectionModel::SelectionFlags flags);
private: private:
int m_maxSizeOfFileName; int m_maxSizeOfFileName = 0;
bool m_canFetchMore; bool m_canFetchMore = false;
}; };
} // Internal } // Internal

View File

@@ -52,7 +52,8 @@ signals:
QItemSelectionModel::SelectionFlags command); QItemSelectionModel::SelectionFlags command);
protected: protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; bool filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const override;
private: private:
QFlags<ConsoleItem::ItemType> m_filter; QFlags<ConsoleItem::ItemType> m_filter;

View File

@@ -110,7 +110,7 @@ ConsoleView::ConsoleView(ConsoleItemModel *model, QWidget *parent) :
baseName = QLatin1String("fusion"); // Qt5 baseName = QLatin1String("fusion"); // Qt5
} }
} }
ConsoleViewStyle *style = new ConsoleViewStyle(baseName); auto style = new ConsoleViewStyle(baseName);
setStyle(style); setStyle(style);
style->setParent(this); style->setParent(this);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -180,18 +180,18 @@ void ConsoleView::contextMenuEvent(QContextMenuEvent *event)
QModelIndex itemIndex = indexAt(event->pos()); QModelIndex itemIndex = indexAt(event->pos());
QMenu menu; QMenu menu;
QAction *copy = new QAction(tr("&Copy"), this); auto copy = new QAction(tr("&Copy"), this);
copy->setEnabled(itemIndex.isValid()); copy->setEnabled(itemIndex.isValid());
menu.addAction(copy); menu.addAction(copy);
QAction *show = new QAction(tr("&Show in Editor"), this); auto show = new QAction(tr("&Show in Editor"), this);
show->setEnabled(canShowItemInTextEditor(itemIndex)); show->setEnabled(canShowItemInTextEditor(itemIndex));
menu.addAction(show); menu.addAction(show);
menu.addSeparator(); menu.addSeparator();
QAction *clear = new QAction(tr("C&lear"), this); auto clear = new QAction(tr("C&lear"), this);
menu.addAction(clear); menu.addAction(clear);
QAction *a = menu.exec(event->globalPos()); QAction *a = menu.exec(event->globalPos());
if (a == 0) if (a == nullptr)
return; return;
if (a == copy) { if (a == copy) {
@@ -199,8 +199,8 @@ void ConsoleView::contextMenuEvent(QContextMenuEvent *event)
} else if (a == show) { } else if (a == show) {
onRowActivated(itemIndex); onRowActivated(itemIndex);
} else if (a == clear) { } else if (a == clear) {
QAbstractProxyModel *proxyModel = qobject_cast<QAbstractProxyModel *>(model()); auto proxyModel = qobject_cast<QAbstractProxyModel*>(model());
ConsoleItemModel *handler = qobject_cast<ConsoleItemModel *>( auto handler = qobject_cast<ConsoleItemModel*>(
proxyModel->sourceModel()); proxyModel->sourceModel());
handler->clear(); handler->clear();
} }

View File

@@ -44,12 +44,12 @@ public:
void populateFileFinder(); void populateFileFinder();
protected: protected:
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) override;
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e) override;
void drawBranches(QPainter *painter, const QRect &rect, void drawBranches(QPainter *painter, const QRect &rect,
const QModelIndex &index) const; const QModelIndex &index) const override;
void contextMenuEvent(QContextMenuEvent *event); void contextMenuEvent(QContextMenuEvent *event) override;
void focusInEvent(QFocusEvent *event); void focusInEvent(QFocusEvent *event) override;
private: private:
void onRowActivated(const QModelIndex &index); void onRowActivated(const QModelIndex &index);

View File

@@ -677,7 +677,7 @@ void DebuggerSettings::writeSettings() const
SavedAction *DebuggerSettings::item(int code) const SavedAction *DebuggerSettings::item(int code) const
{ {
QTC_ASSERT(m_items.value(code, 0), qDebug() << "CODE: " << code; return 0); QTC_ASSERT(m_items.value(code, 0), qDebug() << "CODE: " << code; return nullptr);
return m_items.value(code, 0); return m_items.value(code, 0);
} }

View File

@@ -36,8 +36,8 @@ namespace Utils { class SavedAction; }
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
typedef QMap<QString, QString> SourcePathMap; using SourcePathMap = QMap<QString, QString>;
typedef QVector<QPair<QRegExp, QString> > SourcePathRegExpMap; using SourcePathRegExpMap = QVector<QPair<QRegExp, QString> >;
// Global debugger options that are not stored as saved action. // Global debugger options that are not stored as saved action.
class GlobalDebuggerOptions class GlobalDebuggerOptions

View File

@@ -585,7 +585,7 @@ static QString cdbRemoteHelp()
} }
StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) : StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) :
QDialog(parent), m_okButton(0), m_lineEdit(new QLineEdit) QDialog(parent), m_lineEdit(new QLineEdit)
{ {
setWindowTitle(tr("Start a CDB Remote Session")); setWindowTitle(tr("Start a CDB Remote Session"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@@ -630,9 +630,7 @@ void StartRemoteCdbDialog::accept()
QDialog::accept(); QDialog::accept();
} }
StartRemoteCdbDialog::~StartRemoteCdbDialog() StartRemoteCdbDialog::~StartRemoteCdbDialog() = default;
{
}
void StartRemoteCdbDialog::textChanged(const QString &t) void StartRemoteCdbDialog::textChanged(const QString &t)
{ {
@@ -698,7 +696,7 @@ void AddressDialog::setAddress(quint64 a)
quint64 AddressDialog::address() const quint64 AddressDialog::address() const
{ {
return m_lineEdit->text().toULongLong(0, 16); return m_lineEdit->text().toULongLong(nullptr, 16);
} }
void AddressDialog::accept() void AddressDialog::accept()
@@ -820,7 +818,7 @@ public:
{ {
m_layout = new QGridLayout; m_layout = new QGridLayout;
m_layout->setColumnStretch(0, 2); m_layout->setColumnStretch(0, 2);
QVBoxLayout *vboxLayout = new QVBoxLayout; auto vboxLayout = new QVBoxLayout;
vboxLayout->addLayout(m_layout); vboxLayout->addLayout(m_layout);
vboxLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Ignored, vboxLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Ignored,
QSizePolicy::MinimumExpanding)); QSizePolicy::MinimumExpanding));
@@ -832,10 +830,10 @@ public:
{ {
const int row = m_layout->rowCount(); const int row = m_layout->rowCount();
int column = 0; int column = 0;
QButtonGroup *group = new QButtonGroup(this); auto group = new QButtonGroup(this);
m_layout->addWidget(new QLabel(type), row, column++); m_layout->addWidget(new QLabel(type), row, column++);
for (int i = -1; i != typeFormats.size(); ++i) { for (int i = -1; i != typeFormats.size(); ++i) {
QRadioButton *choice = new QRadioButton(this); auto choice = new QRadioButton(this);
choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset") choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset")
: WatchHandler::nameForFormat(typeFormats.at(i))); : WatchHandler::nameForFormat(typeFormats.at(i)));
m_layout->addWidget(choice, row, column++); m_layout->addWidget(choice, row, column++);
@@ -858,7 +856,7 @@ public:
buttonBox = new QDialogButtonBox(q); buttonBox = new QDialogButtonBox(q);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
QVBoxLayout *layout = new QVBoxLayout(q); auto layout = new QVBoxLayout(q);
layout->addWidget(tabs); layout->addWidget(tabs);
layout->addWidget(buttonBox); layout->addWidget(buttonBox);
q->setLayout(layout); q->setLayout(layout);
@@ -866,9 +864,9 @@ public:
void addPage(const QString &name) void addPage(const QString &name)
{ {
TypeFormatsDialogPage *page = new TypeFormatsDialogPage; auto page = new TypeFormatsDialogPage;
pages.append(page); pages.append(page);
QScrollArea *scroller = new QScrollArea; auto scroller = new QScrollArea;
scroller->setWidgetResizable(true); scroller->setWidgetResizable(true);
scroller->setWidget(page); scroller->setWidget(page);
scroller->setFrameStyle(QFrame::NoFrame); scroller->setFrameStyle(QFrame::NoFrame);

View File

@@ -120,7 +120,7 @@ private:
void textChanged(const QString &); void textChanged(const QString &);
void accept() override; void accept() override;
QPushButton *m_okButton; QPushButton *m_okButton = nullptr;
QLineEdit *m_lineEdit; QLineEdit *m_lineEdit;
}; };

View File

@@ -1002,12 +1002,12 @@ void DebuggerEngine::updateViews()
bool DebuggerEngine::isSlaveEngine() const bool DebuggerEngine::isSlaveEngine() const
{ {
return d->m_masterEngine != 0; return d->m_masterEngine != nullptr;
} }
bool DebuggerEngine::isMasterEngine() const bool DebuggerEngine::isMasterEngine() const
{ {
return d->m_masterEngine == 0; return d->m_masterEngine == nullptr;
} }
void DebuggerEngine::setMasterEngine(DebuggerEngine *masterEngine) void DebuggerEngine::setMasterEngine(DebuggerEngine *masterEngine)
@@ -1535,7 +1535,7 @@ void DebuggerEngine::updateMemoryViews()
void DebuggerEngine::openDisassemblerView(const Location &location) void DebuggerEngine::openDisassemblerView(const Location &location)
{ {
DisassemblerAgent *agent = new DisassemblerAgent(this); auto agent = new DisassemblerAgent(this);
agent->setLocation(location); agent->setLocation(location);
} }

View File

@@ -187,7 +187,7 @@ public:
class Location class Location
{ {
public: public:
Location() {} Location() = default;
Location(quint64 address) { m_address = address; } Location(quint64 address) { m_address = address; }
Location(const QString &file) { m_fileName = file; } Location(const QString &file) { m_fileName = file; }
Location(const QString &file, int line, bool marker = true) Location(const QString &file, int line, bool marker = true)
@@ -366,7 +366,7 @@ public:
bool isMasterEngine() const; bool isMasterEngine() const;
DebuggerEngine *masterEngine(); DebuggerEngine *masterEngine();
virtual DebuggerEngine *activeEngine() { return this; } virtual DebuggerEngine *activeEngine() { return this; }
virtual DebuggerEngine *cppEngine() { return 0; } virtual DebuggerEngine *cppEngine() { return nullptr; }
virtual bool canDisplayTooltip() const; virtual bool canDisplayTooltip() const;

View File

@@ -68,17 +68,11 @@ namespace Debugger {
// DebuggerItem // DebuggerItem
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
DebuggerItem::DebuggerItem() DebuggerItem::DebuggerItem() = default;
{
m_engineType = NoEngineType;
m_isAutoDetected = false;
}
DebuggerItem::DebuggerItem(const QVariant &id) DebuggerItem::DebuggerItem(const QVariant &id)
{ {
m_id = id; m_id = id;
m_engineType = NoEngineType;
m_isAutoDetected = false;
} }
DebuggerItem::DebuggerItem(const QVariantMap &data) DebuggerItem::DebuggerItem(const QVariantMap &data)

View File

@@ -111,10 +111,10 @@ private:
QVariant m_id; QVariant m_id;
QString m_unexpandedDisplayName; QString m_unexpandedDisplayName;
DebuggerEngineType m_engineType; DebuggerEngineType m_engineType = NoEngineType;
Utils::FileName m_command; Utils::FileName m_command;
Utils::FileName m_workingDirectory; Utils::FileName m_workingDirectory;
bool m_isAutoDetected; bool m_isAutoDetected = false;
QString m_autoDetectionSource; QString m_autoDetectionSource;
QString m_version; QString m_version;
QList<ProjectExplorer::Abi> m_abis; QList<ProjectExplorer::Abi> m_abis;

View File

@@ -144,7 +144,7 @@ public:
: m_item(item), m_orig(item), m_added(changed), m_changed(changed) : m_item(item), m_orig(item), m_added(changed), m_changed(changed)
{} {}
QVariant data(int column, int role) const QVariant data(int column, int role) const override
{ {
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
@@ -327,7 +327,7 @@ DebuggerItemConfigWidget::DebuggerItemConfigWidget()
m_abis = new QLineEdit(this); m_abis = new QLineEdit(this);
m_abis->setEnabled(false); m_abis->setEnabled(false);
QFormLayout *formLayout = new QFormLayout(this); auto formLayout = new QFormLayout(this);
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
formLayout->addRow(new QLabel(tr("Name:")), m_displayNameLineEdit); formLayout->addRow(new QLabel(tr("Name:")), m_displayNameLineEdit);
formLayout->addRow(m_cdbLabel); formLayout->addRow(m_cdbLabel);
@@ -620,7 +620,7 @@ void DebuggerOptionsPage::apply()
void DebuggerOptionsPage::finish() void DebuggerOptionsPage::finish()
{ {
delete m_configWidget; delete m_configWidget;
m_configWidget = 0; m_configWidget = nullptr;
d->m_model->cancel(); d->m_model->cancel();
} }

View File

@@ -64,8 +64,7 @@ namespace Internal {
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
DebuggerKitConfigWidget::DebuggerKitConfigWidget(Kit *workingCopy, const KitInformation *ki) DebuggerKitConfigWidget::DebuggerKitConfigWidget(Kit *workingCopy, const KitInformation *ki)
: KitConfigWidget(workingCopy, ki), : KitConfigWidget(workingCopy, ki)
m_ignoreChanges(false)
{ {
m_comboBox = new QComboBox; m_comboBox = new QComboBox;
m_comboBox->setEnabled(true); m_comboBox->setEnabled(true);

View File

@@ -72,7 +72,7 @@ private:
void updateComboBox(const QVariant &id); void updateComboBox(const QVariant &id);
bool m_isReadOnly; bool m_isReadOnly;
bool m_ignoreChanges; bool m_ignoreChanges = false;
QComboBox *m_comboBox; QComboBox *m_comboBox;
QPushButton *m_manageButton; QPushButton *m_manageButton;
}; };

View File

@@ -86,7 +86,7 @@ DebuggerMainWindow::DebuggerMainWindow()
DebuggerMainWindow::~DebuggerMainWindow() DebuggerMainWindow::~DebuggerMainWindow()
{ {
delete m_editorPlaceHolder; delete m_editorPlaceHolder;
m_editorPlaceHolder = 0; m_editorPlaceHolder = nullptr;
// As we have to setParent(0) on dock widget that are not selected, // As we have to setParent(0) on dock widget that are not selected,
// we keep track of all and make sure we don't leak any // we keep track of all and make sure we don't leak any
foreach (QDockWidget *dock, m_dockForDockId) { foreach (QDockWidget *dock, m_dockForDockId) {
@@ -312,7 +312,7 @@ void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId,
removeDockWidget(dockWidget); removeDockWidget(dockWidget);
dockWidget->hide(); dockWidget->hide();
// Prevent saveState storing the data of the wrong children. // Prevent saveState storing the data of the wrong children.
dockWidget->setParent(0); dockWidget->setParent(nullptr);
} }
ICore::removeAdditionalContext(Context(Id::fromName(m_currentPerspectiveId))); ICore::removeAdditionalContext(Context(Id::fromName(m_currentPerspectiveId)));
@@ -416,7 +416,7 @@ void DebuggerMainWindow::savePerspectiveHelper(const QByteArray &perspectiveId)
QDockWidget *DebuggerMainWindow::registerDockWidget(const QByteArray &dockId, QWidget *widget) QDockWidget *DebuggerMainWindow::registerDockWidget(const QByteArray &dockId, QWidget *widget)
{ {
QTC_ASSERT(!widget->objectName().isEmpty(), return 0); QTC_ASSERT(!widget->objectName().isEmpty(), return nullptr);
QDockWidget *dockWidget = addDockForWidget(widget); QDockWidget *dockWidget = addDockForWidget(widget);
m_dockForDockId[dockId] = dockWidget; m_dockForDockId[dockId] = dockWidget;
return dockWidget; return dockWidget;

View File

@@ -468,8 +468,8 @@ QAction *addCheckableAction(QMenu *menu, const QString &display, bool on, bool c
class DummyEngine : public DebuggerEngine class DummyEngine : public DebuggerEngine
{ {
public: public:
DummyEngine() {} DummyEngine() = default;
~DummyEngine() override {} ~DummyEngine() override = default;
void setupEngine() override {} void setupEngine() override {}
void runEngine() override {} void runEngine() override {}
@@ -486,7 +486,7 @@ bool DummyEngine::hasCapability(unsigned cap) const
// This can only be a first approximation of what to expect when running. // This can only be a first approximation of what to expect when running.
Project *project = ProjectTree::currentProject(); Project *project = ProjectTree::currentProject();
if (!project) if (!project)
return 0; return false;
Target *target = project->activeTarget(); Target *target = project->activeTarget();
QTC_ASSERT(target, return 0); QTC_ASSERT(target, return 0);
RunConfiguration *activeRc = target->activeRunConfiguration(); RunConfiguration *activeRc = target->activeRunConfiguration();
@@ -632,7 +632,7 @@ class DebuggerPluginPrivate : public QObject
public: public:
explicit DebuggerPluginPrivate(DebuggerPlugin *plugin); explicit DebuggerPluginPrivate(DebuggerPlugin *plugin);
~DebuggerPluginPrivate(); ~DebuggerPluginPrivate() override;
bool initialize(const QStringList &arguments, QString *errorMessage); bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized(); void extensionsInitialized();
@@ -640,7 +640,7 @@ public:
void doShutdown(); void doShutdown();
void connectEngine(DebuggerRunTool *runTool); void connectEngine(DebuggerRunTool *runTool);
void disconnectEngine() { connectEngine(0); } void disconnectEngine() { connectEngine(nullptr); }
DebuggerEngine *dummyEngine(); DebuggerEngine *dummyEngine();
void setThreadBoxContents(const QStringList &list, int index) void setThreadBoxContents(const QStringList &list, int index)
@@ -1842,7 +1842,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
{DOCKWIDGET_WATCHERS, m_watchersWindow, DOCKWIDGET_LOCALS_AND_INSPECTOR, Perspective::AddToTab, true, {DOCKWIDGET_WATCHERS, m_watchersWindow, DOCKWIDGET_LOCALS_AND_INSPECTOR, Perspective::AddToTab, true,
Qt::RightDockWidgetArea}, Qt::RightDockWidgetArea},
{DOCKWIDGET_OUTPUT, m_logWindow, {}, Perspective::AddToTab, false, Qt::TopDockWidgetArea}, {DOCKWIDGET_OUTPUT, m_logWindow, {}, Perspective::AddToTab, false, Qt::TopDockWidgetArea},
{DOCKWIDGET_BREAK, 0, {}, Perspective::Raise} {DOCKWIDGET_BREAK, nullptr, {}, Perspective::Raise}
}); }; }); };
Perspective *cppPerspective = createBasePerspective(); Perspective *cppPerspective = createBasePerspective();
@@ -1865,7 +1865,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
this, &DebuggerPluginPrivate::enableReverseDebuggingTriggered); this, &DebuggerPluginPrivate::enableReverseDebuggingTriggered);
setInitialState(); setInitialState();
connectEngine(0); connectEngine(nullptr);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged, connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &DebuggerPluginPrivate::onCurrentProjectChanged); this, &DebuggerPluginPrivate::onCurrentProjectChanged);
@@ -2066,12 +2066,12 @@ void DebuggerPluginPrivate::attachToUnstartedApplicationDialog()
RunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit, RunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
DeviceProcessItem process, bool contAfterAttach) DeviceProcessItem process, bool contAfterAttach)
{ {
QTC_ASSERT(kit, return 0); QTC_ASSERT(kit, return nullptr);
IDevice::ConstPtr device = DeviceKitInformation::device(kit); IDevice::ConstPtr device = DeviceKitInformation::device(kit);
QTC_ASSERT(device, return 0); QTC_ASSERT(device, return nullptr);
if (process.pid == 0) { if (process.pid == 0) {
AsynchronousMessageBox::warning(tr("Warning"), tr("Cannot attach to process with PID 0")); AsynchronousMessageBox::warning(tr("Warning"), tr("Cannot attach to process with PID 0"));
return 0; return nullptr;
} }
const Abi tcAbi = ToolChainKitInformation::targetAbi(kit); const Abi tcAbi = ToolChainKitInformation::targetAbi(kit);
@@ -2082,13 +2082,13 @@ RunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
tr("The process %1 is already under the control of a debugger.\n" tr("The process %1 is already under the control of a debugger.\n"
"%2 cannot attach to it.").arg(process.pid) "%2 cannot attach to it.").arg(process.pid)
.arg(Core::Constants::IDE_DISPLAY_NAME)); .arg(Core::Constants::IDE_DISPLAY_NAME));
return 0; return nullptr;
} }
if (device->type() != PE::DESKTOP_DEVICE_TYPE) { if (device->type() != PE::DESKTOP_DEVICE_TYPE) {
AsynchronousMessageBox::warning(tr("Not a Desktop Device Type"), AsynchronousMessageBox::warning(tr("Not a Desktop Device Type"),
tr("It is only possible to attach to a locally running process.")); tr("It is only possible to attach to a locally running process."));
return 0; return nullptr;
} }
auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE); auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
@@ -2208,8 +2208,8 @@ void DebuggerPluginPrivate::editorOpened(IEditor *editor)
void DebuggerPluginPrivate::updateBreakMenuItem(IEditor *editor) void DebuggerPluginPrivate::updateBreakMenuItem(IEditor *editor)
{ {
BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor); auto textEditor = qobject_cast<BaseTextEditor *>(editor);
m_breakAction->setEnabled(textEditor != 0); m_breakAction->setEnabled(textEditor != nullptr);
} }
void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget, void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
@@ -3049,7 +3049,7 @@ BreakHandler *breakHandler()
void showModuleSymbols(const QString &moduleName, const Symbols &symbols) void showModuleSymbols(const QString &moduleName, const Symbols &symbols)
{ {
QTreeWidget *w = new QTreeWidget; auto w = new QTreeWidget;
w->setUniformRowHeights(true); w->setUniformRowHeights(true);
w->setColumnCount(5); w->setColumnCount(5);
w->setRootIsDecorated(false); w->setRootIsDecorated(false);
@@ -3065,7 +3065,7 @@ void showModuleSymbols(const QString &moduleName, const Symbols &symbols)
w->setHeaderLabels(header); w->setHeaderLabels(header);
w->setWindowTitle(DebuggerPlugin::tr("Symbols in \"%1\"").arg(moduleName)); w->setWindowTitle(DebuggerPlugin::tr("Symbols in \"%1\"").arg(moduleName));
for (const Symbol &s : symbols) { for (const Symbol &s : symbols) {
QTreeWidgetItem *it = new QTreeWidgetItem; auto it = new QTreeWidgetItem;
it->setData(0, Qt::DisplayRole, s.name); it->setData(0, Qt::DisplayRole, s.name);
it->setData(1, Qt::DisplayRole, s.address); it->setData(1, Qt::DisplayRole, s.address);
it->setData(2, Qt::DisplayRole, s.state); it->setData(2, Qt::DisplayRole, s.state);
@@ -3078,7 +3078,7 @@ void showModuleSymbols(const QString &moduleName, const Symbols &symbols)
void showModuleSections(const QString &moduleName, const Sections &sections) void showModuleSections(const QString &moduleName, const Sections &sections)
{ {
QTreeWidget *w = new QTreeWidget; auto w = new QTreeWidget;
w->setUniformRowHeights(true); w->setUniformRowHeights(true);
w->setColumnCount(5); w->setColumnCount(5);
w->setRootIsDecorated(false); w->setRootIsDecorated(false);
@@ -3094,7 +3094,7 @@ void showModuleSections(const QString &moduleName, const Sections &sections)
w->setHeaderLabels(header); w->setHeaderLabels(header);
w->setWindowTitle(DebuggerPlugin::tr("Sections in \"%1\"").arg(moduleName)); w->setWindowTitle(DebuggerPlugin::tr("Sections in \"%1\"").arg(moduleName));
for (const Section &s : sections) { for (const Section &s : sections) {
QTreeWidgetItem *it = new QTreeWidgetItem; auto it = new QTreeWidgetItem;
it->setData(0, Qt::DisplayRole, s.name); it->setData(0, Qt::DisplayRole, s.name);
it->setData(1, Qt::DisplayRole, s.from); it->setData(1, Qt::DisplayRole, s.from);
it->setData(2, Qt::DisplayRole, s.to); it->setData(2, Qt::DisplayRole, s.to);
@@ -3109,13 +3109,13 @@ void DebuggerPluginPrivate::doShutdown()
{ {
m_shutdownTimer.stop(); m_shutdownTimer.stop();
delete m_mainWindow; delete m_mainWindow;
m_mainWindow = 0; m_mainWindow = nullptr;
delete m_modeWindow; delete m_modeWindow;
m_modeWindow = 0; m_modeWindow = nullptr;
delete m_mode; delete m_mode;
m_mode = 0; m_mode = nullptr;
emit m_plugin->asynchronousShutdownFinished(); emit m_plugin->asynchronousShutdownFinished();
} }
@@ -3234,7 +3234,7 @@ QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions()
is DebuggerCore, implemented in DebuggerPluginPrivate. is DebuggerCore, implemented in DebuggerPluginPrivate.
*/ */
static DebuggerPlugin *m_instance = 0; static DebuggerPlugin *m_instance = nullptr;
DebuggerPlugin::DebuggerPlugin() DebuggerPlugin::DebuggerPlugin()
{ {
@@ -3245,8 +3245,8 @@ DebuggerPlugin::DebuggerPlugin()
DebuggerPlugin::~DebuggerPlugin() DebuggerPlugin::~DebuggerPlugin()
{ {
delete dd; delete dd;
dd = 0; dd = nullptr;
m_instance = 0; m_instance = nullptr;
} }
DebuggerPlugin *DebuggerPlugin::instance() DebuggerPlugin *DebuggerPlugin::instance()
@@ -3294,7 +3294,7 @@ QObject *DebuggerPlugin::remoteCommand(const QStringList &options,
Q_UNUSED(workingDirectory); Q_UNUSED(workingDirectory);
Q_UNUSED(list); Q_UNUSED(list);
dd->remoteCommand(options); dd->remoteCommand(options);
return 0; return nullptr;
} }
void DebuggerPlugin::extensionsInitialized() void DebuggerPlugin::extensionsInitialized()
@@ -3405,7 +3405,7 @@ static BuildConfiguration::BuildType startupBuildType()
void showCannotStartDialog(const QString &text) void showCannotStartDialog(const QString &text)
{ {
QMessageBox *errorDialog = new QMessageBox(ICore::mainWindow()); auto errorDialog = new QMessageBox(ICore::mainWindow());
errorDialog->setAttribute(Qt::WA_DeleteOnClose); errorDialog->setAttribute(Qt::WA_DeleteOnClose);
errorDialog->setIcon(QMessageBox::Warning); errorDialog->setIcon(QMessageBox::Warning);
errorDialog->setWindowTitle(text); errorDialog->setWindowTitle(text);
@@ -3571,7 +3571,7 @@ class DebuggerUnitTests : public QObject
Q_OBJECT Q_OBJECT
public: public:
DebuggerUnitTests() {} DebuggerUnitTests() = default;
private slots: private slots:
void initTestCase(); void initTestCase();
@@ -3584,7 +3584,7 @@ private slots:
void testStateMachine(); void testStateMachine();
private: private:
CppTools::Tests::TemporaryCopiedDir *m_tmpDir = 0; CppTools::Tests::TemporaryCopiedDir *m_tmpDir = nullptr;
}; };
void DebuggerUnitTests::initTestCase() void DebuggerUnitTests::initTestCase()
@@ -3749,7 +3749,7 @@ void DebuggerUnitTests::testDebuggerMatching()
QFETCH(QString, target); QFETCH(QString, target);
QFETCH(int, result); QFETCH(int, result);
DebuggerItem::MatchLevel expectedLevel = static_cast<DebuggerItem::MatchLevel>(result); auto expectedLevel = static_cast<DebuggerItem::MatchLevel>(result);
QList<Abi> debuggerAbis; QList<Abi> debuggerAbis;
foreach (const QString &abi, debugger) foreach (const QString &abi, debugger)

View File

@@ -384,7 +384,7 @@ qulonglong GdbMi::toAddress() const
ba.chop(1); ba.chop(1);
if (ba.startsWith('*') || ba.startsWith('@')) if (ba.startsWith('*') || ba.startsWith('@'))
ba = ba.mid(1); ba = ba.mid(1);
return ba.toULongLong(0, 0); return ba.toULongLong(nullptr, 0);
} }
Utils::ProcessHandle GdbMi::toProcessHandle() const Utils::ProcessHandle GdbMi::toProcessHandle() const
@@ -574,13 +574,13 @@ QString decodeData(const QString &ba, const QString &encoding)
if (encoding == "empty") if (encoding == "empty")
return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<empty>"); return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<empty>");
if (encoding == "minimumitemcount") if (encoding == "minimumitemcount")
return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<at least %n items>", 0, ba.toInt()); return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<at least %n items>", nullptr, ba.toInt());
if (encoding == "undefined") if (encoding == "undefined")
return QLatin1String("Undefined"); return QLatin1String("Undefined");
if (encoding == "null") if (encoding == "null")
return QLatin1String("Null"); return QLatin1String("Null");
if (encoding == "itemcount") if (encoding == "itemcount")
return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<%n items>", 0, ba.toInt()); return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<%n items>", nullptr, ba.toInt());
if (encoding == "notaccessible") if (encoding == "notaccessible")
return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<not accessible>"); return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<not accessible>");
if (encoding == "optimizedout") if (encoding == "optimizedout")

View File

@@ -45,9 +45,9 @@ class DebuggerResponse;
class DebuggerCommand class DebuggerCommand
{ {
public: public:
typedef std::function<void(const DebuggerResponse &)> Callback; using Callback = std::function<void (const DebuggerResponse &)>;
DebuggerCommand() {} DebuggerCommand() = default;
DebuggerCommand(const QString &f) : function(f) {} DebuggerCommand(const QString &f) : function(f) {}
DebuggerCommand(const QString &f, const QJsonValue &a) : function(f), args(a) {} DebuggerCommand(const QString &f, const QJsonValue &a) : function(f), args(a) {}
DebuggerCommand(const QString &f, int fl) : function(f), flags(fl) {} DebuggerCommand(const QString &f, int fl) : function(f), flags(fl) {}
@@ -109,7 +109,7 @@ private:
class DebuggerCommandSequence class DebuggerCommandSequence
{ {
public: public:
DebuggerCommandSequence() {} DebuggerCommandSequence() = default;
bool isEmpty() const { return m_commands.isEmpty(); } bool isEmpty() const { return m_commands.isEmpty(); }
bool wantContinue() const { return m_continue; } bool wantContinue() const { return m_continue; }
const QList<DebuggerCommand> &commands() const { return m_commands; } const QList<DebuggerCommand> &commands() const { return m_commands; }
@@ -127,7 +127,7 @@ public:
class GdbMi class GdbMi
{ {
public: public:
GdbMi() : m_type(Invalid) {} GdbMi() = default;
QString m_name; QString m_name;
QString m_data; QString m_data;
@@ -135,7 +135,7 @@ public:
enum Type { Invalid, Const, Tuple, List }; enum Type { Invalid, Const, Tuple, List };
Type m_type; Type m_type = Invalid;
Type type() const { return m_type; } Type type() const { return m_type; }
const QString &name() const { return m_name; } const QString &name() const { return m_name; }
@@ -189,12 +189,12 @@ enum ResultClass
class DebuggerResponse class DebuggerResponse
{ {
public: public:
DebuggerResponse() : token(-1), resultClass(ResultUnknown) {} DebuggerResponse() = default;
QString toString() const; QString toString() const;
static QString stringFromResultClass(ResultClass resultClass); static QString stringFromResultClass(ResultClass resultClass);
int token; int token = -1;
ResultClass resultClass; ResultClass resultClass = ResultUnknown;
GdbMi data; GdbMi data;
QString logStreamOutput; QString logStreamOutput;
QString consoleStreamOutput; QString consoleStreamOutput;
@@ -224,7 +224,7 @@ public:
DateTimeInternal, DateTimeInternal,
}; };
DebuggerEncoding() {} DebuggerEncoding() = default;
explicit DebuggerEncoding(const QString &data); explicit DebuggerEncoding(const QString &data);
QString toString() const; QString toString() const;

View File

@@ -69,9 +69,9 @@ class DebuggerRunConfigWidget : public RunConfigWidget
public: public:
explicit DebuggerRunConfigWidget(DebuggerRunConfigurationAspect *aspect); explicit DebuggerRunConfigWidget(DebuggerRunConfigurationAspect *aspect);
QString displayName() const { return tr("Debugger Settings"); } QString displayName() const override { return tr("Debugger Settings"); }
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event) override;
void update(); void update();
void useCppDebuggerClicked(bool on); void useCppDebuggerClicked(bool on);

View File

@@ -932,7 +932,7 @@ DebuggerRunTool::~DebuggerRunTool()
disconnect(); disconnect();
if (m_engine) { if (m_engine) {
DebuggerEngine *engine = m_engine; DebuggerEngine *engine = m_engine;
m_engine = 0; m_engine = nullptr;
engine->disconnect(); engine->disconnect();
delete engine; delete engine;
} }
@@ -975,9 +975,7 @@ GdbServerPortsGatherer::GdbServerPortsGatherer(RunControl *runControl)
m_device = runControl->device(); m_device = runControl->device();
} }
GdbServerPortsGatherer::~GdbServerPortsGatherer() GdbServerPortsGatherer::~GdbServerPortsGatherer() = default;
{
}
Port GdbServerPortsGatherer::gdbServerPort() const Port GdbServerPortsGatherer::gdbServerPort() const
{ {
@@ -1016,9 +1014,7 @@ GdbServerRunner::GdbServerRunner(RunControl *runControl, GdbServerPortsGatherer
addStartDependency(m_portsGatherer); addStartDependency(m_portsGatherer);
} }
GdbServerRunner::~GdbServerRunner() GdbServerRunner::~GdbServerRunner() = default;
{
}
void GdbServerRunner::setRunnable(const Runnable &runnable) void GdbServerRunner::setRunnable(const Runnable &runnable)
{ {

View File

@@ -50,8 +50,8 @@ enum { SourceColumn, TargetColumn, ColumnCount };
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
typedef QPair<QString, QString> Mapping; using Mapping = QPair<QString, QString>;
typedef DebuggerSourcePathMappingWidget::SourcePathMap SourcePathMap; using SourcePathMap = DebuggerSourcePathMappingWidget::SourcePathMap;
// Qt's various build paths for unpatched versions. // Qt's various build paths for unpatched versions.
QStringList qtBuildPaths() QStringList qtBuildPaths()
@@ -166,9 +166,9 @@ void SourcePathMappingModel::setSourcePathMap(const SourcePathMap &m)
void SourcePathMappingModel::addRawMapping(const QString &source, const QString &target) void SourcePathMappingModel::addRawMapping(const QString &source, const QString &target)
{ {
QList<QStandardItem *> items; QList<QStandardItem *> items;
QStandardItem *sourceItem = new QStandardItem(source); auto sourceItem = new QStandardItem(source);
sourceItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); sourceItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
QStandardItem *targetItem = new QStandardItem(target); auto targetItem = new QStandardItem(target);
targetItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); targetItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
items << sourceItem << targetItem; items << sourceItem << targetItem;
appendRow(items); appendRow(items);

View File

@@ -50,7 +50,7 @@ class DebuggerSourcePathMappingWidget : public QGroupBox
Q_OBJECT Q_OBJECT
public: public:
typedef QMap<QString, QString> SourcePathMap; using SourcePathMap = QMap<QString, QString>;
explicit DebuggerSourcePathMappingWidget(QWidget *parent = nullptr); explicit DebuggerSourcePathMappingWidget(QWidget *parent = nullptr);

View File

@@ -139,9 +139,9 @@ public:
: m_target(target), m_moveStartPos(-1, -1), active(false) : m_target(target), m_moveStartPos(-1, -1), active(false)
{} {}
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event) override;
public: public:
QWidget *m_target; QWidget *m_target;
@@ -192,13 +192,13 @@ void DraggableLabel::mouseMoveEvent(QMouseEvent * event)
class ToolTipWatchItem : public TreeItem class ToolTipWatchItem : public TreeItem
{ {
public: public:
ToolTipWatchItem() : expandable(false) {} ToolTipWatchItem() = default;
ToolTipWatchItem(TreeItem *item); ToolTipWatchItem(TreeItem *item);
bool hasChildren() const { return expandable; } bool hasChildren() const override { return expandable; }
bool canFetchMore() const { return childCount() == 0 && expandable && model(); } bool canFetchMore() const override { return childCount() == 0 && expandable && model(); }
void fetchMore() {} void fetchMore() override {}
QVariant data(int column, int role) const; QVariant data(int column, int role) const override;
public: public:
QString name; QString name;
@@ -206,7 +206,7 @@ public:
QString type; QString type;
QString expression; QString expression;
QColor valueColor; QColor valueColor;
bool expandable; bool expandable = false;
QString iname; QString iname;
}; };
@@ -257,7 +257,7 @@ public:
m_expandedINames.remove(idx.data(LocalsINameRole).toString()); m_expandedINames.remove(idx.data(LocalsINameRole).toString());
} }
void fetchMore(const QModelIndex &idx) void fetchMore(const QModelIndex &idx) override
{ {
if (!idx.isValid()) if (!idx.isValid())
return; return;
@@ -379,9 +379,9 @@ public:
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
} }
QSize sizeHint() const { return m_size; } QSize sizeHint() const override { return m_size; }
int sizeHintForColumn(int column) const int sizeHintForColumn(int column) const override
{ {
return QTreeView::sizeHintForColumn(column); return QTreeView::sizeHintForColumn(column);
} }
@@ -410,19 +410,19 @@ class DebuggerToolTipWidget : public QWidget
public: public:
DebuggerToolTipWidget(); DebuggerToolTipWidget();
~DebuggerToolTipWidget() { DEBUG("DESTROY DEBUGGERTOOLTIP WIDGET"); } ~DebuggerToolTipWidget() override { DEBUG("DESTROY DEBUGGERTOOLTIP WIDGET"); }
void closeEvent(QCloseEvent *) void closeEvent(QCloseEvent *) override
{ {
DEBUG("CLOSE DEBUGGERTOOLTIP WIDGET"); DEBUG("CLOSE DEBUGGERTOOLTIP WIDGET");
} }
void enterEvent(QEvent *) void enterEvent(QEvent *) override
{ {
DEBUG("ENTER DEBUGGERTOOLTIP WIDGET"); DEBUG("ENTER DEBUGGERTOOLTIP WIDGET");
} }
void leaveEvent(QEvent *) void leaveEvent(QEvent *) override
{ {
DEBUG("LEAVE DEBUGGERTOOLTIP WIDGET"); DEBUG("LEAVE DEBUGGERTOOLTIP WIDGET");
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor())
@@ -826,7 +826,7 @@ void DebuggerToolTipHolder::destroy()
{ {
if (widget) { if (widget) {
widget->close(); widget->close();
widget = 0; widget = nullptr;
} }
} }
@@ -1224,7 +1224,7 @@ static void slotTooltipOverrideRequested
static void slotEditorOpened(IEditor *e) static void slotEditorOpened(IEditor *e)
{ {
// Move tooltip along when scrolled. // Move tooltip along when scrolled.
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(e)) { if (auto textEditor = qobject_cast<BaseTextEditor *>(e)) {
TextEditorWidget *widget = textEditor->editorWidget(); TextEditorWidget *widget = textEditor->editorWidget();
QObject::connect(widget->verticalScrollBar(), &QScrollBar::valueChanged, QObject::connect(widget->verticalScrollBar(), &QScrollBar::valueChanged,
&DebuggerToolTipManager::updateVisibleToolTips); &DebuggerToolTipManager::updateVisibleToolTips);
@@ -1262,7 +1262,7 @@ void DebuggerToolTipManager::leavingDebugMode()
if (QWidget *topLevel = ICore::mainWindow()->topLevelWidget()) if (QWidget *topLevel = ICore::mainWindow()->topLevelWidget())
topLevel->removeEventFilter(this); topLevel->removeEventFilter(this);
foreach (IEditor *e, DocumentModel::editorsForOpenedDocuments()) { foreach (IEditor *e, DocumentModel::editorsForOpenedDocuments()) {
if (BaseTextEditor *toolTipEditor = qobject_cast<BaseTextEditor *>(e)) { if (auto toolTipEditor = qobject_cast<BaseTextEditor *>(e)) {
toolTipEditor->editorWidget()->verticalScrollBar()->disconnect(this); toolTipEditor->editorWidget()->verticalScrollBar()->disconnect(this);
toolTipEditor->disconnect(this); toolTipEditor->disconnect(this);
} }
@@ -1289,7 +1289,7 @@ bool DebuggerToolTipManager::eventFilter(QObject *o, QEvent *e)
return false; return false;
switch (e->type()) { switch (e->type()) {
case QEvent::Move: { // Move along with parent (toplevel) case QEvent::Move: { // Move along with parent (toplevel)
const QMoveEvent *me = static_cast<const QMoveEvent *>(e); const auto me = static_cast<const QMoveEvent *>(e);
const QPoint dist = me->pos() - me->oldPos(); const QPoint dist = me->pos() - me->oldPos();
purgeClosedToolTips(); purgeClosedToolTips();
foreach (DebuggerToolTipHolder *tooltip, m_tooltips) { foreach (DebuggerToolTipHolder *tooltip, m_tooltips) {
@@ -1299,7 +1299,7 @@ bool DebuggerToolTipManager::eventFilter(QObject *o, QEvent *e)
break; break;
} }
case QEvent::WindowStateChange: { // Hide/Show along with parent (toplevel) case QEvent::WindowStateChange: { // Hide/Show along with parent (toplevel)
const QWindowStateChangeEvent *se = static_cast<const QWindowStateChangeEvent *>(e); const auto se = static_cast<const QWindowStateChangeEvent *>(e);
const bool wasMinimized = se->oldState() & Qt::WindowMinimized; const bool wasMinimized = se->oldState() & Qt::WindowMinimized;
const bool isMinimized = static_cast<const QWidget *>(o)->windowState() & Qt::WindowMinimized; const bool isMinimized = static_cast<const QWidget *>(o)->windowState() & Qt::WindowMinimized;
if (wasMinimized ^ isMinimized) { if (wasMinimized ^ isMinimized) {

View File

@@ -67,7 +67,7 @@ public:
bool isCppEditor; bool isCppEditor;
}; };
typedef QList<DebuggerToolTipContext> DebuggerToolTipContexts; using DebuggerToolTipContexts = QList<DebuggerToolTipContext>;
class DebuggerToolTipManager : public QObject class DebuggerToolTipManager : public QObject
{ {

View File

@@ -72,8 +72,8 @@ public:
setPriority(TextMark::NormalPriority); setPriority(TextMark::NormalPriority);
} }
bool isClickable() const { return true; } bool isClickable() const override { return true; }
void clicked() { m_bp.removeBreakpoint(); } void clicked() override { m_bp.removeBreakpoint(); }
public: public:
Breakpoint m_bp; Breakpoint m_bp;
@@ -88,13 +88,13 @@ public:
class FrameKey class FrameKey
{ {
public: public:
FrameKey() : startAddress(0), endAddress(0) {} FrameKey() = default;
inline bool matches(const Location &loc) const; inline bool matches(const Location &loc) const;
QString functionName; QString functionName;
QString fileName; QString fileName;
quint64 startAddress; quint64 startAddress = 0;
quint64 endAddress; quint64 endAddress = 0;
}; };
bool FrameKey::matches(const Location &loc) const bool FrameKey::matches(const Location &loc) const
@@ -105,7 +105,7 @@ bool FrameKey::matches(const Location &loc) const
&& loc.functionName() == functionName; && loc.functionName() == functionName;
} }
typedef QPair<FrameKey, DisassemblerLines> CacheEntry; using CacheEntry = QPair<FrameKey, DisassemblerLines>;
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@@ -134,7 +134,7 @@ public:
}; };
DisassemblerAgentPrivate::DisassemblerAgentPrivate(DebuggerEngine *engine) DisassemblerAgentPrivate::DisassemblerAgentPrivate(DebuggerEngine *engine)
: document(0), : document(nullptr),
engine(engine), engine(engine),
locationMark(engine, Utils::FileName(), 0), locationMark(engine, Utils::FileName(), 0),
mimeType("text/x-qtcreator-generic-asm"), mimeType("text/x-qtcreator-generic-asm"),
@@ -144,7 +144,7 @@ DisassemblerAgentPrivate::DisassemblerAgentPrivate(DebuggerEngine *engine)
DisassemblerAgentPrivate::~DisassemblerAgentPrivate() DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
{ {
EditorManager::closeDocuments(QList<IDocument *>() << document); EditorManager::closeDocuments(QList<IDocument *>() << document);
document = 0; document = nullptr;
qDeleteAll(breakpointMarks); qDeleteAll(breakpointMarks);
} }
@@ -183,7 +183,7 @@ DisassemblerAgent::DisassemblerAgent(DebuggerEngine *engine)
DisassemblerAgent::~DisassemblerAgent() DisassemblerAgent::~DisassemblerAgent()
{ {
delete d; delete d;
d = 0; d = nullptr;
} }
int DisassemblerAgent::indexOf(const Location &loc) const int DisassemblerAgent::indexOf(const Location &loc) const
@@ -261,7 +261,7 @@ void DisassemblerAgentPrivate::configureMimeType()
Utils::MimeType mtype = Utils::mimeTypeForName(mimeType); Utils::MimeType mtype = Utils::mimeTypeForName(mimeType);
if (mtype.isValid()) { if (mtype.isValid()) {
foreach (IEditor *editor, DocumentModel::editorsForDocument(document)) foreach (IEditor *editor, DocumentModel::editorsForDocument(document))
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) if (auto widget = qobject_cast<TextEditorWidget *>(editor->widget()))
widget->configureGenericHighlighter(); widget->configureGenericHighlighter();
} else { } else {
qWarning("Assembler mimetype '%s' not found.", qPrintable(mimeType)); qWarning("Assembler mimetype '%s' not found.", qPrintable(mimeType));
@@ -309,7 +309,7 @@ void DisassemblerAgent::setContentsToDocument(const DisassemblerLines &contents)
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
&titlePattern); &titlePattern);
QTC_ASSERT(editor, return); QTC_ASSERT(editor, return);
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) { if (auto widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
widget->setReadOnly(true); widget->setReadOnly(true);
widget->setRequestMarkEnabled(true); widget->setRequestMarkEnabled(true);
} }
@@ -350,7 +350,7 @@ void DisassemblerAgent::updateLocationMarker()
// Center cursor. // Center cursor.
if (EditorManager::currentDocument() == d->document) if (EditorManager::currentDocument() == d->document)
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(EditorManager::currentEditor())) if (auto textEditor = qobject_cast<BaseTextEditor *>(EditorManager::currentEditor()))
textEditor->gotoLine(lineNumber); textEditor->gotoLine(lineNumber);
} }

View File

@@ -189,12 +189,12 @@ void DisassemblerLines::appendUnparsed(const QString &unparsed)
m_lastFunction = function; m_lastFunction = function;
} }
} }
dl.address = address.left(pos1 - 1).toULongLong(0, 0); dl.address = address.left(pos1 - 1).toULongLong(nullptr, 0);
dl.function = m_lastFunction; dl.function = m_lastFunction;
dl.offset = address.mid(pos2).toUInt(); dl.offset = address.mid(pos2).toUInt();
} else { } else {
// Plain data like "0x0000cd64:\tadd\tlr, pc, lr\n" // Plain data like "0x0000cd64:\tadd\tlr, pc, lr\n"
dl.address = address.toULongLong(0, 0); dl.address = address.toULongLong(nullptr, 0);
dl.function = m_lastFunction; dl.function = m_lastFunction;
dl.offset = 0; dl.offset = 0;
} }

View File

@@ -40,7 +40,7 @@ namespace Internal {
class DisassemblerLine class DisassemblerLine
{ {
public: public:
DisassemblerLine() : address(0), offset(0), lineNumber(0), hunk(0) {} DisassemblerLine() = default;
bool isAssembler() const { return address != 0; } bool isAssembler() const { return address != 0; }
bool isCode() const { return lineNumber != 0; } bool isCode() const { return lineNumber != 0; }
bool isComment() const { return lineNumber == 0 && address == 0; } bool isComment() const { return lineNumber == 0 && address == 0; }
@@ -48,21 +48,21 @@ public:
void fromString(const QString &unparsed); void fromString(const QString &unparsed);
public: public:
quint64 address; // (ass) Address of instruction in memory/in binary. quint64 address = 0; // (ass) Address of instruction in memory/in binary.
QString function; // (ass) Function to which current instruction belongs. QString function; // (ass) Function to which current instruction belongs.
QString fileName; // (src) Source file QString fileName; // (src) Source file
uint offset; // (ass) Offset of instruction in relation to current function. uint offset = 0; // (ass) Offset of instruction in relation to current function.
uint lineNumber; // (src) Line number in source. uint lineNumber = 0; // (src) Line number in source.
uint hunk; // (src) Number of hunk if source line was split uint hunk = 0; // (src) Number of hunk if source line was split
QByteArray rawData; // (ass) Raw bytes of the instruction QByteArray rawData; // (ass) Raw bytes of the instruction
QString data; // (ass) Instruction text, (src) source text, (cmt) arbitrary. QString data; // (ass) Instruction text, (src) source text, (cmt) arbitrary.
QString bytes; // (ass) The instruction in raw bytes QString bytes; // (ass) The instruction in raw bytes
}; };
class DisassemblerLines class DisassemblerLines
{ {
public: public:
DisassemblerLines() : m_bytesLength(0) {} DisassemblerLines() = default;
bool coversAddress(quint64 address) const; bool coversAddress(quint64 address) const;
void appendUnparsed(const QString &line); void appendUnparsed(const QString &line);
@@ -84,7 +84,7 @@ public:
private: private:
QString m_lastFunction; QString m_lastFunction;
int m_bytesLength; int m_bytesLength = 0;
QVector<DisassemblerLine> m_data; QVector<DisassemblerLine> m_data;
QHash<quint64, int> m_rowCache; QHash<quint64, int> m_rowCache;
}; };

View File

@@ -192,10 +192,10 @@ static QString msgWinException(const QString &data, unsigned *exCodeIn = nullptr
const int addressPos = blankPos != -1 ? data.indexOf("0x", blankPos + 1) : -1; const int addressPos = blankPos != -1 ? data.indexOf("0x", blankPos + 1) : -1;
if (addressPos < 0) if (addressPos < 0)
return GdbEngine::tr("An exception was triggered."); return GdbEngine::tr("An exception was triggered.");
const unsigned exCode = data.mid(exCodePos, blankPos - exCodePos).toUInt(0, 0); const unsigned exCode = data.mid(exCodePos, blankPos - exCodePos).toUInt(nullptr, 0);
if (exCodeIn) if (exCodeIn)
*exCodeIn = exCode; *exCodeIn = exCode;
const quint64 address = data.mid(addressPos).trimmed().toULongLong(0, 0); const quint64 address = data.mid(addressPos).trimmed().toULongLong(nullptr, 0);
QString rc; QString rc;
QTextStream str(&rc); QTextStream str(&rc);
str << GdbEngine::tr("An exception was triggered:") << ' '; str << GdbEngine::tr("An exception was triggered:") << ' ';
@@ -841,7 +841,7 @@ void GdbEngine::commandTimeout()
"to a command within %n seconds. This could mean it is stuck " "to a command within %n seconds. This could mean it is stuck "
"in an endless loop or taking longer than expected to perform " "in an endless loop or taking longer than expected to perform "
"the operation.\nYou can choose between waiting " "the operation.\nYou can choose between waiting "
"longer or aborting debugging.", 0, timeOut / 1000); "longer or aborting debugging.", nullptr, timeOut / 1000);
QMessageBox *mb = showMessageBox(QMessageBox::Critical, QMessageBox *mb = showMessageBox(QMessageBox::Critical,
tr("GDB Not Responding"), msg, tr("GDB Not Responding"), msg,
QMessageBox::Ok | QMessageBox::Cancel); QMessageBox::Ok | QMessageBox::Cancel);
@@ -1008,7 +1008,7 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response)
if (m_commandsDoneCallback && m_commandForToken.isEmpty()) { if (m_commandsDoneCallback && m_commandForToken.isEmpty()) {
showMessage("ALL COMMANDS DONE; INVOKING CALLBACK"); showMessage("ALL COMMANDS DONE; INVOKING CALLBACK");
CommandsDoneCallback cont = m_commandsDoneCallback; CommandsDoneCallback cont = m_commandsDoneCallback;
m_commandsDoneCallback = 0; m_commandsDoneCallback = nullptr;
if (response->resultClass != ResultRunning) //only start if the thing is not already running if (response->resultClass != ResultRunning) //only start if the thing is not already running
(this->*cont)(); (this->*cont)();
} else { } else {
@@ -1408,7 +1408,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
const GdbMi wpt = data["wpt"]; const GdbMi wpt = data["wpt"];
const BreakpointResponseId rid(wpt["number"].data()); const BreakpointResponseId rid(wpt["number"].data());
const Breakpoint bp = breakHandler()->findBreakpointByResponseId(rid); const Breakpoint bp = breakHandler()->findBreakpointByResponseId(rid);
const quint64 bpAddress = wpt["exp"].data().mid(1).toULongLong(0, 0); const quint64 bpAddress = wpt["exp"].data().mid(1).toULongLong(nullptr, 0);
QString msg; QString msg;
if (bp.type() == WatchpointAtExpression) if (bp.type() == WatchpointAtExpression)
msg = bp.msgWatchpointByExpressionTriggered(rid.majorPart(), bp.expression()); msg = bp.msgWatchpointByExpressionTriggered(rid.majorPart(), bp.expression());
@@ -2141,7 +2141,7 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
QString what = bkpt["what"].data(); QString what = bkpt["what"].data();
if (what.startsWith("*0x")) { if (what.startsWith("*0x")) {
response.type = WatchpointAtAddress; response.type = WatchpointAtAddress;
response.address = what.mid(1).toULongLong(0, 0); response.address = what.mid(1).toULongLong(nullptr, 0);
} else { } else {
response.type = WatchpointAtExpression; response.type = WatchpointAtExpression;
response.expression = what; response.expression = what;
@@ -2270,7 +2270,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, Breakpoint b
br.id = BreakpointResponseId(wpt["number"].data()); br.id = BreakpointResponseId(wpt["number"].data());
QString exp = wpt["exp"].data(); QString exp = wpt["exp"].data();
if (exp.startsWith('*')) if (exp.startsWith('*'))
br.address = exp.mid(1).toULongLong(0, 0); br.address = exp.mid(1).toULongLong(nullptr, 0);
bp.setResponse(br); bp.setResponse(br);
QTC_CHECK(!bp.needsChange()); QTC_CHECK(!bp.needsChange());
bp.notifyBreakpointInsertOk(); bp.notifyBreakpointInsertOk();
@@ -2282,7 +2282,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, Breakpoint b
const QString address = ba.mid(end + 2).trimmed(); const QString address = ba.mid(end + 2).trimmed();
br.id = BreakpointResponseId(ba.mid(begin, end - begin)); br.id = BreakpointResponseId(ba.mid(begin, end - begin));
if (address.startsWith('*')) if (address.startsWith('*'))
br.address = address.mid(1).toULongLong(0, 0); br.address = address.mid(1).toULongLong(nullptr, 0);
bp.setResponse(br); bp.setResponse(br);
QTC_CHECK(!bp.needsChange()); QTC_CHECK(!bp.needsChange());
bp.notifyBreakpointInsertOk(); bp.notifyBreakpointInsertOk();
@@ -2905,7 +2905,7 @@ void GdbEngine::handleModulesList(const DebuggerResponse &response)
module.symbolsRead = (item["state"].data() == "Y") module.symbolsRead = (item["state"].data() == "Y")
? Module::ReadOk : Module::ReadFailed; ? Module::ReadOk : Module::ReadFailed;
module.startAddress = module.startAddress =
item["loaded_addr"].data().toULongLong(0, 0); item["loaded_addr"].data().toULongLong(nullptr, 0);
module.endAddress = 0; // FIXME: End address not easily available. module.endAddress = 0; // FIXME: End address not easily available.
handler->updateModule(module); handler->updateModule(module);
} }
@@ -3409,7 +3409,7 @@ void GdbEngine::assignValueInDebugger(WatchItem *item,
class MemoryAgentCookie class MemoryAgentCookie
{ {
public: public:
MemoryAgentCookie() {} MemoryAgentCookie() = default;
QByteArray *accumulator = nullptr; // Shared between split request. Last one cleans up. QByteArray *accumulator = nullptr; // Shared between split request. Last one cleans up.
uint *pendingRequests = nullptr; // Shared between split request. Last one cleans up. uint *pendingRequests = nullptr; // Shared between split request. Last one cleans up.
@@ -3503,7 +3503,7 @@ void GdbEngine::handleFetchMemory(const DebuggerResponse &response, MemoryAgentC
class DisassemblerAgentCookie class DisassemblerAgentCookie
{ {
public: public:
DisassemblerAgentCookie() : agent(0) {} DisassemblerAgentCookie() : agent(nullptr) {}
DisassemblerAgentCookie(DisassemblerAgent *agent_) : agent(agent_) {} DisassemblerAgentCookie(DisassemblerAgent *agent_) : agent(agent_) {}
public: public:
@@ -3594,7 +3594,7 @@ void GdbEngine::fetchDisassemblerByCliRangePlain(const DisassemblerAgentCookie &
struct LineData struct LineData
{ {
LineData() {} LineData() = default;
LineData(int i, int f) : index(i), function(f) {} LineData(int i, int f) : index(i), function(f) {}
int index; int index;
int function; int function;
@@ -3611,7 +3611,7 @@ bool GdbEngine::handleCliDisassemblerResult(const QString &output, DisassemblerA
QVector<DisassemblerLine> lines = dlines.data(); QVector<DisassemblerLine> lines = dlines.data();
typedef QMap<quint64, LineData> LineMap; using LineMap = QMap<quint64, LineData>;
LineMap lineMap; LineMap lineMap;
int currentFunction = -1; int currentFunction = -1;
for (int i = 0, n = lines.size(); i != n; ++i) { for (int i = 0, n = lines.size(); i != n; ++i) {
@@ -3983,7 +3983,7 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, Id settingsIdHint)
void GdbEngine::prepareForRestart() void GdbEngine::prepareForRestart()
{ {
m_rerunPending = false; m_rerunPending = false;
m_commandsDoneCallback = 0; m_commandsDoneCallback = nullptr;
m_commandForToken.clear(); m_commandForToken.clear();
m_flagsForToken.clear(); m_flagsForToken.clear();
} }
@@ -4003,7 +4003,7 @@ void GdbEngine::handleInferiorPrepared()
if (m_commandForToken.isEmpty()) { if (m_commandForToken.isEmpty()) {
finishInferiorSetup(); finishInferiorSetup();
} else { } else {
QTC_CHECK(m_commandsDoneCallback == 0); QTC_CHECK(m_commandsDoneCallback == nullptr);
m_commandsDoneCallback = &GdbEngine::finishInferiorSetup; m_commandsDoneCallback = &GdbEngine::finishInferiorSetup;
} }
} }
@@ -4503,7 +4503,7 @@ void GdbEngine::shutdownEngine()
CHECK_STATE(EngineShutdownRequested); CHECK_STATE(EngineShutdownRequested);
showMessage(QString("INITIATE GDBENGINE SHUTDOWN, PROC STATE: %1").arg(m_gdbProc.state())); showMessage(QString("INITIATE GDBENGINE SHUTDOWN, PROC STATE: %1").arg(m_gdbProc.state()));
m_commandsDoneCallback = 0; m_commandsDoneCallback = nullptr;
switch (m_gdbProc.state()) { switch (m_gdbProc.state()) {
case QProcess::Running: { case QProcess::Running: {
if (runParameters().closeMode == KillAndExitMonitorAtClose) if (runParameters().closeMode == KillAndExitMonitorAtClose)

View File

@@ -159,7 +159,7 @@ private: ////////// General Interface //////////
int m_oldestAcceptableToken = -1; int m_oldestAcceptableToken = -1;
int m_nonDiscardableCount = 0; int m_nonDiscardableCount = 0;
typedef void (GdbEngine::*CommandsDoneCallback)(); using CommandsDoneCallback = void (GdbEngine::*)();
// This function is called after all previous responses have been received. // This function is called after all previous responses have been received.
CommandsDoneCallback m_commandsDoneCallback = nullptr; CommandsDoneCallback m_commandsDoneCallback = nullptr;

View File

@@ -70,9 +70,9 @@ class GdbOptionsPage : public Core::IOptionsPage
public: public:
GdbOptionsPage(); GdbOptionsPage();
QWidget *widget(); QWidget *widget() override;
void apply(); void apply() override;
void finish(); void finish() override;
private: private:
QPointer<GdbOptionsPageWidget> m_widget; QPointer<GdbOptionsPageWidget> m_widget;
@@ -396,9 +396,9 @@ class GdbOptionsPage2 : public Core::IOptionsPage
public: public:
GdbOptionsPage2(); GdbOptionsPage2();
QWidget *widget(); QWidget *widget() override;
void apply(); void apply() override;
void finish(); void finish() override;
private: private:
QPointer<GdbOptionsPageWidget2> m_widget; QPointer<GdbOptionsPageWidget2> m_widget;

View File

@@ -49,7 +49,7 @@ class ImageWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
ImageWidget() {} ImageWidget() = default;
void setImage(const QImage &image); void setImage(const QImage &image);
const QImage &image() const { return m_image; } const QImage &image() const { return m_image; }
@@ -58,8 +58,8 @@ signals:
void clicked(const QString &message); void clicked(const QString &message);
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *) override;
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(QMouseEvent *ev) override;
private: private:
QImage m_image; QImage m_image;

View File

@@ -64,7 +64,7 @@ class PlotViewer : public QWidget
public: public:
explicit PlotViewer(QWidget *parent = nullptr); explicit PlotViewer(QWidget *parent = nullptr);
typedef std::vector<double> Data; using Data = std::vector<double>;
void setData(const Data &data); void setData(const Data &data);
void setInfo(const QString &description); void setInfo(const QString &description);

View File

@@ -117,7 +117,7 @@ SelectRemoteFileDialog::SelectRemoteFileDialog(QWidget *parent)
m_buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); m_buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
QVBoxLayout *layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
layout->addWidget(m_fileSystemView); layout->addWidget(m_fileSystemView);
layout->addWidget(m_textBrowser); layout->addWidget(m_textBrowser);
layout->addWidget(m_buttonBox); layout->addWidget(m_buttonBox);
@@ -234,7 +234,7 @@ public:
{ {
State st; State st;
st.localCoreFile = p.useLocalCoreFile(); st.localCoreFile = p.useLocalCoreFile();
st.validKit = (kitChooser->currentKit() != 0); st.validKit = (kitChooser->currentKit() != nullptr);
st.validLocalExecFilename = localExecFileName->isValid(); st.validLocalExecFilename = localExecFileName->isValid();
if (st.localCoreFile) if (st.localCoreFile)

View File

@@ -41,9 +41,9 @@ class AttachCoreDialog : public QDialog
public: public:
explicit AttachCoreDialog(QWidget *parent); explicit AttachCoreDialog(QWidget *parent);
~AttachCoreDialog(); ~AttachCoreDialog() override;
int exec(); int exec() override;
QString localExecutableFile() const; QString localExecutableFile() const;
QString localCoreFile() const; QString localCoreFile() const;

View File

@@ -37,7 +37,6 @@ enum { LocalsIndex = 0, InspectorIndex = 1 };
LocalsAndInspectorWindow::LocalsAndInspectorWindow(QWidget *locals, LocalsAndInspectorWindow::LocalsAndInspectorWindow(QWidget *locals,
QWidget *inspector, QWidget *returnWidget) QWidget *inspector, QWidget *returnWidget)
: m_showLocals(false)
{ {
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
layout->setMargin(0); layout->setMargin(0);

View File

@@ -35,13 +35,13 @@ class LocalsAndInspectorWindow : public QWidget
{ {
public: public:
LocalsAndInspectorWindow(QWidget *locals, QWidget *inspector, LocalsAndInspectorWindow(QWidget *locals, QWidget *inspector,
QWidget *returnWidget); QWidget *returnWidget); // TODO parent?
void setShowLocals(bool showLocals); void setShowLocals(bool showLocals);
private: private:
QTimer m_timer; QTimer m_timer;
bool m_showLocals; bool m_showLocals = false;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -72,7 +72,7 @@ public:
{} {}
private: private:
void highlightBlock(const QString &text) void highlightBlock(const QString &text) override
{ {
using Utils::Theme; using Utils::Theme;
QTextCharFormat format; QTextCharFormat format;
@@ -125,7 +125,7 @@ public:
{} {}
private: private:
void highlightBlock(const QString &text) void highlightBlock(const QString &text) override
{ {
using Utils::Theme; using Utils::Theme;
Theme *theme = Utils::creatorTheme(); Theme *theme = Utils::creatorTheme();
@@ -172,7 +172,7 @@ public:
this, &DebuggerPane::reloadDebuggingHelpers); this, &DebuggerPane::reloadDebuggingHelpers);
} }
void contextMenuEvent(QContextMenuEvent *ev) void contextMenuEvent(QContextMenuEvent *ev) override
{ {
QMenu *menu = createStandardContextMenu(); QMenu *menu = createStandardContextMenu();
menu->addAction(m_clearContentsAction); menu->addAction(m_clearContentsAction);
@@ -254,7 +254,7 @@ signals:
void commandSelected(int); void commandSelected(int);
private: private:
void keyPressEvent(QKeyEvent *ev) void keyPressEvent(QKeyEvent *ev) override
{ {
if (ev->modifiers() == Qt::ControlModifier && ev->key() == Qt::Key_Return) if (ev->modifiers() == Qt::ControlModifier && ev->key() == Qt::Key_Return)
emit executeLineRequested(); emit executeLineRequested();
@@ -264,7 +264,7 @@ private:
QPlainTextEdit::keyPressEvent(ev); QPlainTextEdit::keyPressEvent(ev);
} }
void mouseDoubleClickEvent(QMouseEvent *ev) void mouseDoubleClickEvent(QMouseEvent *ev) override
{ {
QString line = cursorForPosition(ev->pos()).block().text(); QString line = cursorForPosition(ev->pos()).block().text();
int n = 0; int n = 0;
@@ -283,13 +283,13 @@ private:
emit commandSelected(n); emit commandSelected(n);
} }
void focusInEvent(QFocusEvent *ev) void focusInEvent(QFocusEvent *ev) override
{ {
emit statusMessageRequested(tr("Type Ctrl-<Return> to execute a line."), -1); emit statusMessageRequested(tr("Type Ctrl-<Return> to execute a line."), -1);
QPlainTextEdit::focusInEvent(ev); QPlainTextEdit::focusInEvent(ev);
} }
void focusOutEvent(QFocusEvent *ev) void focusOutEvent(QFocusEvent *ev) override
{ {
emit statusMessageRequested(QString(), -1); emit statusMessageRequested(QString(), -1);
QPlainTextEdit::focusOutEvent(ev); QPlainTextEdit::focusOutEvent(ev);

View File

@@ -42,7 +42,7 @@ class DebuggerEngine;
class MemoryMarkup class MemoryMarkup
{ {
public: public:
MemoryMarkup() {} MemoryMarkup() = default;
MemoryMarkup(quint64 address, quint64 length, QColor c, const QString &tt) MemoryMarkup(quint64 address, quint64 length, QColor c, const QString &tt)
: address(address), length(length), color(c), toolTip(tt) : address(address), length(length), color(c), toolTip(tt)
{} {}
@@ -56,7 +56,7 @@ public:
class MemoryViewSetupData class MemoryViewSetupData
{ {
public: public:
MemoryViewSetupData() {} MemoryViewSetupData() = default;
quint64 startAddress = 0; quint64 startAddress = 0;
QString registerName; QString registerName;

View File

@@ -55,7 +55,7 @@ public:
QString demangled; QString demangled;
}; };
typedef QVector<Symbol> Symbols; using Symbols = QVector<Symbol>;
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //
@@ -73,7 +73,7 @@ public:
QString flags; QString flags;
}; };
typedef QVector<Section> Sections; using Sections = QVector<Section>;
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //
@@ -84,7 +84,7 @@ typedef QVector<Section> Sections;
class Module class Module
{ {
public: public:
Module() : symbolsRead(UnknownReadState), startAddress(0), endAddress(0) {} Module() = default;
public: public:
enum SymbolReadState { enum SymbolReadState {
@@ -95,14 +95,14 @@ public:
QString moduleName; QString moduleName;
QString modulePath; QString modulePath;
QString hostPath; QString hostPath;
SymbolReadState symbolsRead; SymbolReadState symbolsRead = UnknownReadState;
quint64 startAddress; quint64 startAddress = 0;
quint64 endAddress; quint64 endAddress = 0;
Utils::ElfData elfData; Utils::ElfData elfData;
}; };
typedef QVector<Module> Modules; using Modules = QVector<Module>;
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //

View File

@@ -56,7 +56,7 @@ public:
QSharedPointer<ParseTreeNode> templateParamAt(int index) const { return m_templateParams.at(index); } QSharedPointer<ParseTreeNode> templateParamAt(int index) const { return m_templateParams.at(index); }
void addTemplateParam(const QSharedPointer<ParseTreeNode> &node) { m_templateParams << node; } void addTemplateParam(const QSharedPointer<ParseTreeNode> &node) { m_templateParams << node; }
private: private:
int m_pos; int m_pos = 0;
QByteArray m_mangledName; QByteArray m_mangledName;
QList<QSharedPointer<ParseTreeNode> > m_substitutions; QList<QSharedPointer<ParseTreeNode> > m_substitutions;
QList<QSharedPointer<ParseTreeNode> > m_templateParams; QList<QSharedPointer<ParseTreeNode> > m_templateParams;

View File

@@ -76,9 +76,7 @@ ParseTreeNode::ParseTreeNode(const ParseTreeNode &other) : m_parseState(other.m_
addChild(child->clone()); addChild(child->clone());
} }
ParseTreeNode::~ParseTreeNode() ParseTreeNode::~ParseTreeNode() = default;
{
}
ParseTreeNode::Ptr ParseTreeNode::childAt(int i, const QString &func, const QString &file, ParseTreeNode::Ptr ParseTreeNode::childAt(int i, const QString &func, const QString &file,
int line) const int line) const
@@ -155,7 +153,7 @@ QByteArray ArrayTypeNode::toByteArray() const
BareFunctionTypeNode::BareFunctionTypeNode(GlobalParseState *parseState) BareFunctionTypeNode::BareFunctionTypeNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_hasReturnType(false) : ParseTreeNode(parseState)
{ {
} }
@@ -440,12 +438,7 @@ void DiscriminatorRule::parse(GlobalParseState *parseState)
} }
CtorDtorNameNode::CtorDtorNameNode(const CtorDtorNameNode &other) CtorDtorNameNode::CtorDtorNameNode(const CtorDtorNameNode &other) = default;
: ParseTreeNode(other),
m_isDestructor(other.m_isDestructor),
m_representation(other.m_representation)
{
}
bool CtorDtorNameNode::mangledRepresentationStartsWith(char c) bool CtorDtorNameNode::mangledRepresentationStartsWith(char c)
{ {
@@ -504,14 +497,11 @@ QByteArray CtorDtorNameNode::toByteArray() const
CvQualifiersNode::CvQualifiersNode(GlobalParseState *parseState) CvQualifiersNode::CvQualifiersNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_hasConst(false), m_hasVolatile(false) : ParseTreeNode(parseState)
{ {
} }
CvQualifiersNode::CvQualifiersNode(const CvQualifiersNode &other) CvQualifiersNode::CvQualifiersNode(const CvQualifiersNode &other) = default;
: ParseTreeNode(other), m_hasConst(other.m_hasConst), m_hasVolatile(other.m_hasVolatile)
{
}
bool CvQualifiersNode::mangledRepresentationStartsWith(char c) bool CvQualifiersNode::mangledRepresentationStartsWith(char c)
{ {
@@ -601,14 +591,11 @@ QByteArray EncodingNode::toByteArray() const
ExpressionNode::ExpressionNode(GlobalParseState *parseState) ExpressionNode::ExpressionNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_type(OtherType), m_globalNamespace(false) : ParseTreeNode(parseState), m_type(OtherType)
{ {
} }
ExpressionNode::ExpressionNode(const ExpressionNode &other) ExpressionNode::ExpressionNode(const ExpressionNode &other) = default;
: ParseTreeNode(other), m_type(other.m_type), m_globalNamespace(other.m_globalNamespace)
{
}
bool ExpressionNode::mangledRepresentationStartsWith(char c) bool ExpressionNode::mangledRepresentationStartsWith(char c)
{ {
@@ -1000,10 +987,7 @@ QByteArray ExpressionNode::toByteArray() const
} }
OperatorNameNode::OperatorNameNode(const OperatorNameNode &other) OperatorNameNode::OperatorNameNode(const OperatorNameNode &other) = default;
: ParseTreeNode(other), m_type(other.m_type)
{
}
bool OperatorNameNode::mangledRepresentationStartsWith(char c) bool OperatorNameNode::mangledRepresentationStartsWith(char c)
{ {
@@ -1253,14 +1237,11 @@ QByteArray OperatorNameNode::toByteArray() const
ExprPrimaryNode::ExprPrimaryNode(GlobalParseState *parseState) ExprPrimaryNode::ExprPrimaryNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_isNullPtr(false) : ParseTreeNode(parseState)
{ {
} }
ExprPrimaryNode::ExprPrimaryNode(const ExprPrimaryNode &other) ExprPrimaryNode::ExprPrimaryNode(const ExprPrimaryNode &other) = default;
: ParseTreeNode(other), m_suffix(other.m_suffix), m_isNullPtr(other.m_isNullPtr)
{
}
bool ExprPrimaryNode::mangledRepresentationStartsWith(char c) bool ExprPrimaryNode::mangledRepresentationStartsWith(char c)
{ {
@@ -1353,7 +1334,7 @@ QByteArray ExprPrimaryNode::toByteArray() const
FunctionTypeNode::FunctionTypeNode(GlobalParseState *parseState) FunctionTypeNode::FunctionTypeNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_isExternC(false) : ParseTreeNode(parseState)
{ {
} }
@@ -1395,16 +1376,11 @@ QByteArray FunctionTypeNode::toByteArray() const
LocalNameNode::LocalNameNode(GlobalParseState *parseState) LocalNameNode::LocalNameNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_isStringLiteral(false), m_isDefaultArg(false) : ParseTreeNode(parseState)
{ {
} }
LocalNameNode::LocalNameNode(const LocalNameNode &other) LocalNameNode::LocalNameNode(const LocalNameNode &other) = default;
: ParseTreeNode(other),
m_isStringLiteral(other.m_isStringLiteral),
m_isDefaultArg(other.m_isDefaultArg)
{
}
bool LocalNameNode::mangledRepresentationStartsWith(char c) bool LocalNameNode::mangledRepresentationStartsWith(char c)
{ {
@@ -1538,10 +1514,7 @@ void MangledNameRule::parse(GlobalParseState *parseState, const ParseTreeNode::P
} }
SourceNameNode::SourceNameNode(const SourceNameNode &other) SourceNameNode::SourceNameNode(const SourceNameNode &other) = default;
: ParseTreeNode(other), m_name(other.m_name)
{
}
bool SourceNameNode::mangledRepresentationStartsWith(char c) bool SourceNameNode::mangledRepresentationStartsWith(char c)
{ {
@@ -1609,14 +1582,11 @@ void UnqualifiedNameNode::parse()
UnscopedNameNode::UnscopedNameNode(GlobalParseState *parseState) UnscopedNameNode::UnscopedNameNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_inStdNamespace(false) : ParseTreeNode(parseState)
{ {
} }
UnscopedNameNode::UnscopedNameNode(const UnscopedNameNode &other) UnscopedNameNode::UnscopedNameNode(const UnscopedNameNode &other) = default;
: ParseTreeNode(other), m_inStdNamespace(other.m_inStdNamespace)
{
}
bool UnscopedNameNode::mangledRepresentationStartsWith(char c) bool UnscopedNameNode::mangledRepresentationStartsWith(char c)
{ {
@@ -1972,10 +1942,7 @@ QByteArray TemplateArgsNode::toByteArray() const
} }
SpecialNameNode::SpecialNameNode(const SpecialNameNode &other) SpecialNameNode::SpecialNameNode(const SpecialNameNode &other) = default;
: ParseTreeNode(other), m_type(other.m_type)
{
}
bool SpecialNameNode::mangledRepresentationStartsWith(char c) bool SpecialNameNode::mangledRepresentationStartsWith(char c)
{ {
@@ -2063,14 +2030,11 @@ QByteArray SpecialNameNode::toByteArray() const
NumberNode::NumberNode(GlobalParseState *parseState) NumberNode::NumberNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_isNegative(false) : ParseTreeNode(parseState)
{ {
} }
NumberNode::NumberNode(const NumberNode &other) NumberNode::NumberNode(const NumberNode &other) = default;
: ParseTreeNode(other), m_isNegative(other.m_isNegative)
{
}
bool NumberNode::mangledRepresentationStartsWith(char c) bool NumberNode::mangledRepresentationStartsWith(char c)
{ {
@@ -2118,7 +2082,7 @@ template<int base> void NonNegativeNumberNode<base>::parse()
numberRepr += ADVANCE(); numberRepr += ADVANCE();
if (numberRepr.count() == 0) if (numberRepr.count() == 0)
throw ParseException(QString::fromLatin1("Invalid non-negative number")); throw ParseException(QString::fromLatin1("Invalid non-negative number"));
m_number = numberRepr.toULongLong(0, base); m_number = numberRepr.toULongLong(nullptr, base);
} }
template<int base> QByteArray NonNegativeNumberNode<base>::description() const template<int base> QByteArray NonNegativeNumberNode<base>::description() const
@@ -2225,14 +2189,11 @@ void NameNode::parse()
TemplateArgNode::TemplateArgNode(GlobalParseState *parseState) TemplateArgNode::TemplateArgNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_isTemplateArgumentPack(false) : ParseTreeNode(parseState)
{ {
} }
TemplateArgNode::TemplateArgNode(const TemplateArgNode &other) TemplateArgNode::TemplateArgNode(const TemplateArgNode &other) = default;
: ParseTreeNode(other), m_isTemplateArgumentPack(other.m_isTemplateArgumentPack)
{
}
bool TemplateArgNode::mangledRepresentationStartsWith(char c) bool TemplateArgNode::mangledRepresentationStartsWith(char c)
{ {
@@ -2680,7 +2641,7 @@ QByteArray TypeNode::qualPtrRefListToByteArray(const QList<const ParseTreeNode *
{ {
QByteArray repr; QByteArray repr;
for (const ParseTreeNode * const n : nodeList) { for (const ParseTreeNode * const n : nodeList) {
const TypeNode * const typeNode = dynamic_cast<const TypeNode *>(n); const auto typeNode = dynamic_cast<const TypeNode*>(n);
if (typeNode) { if (typeNode) {
switch (typeNode->m_type) { switch (typeNode->m_type) {
case PointerType: case PointerType:
@@ -2712,10 +2673,7 @@ QByteArray TypeNode::qualPtrRefListToByteArray(const QList<const ParseTreeNode *
} }
FloatValueNode::FloatValueNode(const FloatValueNode &other) FloatValueNode::FloatValueNode(const FloatValueNode &other) = default;
: ParseTreeNode(other), m_value(other.m_value)
{
}
bool FloatValueNode::mangledRepresentationStartsWith(char c) bool FloatValueNode::mangledRepresentationStartsWith(char c)
{ {
@@ -2975,14 +2933,11 @@ bool UnresolvedQualifierLevelRule::mangledRepresentationStartsWith(char c)
BaseUnresolvedNameNode::BaseUnresolvedNameNode(GlobalParseState *parseState) BaseUnresolvedNameNode::BaseUnresolvedNameNode(GlobalParseState *parseState)
: ParseTreeNode(parseState), m_isOperator(false) : ParseTreeNode(parseState)
{ {
} }
BaseUnresolvedNameNode::BaseUnresolvedNameNode(const BaseUnresolvedNameNode &other) BaseUnresolvedNameNode::BaseUnresolvedNameNode(const BaseUnresolvedNameNode &other) = default;
: ParseTreeNode(other), m_isOperator(other.m_isOperator)
{
}
bool BaseUnresolvedNameNode::mangledRepresentationStartsWith(char c) bool BaseUnresolvedNameNode::mangledRepresentationStartsWith(char c)
{ {
@@ -3057,10 +3012,7 @@ QByteArray InitializerNode::toByteArray() const
} }
UnresolvedNameNode::UnresolvedNameNode(const UnresolvedNameNode &other) UnresolvedNameNode::UnresolvedNameNode(const UnresolvedNameNode &other) = default;
: ParseTreeNode(other), m_globalNamespace(other.m_globalNamespace)
{
}
bool UnresolvedNameNode::mangledRepresentationStartsWith(char c) bool UnresolvedNameNode::mangledRepresentationStartsWith(char c)
{ {

View File

@@ -33,7 +33,7 @@ namespace Internal {
class ParseTreeNode class ParseTreeNode
{ {
public: public:
typedef QSharedPointer<ParseTreeNode> Ptr; using Ptr = QSharedPointer<ParseTreeNode>;
virtual ~ParseTreeNode(); virtual ~ParseTreeNode();
virtual QByteArray toByteArray() const = 0; virtual QByteArray toByteArray() const = 0;
@@ -76,41 +76,41 @@ public:
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
ArrayTypeNode(const ArrayTypeNode &other) : ParseTreeNode(other) {} ArrayTypeNode(const ArrayTypeNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new ArrayTypeNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new ArrayTypeNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "ArrayType"; } QByteArray description() const override { return "ArrayType"; }
}; };
class BareFunctionTypeNode : public ParseTreeNode class BareFunctionTypeNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<BareFunctionTypeNode> Ptr; using Ptr = QSharedPointer<BareFunctionTypeNode>;
BareFunctionTypeNode(GlobalParseState *parseState); BareFunctionTypeNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
bool hasReturnType() const { return m_hasReturnType; } bool hasReturnType() const { return m_hasReturnType; }
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
BareFunctionTypeNode(const BareFunctionTypeNode &other); BareFunctionTypeNode(const BareFunctionTypeNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new BareFunctionTypeNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new BareFunctionTypeNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_hasReturnType; bool m_hasReturnType = false;
}; };
class BuiltinTypeNode : public ParseTreeNode class BuiltinTypeNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<BuiltinTypeNode> Ptr; using Ptr = QSharedPointer<BuiltinTypeNode>;
BuiltinTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} BuiltinTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
enum Type { enum Type {
VoidType, WCharType, BoolType, VoidType, WCharType, BoolType,
@@ -125,11 +125,11 @@ public:
private: private:
BuiltinTypeNode(const BuiltinTypeNode &other); BuiltinTypeNode(const BuiltinTypeNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new BuiltinTypeNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new BuiltinTypeNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
Type m_type; Type m_type; // TODO: define?
}; };
class CallOffsetRule class CallOffsetRule
@@ -146,26 +146,26 @@ class NvOffsetNode : public ParseTreeNode
{ {
public: public:
NvOffsetNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} NvOffsetNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
QByteArray toByteArray() const { return QByteArray(); } // TODO: How to encode this? QByteArray toByteArray() const override { return QByteArray(); } // TODO: How to encode this?
private: private:
NvOffsetNode(const NvOffsetNode &other) : ParseTreeNode(other) {} NvOffsetNode(const NvOffsetNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new NvOffsetNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new NvOffsetNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "NvOffset"; } QByteArray description() const override { return "NvOffset"; }
}; };
class VOffsetNode : public ParseTreeNode class VOffsetNode : public ParseTreeNode
{ {
public: public:
VOffsetNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} VOffsetNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
QByteArray toByteArray() const { return QByteArray(); } // TODO: How to encode this? QByteArray toByteArray() const override { return QByteArray(); } // TODO: How to encode this?
private: private:
VOffsetNode(const VOffsetNode &other) : ParseTreeNode(other) {} VOffsetNode(const VOffsetNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new VOffsetNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new VOffsetNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "VOffset"; } QByteArray description() const override { return "VOffset"; }
}; };
class ClassEnumTypeRule class ClassEnumTypeRule
@@ -193,34 +193,34 @@ class CtorDtorNameNode : public ParseTreeNode
public: public:
CtorDtorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} CtorDtorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
CtorDtorNameNode(const CtorDtorNameNode &other); CtorDtorNameNode(const CtorDtorNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new CtorDtorNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new CtorDtorNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_isDestructor; bool m_isDestructor; // TODO: define?
QByteArray m_representation; QByteArray m_representation;
}; };
class CvQualifiersNode : public ParseTreeNode class CvQualifiersNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<CvQualifiersNode> Ptr; using Ptr = QSharedPointer<CvQualifiersNode>;
CvQualifiersNode(GlobalParseState *parseState); CvQualifiersNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
bool hasQualifiers() const { return m_hasConst || m_hasVolatile; } bool hasQualifiers() const { return m_hasConst || m_hasVolatile; }
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
CvQualifiersNode(const CvQualifiersNode &other); CvQualifiersNode(const CvQualifiersNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new CvQualifiersNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new CvQualifiersNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "CvQualifiers[" + toByteArray() + ']'; } QByteArray description() const override { return "CvQualifiers[" + toByteArray() + ']'; }
bool m_hasConst; bool m_hasConst = false;
bool m_hasVolatile; bool m_hasVolatile = false;
}; };
class EncodingNode : public ParseTreeNode class EncodingNode : public ParseTreeNode
@@ -228,13 +228,13 @@ class EncodingNode : public ParseTreeNode
public: public:
EncodingNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} EncodingNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
EncodingNode(const EncodingNode &other) : ParseTreeNode(other) {} EncodingNode(const EncodingNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new EncodingNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new EncodingNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "Encoding"; } QByteArray description() const override { return "Encoding"; }
}; };
class ExpressionNode : public ParseTreeNode class ExpressionNode : public ParseTreeNode
@@ -242,13 +242,13 @@ class ExpressionNode : public ParseTreeNode
public: public:
ExpressionNode(GlobalParseState *parseState); ExpressionNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
ExpressionNode(const ExpressionNode &other); ExpressionNode(const ExpressionNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new ExpressionNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new ExpressionNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
enum Type { enum Type {
ConversionType, SizeofType, AlignofType, OperatorType, ParameterPackSizeType, ConversionType, SizeofType, AlignofType, OperatorType, ParameterPackSizeType,
@@ -257,14 +257,14 @@ private:
StaticCastType, ConstCastType, ReinterpretCastType, MemberAccessType, StaticCastType, ConstCastType, ReinterpretCastType, MemberAccessType,
PointerMemberAccessType, MemberDerefType, PackExpansionType, ThrowType, PointerMemberAccessType, MemberDerefType, PackExpansionType, ThrowType,
RethrowType, OtherType RethrowType, OtherType
} m_type; } m_type; // TODO: define?
bool m_globalNamespace; bool m_globalNamespace = false;
}; };
class OperatorNameNode : public ParseTreeNode class OperatorNameNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<OperatorNameNode> Ptr; using Ptr = QSharedPointer<OperatorNameNode>;
OperatorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} OperatorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
@@ -282,13 +282,13 @@ public:
}; };
Type type() const { return m_type; } Type type() const { return m_type; }
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
OperatorNameNode(const OperatorNameNode &other); OperatorNameNode(const OperatorNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new OperatorNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new OperatorNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
Type m_type = VendorType; Type m_type = VendorType;
}; };
@@ -299,55 +299,55 @@ public:
ExprPrimaryNode(GlobalParseState *parseState); ExprPrimaryNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
ExprPrimaryNode(const ExprPrimaryNode &other); ExprPrimaryNode(const ExprPrimaryNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new ExprPrimaryNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new ExprPrimaryNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
QByteArray m_suffix; QByteArray m_suffix;
bool m_isNullPtr; bool m_isNullPtr = false;
}; };
class FunctionTypeNode : public ParseTreeNode class FunctionTypeNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<FunctionTypeNode> Ptr; using Ptr = QSharedPointer<FunctionTypeNode>;
FunctionTypeNode(GlobalParseState *parseState); FunctionTypeNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
bool isExternC() const { return m_isExternC; } bool isExternC() const { return m_isExternC; }
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
FunctionTypeNode(const FunctionTypeNode &other); FunctionTypeNode(const FunctionTypeNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new FunctionTypeNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new FunctionTypeNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_isExternC; bool m_isExternC = false;
}; };
class LocalNameNode : public ParseTreeNode class LocalNameNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<LocalNameNode> Ptr; using Ptr = QSharedPointer<LocalNameNode>;
LocalNameNode(GlobalParseState *parseState); LocalNameNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
bool isTemplate() const; bool isTemplate() const;
bool isConstructorOrDestructorOrConversionOperator() const; bool isConstructorOrDestructorOrConversionOperator() const;
CvQualifiersNode::Ptr cvQualifiers() const; CvQualifiersNode::Ptr cvQualifiers() const;
private: private:
LocalNameNode(const LocalNameNode &other); LocalNameNode(const LocalNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new LocalNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new LocalNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_isStringLiteral; bool m_isStringLiteral = false;
bool m_isDefaultArg; bool m_isDefaultArg = false;
}; };
class MangledNameRule class MangledNameRule
@@ -365,15 +365,15 @@ class NumberNode : public ParseTreeNode
public: public:
NumberNode(GlobalParseState *parseState); NumberNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
NumberNode(const NumberNode &other); NumberNode(const NumberNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new NumberNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new NumberNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_isNegative; bool m_isNegative = false;
}; };
class SourceNameNode : public ParseTreeNode class SourceNameNode : public ParseTreeNode
@@ -381,13 +381,13 @@ class SourceNameNode : public ParseTreeNode
public: public:
SourceNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} SourceNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const { return m_name; } QByteArray toByteArray() const override { return m_name; }
private: private:
SourceNameNode(const SourceNameNode &other); SourceNameNode(const SourceNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new SourceNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new SourceNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
QByteArray m_name; QByteArray m_name;
}; };
@@ -395,17 +395,17 @@ private:
class UnqualifiedNameNode : public ParseTreeNode class UnqualifiedNameNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<UnqualifiedNameNode> Ptr; using Ptr = QSharedPointer<UnqualifiedNameNode>;
UnqualifiedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} UnqualifiedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
bool isConstructorOrDestructorOrConversionOperator() const; bool isConstructorOrDestructorOrConversionOperator() const;
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
UnqualifiedNameNode(const UnqualifiedNameNode &other) : ParseTreeNode(other) {} UnqualifiedNameNode(const UnqualifiedNameNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new UnqualifiedNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new UnqualifiedNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "UnqualifiedName"; } QByteArray description() const override { return "UnqualifiedName"; }
}; };
class UnscopedNameNode : public ParseTreeNode class UnscopedNameNode : public ParseTreeNode
@@ -414,21 +414,21 @@ public:
UnscopedNameNode(GlobalParseState *parseState); UnscopedNameNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
bool isConstructorOrDestructorOrConversionOperator() const; bool isConstructorOrDestructorOrConversionOperator() const;
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
UnscopedNameNode(const UnscopedNameNode &other); UnscopedNameNode(const UnscopedNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new UnscopedNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new UnscopedNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_inStdNamespace; bool m_inStdNamespace = false;
}; };
class NestedNameNode : public ParseTreeNode class NestedNameNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<NestedNameNode> Ptr; using Ptr = QSharedPointer<NestedNameNode>;
NestedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState ){} NestedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState ){}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
@@ -437,22 +437,22 @@ public:
bool isConstructorOrDestructorOrConversionOperator() const; bool isConstructorOrDestructorOrConversionOperator() const;
CvQualifiersNode::Ptr cvQualifiers() const; CvQualifiersNode::Ptr cvQualifiers() const;
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
NestedNameNode(const NestedNameNode &other) : ParseTreeNode(other) {} NestedNameNode(const NestedNameNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new NestedNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new NestedNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "NestedName"; } QByteArray description() const override { return "NestedName"; }
}; };
class SubstitutionNode : public ParseTreeNode class SubstitutionNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<SubstitutionNode> Ptr; using Ptr = QSharedPointer<SubstitutionNode>;
SubstitutionNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} SubstitutionNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
enum Type { enum Type {
ActualSubstitutionType, StdType, StdAllocType, StdBasicStringType, FullStdBasicStringType, ActualSubstitutionType, StdType, StdAllocType, StdBasicStringType, FullStdBasicStringType,
@@ -462,11 +462,11 @@ public:
private: private:
SubstitutionNode(const SubstitutionNode &other); SubstitutionNode(const SubstitutionNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new SubstitutionNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new SubstitutionNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
Type m_type; Type m_type; // TODO: define?
}; };
class PointerToMemberTypeNode : public ParseTreeNode class PointerToMemberTypeNode : public ParseTreeNode
@@ -474,19 +474,19 @@ class PointerToMemberTypeNode : public ParseTreeNode
public: public:
PointerToMemberTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} PointerToMemberTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
PointerToMemberTypeNode(const PointerToMemberTypeNode &other) : ParseTreeNode(other) {} PointerToMemberTypeNode(const PointerToMemberTypeNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new PointerToMemberTypeNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new PointerToMemberTypeNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "PointerToMember"; } QByteArray description() const override { return "PointerToMember"; }
}; };
class TemplateParamNode : public ParseTreeNode class TemplateParamNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<TemplateParamNode> Ptr; using Ptr = QSharedPointer<TemplateParamNode>;
TemplateParamNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} TemplateParamNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
@@ -494,15 +494,15 @@ public:
int index() const { return m_index; } int index() const { return m_index; }
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
TemplateParamNode(const TemplateParamNode &other); TemplateParamNode(const TemplateParamNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new TemplateParamNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new TemplateParamNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
int m_index; int m_index; // TODO: define?
}; };
class TemplateArgsNode : public ParseTreeNode class TemplateArgsNode : public ParseTreeNode
@@ -510,13 +510,13 @@ class TemplateArgsNode : public ParseTreeNode
public: public:
TemplateArgsNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} TemplateArgsNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
TemplateArgsNode(const TemplateArgsNode &other) : ParseTreeNode(other) {} TemplateArgsNode(const TemplateArgsNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new TemplateArgsNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new TemplateArgsNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "TemplateArgs"; } QByteArray description() const override { return "TemplateArgs"; }
}; };
class SpecialNameNode : public ParseTreeNode class SpecialNameNode : public ParseTreeNode
@@ -524,45 +524,45 @@ class SpecialNameNode : public ParseTreeNode
public: public:
SpecialNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} SpecialNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
SpecialNameNode(const SpecialNameNode &other); SpecialNameNode(const SpecialNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new SpecialNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new SpecialNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
enum Type { enum Type {
VirtualTableType, VttStructType, TypeInfoType, TypeInfoNameType, GuardVarType, VirtualTableType, VttStructType, TypeInfoType, TypeInfoNameType, GuardVarType,
SingleCallOffsetType, DoubleCallOffsetType SingleCallOffsetType, DoubleCallOffsetType
} m_type; } m_type; // TODO: define?
}; };
template<int base> class NonNegativeNumberNode : public ParseTreeNode template<int base> class NonNegativeNumberNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<NonNegativeNumberNode<base> > Ptr; using Ptr = QSharedPointer<NonNegativeNumberNode<base> >;
NonNegativeNumberNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} NonNegativeNumberNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c) { static bool mangledRepresentationStartsWith(char c) {
// Base can only be 10 or 36. // Base can only be 10 or 36.
return (c >= '0' && c <= '9') || (base == 36 && c >= 'A' && c <= 'Z'); return (c >= '0' && c <= '9') || (base == 36 && c >= 'A' && c <= 'Z');
} }
quint64 number() const { return m_number; } quint64 number() const { return m_number; }
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
NonNegativeNumberNode(const NonNegativeNumberNode &other); NonNegativeNumberNode(const NonNegativeNumberNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new NonNegativeNumberNode<base>(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new NonNegativeNumberNode<base>(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
quint64 m_number; quint64 m_number; // TODO: define?
}; };
class NameNode : public ParseTreeNode class NameNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<NameNode> Ptr; using Ptr = QSharedPointer<NameNode>;
NameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} NameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
@@ -572,13 +572,13 @@ public:
bool isConstructorOrDestructorOrConversionOperator() const; bool isConstructorOrDestructorOrConversionOperator() const;
CvQualifiersNode::Ptr cvQualifiers() const; CvQualifiersNode::Ptr cvQualifiers() const;
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
NameNode(const NameNode &other) : ParseTreeNode(other) {} NameNode(const NameNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new NameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new NameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "Name"; } QByteArray description() const override { return "Name"; }
}; };
class TemplateArgNode : public ParseTreeNode class TemplateArgNode : public ParseTreeNode
@@ -586,21 +586,21 @@ class TemplateArgNode : public ParseTreeNode
public: public:
TemplateArgNode(GlobalParseState *parseState); TemplateArgNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
TemplateArgNode(const TemplateArgNode &other); TemplateArgNode(const TemplateArgNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new TemplateArgNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new TemplateArgNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_isTemplateArgumentPack; bool m_isTemplateArgumentPack = false;
}; };
class PrefixNode : public ParseTreeNode class PrefixNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<PrefixNode> Ptr; using Ptr = QSharedPointer<PrefixNode>;
PrefixNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} PrefixNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
@@ -608,21 +608,21 @@ public:
bool isTemplate() const; bool isTemplate() const;
bool isConstructorOrDestructorOrConversionOperator() const; bool isConstructorOrDestructorOrConversionOperator() const;
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
PrefixNode(const PrefixNode &other) : ParseTreeNode(other) {} PrefixNode(const PrefixNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new PrefixNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new PrefixNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "Prefix"; } QByteArray description() const override { return "Prefix"; }
}; };
class TypeNode : public ParseTreeNode class TypeNode : public ParseTreeNode
{ {
public: public:
typedef QSharedPointer<TypeNode> Ptr; using Ptr = QSharedPointer<TypeNode>;
TypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState), m_type(OtherType) {} TypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
@@ -632,19 +632,19 @@ public:
}; };
Type type() const { return m_type; } Type type() const { return m_type; }
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
TypeNode(const TypeNode &other); TypeNode(const TypeNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new TypeNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new TypeNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
QByteArray toByteArrayQualPointerRef(const TypeNode *typeNode, QByteArray toByteArrayQualPointerRef(const TypeNode *typeNode,
const QByteArray &qualPtrRef) const; const QByteArray &qualPtrRef) const;
QByteArray qualPtrRefListToByteArray(const QList<const ParseTreeNode *> &nodeList) const; QByteArray qualPtrRefListToByteArray(const QList<const ParseTreeNode *> &nodeList) const;
Type m_type; Type m_type = OtherType;
}; };
class FloatValueNode : public ParseTreeNode class FloatValueNode : public ParseTreeNode
@@ -652,15 +652,15 @@ class FloatValueNode : public ParseTreeNode
public: public:
FloatValueNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} FloatValueNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
FloatValueNode(const FloatValueNode &other); FloatValueNode(const FloatValueNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new FloatValueNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new FloatValueNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
double m_value; double m_value; // TODO: define?
}; };
class LambdaSigNode : public ParseTreeNode class LambdaSigNode : public ParseTreeNode
@@ -668,26 +668,26 @@ class LambdaSigNode : public ParseTreeNode
public: public:
LambdaSigNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} LambdaSigNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
LambdaSigNode(const LambdaSigNode &other) : ParseTreeNode(other) {} LambdaSigNode(const LambdaSigNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new LambdaSigNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new LambdaSigNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "LambdaSig"; } QByteArray description() const override { return "LambdaSig"; }
}; };
class ClosureTypeNameNode : public ParseTreeNode class ClosureTypeNameNode : public ParseTreeNode
{ {
public: public:
ClosureTypeNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} ClosureTypeNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
ClosureTypeNameNode(const ClosureTypeNameNode &other) : ParseTreeNode(other) {} ClosureTypeNameNode(const ClosureTypeNameNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new ClosureTypeNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new ClosureTypeNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "ClosureType"; } QByteArray description() const override { return "ClosureType"; }
}; };
class UnnamedTypeNameNode : public ParseTreeNode class UnnamedTypeNameNode : public ParseTreeNode
@@ -695,13 +695,13 @@ class UnnamedTypeNameNode : public ParseTreeNode
public: public:
UnnamedTypeNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} UnnamedTypeNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
UnnamedTypeNameNode(const UnnamedTypeNameNode &other) : ParseTreeNode(other) {} UnnamedTypeNameNode(const UnnamedTypeNameNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new UnnamedTypeNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new UnnamedTypeNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "UnnnamedType"; } QByteArray description() const override { return "UnnnamedType"; }
}; };
class DeclTypeNode : public ParseTreeNode class DeclTypeNode : public ParseTreeNode
@@ -709,13 +709,13 @@ class DeclTypeNode : public ParseTreeNode
public: public:
DeclTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} DeclTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
DeclTypeNode(const DeclTypeNode &other) : ParseTreeNode(other) {} DeclTypeNode(const DeclTypeNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new DeclTypeNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new DeclTypeNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "DeclType"; } QByteArray description() const override { return "DeclType"; }
}; };
class UnresolvedTypeRule class UnresolvedTypeRule
@@ -733,13 +733,13 @@ class SimpleIdNode : public ParseTreeNode
public: public:
SimpleIdNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} SimpleIdNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
SimpleIdNode(const SimpleIdNode &other) : ParseTreeNode(other) {} SimpleIdNode(const SimpleIdNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new SimpleIdNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new SimpleIdNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "SimpleId"; } QByteArray description() const override { return "SimpleId"; }
}; };
class DestructorNameNode : public ParseTreeNode class DestructorNameNode : public ParseTreeNode
@@ -747,13 +747,13 @@ class DestructorNameNode : public ParseTreeNode
public: public:
DestructorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} DestructorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
DestructorNameNode(const DestructorNameNode &other) : ParseTreeNode(other) {} DestructorNameNode(const DestructorNameNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new DestructorNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new DestructorNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "DesctuctorName"; } QByteArray description() const override { return "DesctuctorName"; }
}; };
class UnresolvedQualifierLevelRule class UnresolvedQualifierLevelRule
@@ -771,15 +771,15 @@ class BaseUnresolvedNameNode : public ParseTreeNode
public: public:
BaseUnresolvedNameNode(GlobalParseState *parseState); BaseUnresolvedNameNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
BaseUnresolvedNameNode(const BaseUnresolvedNameNode &other); BaseUnresolvedNameNode(const BaseUnresolvedNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new BaseUnresolvedNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new BaseUnresolvedNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_isOperator; bool m_isOperator = false;
}; };
class InitializerNode : public ParseTreeNode class InitializerNode : public ParseTreeNode
@@ -787,13 +787,13 @@ class InitializerNode : public ParseTreeNode
public: public:
InitializerNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} InitializerNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
InitializerNode(const InitializerNode &other) : ParseTreeNode(other) {} InitializerNode(const InitializerNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new InitializerNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new InitializerNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "Initializer"; } QByteArray description() const override { return "Initializer"; }
}; };
class UnresolvedNameNode : public ParseTreeNode class UnresolvedNameNode : public ParseTreeNode
@@ -801,15 +801,15 @@ class UnresolvedNameNode : public ParseTreeNode
public: public:
UnresolvedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} UnresolvedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
UnresolvedNameNode(const UnresolvedNameNode &other); UnresolvedNameNode(const UnresolvedNameNode &other);
ParseTreeNode::Ptr clone() const { return Ptr(new UnresolvedNameNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new UnresolvedNameNode(*this)); }
void parse(); void parse() override;
QByteArray description() const; QByteArray description() const override;
bool m_globalNamespace; bool m_globalNamespace; // TODO: define?
}; };
class FunctionParamNode : public ParseTreeNode class FunctionParamNode : public ParseTreeNode
@@ -817,13 +817,13 @@ class FunctionParamNode : public ParseTreeNode
public: public:
FunctionParamNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {} FunctionParamNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c); static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const; QByteArray toByteArray() const override;
private: private:
FunctionParamNode(const FunctionParamNode &other) : ParseTreeNode(other) {} FunctionParamNode(const FunctionParamNode &other) = default;
ParseTreeNode::Ptr clone() const { return Ptr(new FunctionParamNode(*this)); } ParseTreeNode::Ptr clone() const override { return Ptr(new FunctionParamNode(*this)); }
void parse(); void parse() override;
QByteArray description() const { return "FunctionParam"; } QByteArray description() const override { return "FunctionParam"; }
}; };
} // namespace Internal } // namespace Internal

View File

@@ -47,7 +47,7 @@ class OutputCollector : public QObject
Q_OBJECT Q_OBJECT
public: public:
OutputCollector() {} OutputCollector() = default;
~OutputCollector() override; ~OutputCollector() override;
bool listen(); bool listen();
void shutdown(); void shutdown();

View File

@@ -53,7 +53,7 @@ static inline QString msgCannotInterrupt(qint64 pid, const QString &why)
static BOOL isWow64Process(HANDLE hproc) static BOOL isWow64Process(HANDLE hproc)
{ {
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); using LPFN_ISWOW64PROCESS = BOOL (WINAPI*)(HANDLE, PBOOL);
BOOL ret = false; BOOL ret = false;

View File

@@ -127,7 +127,7 @@ struct QmlV8ObjectData
} }
}; };
typedef std::function<void(const QVariantMap &)> QmlCallback; using QmlCallback = std::function<void(const QVariantMap &)>;
struct LookupData struct LookupData
{ {
@@ -136,7 +136,7 @@ struct LookupData
QString exp; QString exp;
}; };
typedef QHash<int, LookupData> LookupItems; // id -> (iname, exp) using LookupItems = QHash<int, LookupData>; // id -> (iname, exp)
static void setWatchItemHasChildren(WatchItem *item, bool hasChildren) static void setWatchItemHasChildren(WatchItem *item, bool hasChildren)
{ {
@@ -415,7 +415,7 @@ void QmlEngine::connectionStartupFailed()
return; return;
} }
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow()); auto infoBox = new QMessageBox(ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical); infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME); infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
infoBox->setText(tr("Could not connect to the in-process QML debugger." infoBox->setText(tr("Could not connect to the in-process QML debugger."
@@ -436,7 +436,7 @@ void QmlEngine::appStartupFailed(const QString &errorMessage)
QString error = tr("Could not connect to the in-process QML debugger. %1").arg(errorMessage); QString error = tr("Could not connect to the in-process QML debugger. %1").arg(errorMessage);
if (isMasterEngine()) { if (isMasterEngine()) {
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow()); auto infoBox = new QMessageBox(ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical); infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME); infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
infoBox->setText(error); infoBox->setText(error);
@@ -935,9 +935,9 @@ void QmlEngine::selectWatchData(const QString &iname)
bool compareConsoleItems(const ConsoleItem *a, const ConsoleItem *b) bool compareConsoleItems(const ConsoleItem *a, const ConsoleItem *b)
{ {
if (a == 0) if (a == nullptr)
return true; return true;
if (b == 0) if (b == nullptr)
return false; return false;
return a->text() < b->text(); return a->text() < b->text();
} }
@@ -947,7 +947,7 @@ static ConsoleItem *constructLogItemTree(const QVariant &result,
{ {
bool sorted = boolSetting(SortStructMembers); bool sorted = boolSetting(SortStructMembers);
if (!result.isValid()) if (!result.isValid())
return 0; return nullptr;
QString text; QString text;
ConsoleItem *item = nullptr; ConsoleItem *item = nullptr;

View File

@@ -58,7 +58,7 @@ public:
Node::accept(ast, this); Node::accept(ast, this);
} }
bool preVisit(Node *ast) bool preVisit(Node *ast) override
{ {
return !done && ast->lastSourceLocation().startLine >= *line; return !done && ast->lastSourceLocation().startLine >= *line;
} }
@@ -73,7 +73,7 @@ public:
//Add more types when suitable. //Add more types when suitable.
bool visit(UiScriptBinding *ast) bool visit(UiScriptBinding *ast) override
{ {
if (!ast->statement) if (!ast->statement)
return true; return true;
@@ -87,7 +87,7 @@ public:
statementColumn = ast->statement->firstSourceLocation().startColumn; statementColumn = ast->statement->firstSourceLocation().startColumn;
} else if (ast->statement->kind == Node::Kind_Block) { } else if (ast->statement->kind == Node::Kind_Block) {
Block *block = static_cast<Block *>(ast->statement); auto block = static_cast<Block *>(ast->statement);
if (!block->statements) if (!block->statements)
return true; return true;
statementStartLine = block->statements->firstSourceLocation().startLine; statementStartLine = block->statements->firstSourceLocation().startLine;
@@ -124,7 +124,7 @@ public:
return true; return true;
} }
bool visit(FunctionDeclaration *ast) { bool visit(FunctionDeclaration *ast) override {
quint32 sourceStartLine = ast->firstSourceLocation().startLine; quint32 sourceStartLine = ast->firstSourceLocation().startLine;
quint32 sourceStartColumn = ast->firstSourceLocation().startColumn; quint32 sourceStartColumn = ast->firstSourceLocation().startColumn;
quint32 statementStartLine = ast->body->firstSourceLocation().startLine; quint32 statementStartLine = ast->body->firstSourceLocation().startLine;
@@ -152,39 +152,39 @@ public:
return true; return true;
} }
bool visit(EmptyStatement *ast) bool visit(EmptyStatement *ast) override
{ {
*line = ast->lastSourceLocation().startLine + 1; *line = ast->lastSourceLocation().startLine + 1;
return true; return true;
} }
bool visit(VariableStatement *ast) { test(ast); return true; } bool visit(VariableStatement *ast) override { test(ast); return true; }
bool visit(VariableDeclarationList *ast) { test(ast); return true; } bool visit(VariableDeclarationList *ast) override { test(ast); return true; }
bool visit(VariableDeclaration *ast) { test(ast); return true; } bool visit(VariableDeclaration *ast) override { test(ast); return true; }
bool visit(ExpressionStatement *ast) { test(ast); return true; } bool visit(ExpressionStatement *ast) override { test(ast); return true; }
bool visit(IfStatement *ast) { test(ast); return true; } bool visit(IfStatement *ast) override { test(ast); return true; }
bool visit(DoWhileStatement *ast) { test(ast); return true; } bool visit(DoWhileStatement *ast) override { test(ast); return true; }
bool visit(WhileStatement *ast) { test(ast); return true; } bool visit(WhileStatement *ast) override { test(ast); return true; }
bool visit(ForStatement *ast) { test(ast); return true; } bool visit(ForStatement *ast) override { test(ast); return true; }
bool visit(LocalForStatement *ast) { test(ast); return true; } bool visit(LocalForStatement *ast) override { test(ast); return true; }
bool visit(ForEachStatement *ast) { test(ast); return true; } bool visit(ForEachStatement *ast) override { test(ast); return true; }
bool visit(LocalForEachStatement *ast) { test(ast); return true; } bool visit(LocalForEachStatement *ast) override { test(ast); return true; }
bool visit(ContinueStatement *ast) { test(ast); return true; } bool visit(ContinueStatement *ast) override { test(ast); return true; }
bool visit(BreakStatement *ast) { test(ast); return true; } bool visit(BreakStatement *ast) override { test(ast); return true; }
bool visit(ReturnStatement *ast) { test(ast); return true; } bool visit(ReturnStatement *ast) override { test(ast); return true; }
bool visit(WithStatement *ast) { test(ast); return true; } bool visit(WithStatement *ast) override { test(ast); return true; }
bool visit(SwitchStatement *ast) { test(ast); return true; } bool visit(SwitchStatement *ast) override { test(ast); return true; }
bool visit(CaseBlock *ast) { test(ast); return true; } bool visit(CaseBlock *ast) override { test(ast); return true; }
bool visit(CaseClauses *ast) { test(ast); return true; } bool visit(CaseClauses *ast) override { test(ast); return true; }
bool visit(CaseClause *ast) { test(ast); return true; } bool visit(CaseClause *ast) override { test(ast); return true; }
bool visit(DefaultClause *ast) { test(ast); return true; } bool visit(DefaultClause *ast) override { test(ast); return true; }
bool visit(LabelledStatement *ast) { test(ast); return true; } bool visit(LabelledStatement *ast) override { test(ast); return true; }
bool visit(ThrowStatement *ast) { test(ast); return true; } bool visit(ThrowStatement *ast) override { test(ast); return true; }
bool visit(TryStatement *ast) { test(ast); return true; } bool visit(TryStatement *ast) override { test(ast); return true; }
bool visit(Catch *ast) { test(ast); return true; } bool visit(Catch *ast) override { test(ast); return true; }
bool visit(Finally *ast) { test(ast); return true; } bool visit(Finally *ast) override { test(ast); return true; }
bool visit(FunctionExpression *ast) { test(ast); return true; } bool visit(FunctionExpression *ast) override { test(ast); return true; }
bool visit(DebuggerStatement *ast) { test(ast); return true; } bool visit(DebuggerStatement *ast) override { test(ast); return true; }
void test(Node *ast) void test(Node *ast)
{ {
@@ -247,7 +247,7 @@ QStringList highlightExceptionCode(int lineNumber, const QString &filePath, cons
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR); QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
for (IEditor *editor : editors) { for (IEditor *editor : editors) {
TextEditorWidget *ed = qobject_cast<TextEditorWidget *>(editor->widget()); auto ed = qobject_cast<TextEditorWidget *>(editor->widget());
if (!ed) if (!ed)
continue; continue;

View File

@@ -66,21 +66,14 @@ Q_LOGGING_CATEGORY(qmlInspectorLog, "qtc.dbg.qmlinspector")
*/ */
QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *connection) QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *connection)
: m_qmlEngine(engine) : m_qmlEngine(engine)
, m_engineClient(0)
, m_engineQueryId(0)
, m_rootContextQueryId(0)
, m_objectToSelect(WatchItem::InvalidId) , m_objectToSelect(WatchItem::InvalidId)
, m_masterEngine(engine->masterEngine()) , m_masterEngine(engine->masterEngine())
, m_toolsClient(0)
, m_targetToSync(NoTarget)
, m_debugIdToSelect(WatchItem::InvalidId) , m_debugIdToSelect(WatchItem::InvalidId)
, m_currentSelectedDebugId(WatchItem::InvalidId) , m_currentSelectedDebugId(WatchItem::InvalidId)
, m_toolsClientConnected(false)
, m_inspectorToolsContext("Debugger.QmlInspector") , m_inspectorToolsContext("Debugger.QmlInspector")
, m_selectAction(new QAction(this)) , m_selectAction(new QAction(this))
, m_zoomAction(new QAction(this)) , m_zoomAction(new QAction(this))
, m_showAppOnTopAction(action(ShowAppOnTop)) , m_showAppOnTopAction(action(ShowAppOnTop))
, m_engineClientConnected(false)
{ {
m_debugIdToIname.insert(WatchItem::InvalidId, "inspect"); m_debugIdToIname.insert(WatchItem::InvalidId, "inspect");
connect(action(ShowQmlObjectTree), connect(action(ShowQmlObjectTree),
@@ -396,7 +389,7 @@ static bool insertChildren(WatchItem *parent, const QVariant &value)
case QVariant::Map: { case QVariant::Map: {
const QVariantMap map = value.toMap(); const QVariantMap map = value.toMap();
for (auto it = map.begin(), end = map.end(); it != end; ++it) { for (auto it = map.begin(), end = map.end(); it != end; ++it) {
WatchItem *child = new WatchItem; auto child = new WatchItem;
child->name = it.key(); child->name = it.key();
child->value = it.value().toString(); child->value = it.value().toString();
child->type = QLatin1String(it.value().typeName()); child->type = QLatin1String(it.value().typeName());
@@ -410,7 +403,7 @@ static bool insertChildren(WatchItem *parent, const QVariant &value)
case QVariant::List: { case QVariant::List: {
const QVariantList list = value.toList(); const QVariantList list = value.toList();
for (int i = 0, end = list.size(); i != end; ++i) { for (int i = 0, end = list.size(); i != end; ++i) {
WatchItem *child = new WatchItem; auto child = new WatchItem;
const QVariant &value = list.at(i); const QVariant &value = list.at(i);
child->arrayIndex = i; child->arrayIndex = i;
child->value = value.toString(); child->value = value.toString();
@@ -756,7 +749,7 @@ void QmlInspectorAgent::clientStateChanged(QmlDebugClient::State state)
{ {
QString serviceName; QString serviceName;
float version = 0; float version = 0;
if (QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender())) { if (auto client = qobject_cast<QmlDebugClient*>(sender())) {
serviceName = client->name(); serviceName = client->name();
version = client->serviceVersion(); version = client->serviceVersion();
} }
@@ -766,7 +759,7 @@ void QmlInspectorAgent::clientStateChanged(QmlDebugClient::State state)
void QmlInspectorAgent::toolsClientStateChanged(QmlDebugClient::State state) void QmlInspectorAgent::toolsClientStateChanged(QmlDebugClient::State state)
{ {
BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender()); auto client = qobject_cast<BaseToolsClient*>(sender());
QTC_ASSERT(client, return); QTC_ASSERT(client, return);
if (state == QmlDebugClient::Enabled) { if (state == QmlDebugClient::Enabled) {
m_toolsClient = client; m_toolsClient = client;
@@ -820,8 +813,7 @@ void QmlInspectorAgent::toolsClientStateChanged(QmlDebugClient::State state)
void QmlInspectorAgent::engineClientStateChanged(QmlDebugClient::State state) void QmlInspectorAgent::engineClientStateChanged(QmlDebugClient::State state)
{ {
BaseEngineDebugClient *client auto client = qobject_cast<BaseEngineDebugClient*>(sender());
= qobject_cast<BaseEngineDebugClient*>(sender());
if (state == QmlDebugClient::Enabled && !m_engineClientConnected) { if (state == QmlDebugClient::Enabled && !m_engineClientConnected) {
// We accept the first client that is enabled and reject the others. // We accept the first client that is enabled and reject the others.

View File

@@ -49,8 +49,8 @@ class QmlEngine;
class WatchItem; class WatchItem;
//map <filename, editorRevision> -> <lineNumber, columnNumber> -> debugId //map <filename, editorRevision> -> <lineNumber, columnNumber> -> debugId
typedef using DebugIdHash =
QHash<QPair<QString, int>, QHash<QPair<int, int>, QList<int> > > DebugIdHash; QHash<QPair<QString, int>, QHash<QPair<int, int>, QList<int> > >;
class QmlInspectorAgent : public QObject class QmlInspectorAgent : public QObject
{ {
@@ -118,10 +118,10 @@ private:
private: private:
QPointer<QmlEngine> m_qmlEngine; QPointer<QmlEngine> m_qmlEngine;
QmlDebug::BaseEngineDebugClient *m_engineClient; QmlDebug::BaseEngineDebugClient *m_engineClient = nullptr;
quint32 m_engineQueryId; quint32 m_engineQueryId = 0;
quint32 m_rootContextQueryId; quint32 m_rootContextQueryId = 0;
int m_objectToSelect; int m_objectToSelect;
QList<quint32> m_objectTreeQueryIds; QList<quint32> m_objectTreeQueryIds;
QStack<QmlDebug::ObjectReference> m_objectStack; QStack<QmlDebug::ObjectReference> m_objectStack;
@@ -136,22 +136,22 @@ private:
DebuggerEngine *m_masterEngine; DebuggerEngine *m_masterEngine;
QHash<QString, QmlDebug::BaseEngineDebugClient*> m_engineClients; QHash<QString, QmlDebug::BaseEngineDebugClient*> m_engineClients;
QmlDebug::BaseToolsClient *m_toolsClient; QmlDebug::BaseToolsClient *m_toolsClient = nullptr;
SelectionTarget m_targetToSync; SelectionTarget m_targetToSync = NoTarget;
int m_debugIdToSelect; int m_debugIdToSelect;
int m_currentSelectedDebugId; int m_currentSelectedDebugId;
QString m_currentSelectedDebugName; QString m_currentSelectedDebugName;
// toolbar // toolbar
bool m_toolsClientConnected; bool m_toolsClientConnected = false;
Core::Context m_inspectorToolsContext; Core::Context m_inspectorToolsContext;
QAction *m_selectAction; QAction *m_selectAction;
QAction *m_zoomAction; QAction *m_zoomAction;
QAction *m_showAppOnTopAction; QAction *m_showAppOnTopAction;
bool m_engineClientConnected; bool m_engineClientConnected = false;
}; };
} // Internal } // Internal

View File

@@ -69,7 +69,7 @@ enum RegisterDataRole
class RegisterDelegate : public QItemDelegate class RegisterDelegate : public QItemDelegate
{ {
public: public:
RegisterDelegate() {} RegisterDelegate() = default;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
const QModelIndex &index) const override const QModelIndex &index) const override
@@ -80,7 +80,7 @@ public:
lineEdit->setFrame(false); lineEdit->setFrame(false);
return lineEdit; return lineEdit;
} }
return 0; return nullptr;
} }
void setEditorData(QWidget *editor, const QModelIndex &index) const override void setEditorData(QWidget *editor, const QModelIndex &index) const override
@@ -428,9 +428,9 @@ public:
appendChild(new RegisterEditItem(i, subKind, subSize, format)); appendChild(new RegisterEditItem(i, subKind, subSize, format));
} }
QVariant data(int column, int role) const; QVariant data(int column, int role) const override;
Qt::ItemFlags flags(int column) const Qt::ItemFlags flags(int column) const override
{ {
//return column == 1 ? Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable //return column == 1 ? Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable
// : Qt::ItemIsSelectable|Qt::ItemIsEnabled; // : Qt::ItemIsSelectable|Qt::ItemIsEnabled;

View File

@@ -103,7 +103,7 @@ class RegisterItem;
using RegisterRootItem = Utils::TypedTreeItem<RegisterItem>; using RegisterRootItem = Utils::TypedTreeItem<RegisterItem>;
using RegisterModel = Utils::TreeModel<RegisterRootItem, RegisterItem, RegisterSubItem>; using RegisterModel = Utils::TreeModel<RegisterRootItem, RegisterItem, RegisterSubItem>;
typedef QMap<quint64, QString> RegisterMap; using RegisterMap = QMap<quint64, QString>;
class RegisterHandler : public RegisterModel class RegisterHandler : public RegisterModel
{ {

View File

@@ -78,7 +78,7 @@ void RegisterPostMortemAction::readSettings(const QSettings *)
Q_UNUSED(debuggerRegistryValueNameC); // avoid warning from MinGW Q_UNUSED(debuggerRegistryValueNameC); // avoid warning from MinGW
bool registered = false; bool registered = false;
HKEY handle = 0; HKEY handle = NULL;
QString errorMessage; QString errorMessage;
if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, &errorMessage)) if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, &errorMessage))
registered = isRegistered(handle, debuggerCall(), &errorMessage); registered = isRegistered(handle, debuggerCall(), &errorMessage);

View File

@@ -53,13 +53,13 @@ CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) :
setModal(true); setModal(true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QFormLayout *formLayout = new QFormLayout; auto formLayout = new QFormLayout;
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
m_chooser->setHistoryCompleter(QLatin1String("Debugger.CdbCacheDir.History")); m_chooser->setHistoryCompleter(QLatin1String("Debugger.CdbCacheDir.History"));
m_chooser->setMinimumWidth(400); m_chooser->setMinimumWidth(400);
formLayout->addRow(tr("Path:"), m_chooser); formLayout->addRow(tr("Path:"), m_chooser);
QVBoxLayout *mainLayout = new QVBoxLayout; auto mainLayout = new QVBoxLayout;
mainLayout->addLayout(formLayout); mainLayout->addLayout(formLayout);
mainLayout->addWidget(m_buttonBox); mainLayout->addWidget(m_buttonBox);

View File

@@ -72,21 +72,21 @@ struct CV_INFO_PDB70
// Retrieve the NT image header of an executable via the legacy DOS header. // Retrieve the NT image header of an executable via the legacy DOS header.
static IMAGE_NT_HEADERS *getNtHeader(void *fileMemory, QString *errorMessage) static IMAGE_NT_HEADERS *getNtHeader(void *fileMemory, QString *errorMessage)
{ {
IMAGE_DOS_HEADER *dosHeader = static_cast<PIMAGE_DOS_HEADER>(fileMemory); auto dosHeader = static_cast<PIMAGE_DOS_HEADER>(fileMemory);
// Check DOS header consistency // Check DOS header consistency
if (IsBadReadPtr(dosHeader, sizeof(IMAGE_DOS_HEADER)) if (IsBadReadPtr(dosHeader, sizeof(IMAGE_DOS_HEADER))
|| dosHeader->e_magic != IMAGE_DOS_SIGNATURE) { || dosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
*errorMessage = QString::fromLatin1("DOS header check failed."); *errorMessage = QString::fromLatin1("DOS header check failed.");
return 0; return nullptr;
} }
// Retrieve NT header // Retrieve NT header
IMAGE_NT_HEADERS *ntHeaders = makePtr<IMAGE_NT_HEADERS>(dosHeader, dosHeader->e_lfanew); auto ntHeaders = makePtr<IMAGE_NT_HEADERS>(dosHeader, dosHeader->e_lfanew);
// check NT header consistency // check NT header consistency
if (IsBadReadPtr(ntHeaders, sizeof(ntHeaders->Signature)) if (IsBadReadPtr(ntHeaders, sizeof(ntHeaders->Signature))
|| ntHeaders->Signature != IMAGE_NT_SIGNATURE || ntHeaders->Signature != IMAGE_NT_SIGNATURE
|| IsBadReadPtr(&ntHeaders->FileHeader, sizeof(IMAGE_FILE_HEADER))) { || IsBadReadPtr(&ntHeaders->FileHeader, sizeof(IMAGE_FILE_HEADER))) {
*errorMessage = QString::fromLatin1("NT header check failed."); *errorMessage = QString::fromLatin1("NT header check failed.");
return 0; return nullptr;
} }
// Check magic // Check magic
const WORD magic = ntHeaders->OptionalHeader.Magic; const WORD magic = ntHeaders->OptionalHeader.Magic;
@@ -100,14 +100,14 @@ static IMAGE_NT_HEADERS *getNtHeader(void *fileMemory, QString *errorMessage)
if (magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC && magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC) { if (magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC && magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
*errorMessage = QString::fromLatin1("NT header check failed; magic %1 is none of %2, %3."). *errorMessage = QString::fromLatin1("NT header check failed; magic %1 is none of %2, %3.").
arg(magic).arg(IMAGE_NT_OPTIONAL_HDR32_MAGIC).arg(IMAGE_NT_OPTIONAL_HDR64_MAGIC); arg(magic).arg(IMAGE_NT_OPTIONAL_HDR32_MAGIC).arg(IMAGE_NT_OPTIONAL_HDR64_MAGIC);
return 0; return nullptr;
} }
#endif #endif
// Check section headers // Check section headers
IMAGE_SECTION_HEADER *sectionHeaders = IMAGE_FIRST_SECTION(ntHeaders); IMAGE_SECTION_HEADER *sectionHeaders = IMAGE_FIRST_SECTION(ntHeaders);
if (IsBadReadPtr(sectionHeaders, ntHeaders->FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER))) { if (IsBadReadPtr(sectionHeaders, ntHeaders->FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER))) {
*errorMessage = QString::fromLatin1("NT header section header check failed."); *errorMessage = QString::fromLatin1("NT header section header check failed.");
return 0; return nullptr;
} }
return ntHeaders; return ntHeaders;
} }
@@ -134,22 +134,22 @@ static bool getDebugDirectory(IMAGE_NT_HEADERS *ntHeaders, void *fileMemory,
{ {
DWORD debugDirRva = 0; DWORD debugDirRva = 0;
DWORD debugDirSize; DWORD debugDirSize;
*debugDir = 0; *debugDir = nullptr;
*count = 0; *count = 0;
#ifdef __GNUC__ // MinGW does not have complete 64bit definitions. #ifdef __GNUC__ // MinGW does not have complete 64bit definitions.
IMAGE_OPTIONAL_HEADER *optionalHeader = reinterpret_cast<IMAGE_OPTIONAL_HEADER*>(&(ntHeaders->OptionalHeader)); auto optionalHeader = reinterpret_cast<IMAGE_OPTIONAL_HEADER*>(&(ntHeaders->OptionalHeader));
debugDirRva = optionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress; debugDirRva = optionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
debugDirSize = optionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; debugDirSize = optionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
#else #else
// Find the virtual address // Find the virtual address
const bool is64Bit = ntHeaders->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC; const bool is64Bit = ntHeaders->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC;
if (is64Bit) { if (is64Bit) {
IMAGE_OPTIONAL_HEADER64 *optionalHeader64 = reinterpret_cast<IMAGE_OPTIONAL_HEADER64*>(&(ntHeaders->OptionalHeader)); auto optionalHeader64 = reinterpret_cast<IMAGE_OPTIONAL_HEADER64*>(&(ntHeaders->OptionalHeader));
debugDirRva = optionalHeader64->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress; debugDirRva = optionalHeader64->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
debugDirSize = optionalHeader64->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; debugDirSize = optionalHeader64->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
} else { } else {
IMAGE_OPTIONAL_HEADER32 *optionalHeader32 = reinterpret_cast<IMAGE_OPTIONAL_HEADER32*>(&(ntHeaders->OptionalHeader)); auto optionalHeader32 = reinterpret_cast<IMAGE_OPTIONAL_HEADER32*>(&(ntHeaders->OptionalHeader));
debugDirRva = optionalHeader32->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress; debugDirRva = optionalHeader32->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
debugDirSize = optionalHeader32->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; debugDirSize = optionalHeader32->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
} }
@@ -168,7 +168,7 @@ static bool getDebugDirectory(IMAGE_NT_HEADERS *ntHeaders, void *fileMemory,
// Check // Check
if (IsBadReadPtr(*debugDir, debugDirSize) || debugDirSize < sizeof(IMAGE_DEBUG_DIRECTORY)) { if (IsBadReadPtr(*debugDir, debugDirSize) || debugDirSize < sizeof(IMAGE_DEBUG_DIRECTORY)) {
*errorMessage = QString::fromLatin1("Debug directory corrupted."); *errorMessage = QString::fromLatin1("Debug directory corrupted.");
return 0; return false;
} }
*count = debugDirSize / sizeof(IMAGE_DEBUG_DIRECTORY); *count = debugDirSize / sizeof(IMAGE_DEBUG_DIRECTORY);
@@ -185,19 +185,19 @@ static QString getPDBFileOfCodeViewSection(void *debugInfo, DWORD size)
const DWORD cvSignature = *static_cast<DWORD*>(debugInfo); const DWORD cvSignature = *static_cast<DWORD*>(debugInfo);
if (cvSignature == CV_SIGNATURE_NB10) { if (cvSignature == CV_SIGNATURE_NB10) {
CV_INFO_PDB20* cvInfo = static_cast<CV_INFO_PDB20*>(debugInfo); auto cvInfo = static_cast<CV_INFO_PDB20*>(debugInfo);
if (IsBadReadPtr(debugInfo, sizeof(CV_INFO_PDB20))) if (IsBadReadPtr(debugInfo, sizeof(CV_INFO_PDB20)))
return QString(); return QString();
CHAR* pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName); auto pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName);
if (IsBadStringPtrA(pdbFileName, UINT_MAX)) if (IsBadStringPtrA(pdbFileName, UINT_MAX))
return QString(); return QString();
return QString::fromLocal8Bit(pdbFileName); return QString::fromLocal8Bit(pdbFileName);
} }
if (cvSignature == CV_SIGNATURE_RSDS) { if (cvSignature == CV_SIGNATURE_RSDS) {
CV_INFO_PDB70* cvInfo = static_cast<CV_INFO_PDB70*>(debugInfo); auto cvInfo = static_cast<CV_INFO_PDB70*>(debugInfo);
if (IsBadReadPtr(debugInfo, sizeof(CV_INFO_PDB70))) if (IsBadReadPtr(debugInfo, sizeof(CV_INFO_PDB70)))
return QString(); return QString();
CHAR* pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName); auto pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName);
if (IsBadStringPtrA(pdbFileName, UINT_MAX)) if (IsBadStringPtrA(pdbFileName, UINT_MAX))
return QString(); return QString();
return QString::fromLocal8Bit(pdbFileName); return QString::fromLocal8Bit(pdbFileName);

View File

@@ -39,7 +39,7 @@ class SymbolPathsDialog : public QDialog
public: public:
explicit SymbolPathsDialog(QWidget *parent = nullptr); explicit SymbolPathsDialog(QWidget *parent = nullptr);
~SymbolPathsDialog(); ~SymbolPathsDialog() override;
bool useSymbolCache() const; bool useSymbolCache() const;
bool useSymbolServer() const; bool useSymbolServer() const;

View File

@@ -44,7 +44,7 @@ namespace Internal {
static QString chopConst(QString type) static QString chopConst(QString type)
{ {
while (1) { while (true) {
if (type.startsWith(QLatin1String("const"))) if (type.startsWith(QLatin1String("const")))
type = type.mid(5); type = type.mid(5);
else if (type.startsWith(QLatin1Char(' '))) else if (type.startsWith(QLatin1Char(' ')))

View File

@@ -116,10 +116,7 @@ QDebug operator<<(QDebug d, const SnapshotData &f)
A snapshot represents a debugging session. A snapshot represents a debugging session.
*/ */
SnapshotHandler::SnapshotHandler() SnapshotHandler::SnapshotHandler() = default;
{
m_currentIndex = -1;
}
SnapshotHandler::~SnapshotHandler() SnapshotHandler::~SnapshotHandler()
{ {
@@ -196,10 +193,10 @@ QVariant SnapshotHandler::headerData(int section, Qt::Orientation orientation, i
Qt::ItemFlags SnapshotHandler::flags(const QModelIndex &index) const Qt::ItemFlags SnapshotHandler::flags(const QModelIndex &index) const
{ {
if (index.row() >= m_snapshots.size()) if (index.row() >= m_snapshots.size())
return 0; return nullptr;
if (index.row() == m_snapshots.size()) if (index.row() == m_snapshots.size())
return QAbstractTableModel::flags(index); return QAbstractTableModel::flags(index);
return true ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0); return true ? QAbstractTableModel::flags(index) : Qt::ItemFlags({});
} }
void SnapshotHandler::activateSnapshot(int index) void SnapshotHandler::activateSnapshot(int index)

View File

@@ -40,7 +40,7 @@ class SnapshotHandler : public QAbstractTableModel
public: public:
explicit SnapshotHandler(); explicit SnapshotHandler();
~SnapshotHandler(); ~SnapshotHandler() override;
// Called from SnapshotHandler after a new snapshot has been added // Called from SnapshotHandler after a new snapshot has been added
void removeAll(); void removeAll();
@@ -58,13 +58,13 @@ public:
private: private:
// QAbstractTableModel // QAbstractTableModel
int rowCount(const QModelIndex &parent) const; int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const override;
int m_currentIndex; int m_currentIndex = -1;
QList< QPointer<DebuggerRunTool> > m_snapshots; QList< QPointer<DebuggerRunTool> > m_snapshots;
}; };

View File

@@ -42,8 +42,8 @@ public:
private: private:
void rowActivated(const QModelIndex &index); void rowActivated(const QModelIndex &index);
void removeSnapshot(int i); void removeSnapshot(int i);
void keyPressEvent(QKeyEvent *ev); void keyPressEvent(QKeyEvent *ev) override;
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev) override;
SnapshotHandler *m_snapshotHandler; SnapshotHandler *m_snapshotHandler;
}; };

View File

@@ -62,15 +62,13 @@ public:
public: public:
QPointer<BaseTextEditor> editor; QPointer<BaseTextEditor> editor;
QPointer<DebuggerEngine> engine; QPointer<DebuggerEngine> engine;
TextMark *locationMark; TextMark *locationMark = nullptr;
QString path; QString path;
QString producer; QString producer;
}; };
SourceAgentPrivate::SourceAgentPrivate() SourceAgentPrivate::SourceAgentPrivate()
: editor(0) : producer(QLatin1String("remote"))
, locationMark(nullptr)
, producer(QLatin1String("remote"))
{ {
} }
@@ -78,7 +76,7 @@ SourceAgentPrivate::~SourceAgentPrivate()
{ {
if (editor) if (editor)
EditorManager::closeDocument(editor->document()); EditorManager::closeDocument(editor->document());
editor = 0; editor = nullptr;
delete locationMark; delete locationMark;
} }
@@ -135,7 +133,7 @@ void SourceAgent::updateLocationMarker()
if (d->locationMark) if (d->locationMark)
d->editor->textDocument()->removeMark(d->locationMark); d->editor->textDocument()->removeMark(d->locationMark);
delete d->locationMark; delete d->locationMark;
d->locationMark = 0; d->locationMark = nullptr;
if (d->engine->stackHandler()->currentFrame().file == d->path) { if (d->engine->stackHandler()->currentFrame().file == d->path) {
int lineNumber = d->engine->stackHandler()->currentFrame().line; int lineNumber = d->engine->stackHandler()->currentFrame().line;

View File

@@ -46,7 +46,7 @@ SourceFilesHandler::SourceFilesHandler(DebuggerEngine *engine)
: m_engine(engine) : m_engine(engine)
{ {
setObjectName("SourceFilesModel"); setObjectName("SourceFilesModel");
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this); auto proxy = new QSortFilterProxyModel(this);
proxy->setObjectName("SourceFilesProxyModel"); proxy->setObjectName("SourceFilesProxyModel");
proxy->setSourceModel(this); proxy->setSourceModel(this);
m_proxyModel = proxy; m_proxyModel = proxy;
@@ -78,9 +78,9 @@ QVariant SourceFilesHandler::headerData(int section,
Qt::ItemFlags SourceFilesHandler::flags(const QModelIndex &index) const Qt::ItemFlags SourceFilesHandler::flags(const QModelIndex &index) const
{ {
if (index.row() >= m_fullNames.size()) if (index.row() >= m_fullNames.size())
return 0; return nullptr;
QFileInfo fi(m_fullNames.at(index.row())); QFileInfo fi(m_fullNames.at(index.row()));
return fi.isReadable() ? QAbstractItemModel::flags(index) : Qt::ItemFlags(0); return fi.isReadable() ? QAbstractItemModel::flags(index) : Qt::ItemFlags({});
} }
QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const

View File

@@ -149,7 +149,7 @@ if (true) {
\endcode \endcode
*/ */
typedef QHash<QString, int> SeenHash; using SeenHash = QHash<QString, int>;
static void blockRecursion(const Overview &overview, static void blockRecursion(const Overview &overview,
const Scope *scope, const Scope *scope,

View File

@@ -44,9 +44,7 @@ namespace Internal {
// //
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
StackFrame::StackFrame() StackFrame::StackFrame() = default;
: language(CppLanguage), line(-1), address(0), usable(false)
{}
void StackFrame::clear() void StackFrame::clear()
{ {

View File

@@ -53,21 +53,21 @@ public:
void fixQrcFrame(const DebuggerRunParameters &rp); void fixQrcFrame(const DebuggerRunParameters &rp);
public: public:
DebuggerLanguage language; DebuggerLanguage language = CppLanguage;
QString level; QString level;
QString function; QString function;
QString file; // We try to put an absolute file name in there. QString file; // We try to put an absolute file name in there.
QString module; // Sometimes something like "/usr/lib/libstdc++.so.6" QString module; // Sometimes something like "/usr/lib/libstdc++.so.6"
QString receiver; // Used in ScriptEngine only. QString receiver; // Used in ScriptEngine only.
qint32 line; qint32 line = -1;
quint64 address; quint64 address = 0;
bool usable; bool usable = false;
QString context; // Opaque value produced and consumed by the native backends. QString context; // Opaque value produced and consumed by the native backends.
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::StackHandler) Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::StackHandler)
}; };
typedef QList<StackFrame> StackFrames; using StackFrames = QList<StackFrame>;
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -77,9 +77,7 @@ StackHandler::StackHandler(DebuggerEngine *engine)
this, &StackHandler::reloadFullStack); this, &StackHandler::reloadFullStack);
} }
StackHandler::~StackHandler() StackHandler::~StackHandler() = default;
{
}
int StackHandler::rowCount(const QModelIndex &parent) const int StackHandler::rowCount(const QModelIndex &parent) const
{ {
@@ -157,7 +155,7 @@ QVariant StackHandler::headerData(int section, Qt::Orientation orient, int role)
Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const
{ {
if (index.row() >= m_stackFrames.size() + m_canExpand) if (index.row() >= m_stackFrames.size() + m_canExpand)
return 0; return nullptr;
if (index.row() == m_stackFrames.size()) if (index.row() == m_stackFrames.size())
return QAbstractTableModel::flags(index); return QAbstractTableModel::flags(index);
const StackFrame &frame = m_stackFrames.at(index.row()); const StackFrame &frame = m_stackFrames.at(index.row());

View File

@@ -41,7 +41,7 @@ namespace Internal {
class ThreadId class ThreadId
{ {
public: public:
ThreadId() : m_id(-1) {} ThreadId() = default;
explicit ThreadId(qint64 id) : m_id(id) {} explicit ThreadId(qint64 id) : m_id(id) {}
bool isValid() const { return m_id != -1; } bool isValid() const { return m_id != -1; }
@@ -50,7 +50,7 @@ public:
bool operator!=(const ThreadId other) const { return m_id != other.m_id; } bool operator!=(const ThreadId other) const { return m_id != other.m_id; }
private: private:
qint64 m_id; qint64 m_id = -1;
}; };
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@@ -62,13 +62,7 @@ private:
/*! A structure containing information about a single thread. */ /*! A structure containing information about a single thread. */
struct ThreadData struct ThreadData
{ {
ThreadData() ThreadData() = default;
{
frameLevel = -1;
lineNumber = -1;
address = 0;
stopped = true;
}
enum { enum {
IdColumn, IdColumn,
@@ -92,12 +86,12 @@ struct ThreadData
QString groupId; QString groupId;
QString targetId; QString targetId;
QString core; QString core;
bool stopped; bool stopped = true;
// State information when stopped. // State information when stopped.
qint32 frameLevel; qint32 frameLevel = -1;
qint32 lineNumber; qint32 lineNumber = -1;
quint64 address; quint64 address = 0;
QString function; QString function;
QString module; QString module;
QString fileName; QString fileName;
@@ -106,7 +100,7 @@ struct ThreadData
QString name; QString name;
}; };
typedef QVector<ThreadData> Threads; using Threads = QVector<ThreadData>;
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -62,7 +62,7 @@ public:
: threadData(data), handler(handler) : threadData(data), handler(handler)
{} {}
QVariant data(int column, int role) const QVariant data(int column, int role) const override
{ {
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
@@ -83,9 +83,9 @@ public:
return QVariant(); return QVariant();
} }
Qt::ItemFlags flags(int column) const Qt::ItemFlags flags(int column) const override
{ {
return threadData.stopped ? TreeItem::flags(column) : Qt::ItemFlags(0); return threadData.stopped ? TreeItem::flags(column) : Qt::ItemFlags({});
} }
QString threadToolTip() const QString threadToolTip() const
@@ -233,7 +233,6 @@ public:
ThreadsHandler::ThreadsHandler(DebuggerEngine *engine) ThreadsHandler::ThreadsHandler(DebuggerEngine *engine)
: m_engine(engine) : m_engine(engine)
{ {
m_resetLocationScheduled = false;
setObjectName(QLatin1String("ThreadsModel")); setObjectName(QLatin1String("ThreadsModel"));
setHeader({ setHeader({
QLatin1String(" ") + tr("ID") + QLatin1String(" "), QLatin1String(" ") + tr("ID") + QLatin1String(" "),

View File

@@ -87,7 +87,7 @@ private:
DebuggerEngine *m_engine; DebuggerEngine *m_engine;
ThreadId m_currentId; ThreadId m_currentId;
bool m_resetLocationScheduled; bool m_resetLocationScheduled = false;
QHash<QString, QString> m_pidForGroupId; QHash<QString, QString> m_pidForGroupId;
}; };

View File

@@ -57,8 +57,8 @@ namespace Internal {
static bool isLocal(RunConfiguration *runConfiguration) static bool isLocal(RunConfiguration *runConfiguration)
{ {
Target *target = runConfiguration ? runConfiguration->target() : 0; Target *target = runConfiguration ? runConfiguration->target() : nullptr;
Kit *kit = target ? target->kit() : 0; Kit *kit = target ? target->kit() : nullptr;
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE; return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
} }
@@ -94,8 +94,8 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_kitChooser->setVisible(true); m_kitChooser->setVisible(true);
Project *project = ProjectTree::currentProject(); Project *project = ProjectTree::currentProject();
Target *activeTarget = project ? project->activeTarget() : 0; Target *activeTarget = project ? project->activeTarget() : nullptr;
Kit *kit = activeTarget ? activeTarget->kit() : 0; Kit *kit = activeTarget ? activeTarget->kit() : nullptr;
if (kit) if (kit)
m_kitChooser->setCurrentKitId(kit->id()); m_kitChooser->setCurrentKitId(kit->id());
@@ -140,14 +140,14 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_waitingLabel = new QLabel(QString(), this); m_waitingLabel = new QLabel(QString(), this);
m_waitingLabel->setAlignment(Qt::AlignCenter); m_waitingLabel->setAlignment(Qt::AlignCenter);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
m_watchingPushButton = buttonBox->addButton(tr("Start Watching"), QDialogButtonBox::ActionRole); m_watchingPushButton = buttonBox->addButton(tr("Start Watching"), QDialogButtonBox::ActionRole);
m_watchingPushButton->setCheckable(true); m_watchingPushButton->setCheckable(true);
m_watchingPushButton->setChecked(false); m_watchingPushButton->setChecked(false);
m_watchingPushButton->setEnabled(false); m_watchingPushButton->setEnabled(false);
m_watchingPushButton->setDefault(true); m_watchingPushButton->setDefault(true);
QFormLayout *mainLayout = new QFormLayout(this); auto mainLayout = new QFormLayout(this);
mainLayout->addRow(new QLabel(tr("Kit: "), this), m_kitChooser); mainLayout->addRow(new QLabel(tr("Kit: "), this), m_kitChooser);
mainLayout->addRow(new QLabel(tr("Executable: "), this), pathLayout); mainLayout->addRow(new QLabel(tr("Executable: "), this), pathLayout);
mainLayout->addRow(m_hideOnAttachCheckBox); mainLayout->addRow(m_hideOnAttachCheckBox);
@@ -177,7 +177,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
bool UnstartedAppWatcherDialog::event(QEvent *e) bool UnstartedAppWatcherDialog::event(QEvent *e)
{ {
if (e->type() == QEvent::ShortcutOverride) { if (e->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent *>(e); auto ke = static_cast<QKeyEvent *>(e);
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) { if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
ke->accept(); ke->accept();
return true; return true;
@@ -191,7 +191,7 @@ void UnstartedAppWatcherDialog::selectExecutable()
QString path; QString path;
Project *project = ProjectTree::currentProject(); Project *project = ProjectTree::currentProject();
Target *activeTarget = project ? project->activeTarget() : 0; Target *activeTarget = project ? project->activeTarget() : nullptr;
if (activeTarget) { if (activeTarget) {
if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) { if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) {

View File

@@ -236,9 +236,9 @@ public:
void decodeArrayHelper(int childSize) void decodeArrayHelper(int childSize)
{ {
const QByteArray ba = QByteArray::fromHex(rawData.toUtf8()); const QByteArray ba = QByteArray::fromHex(rawData.toUtf8());
const T *p = (const T *) ba.data(); const auto p = (const T*)ba.data();
for (int i = 0, n = ba.size() / sizeof(T); i < n; ++i) { for (int i = 0, n = ba.size() / sizeof(T); i < n; ++i) {
WatchItem *child = new WatchItem; auto child = new WatchItem;
child->arrayIndex = i; child->arrayIndex = i;
child->value = decodeItemHelper(p[i]); child->value = decodeItemHelper(p[i]);
child->size = childSize; child->size = childSize;
@@ -409,7 +409,7 @@ void WatchItem::parseHelper(const GdbMi &input, bool maySort)
for (int i = 0, n = int(children.children().size()); i != n; ++i) { for (int i = 0, n = int(children.children().size()); i != n; ++i) {
const GdbMi &subinput = children.children().at(i); const GdbMi &subinput = children.children().at(i);
WatchItem *child = new WatchItem; auto child = new WatchItem;
if (childType.isValid()) if (childType.isValid())
child->type = childType.data(); child->type = childType.data();
if (childNumChild.isValid()) if (childNumChild.isValid())
@@ -505,7 +505,7 @@ QString WatchItem::toToolTip() const
if (arrayIndex >= 0) if (arrayIndex >= 0)
formatToolTipRow(str, tr("Array Index"), QString::number(arrayIndex)); formatToolTipRow(str, tr("Array Index"), QString::number(arrayIndex));
if (size) if (size)
formatToolTipRow(str, tr("Static Object Size"), tr("%n bytes", 0, size)); formatToolTipRow(str, tr("Static Object Size"), tr("%n bytes", nullptr, size));
formatToolTipRow(str, tr("Internal ID"), internalName()); formatToolTipRow(str, tr("Internal ID"), internalName());
str << "</table></body></html>"; str << "</table></body></html>";
return res; return res;

View File

@@ -102,15 +102,15 @@ const char KeyProperty[] = "KeyProperty";
static QVariant createItemDelegate(); static QVariant createItemDelegate();
typedef QList<MemoryMarkup> MemoryMarkupList; using MemoryMarkupList = QList<MemoryMarkup>;
// Helper functionality to indicate the area of a member variable in // Helper functionality to indicate the area of a member variable in
// a vector representing the memory area by a unique color // a vector representing the memory area by a unique color
// number and tooltip. Parts of it will be overwritten when recursing // number and tooltip. Parts of it will be overwritten when recursing
// over the children. // over the children.
typedef QPair<int, QString> ColorNumberToolTip; using ColorNumberToolTip = QPair<int, QString>;
typedef QVector<ColorNumberToolTip> ColorNumberToolTips; using ColorNumberToolTips = QVector<ColorNumberToolTip>;
struct TypeInfo struct TypeInfo
{ {
@@ -126,7 +126,7 @@ static const WatchModel *watchModel(const WatchItem *item)
template <class T> template <class T>
void readNumericVectorHelper(std::vector<double> *v, const QByteArray &ba) void readNumericVectorHelper(std::vector<double> *v, const QByteArray &ba)
{ {
const T *p = (const T *) ba.data(); const auto p = (const T*)ba.data();
const int n = ba.size() / sizeof(T); const int n = ba.size() / sizeof(T);
v->resize(n); v->resize(n);
// Losing precision in case of 64 bit ints is ok here, as the result // Losing precision in case of 64 bit ints is ok here, as the result
@@ -292,7 +292,7 @@ public:
setSessionValue("DebuggerSeparateWidgetGeometry", geometry()); setSessionValue("DebuggerSeparateWidgetGeometry", geometry());
} }
~SeparatedView() ~SeparatedView() override
{ {
saveGeometry(); saveGeometry();
} }
@@ -332,7 +332,7 @@ public:
if (key == needle) if (key == needle)
return w; return w;
} }
return 0; return nullptr;
} }
template <class T> T *prepareObject(const WatchItem *item) template <class T> T *prepareObject(const WatchItem *item)
@@ -530,7 +530,7 @@ static QString parentName(const QString &iname)
static QString niceTypeHelper(const QString &typeIn) static QString niceTypeHelper(const QString &typeIn)
{ {
typedef QMap<QString, QString> Cache; using Cache = QMap<QString, QString>;
static Cache cache; static Cache cache;
const Cache::const_iterator it = cache.constFind(typeIn); const Cache::const_iterator it = cache.constFind(typeIn);
if (it != cache.constEnd()) if (it != cache.constEnd())
@@ -766,7 +766,7 @@ static inline quint64 pointerValue(QString data)
if (blankPos != -1) if (blankPos != -1)
data.truncate(blankPos); data.truncate(blankPos);
data.remove('`'); data.remove('`');
return data.toULongLong(0, 0); return data.toULongLong(nullptr, 0);
} }
// Return the type used for editing // Return the type used for editing
@@ -1156,7 +1156,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
{ {
if (!idx.isValid()) if (!idx.isValid())
return 0; return nullptr;
const WatchItem *item = nonRootItemForIndex(idx); const WatchItem *item = nonRootItemForIndex(idx);
if (!item) if (!item)
@@ -1897,7 +1897,7 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item, QWidget *parent)
static inline QString msgArrayFormat(int n) static inline QString msgArrayFormat(int n)
{ {
return WatchModel::tr("Array of %n items", 0, n); return WatchModel::tr("Array of %n items", nullptr, n);
} }
QString WatchModel::nameForFormat(int format) QString WatchModel::nameForFormat(int format)
@@ -1960,7 +1960,7 @@ WatchHandler::~WatchHandler()
// Do it manually to prevent calling back in model destructors // Do it manually to prevent calling back in model destructors
// after m_cache is destroyed. // after m_cache is destroyed.
delete m_model; delete m_model;
m_model = 0; m_model = nullptr;
} }
void WatchHandler::cleanup() void WatchHandler::cleanup()
@@ -2267,7 +2267,7 @@ void WatchModel::showEditValue(const WatchItem *item)
QTC_ASSERT(0 < imformat && imformat < 32, return); QTC_ASSERT(0 < imformat && imformat < 32, return);
QImage im(width, height, QImage::Format(imformat)); QImage im(width, height, QImage::Format(imformat));
std::memcpy(im.bits(), bits, nbytes); std::memcpy(im.bits(), bits, nbytes);
ImageViewer *v = m_separatedView->prepareObject<ImageViewer>(item); auto v = m_separatedView->prepareObject<ImageViewer>(item);
v->setInfo(item->address ? v->setInfo(item->address ?
tr("%1 Object at %2").arg(item->type, item->hexAddress()) : tr("%1 Object at %2").arg(item->type, item->hexAddress()) :
tr("%1 Object at Unknown Address").arg(item->type) + " " + tr("%1 Object at Unknown Address").arg(item->type) + " " +
@@ -2307,7 +2307,7 @@ void WatchModel::showEditValue(const WatchItem *item)
QTC_ASSERT(ndims == 2, qDebug() << "Display format: " << format; return); QTC_ASSERT(ndims == 2, qDebug() << "Display format: " << format; return);
QByteArray ba = QByteArray::fromHex(item->editvalue.toUtf8()); QByteArray ba = QByteArray::fromHex(item->editvalue.toUtf8());
void (*reader)(const char *p, QString *res, int size) = 0; void (*reader)(const char *p, QString *res, int size) = nullptr;
if (innerType == "int") if (innerType == "int")
reader = &readOne<qlonglong>; reader = &readOne<qlonglong>;
else if (innerType == "uint") else if (innerType == "uint")
@@ -2427,7 +2427,7 @@ const WatchItem *WatchHandler::findCppLocalVariable(const QString &name) const
// iname.insert(localsPrefix.size(), "this."); // iname.insert(localsPrefix.size(), "this.");
// if (const WatchData *wd = findData(iname)) // if (const WatchData *wd = findData(iname))
// return wd; // return wd;
return 0; return nullptr;
} }
void WatchModel::setTypeFormat(const QString &type0, int format) void WatchModel::setTypeFormat(const QString &type0, int format)
@@ -2666,15 +2666,15 @@ public:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
const QModelIndex &index) const override const QModelIndex &index) const override
{ {
const WatchModelBase *model = qobject_cast<const WatchModelBase *>(index.model()); const auto model = qobject_cast<const WatchModelBase *>(index.model());
QTC_ASSERT(model, return 0); QTC_ASSERT(model, return nullptr);
WatchItem *item = model->nonRootItemForIndex(index); WatchItem *item = model->nonRootItemForIndex(index);
QTC_ASSERT(item, return 0); QTC_ASSERT(item, return nullptr);
// Value column: Custom editor. Apply integer-specific settings. // Value column: Custom editor. Apply integer-specific settings.
if (index.column() == 1) { if (index.column() == 1) {
QVariant::Type editType = QVariant::Type(item->editType()); auto editType = QVariant::Type(item->editType());
if (editType == QVariant::Bool) if (editType == QVariant::Bool)
return new BooleanComboBox(parent); return new BooleanComboBox(parent);

View File

@@ -37,14 +37,14 @@ class DebuggerCommand;
class DebuggerEngine; class DebuggerEngine;
class WatchModel; class WatchModel;
typedef QVector<DisplayFormat> DisplayFormats; using DisplayFormats = QVector<DisplayFormat>;
class WatchModelBase : public Utils::TreeModel<WatchItem, WatchItem> class WatchModelBase : public Utils::TreeModel<WatchItem, WatchItem>
{ {
Q_OBJECT Q_OBJECT
public: public:
WatchModelBase() {} WatchModelBase() = default;
signals: signals:
void currentIndexRequested(const QModelIndex &idx); void currentIndexRequested(const QModelIndex &idx);

View File

@@ -41,7 +41,7 @@ namespace Debugger {
namespace Internal { namespace Internal {
WatchTreeView::WatchTreeView(WatchType type) WatchTreeView::WatchTreeView(WatchType type)
: m_type(type), m_sliderPosition(0) : m_type(type)
{ {
setObjectName("WatchWindow"); setObjectName("WatchWindow");
setWindowTitle(tr("Locals and Expressions")); setWindowTitle(tr("Locals and Expressions"));

View File

@@ -62,7 +62,7 @@ private:
void currentChanged(const QModelIndex &current, const QModelIndex &previous) override; void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
WatchType m_type; WatchType m_type;
int m_sliderPosition; int m_sliderPosition = 0;
}; };
} // namespace Internal } // namespace Internal

Some files were not shown because too many files have changed in this diff Show More