tint/utils: Make Hashmap iterator values mutable

Instead of always returning a const ref to the KeyValue, make the value
part mutable if the map is mutable.

Change-Id: I56512ba48a09300c51b1ac1ea31665a4941e2794
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112280
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2022-11-29 19:59:08 +00:00
committed by Dawn LUCI CQ
parent b200e74715
commit 05f3ebfc68
3 changed files with 82 additions and 14 deletions

View File

@@ -673,7 +673,7 @@ class UniformityGraph {
}
// Set each variable's exit node as its value in the outer scope.
for (auto& v : info.var_exit_nodes) {
for (auto v : info.var_exit_nodes) {
current_function_->variables.Set(v.key, v.value);
}
@@ -726,7 +726,7 @@ class UniformityGraph {
cfx->AddEdge(cf);
// Add edges from variable loop input nodes to their values at the end of the loop.
for (auto& v : info.var_in_nodes) {
for (auto v : info.var_in_nodes) {
auto* in_node = v.value;
auto* out_node = current_function_->variables.Get(v.key);
if (out_node != in_node) {