[tint] Move override tracking into sem objects

Instead of the sem::Info.

This is required to resolve types without recursion.

Change-Id: I6613d0e19b99a910bddf75dabb47a71cc1713435
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/155144
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/wgsl/sem/function.cc b/src/tint/lang/wgsl/sem/function.cc
index 1d1b9e3..bb6a8a2 100644
--- a/src/tint/lang/wgsl/sem/function.cc
+++ b/src/tint/lang/wgsl/sem/function.cc
@@ -52,6 +52,14 @@
     return ret;
 }
 
+void Function::AddTransitivelyReferencedGlobal(const sem::GlobalVariable* global) {
+    if (transitively_referenced_globals_.Add(global)) {
+        for (auto* ref : global->TransitivelyReferencedOverrides()) {
+            AddTransitivelyReferencedGlobal(ref);
+        }
+    }
+}
+
 Function::VariableBindings Function::TransitivelyReferencedUniformVariables() const {
     VariableBindings ret;