[tint] Make LHS of operator << generic.
Breaks a circular dependency in utils, and allows for << to work with
other stream types.
Change-Id: Ia001def89fb1db9dd4aa582ae516911ba8aa71f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/143383
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/wgsl/ast/int_literal_expression.h b/src/tint/lang/wgsl/ast/int_literal_expression.h
index c0ae78d..f6399db 100644
--- a/src/tint/lang/wgsl/ast/int_literal_expression.h
+++ b/src/tint/lang/wgsl/ast/int_literal_expression.h
@@ -55,11 +55,18 @@
const Suffix suffix;
};
+/// @param suffix the enum value
+/// @returns the string for the given enum value
+std::string_view ToString(IntLiteralExpression::Suffix suffix);
+
/// Writes the integer literal suffix to the stream.
/// @param out the stream to write to
/// @param suffix the suffix to write
/// @returns out so calls can be chained
-StringStream& operator<<(StringStream& out, IntLiteralExpression::Suffix suffix);
+template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>>
+auto& operator<<(STREAM& out, IntLiteralExpression::Suffix suffix) {
+ return out << ToString(suffix);
+}
} // namespace tint::ast