summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-01-26 14:38:54 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-10-10 09:55:32 +0000
commit997c730208dfe7aead9e108df18a05cb4aaf6104 (patch)
treeb0134b2a85107c282cf8404f04ae82e2ae9613d9 /src
parent1e51b7e92c31463fcf8e35a07ba1617ceb71347d (diff)
downloadqttools-997c730208dfe7aead9e108df18a05cb4aaf6104.tar.gz
qmake: eradicate Q_FOREACH loops [needing qAsConst()]
... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(). Change-Id: If086bea06fe26232a7bb99fad8b09fce4dc74c27 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> (cherry picked from qtbase/e31541fa6f5f4df64fd44a9a895491c40b8c64b4) Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/linguist/shared/qmakebuiltins.cpp8
-rw-r--r--src/linguist/shared/qmakeevaluator.cpp10
-rw-r--r--src/linguist/shared/qmakeparser.cpp2
3 files changed, 10 insertions, 10 deletions
diff --git a/src/linguist/shared/qmakebuiltins.cpp b/src/linguist/shared/qmakebuiltins.cpp
index 435f1eddb..9afee44a5 100644
--- a/src/linguist/shared/qmakebuiltins.cpp
+++ b/src/linguist/shared/qmakebuiltins.cpp
@@ -446,7 +446,7 @@ void QMakeEvaluator::populateDeps(
if (depends.isEmpty()) {
rootSet.insert(first(ProKey(prefix + item + priosfx)).toInt(), item);
} else {
- foreach (const ProString &dep, depends) {
+ for (const ProString &dep : qAsConst(depends)) {
dset.insert(dep.toKey());
dependees[dep.toKey()] << item;
}
@@ -998,7 +998,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
rootSet.erase(it);
if ((func_t == E_RESOLVE_DEPENDS) || orgList.contains(item))
ret.prepend(item);
- foreach (const ProString &dep, dependees[item.toKey()]) {
+ for (const ProString &dep : qAsConst(dependees[item.toKey()])) {
QSet<ProKey> &dset = dependencies[dep.toKey()];
dset.remove(item.toKey());
if (dset.isEmpty())
@@ -1009,11 +1009,11 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
break;
case E_ENUMERATE_VARS: {
QSet<ProString> keys;
- foreach (const ProValueMap &vmap, m_valuemapStack)
+ for (const ProValueMap &vmap : qAsConst(m_valuemapStack))
for (ProValueMap::ConstIterator it = vmap.constBegin(); it != vmap.constEnd(); ++it)
keys.insert(it.key());
ret.reserve(keys.size());
- foreach (const ProString &key, keys)
+ for (const ProString &key : qAsConst(keys))
ret << key;
break; }
case E_SHADOWED:
diff --git a/src/linguist/shared/qmakeevaluator.cpp b/src/linguist/shared/qmakeevaluator.cpp
index 09da8bf96..c83900dea 100644
--- a/src/linguist/shared/qmakeevaluator.cpp
+++ b/src/linguist/shared/qmakeevaluator.cpp
@@ -1232,7 +1232,7 @@ bool QMakeEvaluator::loadSpec()
qmakespec = m_hostBuild ? QLatin1String("default-host") : QLatin1String("default");
#endif
if (IoUtils::isRelativePath(qmakespec)) {
- foreach (const QString &root, m_mkspecPaths) {
+ for (const QString &root : qAsConst(m_mkspecPaths)) {
QString mkspec = root + QLatin1Char('/') + qmakespec;
if (IoUtils::exists(mkspec)) {
qmakespec = mkspec;
@@ -1466,7 +1466,7 @@ void QMakeEvaluator::updateMkspecPaths()
for (const QString &it : paths)
ret << it + concat;
- foreach (const QString &it, m_qmakepath)
+ for (const QString &it : qAsConst(m_qmakepath))
ret << it + concat;
if (!m_buildRoot.isEmpty())
@@ -1507,7 +1507,7 @@ void QMakeEvaluator::updateFeaturePaths()
for (const QString &item : items)
feature_bases << (item + mkspecs_concat);
- foreach (const QString &item, m_qmakepath)
+ for (const QString &item : qAsConst(m_qmakepath))
feature_bases << (item + mkspecs_concat);
if (!m_qmakespec.isEmpty()) {
@@ -1529,7 +1529,7 @@ void QMakeEvaluator::updateFeaturePaths()
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/get")) + mkspecs_concat);
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/src")) + mkspecs_concat);
- foreach (const QString &fb, feature_bases) {
+ for (const QString &fb : qAsConst(feature_bases)) {
const auto sfxs = values(ProKey("QMAKE_PLATFORM"));
for (const ProString &sfx : sfxs)
feature_roots << (fb + features_concat + sfx + QLatin1Char('/'));
@@ -1543,7 +1543,7 @@ void QMakeEvaluator::updateFeaturePaths()
feature_roots.removeDuplicates();
QStringList ret;
- foreach (const QString &root, feature_roots)
+ for (const QString &root : qAsConst(feature_roots))
if (IoUtils::exists(root))
ret << root;
m_featureRoots = new QMakeFeatureRoots(ret);
diff --git a/src/linguist/shared/qmakeparser.cpp b/src/linguist/shared/qmakeparser.cpp
index 874b39df1..3d5b0354d 100644
--- a/src/linguist/shared/qmakeparser.cpp
+++ b/src/linguist/shared/qmakeparser.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
ProFileCache::~ProFileCache()
{
- foreach (const Entry &ent, parsed_files)
+ for (const Entry &ent : qAsConst(parsed_files))
if (ent.pro)
ent.pro->deref();
}