tint: avoid copying iterator
This fixes a Clang C++20 warning from range-loop-analysis about the loop
variable creating a copy.
Change-Id: I0355081cf6f5b73e6b4f6b73bedeb7fcea69fe6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/156082
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/spirv/writer/common/option_builder.cc b/src/tint/lang/spirv/writer/common/option_builder.cc
index 1bec1e9..d68baa6 100644
--- a/src/tint/lang/spirv/writer/common/option_builder.cc
+++ b/src/tint/lang/spirv/writer/common/option_builder.cc
@@ -48,7 +48,7 @@
};
auto valid = [&wgsl_seen, &spirv_seen](const auto& hsh) -> bool {
- for (const auto it : hsh) {
+ for (const auto& it : hsh) {
const auto& src_binding = it.first;
const auto& dst_binding = it.second;
@@ -84,7 +84,7 @@
return false;
}
- for (const auto it : options.bindings.external_texture) {
+ for (const auto& it : options.bindings.external_texture) {
const auto& src_binding = it.first;
const auto& plane0 = it.second.plane0;
const auto& plane1 = it.second.plane1;
@@ -158,7 +158,7 @@
RemapperData& remapper_data,
ExternalTextureOptions& external_texture) {
auto create_remappings = [&remapper_data](const auto& hsh) {
- for (const auto it : hsh) {
+ for (const auto& it : hsh) {
const BindingPoint& src_binding_point = it.first;
const binding::Uniform& dst_binding_point = it.second;
@@ -180,7 +180,7 @@
create_remappings(options.bindings.sampler);
// External textures are re-bound to their plane0 location
- for (const auto it : options.bindings.external_texture) {
+ for (const auto& it : options.bindings.external_texture) {
const BindingPoint& src_binding_point = it.first;
const binding::BindingInfo& plane0 = it.second.plane0;
const binding::BindingInfo& plane1 = it.second.plane1;