Fix clang 10 warnings about unnecessary copies in range loops

Change-Id: I3b57869b5a04528518bc432b76768b01e3f53e81
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-05-12 13:01:44 +02:00
parent 9c1e8a99d8
commit eb96f9900a
10 changed files with 11 additions and 11 deletions

View File

@@ -892,7 +892,7 @@ QVersionNumber AndroidConfig::buildToolsVersion() const
//TODO: return version according to qt version //TODO: return version according to qt version
QVersionNumber maxVersion; QVersionNumber maxVersion;
QDir buildToolsDir(m_sdkLocation.pathAppended("build-tools").toString()); QDir buildToolsDir(m_sdkLocation.pathAppended("build-tools").toString());
for (const QFileInfo &file: buildToolsDir.entryList(QDir::Dirs|QDir::NoDotAndDotDot)) for (const QFileInfo &file: buildToolsDir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot))
maxVersion = qMax(maxVersion, QVersionNumber::fromString(file.fileName())); maxVersion = qMax(maxVersion, QVersionNumber::fromString(file.fileName()));
return maxVersion; return maxVersion;
} }

View File

@@ -2495,7 +2495,7 @@ GlobalBreakpoint BreakpointManager::findBreakpointFromContext(const ContextData
matchLevel = 2; matchLevel = 2;
bestMatch = gbp; bestMatch = gbp;
} else if (matchLevel < 2) { } else if (matchLevel < 2) {
for (const QPointer<DebuggerEngine> engine : EngineManager::engines()) { for (const QPointer<DebuggerEngine> &engine : EngineManager::engines()) {
BreakHandler *handler = engine->breakHandler(); BreakHandler *handler = engine->breakHandler();
for (Breakpoint bp : handler->breakpoints()) { for (Breakpoint bp : handler->breakpoints()) {
if (bp->globalBreakpoint() == gbp) { if (bp->globalBreakpoint() == gbp) {

View File

@@ -1034,7 +1034,7 @@ void CdbEngine::runCommand(const DebuggerCommand &dbgCmd)
} }
QTC_CHECK(argumentSplitPos == arguments.size()); QTC_CHECK(argumentSplitPos == arguments.size());
int tokenPart = splittedArguments.size(); int tokenPart = splittedArguments.size();
for (const QStringRef part : qAsConst(splittedArguments)) for (const QStringRef &part : qAsConst(splittedArguments))
str << prefix << " -t " << token << '.' << --tokenPart << ' ' << part << '\n'; str << prefix << " -t " << token << '.' << --tokenPart << ' ' << part << '\n';
} else { } else {
cmd = prefix; cmd = prefix;

View File

@@ -689,7 +689,7 @@ void DebuggerRunTool::start()
if (m_runParameters.startMode == StartInternal) { if (m_runParameters.startMode == StartInternal) {
QStringList unhandledIds; QStringList unhandledIds;
for (const GlobalBreakpoint bp : BreakpointManager::globalBreakpoints()) { for (const GlobalBreakpoint &bp : BreakpointManager::globalBreakpoints()) {
// if (bp->isEnabled() && !m_engine->acceptsBreakpoint(bp)) // if (bp->isEnabled() && !m_engine->acceptsBreakpoint(bp))
// unhandledIds.append(bp.id().toString()); // unhandledIds.append(bp.id().toString());
} }

View File

@@ -337,7 +337,7 @@ void DisassemblerAgent::setContentsToDocument(const DisassemblerLines &contents)
.arg(d->location.functionName())); .arg(d->location.functionName()));
const Breakpoints bps = d->engine->breakHandler()->breakpoints(); const Breakpoints bps = d->engine->breakHandler()->breakpoints();
for (const Breakpoint bp : bps) for (const Breakpoint &bp : bps)
updateBreakpointMarker(bp); updateBreakpointMarker(bp);
updateLocationMarker(); updateLocationMarker();

View File

@@ -303,7 +303,7 @@ void hardcodedTargetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage
const QString QulTargetTemplate = const QString QulTargetTemplate =
dir.toString() + "/lib/cmake/Qul/QulTargets/QulTargets_%1_%2.cmake"; dir.toString() + "/lib/cmake/Qul/QulTargets/QulTargets_%1_%2.cmake";
for (const auto target : targets) { for (const auto &target : targets) {
for (auto os : {McuTarget::OS::Desktop, McuTarget::OS::BareMetal, for (auto os : {McuTarget::OS::Desktop, McuTarget::OS::BareMetal,
McuTarget::OS::FreeRTOS}) { McuTarget::OS::FreeRTOS}) {
for (int colorDepth : target.colorDepths) { for (int colorDepth : target.colorDepths) {

View File

@@ -1732,7 +1732,7 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
addChild(toAdd); addChild(toAdd);
result->directChildren.clear(); result->directChildren.clear();
for (const auto priFiles : qAsConst(result->priFiles)) { for (const auto &priFiles : qAsConst(result->priFiles)) {
priFiles.first->finishInitialization(m_buildSystem, this); priFiles.first->finishInitialization(m_buildSystem, this);
priFiles.first->update(priFiles.second); priFiles.first->update(priFiles.second);
} }

View File

@@ -718,7 +718,7 @@ public:
if (from == node.rootModelNode()) { if (from == node.rootModelNode()) {
isStartLine = true; isStartLine = true;
} else { } else {
for (const ModelNode wildcard : QmlFlowViewNode(node.rootModelNode()).wildcards()) { for (const ModelNode &wildcard : QmlFlowViewNode(node.rootModelNode()).wildcards()) {
if (wildcard.bindingProperty("target").resolveToModelNode() == node.modelNode()) { if (wildcard.bindingProperty("target").resolveToModelNode() == node.modelNode()) {
from = wildcard; from = wildcard;
isWildcardLine = true; isWildcardLine = true;

View File

@@ -628,7 +628,7 @@ ModelNode QmlFlowActionAreaNode::decisionNodeForTransition(const ModelNode &tran
} }
QmlFlowViewNode flowView(view()->rootModelNode()); QmlFlowViewNode flowView(view()->rootModelNode());
if (flowView.isValid()) { if (flowView.isValid()) {
for (const ModelNode target : flowView.decicions()) { for (const ModelNode &target : flowView.decicions()) {
if (target.hasBindingProperty("targets") if (target.hasBindingProperty("targets")
&& target.bindingProperty("targets").resolveToModelNodeList().contains(transition)) && target.bindingProperty("targets").resolveToModelNodeList().contains(transition))
return target; return target;
@@ -782,7 +782,7 @@ ModelNode QmlFlowTargetNode::findSourceForDecisionNode() const
if (!isFlowDecision()) if (!isFlowDecision())
return {}; return {};
for (const ModelNode transition : flowView().transitionsForTarget(modelNode())) { for (const ModelNode &transition : flowView().transitionsForTarget(modelNode())) {
if (transition.hasBindingProperty("from")) { if (transition.hasBindingProperty("from")) {
const ModelNode source = transition.bindingProperty("from").resolveToModelNode(); const ModelNode source = transition.bindingProperty("from").resolveToModelNode();
if (source.isValid()) { if (source.isValid()) {

View File

@@ -1496,7 +1496,7 @@ void tst_Dumpers::dumper()
} }
}; };
collectExpandedINames(data.checks); collectExpandedINames(data.checks);
for (const auto checkset : qAsConst(data.checksets)) for (const auto &checkset : qAsConst(data.checksets))
collectExpandedINames(checkset.checks); collectExpandedINames(checkset.checks);
QString expanded; QString expanded;