From 11c4066159e12ff630673c5fd94b37fb8c0f9102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 7 Dec 2020 12:21:11 +0100 Subject: Cleanup: partial Clang-Tidy modernize-loop-convert Modernize loops by using the `for(type variable : container)` syntax. Some loops were trivial to fix, whereas others required more attention to avoid semantic changes. I couldn't address all old-style loops, so this commit doesn't enable the `modernize-loop-convert` rule. Although Clang-Tidy's auto-fixer prefers to use `auto` for the loop variable declaration, I made as many declarations as possible explicit. To me this increases local readability, as you don't need to fully understand the container in order to understand the loop variable type. No functional changes. --- source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 3 +-- source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 3 +-- source/blender/depsgraph/intern/depsgraph_query.cc | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index d71cdea1974..5af70305e13 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1247,8 +1247,7 @@ void DepsgraphNodeBuilder::build_particle_settings(ParticleSettings *particle_se &particle_settings->id, NodeType::PARTICLE_SETTINGS, OperationCode::PARTICLE_SETTINGS_EVAL); op_node->set_as_exit(); /* Texture slots. */ - for (int mtex_index = 0; mtex_index < MAX_MTEX; mtex_index++) { - MTex *mtex = particle_settings->mtex[mtex_index]; + for (MTex *mtex : particle_settings->mtex) { if (mtex == nullptr || mtex->tex == nullptr) { continue; } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 3f6aa778b59..11d34782569 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1907,8 +1907,7 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part) particle_settings_init_key, particle_settings_eval_key, "Particle Settings Init Order"); add_relation(particle_settings_reset_key, particle_settings_eval_key, "Particle Settings Reset"); /* Texture slots. */ - for (int mtex_index = 0; mtex_index < MAX_MTEX; mtex_index++) { - MTex *mtex = part->mtex[mtex_index]; + for (MTex *mtex : part->mtex) { if (mtex == nullptr || mtex->tex == nullptr) { continue; } diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index 1a334d8a451..57de62e1880 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -90,8 +90,8 @@ bool DEG_id_type_any_updated(const Depsgraph *graph) const deg::Depsgraph *deg_graph = reinterpret_cast(graph); /* Loop over all ID types. */ - for (int id_type_index = 0; id_type_index < MAX_LIBARRAY; id_type_index++) { - if (deg_graph->id_type_updated[id_type_index]) { + for (char id_type_index : deg_graph->id_type_updated) { + if (id_type_index) { return true; } } -- cgit v1.2.3