From 95ece56efa0b2a3b480ee3a5761d85b348c01377 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 20 May 2020 18:34:32 +0200 Subject: Fix Clang 10 warning about creating copies in range-for We should not copy the loop variables. Fixes: QTBUG-83989 Pick-to: 5.15 Change-Id: Ic94710a2c08aa19656c5e1853c40b10b203bca0e Reviewed-by: Thiago Macieira --- tools/qmllint/checkidentifiers.cpp | 4 ++-- tools/qmllint/findwarnings.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp index 619fe8e4b9..0bd5c8127e 100644 --- a/tools/qmllint/checkidentifiers.cpp +++ b/tools/qmllint/checkidentifiers.cpp @@ -171,8 +171,8 @@ bool CheckIdentifiers::checkMemberAccess(const QVector & if (scopeMethodIt != methods.end()) return true; // Access to property of JS function - const auto enums= scope->enums(); - for (const auto enumerator : enums) { + const auto enums = scope->enums(); + for (const auto &enumerator : enums) { for (const QString &key : enumerator.keys()) { if (access.m_name == key) { detectedRestrictiveKind = QLatin1String("enum"); diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp index b177c5f5c4..797b312d92 100644 --- a/tools/qmllint/findwarnings.cpp +++ b/tools/qmllint/findwarnings.cpp @@ -394,7 +394,7 @@ void FindWarningVisitor::importExportedNames(const QStringRef &prefix, QString n if (scope) { if (scopes.contains(scope)) { QString inheritenceCycle = name; - for (const auto seen: qAsConst(scopes)) { + for (const auto &seen: qAsConst(scopes)) { inheritenceCycle.append(QLatin1String(" -> ")); inheritenceCycle.append(seen->superclassName()); } -- cgit v1.2.3