Debugger: Code cosmetics

Sprinkling in const and ranged for.

Change-Id: I5d11d57f64140021397c23734c7373544ebebb6f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-05-30 15:42:51 +02:00
parent 829df213a4
commit 4feb2259d9
29 changed files with 122 additions and 122 deletions

View File

@@ -646,7 +646,7 @@ void CdbEngine::runEngine()
qDebug("runEngine");
const QStringList breakEvents = stringListSetting(CdbBreakEvents);
foreach (const QString &breakEvent, breakEvents)
for (const QString &breakEvent : breakEvents)
runCommand({"sxe " + breakEvent, NoFlags});
// Break functions: each function must be fully qualified,
// else the debugger will slow down considerably.
@@ -997,7 +997,7 @@ void CdbEngine::handleJumpToLineAddressResolution(const DebuggerResponse &respon
static inline bool isAsciiWord(const QString &s)
{
foreach (const QChar &c, s) {
for (const QChar &c : s) {
if (!c.isLetterOrNumber() || c.toLatin1() == 0)
return false;
}
@@ -1217,7 +1217,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
if (!expanded.isEmpty()) {
str << blankSeparator << "-e ";
int i = 0;
foreach (const QString &e, expanded) {
for (const QString &e : expanded) {
if (i++)
str << ',';
str << e;
@@ -1947,7 +1947,7 @@ void CdbEngine::handleBreakInsert(const DebuggerResponse &response, const Breakp
const QStringList reply = response.data.data().split('\n');
if (reply.isEmpty())
return;
foreach (const QString &line, reply)
for (const QString &line : reply)
showMessage(line);
if (!reply.last().startsWith("Ambiguous symbol error") &&
(reply.length() < 2 || !reply.at(reply.length() - 2).startsWith("Ambiguous symbol error"))) {
@@ -2468,7 +2468,7 @@ static QByteArray multiBreakpointCommand(const char *cmdC, const Breakpoints &bp
{
QByteArray cmd(cmdC);
ByteArrayInputStream str(cmd);
foreach (const BreakpointData *bp, bps)
for (const BreakpointData *bp : bps)
str << ' ' << bp->bpNumber;
return cmd;
}
@@ -2570,7 +2570,7 @@ void CdbEngine::attemptBreakpointSynchronization()
// Check if there is anything to be done at all.
BreakHandler *handler = breakHandler();
// Take ownership of the breakpoint. Requests insertion. TODO: Cpp only?
foreach (Breakpoint bp, handler->unclaimedBreakpoints())
for (Breakpoint bp : handler->unclaimedBreakpoints())
if (acceptsBreakpoint(bp))
bp.setEngine(this);
@@ -2578,7 +2578,7 @@ void CdbEngine::attemptBreakpointSynchronization()
bool changed = !m_insertSubBreakpointMap.isEmpty();
const Breakpoints bps = handler->engineBreakpoints(this);
if (!changed) {
foreach (Breakpoint bp, bps) {
for (Breakpoint bp : bps) {
switch (bp.state()) {
case BreakpointInsertRequested:
case BreakpointRemoveRequested:
@@ -2616,7 +2616,7 @@ void CdbEngine::attemptBreakpointSynchronization()
// handleBreakPoints will the complete that information and set it on the break handler.
bool addedChanged = false;
QScopedPointer<BreakpointCorrectionContext> lineCorrection;
foreach (Breakpoint bp, bps) {
for (Breakpoint bp : bps) {
BreakpointParameters parameters = bp.parameters();
BreakpointModelId id = bp.id();
const auto handleBreakInsertCB = [this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); };