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

View File

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

View File

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

View File

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

View File

@@ -44,8 +44,8 @@ public:
QString filePath;
// Both values start at 1.
int line;
int column;
int line = 0;
int column = 0;
};
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->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
QFormLayout *formLayout = new QFormLayout;
auto formLayout = new QFormLayout;
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
formLayout->addRow(tr("Kit:"), d->kitChooser);
formLayout->addRow(tr("Executable:"), d->executable);
formLayout->addRow(tr("Arguments:"), d->arguments);
formLayout->addRow(tr("Working directory:"), d->workingDirectory);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
auto verticalLayout = new QVBoxLayout(this);
verticalLayout->addLayout(formLayout);
verticalLayout->addWidget(d->buttonBox);

View File

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

View File

@@ -50,10 +50,10 @@ class Breakpoint
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::BreakHandler)
public:
Breakpoint() {}
Breakpoint() = default;
bool isValid() const;
operator const void *() const { return isValid() ? this : 0; }
operator const void *() const { return isValid() ? this : nullptr; }
bool operator!() const { return !isValid(); }
uint hash() const;
@@ -157,7 +157,7 @@ private:
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>;

View File

@@ -40,13 +40,13 @@ namespace Internal {
class BreakpointIdBase
{
public:
BreakpointIdBase() : m_majorPart(0), m_minorPart(0) {}
BreakpointIdBase() = default;
bool isValid() const { return m_majorPart != 0; }
bool isMajor() const { return m_majorPart != 0 && m_minorPart == 0; }
bool isMinor() const { return m_majorPart != 0 && m_minorPart != 0; }
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); }
QString toString() const;
bool operator==(const BreakpointIdBase &id) const
@@ -55,8 +55,8 @@ public:
quint16 minorPart() const { return m_minorPart; }
protected:
quint16 m_majorPart;
quint16 m_minorPart;
quint16 m_majorPart = 0;
quint16 m_minorPart = 0;
};
class BreakpointModelId : public BreakpointIdBase

View File

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

View File

