diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc index 1d8182189d..e4eab291af 100644 --- a/src/tint/reader/wgsl/parser_impl.cc +++ b/src/tint/reader/wgsl/parser_impl.cc @@ -214,7 +214,7 @@ ParserImpl::~ParserImpl() = default; ParserImpl::Failure::Errored ParserImpl::add_error(const Source& source, std::string_view err, std::string_view use) { - std::stringstream msg; + utils::StringStream msg; msg << err; if (!use.empty()) { msg << " for " << use; @@ -3165,7 +3165,7 @@ bool ParserImpl::expect(std::string_view use, Token::Type tok) { return false; } - std::stringstream err; + utils::StringStream err; if (tok == Token::Type::kTemplateArgsLeft && t.type() == Token::Type::kLessThan) { err << "missing closing '>'"; } else { diff --git a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc index 85e55cb518..af5089492e 100644 --- a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc @@ -14,6 +14,8 @@ #include "src/tint/reader/wgsl/parser_impl_test_helper.h" +#include "src/tint/utils/string_stream.h" + namespace tint::reader::wgsl { namespace { @@ -513,8 +515,8 @@ const i : vec2 = vec2(!); TEST_F(ParserImplErrorTest, GlobalDeclConstExprMaxDepth) { uint32_t kMaxDepth = 128; - std::stringstream src; - std::stringstream mkr; + utils::StringStream src; + utils::StringStream mkr; src << "const i : i32 = "; mkr << " "; for (size_t i = 0; i < kMaxDepth + 8; i++) { @@ -530,7 +532,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclConstExprMaxDepth) { src << ")"; } src << ";"; - std::stringstream err; + utils::StringStream err; err << "test.wgsl:1:529 error: maximum parser recursive depth reached\n" << src.str() << "\n" << mkr.str() << "\n"; diff --git a/src/tint/reader/wgsl/parser_impl_expression_test.cc b/src/tint/reader/wgsl/parser_impl_expression_test.cc index 0de3dea890..9a6c9179b3 100644 --- a/src/tint/reader/wgsl/parser_impl_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_expression_test.cc @@ -14,6 +14,8 @@ #include "src/tint/reader/wgsl/parser_impl_test_helper.h" +#include "src/tint/utils/string_stream.h" + namespace tint::reader::wgsl { namespace { @@ -486,7 +488,7 @@ static std::vector Cases() { using ParserImplMixedBinaryOpTest = ParserImplTestWithParam; TEST_P(ParserImplMixedBinaryOpTest, Test) { - std::stringstream wgsl; + utils::StringStream wgsl; wgsl << GetParam(); auto p = parser(wgsl.str()); auto e = p->expression(); @@ -498,7 +500,7 @@ TEST_P(ParserImplMixedBinaryOpTest, Test) { EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); EXPECT_TRUE(p->has_error()); - std::stringstream expected; + utils::StringStream expected; expected << "1:3: mixing '" << GetParam().lhs_op.symbol << "' and '" << GetParam().rhs_op.symbol << "' requires parenthesis"; EXPECT_EQ(p->error(), expected.str());