[tint][core] Expose intrinsic::PrintOverload()

Bug: tint:2127
Change-Id: I001a2b993a9e884a4a743748dba4876177c579a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/174823
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/core/intrinsic/table.cc b/src/tint/lang/core/intrinsic/table.cc
index a8ee926..b81fde7 100644
--- a/src/tint/lang/core/intrinsic/table.cc
+++ b/src/tint/lang/core/intrinsic/table.cc
@@ -161,12 +161,6 @@
                  const NumberMatcherIndex* number_matcher_indices,
                  EvaluationStage earliest_eval_stage);
 
-// Prints the overload for emitting diagnostics
-void PrintOverload(StringStream& ss,
-                   Context& context,
-                   const OverloadInfo& overload,
-                   std::string_view intrinsic_name);
-
 // Prints the list of candidates for emitting diagnostics
 void PrintCandidates(StringStream& ss,
                      Context& context,
@@ -464,6 +458,57 @@
                       number_matcher_indices, earliest_eval_stage};
 }
 
+void PrintCandidates(StringStream& ss,
+                     Context& context,
+                     VectorRef<Candidate> candidates,
+                     std::string_view intrinsic_name) {
+    for (auto& candidate : candidates) {
+        ss << "  ";
+        PrintOverload(ss, context, *candidate.overload, intrinsic_name);
+        ss << std::endl;
+    }
+}
+
+std::string ErrAmbiguousOverload(Context& context,
+                                 std::string_view intrinsic_name,
+                                 VectorRef<const core::type::Type*> args,
+                                 TemplateState templates,
+                                 VectorRef<Candidate> candidates) {
+    StringStream ss;
+    ss << "ambiguous overload while attempting to match " << intrinsic_name;
+    for (size_t i = 0; i < std::numeric_limits<size_t>::max(); i++) {
+        if (auto* ty = templates.Type(i)) {
+            ss << ((i == 0) ? "<" : ", ") << ty->FriendlyName();
+        } else {
+            if (i > 0) {
+                ss << ">";
+            }
+            break;
+        }
+    }
+    ss << "(";
+    bool first = true;
+    for (auto* arg : args) {
+        if (!first) {
+            ss << ", ";
+        }
+        first = false;
+        ss << arg->FriendlyName();
+    }
+    ss << "):\n";
+    for (auto& candidate : candidates) {
+        if (candidate.score == 0) {
+            ss << "  ";
+            PrintOverload(ss, context, *candidate.overload, intrinsic_name);
+            ss << std::endl;
+        }
+    }
+    TINT_ICE() << ss.str();
+    return ss.str();
+}
+
+}  // namespace
+
 void PrintOverload(StringStream& ss,
                    Context& context,
                    const OverloadInfo& overload,
@@ -545,57 +590,6 @@
     }
 }
 
-void PrintCandidates(StringStream& ss,
-                     Context& context,
-                     VectorRef<Candidate> candidates,
-                     std::string_view intrinsic_name) {
-    for (auto& candidate : candidates) {
-        ss << "  ";
-        PrintOverload(ss, context, *candidate.overload, intrinsic_name);
-        ss << std::endl;
-    }
-}
-
-std::string ErrAmbiguousOverload(Context& context,
-                                 std::string_view intrinsic_name,
-                                 VectorRef<const core::type::Type*> args,
-                                 TemplateState templates,
-                                 VectorRef<Candidate> candidates) {
-    StringStream ss;
-    ss << "ambiguous overload while attempting to match " << intrinsic_name;
-    for (size_t i = 0; i < std::numeric_limits<size_t>::max(); i++) {
-        if (auto* ty = templates.Type(i)) {
-            ss << ((i == 0) ? "<" : ", ") << ty->FriendlyName();
-        } else {
-            if (i > 0) {
-                ss << ">";
-            }
-            break;
-        }
-    }
-    ss << "(";
-    bool first = true;
-    for (auto* arg : args) {
-        if (!first) {
-            ss << ", ";
-        }
-        first = false;
-        ss << arg->FriendlyName();
-    }
-    ss << "):\n";
-    for (auto& candidate : candidates) {
-        if (candidate.score == 0) {
-            ss << "  ";
-            PrintOverload(ss, context, *candidate.overload, intrinsic_name);
-            ss << std::endl;
-        }
-    }
-    TINT_ICE() << ss.str();
-    return ss.str();
-}
-
-}  // namespace
-
 Result<Overload, std::string> LookupFn(Context& context,
                                        std::string_view intrinsic_name,
                                        size_t function_id,
diff --git a/src/tint/lang/core/intrinsic/table.h b/src/tint/lang/core/intrinsic/table.h
index c1cbfcc..8228c1f 100644
--- a/src/tint/lang/core/intrinsic/table.h
+++ b/src/tint/lang/core/intrinsic/table.h
@@ -106,6 +106,12 @@
     SymbolTable& symbols;
 };
 
+// Prints the overload for emitting diagnostics
+void PrintOverload(StringStream& ss,
+                   Context& context,
+                   const OverloadInfo& overload,
+                   std::string_view intrinsic_name);
+
 /// Lookup looks for the builtin overload with the given signature, raising an error diagnostic
 /// if the builtin was not found.
 /// @param context the intrinsic context