Debugger: Use qAsConst with non-const Qt containers in range-loops

Change-Id: I7bd27f8317b62fe448e037d5a25e78b4c88c648d
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2021-02-16 23:09:02 +01:00
parent dfa24f09ad
commit b3686d410d
6 changed files with 9 additions and 9 deletions

View File

@@ -2066,7 +2066,7 @@ void CdbEngine::handleSessionIdle(const QString &message)
elapsedLogTime(), qPrintable(message),
qPrintable(stateName(state())));
for (const InterruptCallback &callback : m_interrupCallbacks)
for (const InterruptCallback &callback : qAsConst(m_interrupCallbacks))
callback();
m_interrupCallbacks.clear();

View File

@@ -1777,7 +1777,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
void DebuggerPluginPrivate::runScheduled()
{
for (DebuggerRunTool *debugger : m_scheduledStarts)
for (DebuggerRunTool *debugger : qAsConst(m_scheduledStarts))
debugger->startRunControl();
}

View File

@@ -368,7 +368,7 @@ void DisassemblerAgent::removeBreakpointMarker(const Breakpoint &bp)
if (!d->document)
return;
for (DisassemblerBreakpointMarker *marker : d->breakpointMarks) {
for (DisassemblerBreakpointMarker *marker : qAsConst(d->breakpointMarks)) {
if (marker->m_bp == bp) {
d->breakpointMarks.removeOne(marker);
d->document->removeMark(marker);

View File

@@ -1848,7 +1848,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
int newColumn = sourceLineText.indexOf('(') + 1;
for (const Breakpoint &bp : v8Breakpoints) {
for (const Breakpoint &bp : qAsConst(v8Breakpoints)) {
QTC_ASSERT(bp, continue);
const BreakpointParameters &params = bp->requestedParameters();
@@ -1874,7 +1874,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
if (inferiorStop) {
//Update breakpoint data
for (const Breakpoint &bp : v8Breakpoints) {
for (const Breakpoint &bp : qAsConst(v8Breakpoints)) {
QTC_ASSERT(bp, continue);
if (bp->functionName().isEmpty()) {
bp->setFunctionName(invocationText);
@@ -1887,7 +1887,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
}
if (engine->state() == InferiorRunOk) {
for (const Breakpoint &bp : v8Breakpoints) {
for (const Breakpoint &bp : qAsConst(v8Breakpoints)) {
QTC_ASSERT(bp, continue);
if (breakpointsTemp.contains(bp->responseId()))
clearBreakpoint(bp);

View File

@@ -268,7 +268,7 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
m_rootContexts.insert(engineId, qvariant_cast<ContextReference>(value));
if (m_rootContexts.size() == m_engines.size()) {
clearObjectTree();
for (const auto &engine : m_engines) {
for (const auto &engine : qAsConst(m_engines)) {
QString name = engine.name();
if (name.isEmpty())
name = QString::fromLatin1("Engine %1").arg(engine.debugId());
@@ -445,7 +445,7 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
// Still not found? Maybe we're loading the engine itself.
if (engineId == -1) {
for (const auto &engine : m_engines) {
for (const auto &engine : qAsConst(m_engines)) {
if (engine.debugId() == objectDebugId) {
engineId = engine.debugId();
break;

View File

@@ -2082,7 +2082,7 @@ void WatchHandler::cleanup()
{
m_model->m_expandedINames.clear();
theWatcherNames.remove(QString());
for (const QString &exp : theTemporaryWatchers)
for (const QString &exp : qAsConst(theTemporaryWatchers))
theWatcherNames.remove(exp);
theTemporaryWatchers.clear();
saveWatchers();