@@ -46,8 +46,8 @@ class CdbEngine : public DebuggerEngine
Q_OBJECT
public:
typedef QSharedPointer<CdbCommand> CdbCommandPtr;
typedef std::function<void(const DebuggerResponse &)> CommandHandler;
using CdbCommandPtr = QSharedPointer<CdbCommand>;
using CommandHandler = std::function<void (const DebuggerResponse &)>;
explicit CdbEngine();
~CdbEngine() override;
@@ -119,8 +119,8 @@ private:
void handleDoInterruptInferior(const QString &errorMessage);
typedef QHash<BreakpointModelId, BreakpointResponse> PendingBreakPointMap;
typedef QPair<QString, QString> SourcePathMapping;
using PendingBreakPointMap = QHash<BreakpointModelId, BreakpointResponse>;
using SourcePathMapping = QPair<QString, QString>;
struct NormalizedSourceFileName // Struct for caching mapped/normalized source files.
{
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,
// further columns with checkbox + parameter
QHBoxLayout *mainLayout = new QHBoxLayout;
auto mainLayout = new QHBoxLayout;
mainLayout->setMargin(0);
QVBoxLayout *leftLayout = new QVBoxLayout;
auto leftLayout = new QVBoxLayout;
QFormLayout *parameterLayout = nullptr;
mainLayout->addLayout(leftLayout);
const size_t eventCount = sizeof(eventDescriptions) / sizeof(EventsDescription);
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;
if (eventDescriptions[e].hasParameter) {
if (!parameterLayout) {
@@ -95,7 +95,7 @@ CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent)
le = new QLineEdit;
parameterLayout->addRow(cb, le);
if (parameterLayout->count() >= 6) // New column
parameterLayout = 0;
parameterLayout = nullptr;
} else {
leftLayout->addWidget(cb);
}
@@ -168,7 +168,7 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent)
m_ui.startupFormLayout->setContentsMargins(margins);
QVBoxLayout *eventLayout = new QVBoxLayout;
auto eventLayout = new QVBoxLayout;
eventLayout->setContentsMargins(margins);
eventLayout->addWidget(m_breakEventWidget);
m_ui.eventGroupBox->setLayout(eventLayout);
@@ -203,9 +203,7 @@ CdbOptionsPage::CdbOptionsPage()
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
CdbOptionsPage::~CdbOptionsPage()
{
}
CdbOptionsPage::~CdbOptionsPage() = default;
QWidget *CdbOptionsPage::widget()
{
@@ -248,19 +246,19 @@ public:
CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
QString title = tr("Symbol Paths");
QGroupBox* gbSymbolPath = new QGroupBox(this);
auto gbSymbolPath = new QGroupBox(this);
gbSymbolPath->setTitle(title);
QVBoxLayout *gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath);
auto gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath);
m_symbolPathListEditor = new CdbSymbolPathListEditor(gbSymbolPath);
gbSymbolPathLayout->addWidget(m_symbolPathListEditor);
title = tr("Source Paths");
QGroupBox* gbSourcePath = new QGroupBox(this);
auto gbSourcePath = new QGroupBox(this);
gbSourcePath->setTitle(title);
QVBoxLayout *gbSourcePathLayout = new QVBoxLayout(gbSourcePath);
auto gbSourcePathLayout = new QVBoxLayout(gbSourcePath);
m_sourcePathListEditor = new Utils::PathListEditor(gbSourcePath);
gbSourcePathLayout->addWidget(m_sourcePathListEditor);
@@ -272,16 +270,14 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
}
CdbPathsPage::CdbPathsPage()
: m_widget(0)
: m_widget(nullptr)
{
setId("F.Debugger.Cdb");
setDisplayName(tr("CDB Paths"));
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
CdbPathsPage::~CdbPathsPage()
{
}
CdbPathsPage::~CdbPathsPage() = default;
QWidget *CdbPathsPage::widget()
{

View File

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

View File

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

View File

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

View File

@@ -31,7 +31,7 @@ namespace Debugger {
namespace Internal {
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)
public:
typedef void (ModifierFunc)(StringInputStream &s);
using ModifierFunc = void (StringInputStream &);
explicit StringInputStream(QString &str);
@@ -62,9 +62,9 @@ private:
template <class IntType> void appendInt(IntType i);
QString &m_target;
int m_integerBase;
bool m_hexPrefix;
int m_width;
int m_integerBase = 10;
bool m_hexPrefix = false;
int m_width = 0;
};
template <class IntType>

View File

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

View File

@@ -63,7 +63,7 @@ Console::Console()
m_consoleWidget->setWindowTitle(displayName());
m_consoleWidget->setEnabled(true);
QVBoxLayout *vbox = new QVBoxLayout(m_consoleWidget);
auto vbox = new QVBoxLayout(m_consoleWidget);
vbox->setMargin(0);
vbox->setSpacing(0);
@@ -92,7 +92,7 @@ Console::Console()
itemDelegate, &ConsoleItemDelegate::currentChanged);
m_consoleView->setItemDelegate(itemDelegate);
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate();
auto aggregate = new Aggregation::Aggregate();
aggregate->add(m_consoleView);
aggregate->add(new Core::ItemViewFind(m_consoleView));
@@ -189,7 +189,7 @@ bool Console::canFocus() 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()) {
if (widget == m_consoleWidget)
return true;

View File

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

View File

@@ -41,8 +41,8 @@ public:
QString getCurrentScript() const;
protected:
void keyPressEvent(QKeyEvent *e);
void focusOutEvent(QFocusEvent *e);
void keyPressEvent(QKeyEvent *e) override;
void focusOutEvent(QFocusEvent *e) override;
signals:
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,
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
@@ -144,7 +144,7 @@ void ConsoleItem::fetchMore()
}
for (TreeItem *child : *this) {
ConsoleItem *item = static_cast<ConsoleItem *>(child);
auto item = static_cast<ConsoleItem*>(child);
if (item->m_doFetch) {
item->m_doFetch(item);
item->m_doFetch = m_doFetch;

View File

@@ -75,7 +75,7 @@ private:
ItemType m_itemType;
QString m_text;
QString m_file;
int m_line;
int m_line = -1;
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_collapseIcon(Utils::Icons::COLLAPSE.icon()),
m_prompt(Utils::Icon({{QLatin1String(":/utils/images/next.png"),
Utils::Theme::TextColorNormal}}, Utils::Icon::Tint).icon()),
m_cachedHeight(0)
Utils::Theme::TextColorNormal}}, Utils::Icon::Tint).icon())
{
}
@@ -124,7 +123,7 @@ void ConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
bool(opt.state & QStyle::State_Selected));
// Calculate positions
const QTreeView *view = qobject_cast<const QTreeView *>(opt.widget);
const auto view = qobject_cast<const QTreeView*>(opt.widget);
int level = 0;
QModelIndex idx(index);
while (idx.parent() != QModelIndex()) {
@@ -219,7 +218,7 @@ QSize ConsoleItemDelegate::sizeHint(const QStyleOptionViewItem &option,
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
const QTreeView *view = qobject_cast<const QTreeView *>(opt.widget);
const auto view = qobject_cast<const QTreeView*>(opt.widget);
int level = 0;
QModelIndex idx(index);
while (idx.parent() != QModelIndex()) {
@@ -268,7 +267,7 @@ QWidget *ConsoleItemDelegate::createEditor(QWidget *parent,
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
editor->setStyleSheet(QLatin1String("QTextEdit {"
"margin-left: 24px;"
@@ -286,7 +285,7 @@ QWidget *ConsoleItemDelegate::createEditor(QWidget *parent,
void ConsoleItemDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
ConsoleEdit *edtr = qobject_cast<ConsoleEdit *>(editor);
auto edtr = qobject_cast<ConsoleEdit*>(editor);
edtr->insertPlainText(index.data(ConsoleItem::ExpressionRole).toString());
}
@@ -294,7 +293,7 @@ void ConsoleItemDelegate::setModelData(QWidget *editor,
QAbstractItemModel *model,
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, ConsoleItem::InputType, ConsoleItem::TypeRole);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -677,7 +677,7 @@ void DebuggerSettings::writeSettings() 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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -144,7 +144,7 @@ public:
: 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) {
case Qt::DisplayRole:
@@ -327,7 +327,7 @@ DebuggerItemConfigWidget::DebuggerItemConfigWidget()
m_abis = new QLineEdit(this);
m_abis->setEnabled(false);
QFormLayout *formLayout = new QFormLayout(this);
auto formLayout = new QFormLayout(this);
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
formLayout->addRow(new QLabel(tr("Name:")), m_displayNameLineEdit);
formLayout->addRow(m_cdbLabel);
@@ -620,7 +620,7 @@ void DebuggerOptionsPage::apply()
void DebuggerOptionsPage::finish()
{
delete m_configWidget;
m_configWidget = 0;
m_configWidget = nullptr;
d->m_model->cancel();
}

View File

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

View File

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

View File

@@ -86,7 +86,7 @@ DebuggerMainWindow::DebuggerMainWindow()
DebuggerMainWindow::~DebuggerMainWindow()
{
delete m_editorPlaceHolder;
m_editorPlaceHolder = 0;
m_editorPlaceHolder = nullptr;
// 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
foreach (QDockWidget *dock, m_dockForDockId) {
@@ -312,7 +312,7 @@ void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId,
removeDockWidget(dockWidget);
dockWidget->hide();
// Prevent saveState storing the data of the wrong children.
dockWidget->setParent(0);
dockWidget->setParent(nullptr);
}
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)
{
QTC_ASSERT(!widget->objectName().isEmpty(), return 0);
QTC_ASSERT(!widget->objectName().isEmpty(), return nullptr);
QDockWidget *dockWidget = addDockForWidget(widget);
m_dockForDockId[dockId] = dockWidget;
return dockWidget;

View File

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

View File

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

View File

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

View File

@@ -69,9 +69,9 @@ class DebuggerRunConfigWidget : public RunConfigWidget
public:
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 useCppDebuggerClicked(bool on);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -189,12 +189,12 @@ void DisassemblerLines::appendUnparsed(const QString &unparsed)
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.offset = address.mid(pos2).toUInt();
} else {
// 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.offset = 0;
}

View File

@@ -40,7 +40,7 @@ namespace Internal {
class DisassemblerLine
{
public:
DisassemblerLine() : address(0), offset(0), lineNumber(0), hunk(0) {}
DisassemblerLine() = default;
bool isAssembler() const { return address != 0; }
bool isCode() const { return lineNumber != 0; }
bool isComment() const { return lineNumber == 0 && address == 0; }
@@ -48,12 +48,12 @@ public:
void fromString(const QString &unparsed);
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 fileName; // (src) Source file
uint offset; // (ass) Offset of instruction in relation to current function.
uint lineNumber; // (src) Line number in source.
uint hunk; // (src) Number of hunk if source line was split
uint offset = 0; // (ass) Offset of instruction in relation to current function.
uint lineNumber = 0; // (src) Line number in source.
uint hunk = 0; // (src) Number of hunk if source line was split
QByteArray rawData; // (ass) Raw bytes of the instruction
QString data; // (ass) Instruction text, (src) source text, (cmt) arbitrary.
QString bytes; // (ass) The instruction in raw bytes
@@ -62,7 +62,7 @@ public:
class DisassemblerLines
{
public:
DisassemblerLines() : m_bytesLength(0) {}
DisassemblerLines() = default;
bool coversAddress(quint64 address) const;
void appendUnparsed(const QString &line);
@@ -84,7 +84,7 @@ public:
private:
QString m_lastFunction;
int m_bytesLength;
int m_bytesLength = 0;
QVector<DisassemblerLine> m_data;
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;
if (addressPos < 0)
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)
*exCodeIn = exCode;
const quint64 address = data.mid(addressPos).trimmed().toULongLong(0, 0);
const quint64 address = data.mid(addressPos).trimmed().toULongLong(nullptr, 0);
QString rc;
QTextStream str(&rc);
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 "
"in an endless loop or taking longer than expected to perform "
"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,
tr("GDB Not Responding"), msg,
QMessageBox::Ok | QMessageBox::Cancel);
@@ -1008,7 +1008,7 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response)
if (m_commandsDoneCallback && m_commandForToken.isEmpty()) {
showMessage("ALL COMMANDS DONE; INVOKING CALLBACK");
CommandsDoneCallback cont = m_commandsDoneCallback;
m_commandsDoneCallback = 0;
m_commandsDoneCallback = nullptr;
if (response->resultClass != ResultRunning) //only start if the thing is not already running
(this->*cont)();
} else {
@@ -1408,7 +1408,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
const GdbMi wpt = data["wpt"];
const BreakpointResponseId rid(wpt["number"].data());
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;
if (bp.type() == WatchpointAtExpression)
msg = bp.msgWatchpointByExpressionTriggered(rid.majorPart(), bp.expression());
@@ -2141,7 +2141,7 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
QString what = bkpt["what"].data();
if (what.startsWith("*0x")) {
response.type = WatchpointAtAddress;
response.address = what.mid(1).toULongLong(0, 0);
response.address = what.mid(1).toULongLong(nullptr, 0);
} else {
response.type = WatchpointAtExpression;
response.expression = what;
@@ -2270,7 +2270,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, Breakpoint b
br.id = BreakpointResponseId(wpt["number"].data());
QString exp = wpt["exp"].data();
if (exp.startsWith('*'))
br.address = exp.mid(1).toULongLong(0, 0);
br.address = exp.mid(1).toULongLong(nullptr, 0);
bp.setResponse(br);
QTC_CHECK(!bp.needsChange());
bp.notifyBreakpointInsertOk();
@@ -2282,7 +2282,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, Breakpoint b
const QString address = ba.mid(end + 2).trimmed();
br.id = BreakpointResponseId(ba.mid(begin, end - begin));
if (address.startsWith('*'))
br.address = address.mid(1).toULongLong(0, 0);
br.address = address.mid(1).toULongLong(nullptr, 0);
bp.setResponse(br);
QTC_CHECK(!bp.needsChange());
bp.notifyBreakpointInsertOk();
@@ -2905,7 +2905,7 @@ void GdbEngine::handleModulesList(const DebuggerResponse &response)
module.symbolsRead = (item["state"].data() == "Y")
? Module::ReadOk : Module::ReadFailed;
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.
handler->updateModule(module);
}
@@ -3409,7 +3409,7 @@ void GdbEngine::assignValueInDebugger(WatchItem *item,
class MemoryAgentCookie
{
public:
MemoryAgentCookie() {}
MemoryAgentCookie() = default;
QByteArray *accumulator = 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
{
public:
DisassemblerAgentCookie() : agent(0) {}
DisassemblerAgentCookie() : agent(nullptr) {}
DisassemblerAgentCookie(DisassemblerAgent *agent_) : agent(agent_) {}
public:
@@ -3594,7 +3594,7 @@ void GdbEngine::fetchDisassemblerByCliRangePlain(const DisassemblerAgentCookie &
struct LineData
{
LineData() {}
LineData() = default;
LineData(int i, int f) : index(i), function(f) {}
int index;
int function;
@@ -3611,7 +3611,7 @@ bool GdbEngine::handleCliDisassemblerResult(const QString &output, DisassemblerA
QVector<DisassemblerLine> lines = dlines.data();
typedef QMap<quint64, LineData> LineMap;
using LineMap = QMap<quint64, LineData>;
LineMap lineMap;
int currentFunction = -1;
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()
{
m_rerunPending = false;
m_commandsDoneCallback = 0;
m_commandsDoneCallback = nullptr;
m_commandForToken.clear();
m_flagsForToken.clear();
}
@@ -4003,7 +4003,7 @@ void GdbEngine::handleInferiorPrepared()
if (m_commandForToken.isEmpty()) {
finishInferiorSetup();
} else {
QTC_CHECK(m_commandsDoneCallback == 0);
QTC_CHECK(m_commandsDoneCallback == nullptr);
m_commandsDoneCallback = &GdbEngine::finishInferiorSetup;
}
}
@@ -4503,7 +4503,7 @@ void GdbEngine::shutdownEngine()
CHECK_STATE(EngineShutdownRequested);
showMessage(QString("INITIATE GDBENGINE SHUTDOWN, PROC STATE: %1").arg(m_gdbProc.state()));
m_commandsDoneCallback = 0;
m_commandsDoneCallback = nullptr;
switch (m_gdbProc.state()) {
case QProcess::Running: {
if (runParameters().closeMode == KillAndExitMonitorAtClose)

View File

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

View File

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

View File

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

View File

@@ -64,7 +64,7 @@ class PlotViewer : public QWidget
public:
explicit PlotViewer(QWidget *parent = nullptr);
typedef std::vector<double> Data;
using Data = std::vector<double>;
void setData(const Data &data);
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)->setEnabled(false);
QVBoxLayout *layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
layout->addWidget(m_fileSystemView);
layout->addWidget(m_textBrowser);
layout->addWidget(m_buttonBox);
@@ -234,7 +234,7 @@ public:
{
State st;
st.localCoreFile = p.useLocalCoreFile();
st.validKit = (kitChooser->currentKit() != 0);
st.validKit = (kitChooser->currentKit() != nullptr);
st.validLocalExecFilename = localExecFileName->isValid();
if (st.localCoreFile)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -55,7 +55,7 @@ public:
QString demangled;
};
typedef QVector<Symbol> Symbols;
using Symbols = QVector<Symbol>;
//////////////////////////////////////////////////////////////////
//
@@ -73,7 +73,7 @@ public:
QString flags;
};
typedef QVector<Section> Sections;
using Sections = QVector<Section>;
//////////////////////////////////////////////////////////////////
//
@@ -84,7 +84,7 @@ typedef QVector<Section> Sections;
class Module
{
public:
Module() : symbolsRead(UnknownReadState), startAddress(0), endAddress(0) {}
Module() = default;
public:
enum SymbolReadState {
@@ -95,14 +95,14 @@ public:
QString moduleName;
QString modulePath;
QString hostPath;
SymbolReadState symbolsRead;
quint64 startAddress;
quint64 endAddress;
SymbolReadState symbolsRead = UnknownReadState;
quint64 startAddress = 0;
quint64 endAddress = 0;
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); }
void addTemplateParam(const QSharedPointer<ParseTreeNode> &node) { m_templateParams << node; }
private:
int m_pos;
int m_pos = 0;
QByteArray m_mangledName;
QList<QSharedPointer<ParseTreeNode> > m_substitutions;
QList<QSharedPointer<ParseTreeNode> > m_templateParams;

View File

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

View File

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

View File

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

View File

@@ -53,7 +53,7 @@ static inline QString msgCannotInterrupt(qint64 pid, const QString &why)
static BOOL isWow64Process(HANDLE hproc)
{
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
using LPFN_ISWOW64PROCESS = BOOL (WINAPI*)(HANDLE, PBOOL);
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
{
@@ -136,7 +136,7 @@ struct LookupData
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)
{
@@ -415,7 +415,7 @@ void QmlEngine::connectionStartupFailed()
return;
}
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow());
auto infoBox = new QMessageBox(ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
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);
if (isMasterEngine()) {
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow());
auto infoBox = new QMessageBox(ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
infoBox->setText(error);
@@ -935,9 +935,9 @@ void QmlEngine::selectWatchData(const QString &iname)
bool compareConsoleItems(const ConsoleItem *a, const ConsoleItem *b)
{
if (a == 0)
if (a == nullptr)
return true;
if (b == 0)
if (b == nullptr)
return false;
return a->text() < b->text();
}
@@ -947,7 +947,7 @@ static ConsoleItem *constructLogItemTree(const QVariant &result,
{
bool sorted = boolSetting(SortStructMembers);
if (!result.isValid())
return 0;
return nullptr;
QString text;
ConsoleItem *item = nullptr;

View File

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

View File

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

View File

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

View File

@@ -69,7 +69,7 @@ enum RegisterDataRole
class RegisterDelegate : public QItemDelegate
{
public:
RegisterDelegate() {}
RegisterDelegate() = default;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
const QModelIndex &index) const override
@@ -80,7 +80,7 @@ public:
lineEdit->setFrame(false);
return lineEdit;
}
return 0;
return nullptr;
}
void setEditorData(QWidget *editor, const QModelIndex &index) const override
@@ -428,9 +428,9 @@ public:
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
// : Qt::ItemIsSelectable|Qt::ItemIsEnabled;

View File

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

View File

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

View File

@@ -53,13 +53,13 @@ CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) :
setModal(true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QFormLayout *formLayout = new QFormLayout;
auto formLayout = new QFormLayout;
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
m_chooser->setHistoryCompleter(QLatin1String("Debugger.CdbCacheDir.History"));
m_chooser->setMinimumWidth(400);
formLayout->addRow(tr("Path:"), m_chooser);
QVBoxLayout *mainLayout = new QVBoxLayout;
auto mainLayout = new QVBoxLayout;
mainLayout->addLayout(formLayout);
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.
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
if (IsBadReadPtr(dosHeader, sizeof(IMAGE_DOS_HEADER))
|| dosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
*errorMessage = QString::fromLatin1("DOS header check failed.");
return 0;
return nullptr;
}
// 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
if (IsBadReadPtr(ntHeaders, sizeof(ntHeaders->Signature))
|| ntHeaders->Signature != IMAGE_NT_SIGNATURE
|| IsBadReadPtr(&ntHeaders->FileHeader, sizeof(IMAGE_FILE_HEADER))) {
*errorMessage = QString::fromLatin1("NT header check failed.");
return 0;
return nullptr;
}
// Check 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) {
*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);
return 0;
return nullptr;
}
#endif
// Check section headers
IMAGE_SECTION_HEADER *sectionHeaders = IMAGE_FIRST_SECTION(ntHeaders);
if (IsBadReadPtr(sectionHeaders, ntHeaders->FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER))) {
*errorMessage = QString::fromLatin1("NT header section header check failed.");
return 0;
return nullptr;
}
return ntHeaders;
}
@@ -134,22 +134,22 @@ static bool getDebugDirectory(IMAGE_NT_HEADERS *ntHeaders, void *fileMemory,
{
DWORD debugDirRva = 0;
DWORD debugDirSize;
*debugDir = 0;
*debugDir = nullptr;
*count = 0;
#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;
debugDirSize = optionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
#else
// Find the virtual address
const bool is64Bit = ntHeaders->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC;
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;
debugDirSize = optionalHeader64->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
} 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;
debugDirSize = optionalHeader32->DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
}
@@ -168,7 +168,7 @@ static bool getDebugDirectory(IMAGE_NT_HEADERS *ntHeaders, void *fileMemory,
// Check
if (IsBadReadPtr(*debugDir, debugDirSize) || debugDirSize < sizeof(IMAGE_DEBUG_DIRECTORY)) {
*errorMessage = QString::fromLatin1("Debug directory corrupted.");
return 0;
return false;
}
*count = debugDirSize / sizeof(IMAGE_DEBUG_DIRECTORY);
@@ -185,19 +185,19 @@ static QString getPDBFileOfCodeViewSection(void *debugInfo, DWORD size)
const DWORD cvSignature = *static_cast<DWORD*>(debugInfo);
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)))
return QString();
CHAR* pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName);
auto pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName);
if (IsBadStringPtrA(pdbFileName, UINT_MAX))
return QString();
return QString::fromLocal8Bit(pdbFileName);
}
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)))
return QString();
CHAR* pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName);
auto pdbFileName = reinterpret_cast<CHAR*>(cvInfo->PdbFileName);
if (IsBadStringPtrA(pdbFileName, UINT_MAX))
return QString();
return QString::fromLocal8Bit(pdbFileName);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -46,7 +46,7 @@ SourceFilesHandler::SourceFilesHandler(DebuggerEngine *engine)
: m_engine(engine)
{
setObjectName("SourceFilesModel");
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
auto proxy = new QSortFilterProxyModel(this);
proxy->setObjectName("SourceFilesProxyModel");
proxy->setSourceModel(this);
m_proxyModel = proxy;
@@ -78,9 +78,9 @@ QVariant SourceFilesHandler::headerData(int section,
Qt::ItemFlags SourceFilesHandler::flags(const QModelIndex &index) const
{
if (index.row() >= m_fullNames.size())
return 0;
return nullptr;
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

View File

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

View File

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

View File

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

View File

@@ -77,9 +77,7 @@ StackHandler::StackHandler(DebuggerEngine *engine)
this, &StackHandler::reloadFullStack);
}
StackHandler::~StackHandler()
{
}
StackHandler::~StackHandler() = default;
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
{
if (index.row() >= m_stackFrames.size() + m_canExpand)
return 0;
return nullptr;
if (index.row() == m_stackFrames.size())
return QAbstractTableModel::flags(index);
const StackFrame &frame = m_stackFrames.at(index.row());

View File

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

View File

@@ -62,7 +62,7 @@ public:
: threadData(data), handler(handler)
{}
QVariant data(int column, int role) const
QVariant data(int column, int role) const override
{
switch (role) {
case Qt::DisplayRole:
@@ -83,9 +83,9 @@ public:
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
@@ -233,7 +233,6 @@ public:
ThreadsHandler::ThreadsHandler(DebuggerEngine *engine)
: m_engine(engine)
{
m_resetLocationScheduled = false;
setObjectName(QLatin1String("ThreadsModel"));
setHeader({
QLatin1String(" ") + tr("ID") + QLatin1String(" "),

View File

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

View File

@@ -57,8 +57,8 @@ namespace Internal {
static bool isLocal(RunConfiguration *runConfiguration)
{
Target *target = runConfiguration ? runConfiguration->target() : 0;
Kit *kit = target ? target->kit() : 0;
Target *target = runConfiguration ? runConfiguration->target() : nullptr;
Kit *kit = target ? target->kit() : nullptr;
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
}
@@ -94,8 +94,8 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_kitChooser->setVisible(true);
Project *project = ProjectTree::currentProject();
Target *activeTarget = project ? project->activeTarget() : 0;
Kit *kit = activeTarget ? activeTarget->kit() : 0;
Target *activeTarget = project ? project->activeTarget() : nullptr;
Kit *kit = activeTarget ? activeTarget->kit() : nullptr;
if (kit)
m_kitChooser->setCurrentKitId(kit->id());
@@ -140,14 +140,14 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_waitingLabel = new QLabel(QString(), this);
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->setCheckable(true);
m_watchingPushButton->setChecked(false);
m_watchingPushButton->setEnabled(false);
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("Executable: "), this), pathLayout);
mainLayout->addRow(m_hideOnAttachCheckBox);
@@ -177,7 +177,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
bool UnstartedAppWatcherDialog::event(QEvent *e)
{
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()) {
ke->accept();
return true;
@@ -191,7 +191,7 @@ void UnstartedAppWatcherDialog::selectExecutable()
QString path;
Project *project = ProjectTree::currentProject();
Target *activeTarget = project ? project->activeTarget() : 0;
Target *activeTarget = project ? project->activeTarget() : nullptr;
if (activeTarget) {
if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) {

View File

@@ -236,9 +236,9 @@ public:
void decodeArrayHelper(int childSize)
{
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) {
WatchItem *child = new WatchItem;
auto child = new WatchItem;
child->arrayIndex = i;
child->value = decodeItemHelper(p[i]);
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) {
const GdbMi &subinput = children.children().at(i);
WatchItem *child = new WatchItem;
auto child = new WatchItem;
if (childType.isValid())
child->type = childType.data();
if (childNumChild.isValid())
@@ -505,7 +505,7 @@ QString WatchItem::toToolTip() const
if (arrayIndex >= 0)
formatToolTipRow(str, tr("Array Index"), QString::number(arrayIndex));
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());
str << "</table></body></html>";
return res;

View File

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

View File

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

View File

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

View File

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

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