aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2019-02-19 23:24:16 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2019-02-20 13:22:38 +0000
commit4146f1067905c3718b0504b510367bb4349b4622 (patch)
tree2554f9fb125bbd117f43ef794cc2f1fb903cf26f
parent5a2e0c4d33c2aedb81adea922cfde824b1df92ad (diff)
Add const-references for non trivial types in range-for loops
This fixes -Wclazy-range-loop Change-Id: I5424d2626d6134ac7be2ce70b83f5a617f58dd7e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/lib/corelib/buildgraph/projectbuilddata.cpp4
-rw-r--r--src/lib/corelib/language/moduleloader.cpp6
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/corelib/buildgraph/projectbuilddata.cpp b/src/lib/corelib/buildgraph/projectbuilddata.cpp
index ccb6c5123..dcb10b45b 100644
--- a/src/lib/corelib/buildgraph/projectbuilddata.cpp
+++ b/src/lib/corelib/buildgraph/projectbuilddata.cpp
@@ -280,7 +280,7 @@ void BuildDataResolver::resolveBuildData(const TopLevelProjectPtr &resolvedProje
const std::vector<ResolvedProductPtr> &allProducts = resolvedProject->allProducts();
evalContext->initializeObserver(Tr::tr("Setting up build graph for configuration %1")
.arg(resolvedProject->id()), int(allProducts.size()) + 1);
- for (ResolvedProductPtr rProduct : allProducts) {
+ for (const auto &rProduct : allProducts) {
if (rProduct->enabled)
resolveProductBuildData(rProduct);
evalContext->incrementProgressValue();
@@ -392,7 +392,7 @@ void BuildDataResolver::resolveProductBuildData(const ResolvedProductPtr &produc
product->buildData.reset(new ProductBuildData);
ArtifactSetByFileTag artifactsPerFileTag;
- for (ResolvedProductPtr dependency : qAsConst(product->dependencies)) {
+ for (const auto &dependency : qAsConst(product->dependencies)) {
QBS_CHECK(dependency->enabled);
resolveProductBuildData(dependency);
}
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index 74d62c818..882ac7061 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -599,7 +599,7 @@ void ModuleLoader::handleTopLevelProject(ModuleLoaderResult *loadResult, Item *p
for (Item * const exportItem : m_exportsWithDeferredDependsItems)
normalizeDependencies(nullptr, DeferredDependsContext(nullptr, exportItem));
- for (const auto deferredDependsData : m_productsWithDeferredDependsItems) {
+ for (const auto &deferredDependsData : m_productsWithDeferredDependsItems) {
ProductContext * const productContext = deferredDependsData.first;
m_reader->setExtraSearchPathsStack(productContext->project->searchPathsStack);
try {
@@ -1877,7 +1877,7 @@ static void adjustParametersScopes(Item *item, Item *scope)
return;
}
- for (auto value : item->properties()) {
+ for (const auto &value : item->properties()) {
if (value->type() != Value::ItemValueType)
continue;
adjustParametersScopes(std::static_pointer_cast<ItemValue>(value)->item(), scope);
@@ -3415,7 +3415,7 @@ void ModuleLoader::instantiateModule(ProductContext *productContext, Item *expor
}
// For foo.bar in modulePrototype create an item foo in moduleInstance.
- for (auto iip : instanceItemProperties(modulePrototype)) {
+ for (const auto &iip : instanceItemProperties(modulePrototype)) {
if (iip.second->item()->properties().empty())
continue;
qCDebug(lcModuleLoader) << "The prototype of " << moduleName
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 8154e7262..94f0d4b52 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -815,7 +815,7 @@ void TestBlackbox::changeTrackingAndMultiplexing()
static QJsonObject findByName(const QJsonArray &objects, const QString &name)
{
- for (const QJsonValue v : objects) {
+ for (const QJsonValue &v : objects) {
if (!v.isObject())
continue;
QJsonObject obj = v.toObject();
@@ -5484,7 +5484,7 @@ void TestBlackbox::chooseModuleInstanceByPriority()
QFile file(installRoot + "/gerbil.txt");
QVERIFY(file.open(QIODevice::ReadOnly));
const QString content = QString::fromUtf8(file.readAll());
- for (auto str : expectedSubStrings) {
+ for (const auto &str : expectedSubStrings) {
if (content.contains(str))
continue;
qDebug() << "content:" << content;