Remove `SymbolTable::NameFor`
This CL removes the `NameFor` method from SymbolTable and accesses the
symbols name directly.
Change-Id: Ic4ad6eecfa78efb946d97aeaecf2d784af2e6f16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127301
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/ast/alias_test.cc b/src/tint/ast/alias_test.cc
index d99fb21..8131f65 100644
--- a/src/tint/ast/alias_test.cc
+++ b/src/tint/ast/alias_test.cc
@@ -24,8 +24,8 @@
TEST_F(AstAliasTest, Create) {
auto u32 = ty.u32();
auto* a = Alias("a_type", u32);
- CheckIdentifier(Symbols(), a->name, "a_type");
- CheckIdentifier(Symbols(), a->type, "u32");
+ CheckIdentifier(a->name, "a_type");
+ CheckIdentifier(a->type, "u32");
}
} // namespace
diff --git a/src/tint/ast/bitcast_expression_test.cc b/src/tint/ast/bitcast_expression_test.cc
index d288a77..ce4ab1d 100644
--- a/src/tint/ast/bitcast_expression_test.cc
+++ b/src/tint/ast/bitcast_expression_test.cc
@@ -25,7 +25,7 @@
TEST_F(BitcastExpressionTest, Create) {
auto* expr = Expr("expr");
auto* exp = Bitcast(ty.f32(), expr);
- CheckIdentifier(Symbols(), exp->type, "f32");
+ CheckIdentifier(exp->type, "f32");
ASSERT_EQ(exp->expr, expr);
}
diff --git a/src/tint/ast/builtin_attribute_test.cc b/src/tint/ast/builtin_attribute_test.cc
index 00192b8..9c4f871 100644
--- a/src/tint/ast/builtin_attribute_test.cc
+++ b/src/tint/ast/builtin_attribute_test.cc
@@ -24,7 +24,7 @@
TEST_F(BuiltinAttributeTest, Creation) {
auto* d = Builtin(builtin::BuiltinValue::kFragDepth);
- CheckIdentifier(Symbols(), d->builtin, "frag_depth");
+ CheckIdentifier(d->builtin, "frag_depth");
}
TEST_F(BuiltinAttributeTest, Assert_Null_Builtin) {
diff --git a/src/tint/ast/diagnostic_directive_test.cc b/src/tint/ast/diagnostic_directive_test.cc
index 3e23d6a..721a545 100644
--- a/src/tint/ast/diagnostic_directive_test.cc
+++ b/src/tint/ast/diagnostic_directive_test.cc
@@ -29,7 +29,7 @@
EXPECT_EQ(diag->source.range.end.line, 10u);
EXPECT_EQ(diag->source.range.end.column, 15u);
EXPECT_EQ(diag->control.severity, builtin::DiagnosticSeverity::kWarning);
- CheckIdentifier(Symbols(), diag->control.rule_name, "foo");
+ CheckIdentifier(diag->control.rule_name, "foo");
}
} // namespace
diff --git a/src/tint/ast/function_test.cc b/src/tint/ast/function_test.cc
index 1af27a6..36a96e3 100644
--- a/src/tint/ast/function_test.cc
+++ b/src/tint/ast/function_test.cc
@@ -33,7 +33,7 @@
auto* f = Func("func", params, i32, utils::Empty);
EXPECT_EQ(f->name->symbol, Symbols().Get("func"));
ASSERT_EQ(f->params.Length(), 1u);
- CheckIdentifier(Symbols(), f->return_type, "i32");
+ CheckIdentifier(f->return_type, "i32");
EXPECT_EQ(f->params[0], var);
}
diff --git a/src/tint/ast/interpolate_attribute_test.cc b/src/tint/ast/interpolate_attribute_test.cc
index ecb2fac..462449d 100644
--- a/src/tint/ast/interpolate_attribute_test.cc
+++ b/src/tint/ast/interpolate_attribute_test.cc
@@ -27,8 +27,8 @@
TEST_F(InterpolateAttributeTest, Creation) {
auto* d =
Interpolate(builtin::InterpolationType::kLinear, builtin::InterpolationSampling::kCenter);
- CheckIdentifier(Symbols(), d->type, "linear");
- CheckIdentifier(Symbols(), d->sampling, "center");
+ CheckIdentifier(d->type, "linear");
+ CheckIdentifier(d->sampling, "center");
}
} // namespace
diff --git a/src/tint/ast/module_test.cc b/src/tint/ast/module_test.cc
index c0255ff..878df56 100644
--- a/src/tint/ast/module_test.cc
+++ b/src/tint/ast/module_test.cc
@@ -125,12 +125,9 @@
ASSERT_TRUE(decls[2]->Is<ast::Alias>());
ASSERT_TRUE(decls[4]->Is<ast::Alias>());
- ASSERT_EQ(cloned.Symbols().NameFor(decls[0]->As<ast::Alias>()->name->symbol),
- "inserted_before_F");
- ASSERT_EQ(cloned.Symbols().NameFor(decls[2]->As<ast::Alias>()->name->symbol),
- "inserted_before_A");
- ASSERT_EQ(cloned.Symbols().NameFor(decls[4]->As<ast::Alias>()->name->symbol),
- "inserted_before_V");
+ ASSERT_EQ(decls[0]->As<ast::Alias>()->name->symbol.Name(), "inserted_before_F");
+ ASSERT_EQ(decls[2]->As<ast::Alias>()->name->symbol.Name(), "inserted_before_A");
+ ASSERT_EQ(decls[4]->As<ast::Alias>()->name->symbol.Name(), "inserted_before_V");
}
TEST_F(ModuleTest, Directives) {
diff --git a/src/tint/ast/struct_member_test.cc b/src/tint/ast/struct_member_test.cc
index 59eb30f..22f40df 100644
--- a/src/tint/ast/struct_member_test.cc
+++ b/src/tint/ast/struct_member_test.cc
@@ -23,8 +23,8 @@
TEST_F(StructMemberTest, Creation) {
auto* st = Member("a", ty.i32(), utils::Vector{MemberSize(4_a)});
- CheckIdentifier(Symbols(), st->name, "a");
- CheckIdentifier(Symbols(), st->type, "i32");
+ CheckIdentifier(st->name, "a");
+ CheckIdentifier(st->type, "i32");
EXPECT_EQ(st->attributes.Length(), 1u);
EXPECT_TRUE(st->attributes[0]->Is<StructMemberSizeAttribute>());
EXPECT_EQ(st->source.range.begin.line, 0u);
@@ -36,8 +36,8 @@
TEST_F(StructMemberTest, CreationWithSource) {
auto* st = Member(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 8}}}, "a",
ty.i32());
- CheckIdentifier(Symbols(), st->name, "a");
- CheckIdentifier(Symbols(), st->type, "i32");
+ CheckIdentifier(st->name, "a");
+ CheckIdentifier(st->type, "i32");
EXPECT_EQ(st->attributes.Length(), 0u);
EXPECT_EQ(st->source.range.begin.line, 27u);
EXPECT_EQ(st->source.range.begin.column, 4u);
diff --git a/src/tint/ast/test_helper.h b/src/tint/ast/test_helper.h
index 9d7b689..e26c10a 100644
--- a/src/tint/ast/test_helper.h
+++ b/src/tint/ast/test_helper.h
@@ -72,25 +72,21 @@
};
/// A testing utility for checking that an Identifier matches the expected values.
-/// @param symbols the symbol table
/// @param got the identifier
/// @param expected the expected identifier name
template <typename... ARGS>
-void CheckIdentifier(const SymbolTable& symbols, const Identifier* got, std::string_view expected) {
+void CheckIdentifier(const Identifier* got, std::string_view expected) {
EXPECT_FALSE(got->Is<TemplatedIdentifier>());
- EXPECT_EQ(symbols.NameFor(got->symbol), expected);
+ EXPECT_EQ(got->symbol.Name(), expected);
}
/// A testing utility for checking that an Identifier matches the expected name and template
/// arguments.
-/// @param symbols the symbol table
/// @param ident the identifier
/// @param expected the expected identifier name and arguments
template <typename... ARGS>
-void CheckIdentifier(const SymbolTable& symbols,
- const Identifier* ident,
- const TemplatedIdentifierMatcher<ARGS...>& expected) {
- EXPECT_EQ(symbols.NameFor(ident->symbol), expected.name);
+void CheckIdentifier(const Identifier* ident, const TemplatedIdentifierMatcher<ARGS...>& expected) {
+ EXPECT_EQ(ident->symbol.Name(), expected.name);
ASSERT_TRUE(ident->Is<TemplatedIdentifier>());
auto* got = ident->As<TemplatedIdentifier>();
ASSERT_EQ(got->arguments.Length(), std::tuple_size_v<decltype(expected.args)>);
@@ -102,12 +98,12 @@
using T = std::decay_t<decltype(expected_arg)>;
if constexpr (traits::IsStringLike<T>) {
ASSERT_TRUE(got_arg->Is<IdentifierExpression>());
- CheckIdentifier(symbols, got_arg->As<IdentifierExpression>()->identifier, expected_arg);
+ CheckIdentifier(got_arg->As<IdentifierExpression>()->identifier, expected_arg);
} else if constexpr (IsTemplatedIdentifierMatcher<T>::value) {
ASSERT_TRUE(got_arg->Is<IdentifierExpression>());
auto* got_ident = got_arg->As<IdentifierExpression>()->identifier;
ASSERT_TRUE(got_ident->Is<TemplatedIdentifier>());
- CheckIdentifier(symbols, got_ident->As<TemplatedIdentifier>(), expected_arg);
+ CheckIdentifier(got_ident->As<TemplatedIdentifier>(), expected_arg);
} else if constexpr (std::is_same_v<T, bool>) {
ASSERT_TRUE(got_arg->Is<BoolLiteralExpression>());
EXPECT_EQ(got_arg->As<BoolLiteralExpression>()->value, expected_arg);
@@ -149,30 +145,24 @@
}
/// A testing utility for checking that an IdentifierExpression matches the expected values.
-/// @param symbols the symbol table
/// @param expr the IdentifierExpression
/// @param expected the expected identifier name
template <typename... ARGS>
-void CheckIdentifier(const SymbolTable& symbols,
- const Expression* expr,
- std::string_view expected) {
+void CheckIdentifier(const Expression* expr, std::string_view expected) {
auto* expr_ident = expr->As<IdentifierExpression>();
ASSERT_NE(expr_ident, nullptr) << "expression is not a IdentifierExpression";
- CheckIdentifier(symbols, expr_ident->identifier, expected);
+ CheckIdentifier(expr_ident->identifier, expected);
}
/// A testing utility for checking that an IdentifierExpression matches the expected name and
/// template arguments.
-/// @param symbols the symbol table
/// @param expr the IdentifierExpression
/// @param expected the expected identifier name and arguments
template <typename... ARGS>
-void CheckIdentifier(const SymbolTable& symbols,
- const Expression* expr,
- const TemplatedIdentifierMatcher<ARGS...>& expected) {
+void CheckIdentifier(const Expression* expr, const TemplatedIdentifierMatcher<ARGS...>& expected) {
auto* expr_ident = expr->As<IdentifierExpression>();
ASSERT_NE(expr_ident, nullptr) << "expression is not a IdentifierExpression";
- CheckIdentifier(symbols, expr_ident->identifier, expected);
+ CheckIdentifier(expr_ident->identifier, expected);
}
} // namespace tint::ast
diff --git a/src/tint/ast/test_helper_test.cc b/src/tint/ast/test_helper_test.cc
index fcf339c..74d529f 100644
--- a/src/tint/ast/test_helper_test.cc
+++ b/src/tint/ast/test_helper_test.cc
@@ -21,21 +21,21 @@
using AstCheckIdentifierTest = TestHelper;
TEST_F(AstCheckIdentifierTest, NonTemplated) {
- CheckIdentifier(Symbols(), Ident("abc"), "abc");
+ CheckIdentifier(Ident("abc"), "abc");
}
TEST_F(AstCheckIdentifierTest, TemplatedScalars) {
- CheckIdentifier(Symbols(), Ident("abc", 1_i, 2_u, 3_f, 4_h, 5_a, 6._a, true), //
+ CheckIdentifier(Ident("abc", 1_i, 2_u, 3_f, 4_h, 5_a, 6._a, true), //
Template("abc", 1_i, 2_u, 3_f, 4_h, 5_a, 6._a, true));
}
TEST_F(AstCheckIdentifierTest, TemplatedIdentifiers) {
- CheckIdentifier(Symbols(), Ident("abc", "one", "two", "three"), //
+ CheckIdentifier(Ident("abc", "one", "two", "three"), //
Template("abc", "one", "two", "three"));
}
TEST_F(AstCheckIdentifierTest, NestedTemplate) {
- CheckIdentifier(Symbols(), Ident("abc", "pre", Ident("nested", 42_a), "post"), //
+ CheckIdentifier(Ident("abc", "pre", Ident("nested", 42_a), "post"), //
Template("abc", "pre", Template("nested", 42_a), "post"));
}
diff --git a/src/tint/ast/variable_test.cc b/src/tint/ast/variable_test.cc
index 6fbc420..bc8f274 100644
--- a/src/tint/ast/variable_test.cc
+++ b/src/tint/ast/variable_test.cc
@@ -28,10 +28,10 @@
TEST_F(VariableTest, Creation) {
auto* v = Var("my_var", ty.i32(), builtin::AddressSpace::kFunction);
- CheckIdentifier(Symbols(), v->name, "my_var");
- CheckIdentifier(Symbols(), v->declared_address_space, "function");
+ CheckIdentifier(v->name, "my_var");
+ CheckIdentifier(v->declared_address_space, "function");
EXPECT_EQ(v->declared_access, nullptr);
- CheckIdentifier(Symbols(), v->type, "i32");
+ CheckIdentifier(v->type, "i32");
EXPECT_EQ(v->source.range.begin.line, 0u);
EXPECT_EQ(v->source.range.begin.column, 0u);
EXPECT_EQ(v->source.range.end.line, 0u);
@@ -42,9 +42,9 @@
auto* v = Var(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 5}}}, "i",
ty.f32(), builtin::AddressSpace::kPrivate, utils::Empty);
- CheckIdentifier(Symbols(), v->name, "i");
- CheckIdentifier(Symbols(), v->declared_address_space, "private");
- CheckIdentifier(Symbols(), v->type, "f32");
+ CheckIdentifier(v->name, "i");
+ CheckIdentifier(v->declared_address_space, "private");
+ CheckIdentifier(v->type, "f32");
EXPECT_EQ(v->source.range.begin.line, 27u);
EXPECT_EQ(v->source.range.begin.column, 4u);
EXPECT_EQ(v->source.range.end.line, 27u);
@@ -55,9 +55,9 @@
auto* v = Var(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 7}}}, "a_var",
ty.i32(), builtin::AddressSpace::kWorkgroup, utils::Empty);
- CheckIdentifier(Symbols(), v->name, "a_var");
- CheckIdentifier(Symbols(), v->declared_address_space, "workgroup");
- CheckIdentifier(Symbols(), v->type, "i32");
+ CheckIdentifier(v->name, "a_var");
+ CheckIdentifier(v->declared_address_space, "workgroup");
+ CheckIdentifier(v->type, "i32");
EXPECT_EQ(v->source.range.begin.line, 27u);
EXPECT_EQ(v->source.range.begin.column, 4u);
EXPECT_EQ(v->source.range.end.line, 27u);
diff --git a/src/tint/ast/workgroup_attribute_test.cc b/src/tint/ast/workgroup_attribute_test.cc
index 3363e52..be833b6 100644
--- a/src/tint/ast/workgroup_attribute_test.cc
+++ b/src/tint/ast/workgroup_attribute_test.cc
@@ -73,7 +73,7 @@
auto* z_ident = As<IdentifierExpression>(values[2]);
ASSERT_TRUE(z_ident);
- EXPECT_EQ(Symbols().NameFor(z_ident->identifier->symbol), "depth");
+ EXPECT_EQ(z_ident->identifier->symbol.Name(), "depth");
}
} // namespace
diff --git a/src/tint/clone_context.cc b/src/tint/clone_context.cc
index 3590301..a6f1478 100644
--- a/src/tint/clone_context.cc
+++ b/src/tint/clone_context.cc
@@ -49,7 +49,7 @@
if (symbol_transform_) {
return symbol_transform_(s);
}
- return dst->Symbols().New(src->Symbols().NameFor(s));
+ return dst->Symbols().New(s.Name());
});
}
diff --git a/src/tint/clone_context_test.cc b/src/tint/clone_context_test.cc
index 59c47c0..ec17e0d 100644
--- a/src/tint/clone_context_test.cc
+++ b/src/tint/clone_context_test.cc
@@ -183,10 +183,8 @@
CloneContext ctx(&cloned, &original);
ctx.ReplaceAll([&](const Replaceable* in) {
- auto out_name =
- cloned.Symbols().Register("replacement:" + original.Symbols().NameFor(in->name));
- auto b_name =
- cloned.Symbols().Register("replacement-child:" + original.Symbols().NameFor(in->name));
+ auto out_name = cloned.Symbols().Register("replacement:" + in->name.Name());
+ auto b_name = cloned.Symbols().Register("replacement-child:" + in->name.Name());
auto* out = alloc.Create<Replacement>(out_name);
out->b = alloc.Create<Node>(b_name);
out->c = ctx.Clone(in->a);
@@ -276,7 +274,7 @@
ProgramBuilder cloned;
auto* cloned_root = CloneContext(&cloned, &original, false)
.ReplaceAll([&](Symbol sym) {
- auto in = original.Symbols().NameFor(sym);
+ auto in = sym.Name();
auto out = "transformed<" + in + ">";
return cloned.Symbols().New(out);
})
@@ -1173,9 +1171,9 @@
Symbol old_a = builder.Symbols().New();
Symbol old_b = builder.Symbols().New();
Symbol old_c = builder.Symbols().New();
- EXPECT_EQ(builder.Symbols().NameFor(old_a), "tint_symbol");
- EXPECT_EQ(builder.Symbols().NameFor(old_b), "tint_symbol_1");
- EXPECT_EQ(builder.Symbols().NameFor(old_c), "tint_symbol_2");
+ EXPECT_EQ(old_a.Name(), "tint_symbol");
+ EXPECT_EQ(old_b.Name(), "tint_symbol_1");
+ EXPECT_EQ(old_c.Name(), "tint_symbol_2");
Program original(std::move(builder));
@@ -1188,12 +1186,12 @@
Symbol new_z = cloned.Symbols().New();
Symbol new_c = ctx.Clone(old_c);
- EXPECT_EQ(cloned.Symbols().NameFor(new_x), "tint_symbol");
- EXPECT_EQ(cloned.Symbols().NameFor(new_a), "tint_symbol_1");
- EXPECT_EQ(cloned.Symbols().NameFor(new_y), "tint_symbol_2");
- EXPECT_EQ(cloned.Symbols().NameFor(new_b), "tint_symbol_1_1");
- EXPECT_EQ(cloned.Symbols().NameFor(new_z), "tint_symbol_3");
- EXPECT_EQ(cloned.Symbols().NameFor(new_c), "tint_symbol_2_1");
+ EXPECT_EQ(new_x.Name(), "tint_symbol");
+ EXPECT_EQ(new_a.Name(), "tint_symbol_1");
+ EXPECT_EQ(new_y.Name(), "tint_symbol_2");
+ EXPECT_EQ(new_b.Name(), "tint_symbol_1_1");
+ EXPECT_EQ(new_z.Name(), "tint_symbol_3");
+ EXPECT_EQ(new_c.Name(), "tint_symbol_2_1");
}
TEST_F(CloneContextTest, CloneNewSymbols) {
@@ -1201,9 +1199,9 @@
Symbol old_a = builder.Symbols().New("a");
Symbol old_b = builder.Symbols().New("b");
Symbol old_c = builder.Symbols().New("c");
- EXPECT_EQ(builder.Symbols().NameFor(old_a), "a");
- EXPECT_EQ(builder.Symbols().NameFor(old_b), "b");
- EXPECT_EQ(builder.Symbols().NameFor(old_c), "c");
+ EXPECT_EQ(old_a.Name(), "a");
+ EXPECT_EQ(old_b.Name(), "b");
+ EXPECT_EQ(old_c.Name(), "c");
Program original(std::move(builder));
@@ -1216,12 +1214,12 @@
Symbol new_z = cloned.Symbols().New("c");
Symbol new_c = ctx.Clone(old_c);
- EXPECT_EQ(cloned.Symbols().NameFor(new_x), "a");
- EXPECT_EQ(cloned.Symbols().NameFor(new_a), "a_1");
- EXPECT_EQ(cloned.Symbols().NameFor(new_y), "b");
- EXPECT_EQ(cloned.Symbols().NameFor(new_b), "b_1");
- EXPECT_EQ(cloned.Symbols().NameFor(new_z), "c");
- EXPECT_EQ(cloned.Symbols().NameFor(new_c), "c_1");
+ EXPECT_EQ(new_x.Name(), "a");
+ EXPECT_EQ(new_a.Name(), "a_1");
+ EXPECT_EQ(new_y.Name(), "b");
+ EXPECT_EQ(new_b.Name(), "b_1");
+ EXPECT_EQ(new_z.Name(), "c");
+ EXPECT_EQ(new_c.Name(), "c_1");
}
TEST_F(CloneContextTest, CloneNewSymbols_AfterCloneSymbols) {
@@ -1229,9 +1227,9 @@
Symbol old_a = builder.Symbols().New("a");
Symbol old_b = builder.Symbols().New("b");
Symbol old_c = builder.Symbols().New("c");
- EXPECT_EQ(builder.Symbols().NameFor(old_a), "a");
- EXPECT_EQ(builder.Symbols().NameFor(old_b), "b");
- EXPECT_EQ(builder.Symbols().NameFor(old_c), "c");
+ EXPECT_EQ(old_a.Name(), "a");
+ EXPECT_EQ(old_b.Name(), "b");
+ EXPECT_EQ(old_c.Name(), "c");
Program original(std::move(builder));
@@ -1244,12 +1242,12 @@
Symbol new_z = cloned.Symbols().New("c");
Symbol new_c = ctx.Clone(old_c);
- EXPECT_EQ(cloned.Symbols().NameFor(new_x), "a_1");
- EXPECT_EQ(cloned.Symbols().NameFor(new_a), "a");
- EXPECT_EQ(cloned.Symbols().NameFor(new_y), "b_1");
- EXPECT_EQ(cloned.Symbols().NameFor(new_b), "b");
- EXPECT_EQ(cloned.Symbols().NameFor(new_z), "c_1");
- EXPECT_EQ(cloned.Symbols().NameFor(new_c), "c");
+ EXPECT_EQ(new_x.Name(), "a_1");
+ EXPECT_EQ(new_a.Name(), "a");
+ EXPECT_EQ(new_y.Name(), "b_1");
+ EXPECT_EQ(new_b.Name(), "b");
+ EXPECT_EQ(new_z.Name(), "c_1");
+ EXPECT_EQ(new_c.Name(), "c");
}
TEST_F(CloneContextTest, ProgramIDs) {
diff --git a/src/tint/cmd/info.cc b/src/tint/cmd/info.cc
index c31095c..bc1a260 100644
--- a/src/tint/cmd/info.cc
+++ b/src/tint/cmd/info.cc
@@ -237,7 +237,7 @@
std::cout << std::endl;
std::cout << "{" << std::endl;
- std::cout << "\"name\": \"" << s->FriendlyName(program->Symbols()) << "\"," << std::endl;
+ std::cout << "\"name\": \"" << s->FriendlyName() << "\"," << std::endl;
std::cout << "\"align\": " << s->Align() << "," << std::endl;
std::cout << "\"size\": " << s->Size() << "," << std::endl;
std::cout << "\"members\": [";
@@ -265,8 +265,7 @@
}
std::cout << "{" << std::endl;
- std::cout << "\"name\": \"" << program->Symbols().NameFor(m->Name()) << "\","
- << std::endl;
+ std::cout << "\"name\": \"" << m->Name().Name() << "\"," << std::endl;
std::cout << "\"offset\": " << m->Offset() << "," << std::endl;
std::cout << "\"align\": " << m->Align() << "," << std::endl;
std::cout << "\"size\": " << m->Size() << std::endl;
@@ -307,7 +306,7 @@
continue;
}
const auto* s = ty->As<tint::type::Struct>();
- std::cout << s->Layout(program->Symbols()) << std::endl << std::endl;
+ std::cout << s->Layout() << std::endl << std::endl;
}
}
}
diff --git a/src/tint/inspector/inspector.cc b/src/tint/inspector/inspector.cc
index 0b8b22c..d2330e9 100644
--- a/src/tint/inspector/inspector.cc
+++ b/src/tint/inspector/inspector.cc
@@ -133,8 +133,8 @@
auto* sem = program_->Sem().Get(func);
- entry_point.name = program_->Symbols().NameFor(func->name->symbol);
- entry_point.remapped_name = program_->Symbols().NameFor(func->name->symbol);
+ entry_point.name = func->name->symbol.Name();
+ entry_point.remapped_name = func->name->symbol.Name();
switch (func->PipelineStage()) {
case ast::PipelineStage::kCompute: {
@@ -163,9 +163,9 @@
}
for (auto* param : sem->Parameters()) {
- AddEntryPointInOutVariables(program_->Symbols().NameFor(param->Declaration()->name->symbol),
- param->Type(), param->Declaration()->attributes,
- param->Location(), entry_point.input_variables);
+ AddEntryPointInOutVariables(param->Declaration()->name->symbol.Name(), param->Type(),
+ param->Declaration()->attributes, param->Location(),
+ entry_point.input_variables);
entry_point.input_position_used |= ContainsBuiltin(
builtin::BuiltinValue::kPosition, param->Type(), param->Declaration()->attributes);
@@ -192,7 +192,7 @@
for (auto* var : sem->TransitivelyReferencedGlobals()) {
auto* decl = var->Declaration();
- auto name = program_->Symbols().NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
auto* global = var->As<sem::GlobalVariable>();
if (global && global->Declaration()->Is<ast::Override>()) {
@@ -295,7 +295,7 @@
for (auto* var : program_->AST().GlobalVariables()) {
auto* global = program_->Sem().Get<sem::GlobalVariable>(var);
if (global && global->Declaration()->Is<ast::Override>()) {
- auto name = program_->Symbols().NameFor(var->name->symbol);
+ auto name = var->name->symbol.Name();
result[name] = global->OverrideId();
}
}
@@ -619,9 +619,9 @@
if (auto* struct_ty = unwrapped_type->As<sem::Struct>()) {
// Recurse into members.
for (auto* member : struct_ty->Members()) {
- AddEntryPointInOutVariables(name + "." + program_->Symbols().NameFor(member->Name()),
- member->Type(), member->Declaration()->attributes,
- member->Location(), variables);
+ AddEntryPointInOutVariables(name + "." + member->Name().Name(), member->Type(),
+ member->Declaration()->attributes, member->Location(),
+ variables);
}
return;
}
@@ -838,8 +838,8 @@
auto sampler_binding_point = globals[1]->BindingPoint();
for (auto* entry_point : entry_points) {
- const auto& ep_name = program_->Symbols().NameFor(
- entry_point->Declaration()->name->symbol);
+ const auto& ep_name =
+ entry_point->Declaration()->name->symbol.Name();
(*sampler_targets_)[ep_name].Add(
{sampler_binding_point, texture_binding_point});
}
diff --git a/src/tint/inspector/test_inspector_builder.cc b/src/tint/inspector/test_inspector_builder.cc
index 9f92d6d..c351ec3 100644
--- a/src/tint/inspector/test_inspector_builder.cc
+++ b/src/tint/inspector/test_inspector_builder.cc
@@ -83,7 +83,7 @@
}
std::string InspectorBuilder::StructMemberName(size_t idx, ast::Type type) {
- return std::to_string(idx) + Symbols().NameFor(type->identifier->symbol);
+ return std::to_string(idx) + type->identifier->symbol.Name();
}
const ast::Struct* InspectorBuilder::MakeStructType(const std::string& name,
diff --git a/src/tint/ir/binary.cc b/src/tint/ir/binary.cc
index cdec94d..6cbf742 100644
--- a/src/tint/ir/binary.cc
+++ b/src/tint/ir/binary.cc
@@ -29,9 +29,9 @@
Binary::~Binary() = default;
-utils::StringStream& Binary::ToString(utils::StringStream& out, const SymbolTable& st) const {
- Result()->ToString(out, st) << " = ";
- lhs_->ToString(out, st) << " ";
+utils::StringStream& Binary::ToString(utils::StringStream& out) const {
+ Result()->ToString(out) << " = ";
+ lhs_->ToString(out) << " ";
switch (GetKind()) {
case Binary::Kind::kAdd:
@@ -90,7 +90,7 @@
break;
}
out << " ";
- rhs_->ToString(out, st);
+ rhs_->ToString(out);
return out;
}
diff --git a/src/tint/ir/binary.h b/src/tint/ir/binary.h
index 063bc93..bb74ea8 100644
--- a/src/tint/ir/binary.h
+++ b/src/tint/ir/binary.h
@@ -76,9 +76,8 @@
/// Write the instruction to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
private:
Kind kind_;
diff --git a/src/tint/ir/binary_test.cc b/src/tint/ir/binary_test.cc
index 9f4ba19..31972ce 100644
--- a/src/tint/ir/binary_test.cc
+++ b/src/tint/ir/binary_test.cc
@@ -47,7 +47,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 & 2");
}
@@ -74,7 +74,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 | 2");
}
@@ -101,7 +101,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 ^ 2");
}
@@ -128,7 +128,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 && 2");
}
@@ -155,7 +155,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 || 2");
}
@@ -182,7 +182,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 == 2");
}
@@ -209,7 +209,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 != 2");
}
@@ -236,7 +236,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 < 2");
}
@@ -263,7 +263,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 > 2");
}
@@ -290,7 +290,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 <= 2");
}
@@ -317,7 +317,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (bool) = 4 >= 2");
}
@@ -344,7 +344,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 << 2");
}
@@ -371,7 +371,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 >> 2");
}
@@ -398,7 +398,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 + 2");
}
@@ -425,7 +425,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 - 2");
}
@@ -452,7 +452,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 * 2");
}
@@ -479,7 +479,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 / 2");
}
@@ -506,7 +506,7 @@
EXPECT_EQ(2_i, rhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = 4 % 2");
}
diff --git a/src/tint/ir/bitcast.cc b/src/tint/ir/bitcast.cc
index 3cf0c97..749702e 100644
--- a/src/tint/ir/bitcast.cc
+++ b/src/tint/ir/bitcast.cc
@@ -26,10 +26,10 @@
Bitcast::~Bitcast() = default;
-utils::StringStream& Bitcast::ToString(utils::StringStream& out, const SymbolTable& st) const {
- Result()->ToString(out, st);
+utils::StringStream& Bitcast::ToString(utils::StringStream& out) const {
+ Result()->ToString(out);
out << " = bitcast(";
- val_->ToString(out, st);
+ val_->ToString(out);
out << ")";
return out;
}
diff --git a/src/tint/ir/bitcast.h b/src/tint/ir/bitcast.h
index 0178066..7e9f7db 100644
--- a/src/tint/ir/bitcast.h
+++ b/src/tint/ir/bitcast.h
@@ -42,9 +42,8 @@
/// Write the instruction to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
private:
Value* val_ = nullptr;
diff --git a/src/tint/ir/bitcast_test.cc b/src/tint/ir/bitcast_test.cc
index 38ae9b2..b46c334 100644
--- a/src/tint/ir/bitcast_test.cc
+++ b/src/tint/ir/bitcast_test.cc
@@ -40,7 +40,7 @@
EXPECT_EQ(4_i, val->As<constant::Scalar<i32>>()->ValueAs<i32>());
utils::StringStream str;
- instr->ToString(str, b.builder.ir.symbols);
+ instr->ToString(str);
EXPECT_EQ(str.str(), "%42 (i32) = bitcast(4)");
}
diff --git a/src/tint/ir/builder_impl.cc b/src/tint/ir/builder_impl.cc
index ba63be6..c6c6ed0 100644
--- a/src/tint/ir/builder_impl.cc
+++ b/src/tint/ir/builder_impl.cc
@@ -146,7 +146,7 @@
}
Symbol BuilderImpl::CloneSymbol(Symbol sym) const {
- return clone_ctx_.type_ctx.dst.st->Register(clone_ctx_.type_ctx.src.st->NameFor(sym));
+ return clone_ctx_.type_ctx.dst.st->Register(sym.Name());
}
ResultType BuilderImpl::Build() {
diff --git a/src/tint/ir/builtin.cc b/src/tint/ir/builtin.cc
index e9acf66..4237797 100644
--- a/src/tint/ir/builtin.cc
+++ b/src/tint/ir/builtin.cc
@@ -25,10 +25,10 @@
Builtin::~Builtin() = default;
-utils::StringStream& Builtin::ToString(utils::StringStream& out, const SymbolTable& st) const {
- Result()->ToString(out, st);
+utils::StringStream& Builtin::ToString(utils::StringStream& out) const {
+ Result()->ToString(out);
out << " = " << builtin::str(func_) << "(";
- EmitArgs(out, st);
+ EmitArgs(out);
out << ")";
return out;
}
diff --git a/src/tint/ir/builtin.h b/src/tint/ir/builtin.h
index 0385c6c..4fc8a76 100644
--- a/src/tint/ir/builtin.h
+++ b/src/tint/ir/builtin.h
@@ -44,9 +44,8 @@
/// Write the instruction to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
private:
const builtin::Function func_;
diff --git a/src/tint/ir/call.cc b/src/tint/ir/call.cc
index 9dda1f9..b801260 100644
--- a/src/tint/ir/call.cc
+++ b/src/tint/ir/call.cc
@@ -26,14 +26,14 @@
Call::~Call() = default;
-void Call::EmitArgs(utils::StringStream& out, const SymbolTable& st) const {
+void Call::EmitArgs(utils::StringStream& out) const {
bool first = true;
for (const auto* arg : args_) {
if (!first) {
out << ", ";
}
first = false;
- arg->ToString(out, st);
+ arg->ToString(out);
}
}
diff --git a/src/tint/ir/call.h b/src/tint/ir/call.h
index d6ced3f..e1f9d48 100644
--- a/src/tint/ir/call.h
+++ b/src/tint/ir/call.h
@@ -42,8 +42,7 @@
/// Writes the call arguments to the given stream.
/// @param out the output stream
- /// @param st the symbol table
- void EmitArgs(utils::StringStream& out, const SymbolTable& st) const;
+ void EmitArgs(utils::StringStream& out) const;
private:
utils::Vector<Value*, 1> args_;
diff --git a/src/tint/ir/constant.cc b/src/tint/ir/constant.cc
index 61610b0..4036616 100644
--- a/src/tint/ir/constant.cc
+++ b/src/tint/ir/constant.cc
@@ -29,7 +29,7 @@
Constant::~Constant() = default;
-utils::StringStream& Constant::ToString(utils::StringStream& out, const SymbolTable& st) const {
+utils::StringStream& Constant::ToString(utils::StringStream& out) const {
std::function<void(const constant::Value*)> emit = [&](const constant::Value* c) {
Switch(
c,
@@ -43,12 +43,12 @@
out << (scalar->ValueAs<bool>() ? "true" : "false");
},
[&](const constant::Splat* splat) {
- out << splat->Type()->FriendlyName(st) << "(";
+ out << splat->Type()->FriendlyName() << "(";
emit(splat->Index(0));
out << ")";
},
[&](const constant::Composite* composite) {
- out << composite->Type()->FriendlyName(st) << "(";
+ out << composite->Type()->FriendlyName() << "(";
for (const auto* elem : composite->elements) {
if (elem != composite->elements[0]) {
out << ", ";
diff --git a/src/tint/ir/constant.h b/src/tint/ir/constant.h
index 1c4088f..7be3688 100644
--- a/src/tint/ir/constant.h
+++ b/src/tint/ir/constant.h
@@ -35,9 +35,8 @@
/// Write the constant to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
/// The constants value
const constant::Value* const value;
diff --git a/src/tint/ir/constant_test.cc b/src/tint/ir/constant_test.cc
index f3a1dc0..f407cdb 100644
--- a/src/tint/ir/constant_test.cc
+++ b/src/tint/ir/constant_test.cc
@@ -31,7 +31,7 @@
auto* c = b.builder.Constant(1.2_f);
EXPECT_EQ(1.2_f, c->value->As<constant::Scalar<f32>>()->ValueAs<f32>());
- c->ToString(str, b.builder.ir.symbols);
+ c->ToString(str);
EXPECT_EQ("1.20000004768371582031", str.str());
EXPECT_TRUE(c->value->Is<constant::Scalar<f32>>());
@@ -49,7 +49,7 @@
auto* c = b.builder.Constant(1.1_h);
EXPECT_EQ(1.1_h, c->value->As<constant::Scalar<f16>>()->ValueAs<f16>());
- c->ToString(str, b.builder.ir.symbols);
+ c->ToString(str);
EXPECT_EQ("1.099609375", str.str());
EXPECT_FALSE(c->value->Is<constant::Scalar<f32>>());
@@ -67,7 +67,7 @@
auto* c = b.builder.Constant(1_i);
EXPECT_EQ(1_i, c->value->As<constant::Scalar<i32>>()->ValueAs<i32>());
- c->ToString(str, b.builder.ir.symbols);
+ c->ToString(str);
EXPECT_EQ("1", str.str());
EXPECT_FALSE(c->value->Is<constant::Scalar<f32>>());
@@ -85,7 +85,7 @@
auto* c = b.builder.Constant(2_u);
EXPECT_EQ(2_u, c->value->As<constant::Scalar<u32>>()->ValueAs<u32>());
- c->ToString(str, b.builder.ir.symbols);
+ c->ToString(str);
EXPECT_EQ("2", str.str());
EXPECT_FALSE(c->value->Is<constant::Scalar<f32>>());
@@ -104,7 +104,7 @@
auto* c = b.builder.Constant(false);
EXPECT_FALSE(c->value->As<constant::Scalar<bool>>()->ValueAs<bool>());
- c->ToString(str, b.builder.ir.symbols);
+ c->ToString(str);
EXPECT_EQ("false", str.str());
}
@@ -113,7 +113,7 @@
auto c = b.builder.Constant(true);
EXPECT_TRUE(c->value->As<constant::Scalar<bool>>()->ValueAs<bool>());
- c->ToString(str, b.builder.ir.symbols);
+ c->ToString(str);
EXPECT_EQ("true", str.str());
EXPECT_FALSE(c->value->Is<constant::Scalar<f32>>());
diff --git a/src/tint/ir/construct.cc b/src/tint/ir/construct.cc
index 27bb084..595075b 100644
--- a/src/tint/ir/construct.cc
+++ b/src/tint/ir/construct.cc
@@ -23,12 +23,12 @@
Construct::~Construct() = default;
-utils::StringStream& Construct::ToString(utils::StringStream& out, const SymbolTable& st) const {
- Result()->ToString(out, st);
- out << " = construct(" << Result()->Type()->FriendlyName(st);
+utils::StringStream& Construct::ToString(utils::StringStream& out) const {
+ Result()->ToString(out);
+ out << " = construct(" << Result()->Type()->FriendlyName();
if (!Args().IsEmpty()) {
out << ", ";
- EmitArgs(out, st);
+ EmitArgs(out);
}
out << ")";
return out;
diff --git a/src/tint/ir/construct.h b/src/tint/ir/construct.h
index 6f620d3..24449b6 100644
--- a/src/tint/ir/construct.h
+++ b/src/tint/ir/construct.h
@@ -39,9 +39,8 @@
/// Write the instruction to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
};
} // namespace tint::ir
diff --git a/src/tint/ir/convert.cc b/src/tint/ir/convert.cc
index e845adb..ed31250 100644
--- a/src/tint/ir/convert.cc
+++ b/src/tint/ir/convert.cc
@@ -24,11 +24,11 @@
Convert::~Convert() = default;
-utils::StringStream& Convert::ToString(utils::StringStream& out, const SymbolTable& st) const {
- Result()->ToString(out, st);
- out << " = convert(" << Result()->Type()->FriendlyName(st) << ", " << from_->FriendlyName(st)
+utils::StringStream& Convert::ToString(utils::StringStream& out) const {
+ Result()->ToString(out);
+ out << " = convert(" << Result()->Type()->FriendlyName() << ", " << from_->FriendlyName()
<< ", ";
- EmitArgs(out, st);
+ EmitArgs(out);
out << ")";
return out;
}
diff --git a/src/tint/ir/convert.h b/src/tint/ir/convert.h
index 5132248..3b8878b 100644
--- a/src/tint/ir/convert.h
+++ b/src/tint/ir/convert.h
@@ -45,9 +45,8 @@
/// Write the instruction to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
private:
const type::Type* from_ = nullptr;
diff --git a/src/tint/ir/debug.cc b/src/tint/ir/debug.cc
index eb7d40f..f69805e 100644
--- a/src/tint/ir/debug.cc
+++ b/src/tint/ir/debug.cc
@@ -145,7 +145,7 @@
for (const auto* func : mod->functions) {
// Cluster each function to label and draw a box around it.
out << "subgraph cluster_" << name_for(func) << " {" << std::endl;
- out << R"(label=")" << mod->symbols.NameFor(func->name) << R"(")" << std::endl;
+ out << R"(label=")" << func->name.Name() << R"(")" << std::endl;
out << name_for(func->start_target) << R"( [label="start"])" << std::endl;
out << name_for(func->end_target) << R"( [label="end"])" << std::endl;
Graph(func->start_target);
diff --git a/src/tint/ir/disassembler.cc b/src/tint/ir/disassembler.cc
index 041495d..c3bb006 100644
--- a/src/tint/ir/disassembler.cc
+++ b/src/tint/ir/disassembler.cc
@@ -64,7 +64,7 @@
void Disassembler::EmitBlockInstructions(const Block* b) {
for (const auto* instr : b->instructions) {
Indent();
- instr->ToString(out_, mod_.symbols) << std::endl;
+ instr->ToString(out_) << std::endl;
}
}
@@ -89,8 +89,7 @@
tint::Switch(
node,
[&](const ir::Function* f) {
- Indent() << "%bb" << GetIdForNode(f) << " = Function " << mod_.symbols.NameFor(f->name)
- << std::endl;
+ Indent() << "%bb" << GetIdForNode(f) << " = Function " << f->name.Name() << std::endl;
{
ScopedIndent func_indent(&indent_size_);
@@ -120,7 +119,7 @@
if (v != b->branch.args.Front()) {
out_ << ", ";
}
- v->ToString(out_, mod_.symbols);
+ v->ToString(out_);
}
out_ << ")" << std::endl;
@@ -132,7 +131,7 @@
},
[&](const ir::Switch* s) {
Indent() << "%bb" << GetIdForNode(s) << " = Switch (";
- s->condition->ToString(out_, mod_.symbols);
+ s->condition->ToString(out_);
out_ << ")" << std::endl;
{
@@ -148,7 +147,7 @@
if (selector.IsDefault()) {
out_ << "default";
} else {
- selector.val->ToString(out_, mod_.symbols);
+ selector.val->ToString(out_);
}
}
out_ << std::endl;
@@ -161,7 +160,7 @@
},
[&](const ir::If* i) {
Indent() << "%bb" << GetIdForNode(i) << " = if (";
- i->condition->ToString(out_, mod_.symbols);
+ i->condition->ToString(out_);
out_ << ")" << std::endl;
{
diff --git a/src/tint/ir/instruction.h b/src/tint/ir/instruction.h
index 9d09fcb..8ae2de4 100644
--- a/src/tint/ir/instruction.h
+++ b/src/tint/ir/instruction.h
@@ -38,10 +38,8 @@
/// Write the instruction to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- virtual utils::StringStream& ToString(utils::StringStream& out,
- const SymbolTable& st) const = 0;
+ virtual utils::StringStream& ToString(utils::StringStream& out) const = 0;
protected:
/// Constructor
diff --git a/src/tint/ir/temp.cc b/src/tint/ir/temp.cc
index 3efae03..b6c9a8e 100644
--- a/src/tint/ir/temp.cc
+++ b/src/tint/ir/temp.cc
@@ -24,8 +24,8 @@
Temp::~Temp() = default;
-utils::StringStream& Temp::ToString(utils::StringStream& out, const SymbolTable& st) const {
- out << "%" << std::to_string(AsId()) << " (" << type_->FriendlyName(st) << ")";
+utils::StringStream& Temp::ToString(utils::StringStream& out) const {
+ out << "%" << std::to_string(AsId()) << " (" << type_->FriendlyName() << ")";
return out;
}
diff --git a/src/tint/ir/temp.h b/src/tint/ir/temp.h
index 8532a45..9433099 100644
--- a/src/tint/ir/temp.h
+++ b/src/tint/ir/temp.h
@@ -49,9 +49,8 @@
/// Write the temp to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
private:
const type::Type* type_ = nullptr;
diff --git a/src/tint/ir/temp_test.cc b/src/tint/ir/temp_test.cc
index e73dd34..edd002b 100644
--- a/src/tint/ir/temp_test.cc
+++ b/src/tint/ir/temp_test.cc
@@ -32,7 +32,7 @@
auto* val = b.builder.Temp(b.builder.ir.types.Get<type::I32>());
EXPECT_EQ(4u, val->AsId());
- val->ToString(str, b.builder.ir.symbols);
+ val->ToString(str);
EXPECT_EQ("%4 (i32)", str.str());
}
diff --git a/src/tint/ir/user_call.cc b/src/tint/ir/user_call.cc
index cf672cf..9a1f7eb 100644
--- a/src/tint/ir/user_call.cc
+++ b/src/tint/ir/user_call.cc
@@ -24,11 +24,11 @@
UserCall::~UserCall() = default;
-utils::StringStream& UserCall::ToString(utils::StringStream& out, const SymbolTable& st) const {
- Result()->ToString(out, st);
+utils::StringStream& UserCall::ToString(utils::StringStream& out) const {
+ Result()->ToString(out);
out << " = call(";
- out << st.NameFor(name_) << ", ";
- EmitArgs(out, st);
+ out << name_.Name() << ", ";
+ EmitArgs(out);
out << ")";
return out;
}
diff --git a/src/tint/ir/user_call.h b/src/tint/ir/user_call.h
index 2edeecb..34215ed 100644
--- a/src/tint/ir/user_call.h
+++ b/src/tint/ir/user_call.h
@@ -43,9 +43,8 @@
/// Write the instruction to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- utils::StringStream& ToString(utils::StringStream& out, const SymbolTable& st) const override;
+ utils::StringStream& ToString(utils::StringStream& out) const override;
private:
Symbol name_{};
diff --git a/src/tint/ir/value.h b/src/tint/ir/value.h
index b3ec7ef..2d4fcb0 100644
--- a/src/tint/ir/value.h
+++ b/src/tint/ir/value.h
@@ -53,10 +53,8 @@
/// Write the value to the given stream
/// @param out the stream to write to
- /// @param st the symbol table
/// @returns the stream
- virtual utils::StringStream& ToString(utils::StringStream& out,
- const SymbolTable& st) const = 0;
+ virtual utils::StringStream& ToString(utils::StringStream& out) const = 0;
protected:
/// Constructor
diff --git a/src/tint/program.cc b/src/tint/program.cc
index 643999d..c8466f5 100644
--- a/src/tint/program.cc
+++ b/src/tint/program.cc
@@ -136,11 +136,11 @@
std::string Program::FriendlyName(ast::Type type) const {
TINT_ASSERT_PROGRAM_IDS_EQUAL(Program, type, ID());
- return type ? Symbols().NameFor(type->identifier->symbol) : "<null>";
+ return type ? type->identifier->symbol.Name() : "<null>";
}
std::string Program::FriendlyName(const type::Type* type) const {
- return type ? type->FriendlyName(Symbols()) : "<null>";
+ return type ? type->FriendlyName() : "<null>";
}
std::string Program::FriendlyName(std::nullptr_t) const {
diff --git a/src/tint/program_builder.cc b/src/tint/program_builder.cc
index bfb7edb..4181f96 100644
--- a/src/tint/program_builder.cc
+++ b/src/tint/program_builder.cc
@@ -115,11 +115,11 @@
std::string ProgramBuilder::FriendlyName(ast::Type type) const {
TINT_ASSERT_PROGRAM_IDS_EQUAL(ProgramBuilder, type, ID());
- return type.expr ? Symbols().NameFor(type->identifier->symbol) : "<null>";
+ return type.expr ? type->identifier->symbol.Name() : "<null>";
}
std::string ProgramBuilder::FriendlyName(const type::Type* type) const {
- return type ? type->FriendlyName(Symbols()) : "<null>";
+ return type ? type->FriendlyName() : "<null>";
}
std::string ProgramBuilder::FriendlyName(std::nullptr_t) const {
diff --git a/src/tint/reader/spirv/parser_impl_test_helper.cc b/src/tint/reader/spirv/parser_impl_test_helper.cc
index 4a57379..697a51b 100644
--- a/src/tint/reader/spirv/parser_impl_test_helper.cc
+++ b/src/tint/reader/spirv/parser_impl_test_helper.cc
@@ -75,7 +75,7 @@
}
return writer.result();
},
- [&](const ast::Identifier* ident) { return program.Symbols().NameFor(ident->symbol); },
+ [&](const ast::Identifier* ident) { return ident->symbol.Name(); },
[&](Default) {
return "<unhandled AST node type " + std::string(node->TypeInfo().name) + ">";
});
diff --git a/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc
index 63f9574..5fd1b59 100644
--- a/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc
@@ -35,7 +35,7 @@
ASSERT_TRUE(e->Is<ast::CallStatement>());
auto* c = e->As<ast::CallStatement>()->expr;
- ast::CheckIdentifier(p->builder().Symbols(), c->target, "a");
+ ast::CheckIdentifier(c->target, "a");
EXPECT_EQ(c->args.Length(), 0u);
}
@@ -51,7 +51,7 @@
ASSERT_TRUE(e->Is<ast::CallStatement>());
auto* c = e->As<ast::CallStatement>()->expr;
- ast::CheckIdentifier(p->builder().Symbols(), c->target, "a");
+ ast::CheckIdentifier(c->target, "a");
EXPECT_EQ(c->args.Length(), 3u);
EXPECT_TRUE(c->args[0]->Is<ast::IntLiteralExpression>());
@@ -70,7 +70,7 @@
ASSERT_TRUE(e->Is<ast::CallStatement>());
auto* c = e->As<ast::CallStatement>()->expr;
- ast::CheckIdentifier(p->builder().Symbols(), c->target, "a");
+ ast::CheckIdentifier(c->target, "a");
EXPECT_EQ(c->args.Length(), 2u);
EXPECT_TRUE(c->args[0]->Is<ast::IntLiteralExpression>());
diff --git a/src/tint/reader/wgsl/parser_impl_diagnostic_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_diagnostic_attribute_test.cc
index 5c54e93..991d5b6 100644
--- a/src/tint/reader/wgsl/parser_impl_diagnostic_attribute_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_diagnostic_attribute_test.cc
@@ -30,7 +30,7 @@
EXPECT_EQ(d->control.severity, builtin::DiagnosticSeverity::kOff);
auto* r = d->control.rule_name;
ASSERT_NE(r, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), r, "foo");
+ ast::CheckIdentifier(r, "foo");
}
} // namespace
diff --git a/src/tint/reader/wgsl/parser_impl_diagnostic_control_test.cc b/src/tint/reader/wgsl/parser_impl_diagnostic_control_test.cc
index 81ce178..e45d1e7 100644
--- a/src/tint/reader/wgsl/parser_impl_diagnostic_control_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_diagnostic_control_test.cc
@@ -33,7 +33,7 @@
auto* r = e->rule_name;
ASSERT_NE(r, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), r, "foo");
+ ast::CheckIdentifier(r, "foo");
}
INSTANTIATE_TEST_SUITE_P(DiagnosticControlParserTest,
DiagnosticControlParserTest,
@@ -52,7 +52,7 @@
auto* r = e->rule_name;
ASSERT_NE(r, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), r, "foo");
+ ast::CheckIdentifier(r, "foo");
}
TEST_F(ParserImplTest, DiagnosticControl_MissingOpenParen) {
diff --git a/src/tint/reader/wgsl/parser_impl_diagnostic_directive_test.cc b/src/tint/reader/wgsl/parser_impl_diagnostic_directive_test.cc
index b2f987c..12b69f1 100644
--- a/src/tint/reader/wgsl/parser_impl_diagnostic_directive_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_diagnostic_directive_test.cc
@@ -33,7 +33,7 @@
auto* r = directive->control.rule_name;
ASSERT_NE(r, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), r, "foo");
+ ast::CheckIdentifier(r, "foo");
}
TEST_F(ParserImplTest, DiagnosticDirective_MissingSemicolon) {
diff --git a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc
index 5e96d8e..8f0512b 100644
--- a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc
@@ -311,7 +311,7 @@
ast::IntLiteralExpression::Suffix::kNone);
ASSERT_NE(values[1], nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), values[1], "height");
+ ast::CheckIdentifier(values[1], "height");
ASSERT_EQ(values[2], nullptr);
}
diff --git a/src/tint/reader/wgsl/parser_impl_function_decl_test.cc b/src/tint/reader/wgsl/parser_impl_function_decl_test.cc
index 3888326..052f786 100644
--- a/src/tint/reader/wgsl/parser_impl_function_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_function_decl_test.cc
@@ -241,7 +241,7 @@
EXPECT_EQ(f->name->symbol, p->builder().Symbols().Get("main"));
ASSERT_NE(f->return_type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), f->return_type, "f32");
+ ast::CheckIdentifier(f->return_type, "f32");
ASSERT_EQ(f->params.Length(), 0u);
diff --git a/src/tint/reader/wgsl/parser_impl_function_header_test.cc b/src/tint/reader/wgsl/parser_impl_function_header_test.cc
index f68ea69..d92fef0 100644
--- a/src/tint/reader/wgsl/parser_impl_function_header_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_function_header_test.cc
@@ -53,7 +53,7 @@
EXPECT_EQ(f->name, "main");
EXPECT_EQ(f->params.Length(), 0u);
- ast::CheckIdentifier(p->builder().Symbols(), f->return_type, "f32");
+ ast::CheckIdentifier(f->return_type, "f32");
ASSERT_EQ(f->return_type_attributes.Length(), 1u);
auto* loc = f->return_type_attributes[0]->As<ast::LocationAttribute>();
@@ -72,7 +72,7 @@
EXPECT_EQ(f->name, "main");
EXPECT_EQ(f->params.Length(), 0u);
- ast::CheckIdentifier(p->builder().Symbols(), f->return_type, "f32");
+ ast::CheckIdentifier(f->return_type, "f32");
ASSERT_EQ(f->return_type_attributes.Length(), 1u);
EXPECT_TRUE(f->return_type_attributes[0]->Is<ast::InvariantAttribute>());
}
diff --git a/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc b/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc
index 98f3de1..ecfdfbc 100644
--- a/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc
@@ -45,7 +45,7 @@
EXPECT_EQ(c->name->symbol, p->builder().Symbols().Get("a"));
ASSERT_NE(c->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), c->type, "f32");
+ ast::CheckIdentifier(c->type, "f32");
EXPECT_EQ(c->source.range.begin.line, 1u);
EXPECT_EQ(c->source.range.begin.column, 7u);
@@ -121,7 +121,7 @@
EXPECT_EQ(override->name->symbol, p->builder().Symbols().Get("a"));
ASSERT_NE(override->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), override->type, "f32");
+ ast::CheckIdentifier(override->type, "f32");
EXPECT_EQ(override->source.range.begin.line, 1u);
EXPECT_EQ(override->source.range.begin.column, 17u);
@@ -151,7 +151,7 @@
EXPECT_EQ(override->name->symbol, p->builder().Symbols().Get("a"));
ASSERT_NE(override->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), override->type, "f32");
+ ast::CheckIdentifier(override->type, "f32");
EXPECT_EQ(override->source.range.begin.line, 1u);
EXPECT_EQ(override->source.range.begin.column, 18u);
@@ -181,7 +181,7 @@
EXPECT_EQ(override->name->symbol, p->builder().Symbols().Get("a"));
ASSERT_NE(override->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), override->type, "f32");
+ ast::CheckIdentifier(override->type, "f32");
EXPECT_EQ(override->source.range.begin.line, 1u);
EXPECT_EQ(override->source.range.begin.column, 10u);
diff --git a/src/tint/reader/wgsl/parser_impl_global_decl_test.cc b/src/tint/reader/wgsl/parser_impl_global_decl_test.cc
index 697475e..d2a6a74 100644
--- a/src/tint/reader/wgsl/parser_impl_global_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_global_decl_test.cc
@@ -34,7 +34,7 @@
auto* v = program.AST().GlobalVariables()[0];
EXPECT_EQ(v->name->symbol, program.Symbols().Get("a"));
- ast::CheckIdentifier(program.Symbols(), v->type, ast::Template("vec2", "i32"));
+ ast::CheckIdentifier(v->type, ast::Template("vec2", "i32"));
}
TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_Inferred) {
@@ -107,8 +107,7 @@
auto program = p->program();
ASSERT_EQ(program.AST().TypeDecls().Length(), 1u);
ASSERT_TRUE(program.AST().TypeDecls()[0]->Is<ast::Alias>());
- ast::CheckIdentifier(program.Symbols(), program.AST().TypeDecls()[0]->As<ast::Alias>()->name,
- "A");
+ ast::CheckIdentifier(program.AST().TypeDecls()[0]->As<ast::Alias>()->name, "A");
}
TEST_F(ParserImplTest, GlobalDecl_TypeAlias_StructIdent) {
@@ -129,7 +128,7 @@
ASSERT_TRUE(program.AST().TypeDecls()[1]->Is<ast::Alias>());
auto* alias = program.AST().TypeDecls()[1]->As<ast::Alias>();
EXPECT_EQ(alias->name->symbol, program.Symbols().Get("B"));
- ast::CheckIdentifier(program.Symbols(), alias->type, "A");
+ ast::CheckIdentifier(alias->type, "A");
}
TEST_F(ParserImplTest, GlobalDecl_TypeAlias_MissingSemicolon) {
@@ -146,7 +145,7 @@
auto program = p->program();
ASSERT_EQ(program.AST().Functions().Length(), 1u);
- ast::CheckIdentifier(program.Symbols(), program.AST().Functions()[0]->name, "main");
+ ast::CheckIdentifier(program.AST().Functions()[0]->name, "main");
}
TEST_F(ParserImplTest, GlobalDecl_Function_WithAttribute) {
@@ -156,7 +155,7 @@
auto program = p->program();
ASSERT_EQ(program.AST().Functions().Length(), 1u);
- ast::CheckIdentifier(program.Symbols(), program.AST().Functions()[0]->name, "main");
+ ast::CheckIdentifier(program.AST().Functions()[0]->name, "main");
}
TEST_F(ParserImplTest, GlobalDecl_Function_Invalid) {
diff --git a/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc b/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc
index a5de0a9..f83438d 100644
--- a/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc
@@ -30,9 +30,9 @@
auto* var = e.value->As<ast::Var>();
ASSERT_NE(var, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), var->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), var->type, "f32");
- ast::CheckIdentifier(p->builder().Symbols(), var->declared_address_space, "private");
+ ast::CheckIdentifier(var->name, "a");
+ ast::CheckIdentifier(var->type, "f32");
+ ast::CheckIdentifier(var->declared_address_space, "private");
EXPECT_EQ(var->source.range.begin.line, 1u);
EXPECT_EQ(var->source.range.begin.column, 14u);
@@ -54,9 +54,9 @@
auto* var = e.value->As<ast::Var>();
ASSERT_NE(var, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), var->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), var->type, "f32");
- ast::CheckIdentifier(p->builder().Symbols(), var->declared_address_space, "private");
+ ast::CheckIdentifier(var->name, "a");
+ ast::CheckIdentifier(var->type, "f32");
+ ast::CheckIdentifier(var->declared_address_space, "private");
EXPECT_EQ(var->source.range.begin.line, 1u);
EXPECT_EQ(var->source.range.begin.column, 14u);
@@ -79,9 +79,9 @@
auto* var = e.value->As<ast::Var>();
ASSERT_NE(var, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), var->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), var->type, "f32");
- ast::CheckIdentifier(p->builder().Symbols(), var->declared_address_space, "uniform");
+ ast::CheckIdentifier(var->name, "a");
+ ast::CheckIdentifier(var->type, "f32");
+ ast::CheckIdentifier(var->declared_address_space, "uniform");
EXPECT_EQ(var->source.range.begin.line, 1u);
EXPECT_EQ(var->source.range.begin.column, 36u);
@@ -109,9 +109,9 @@
auto* var = e.value->As<ast::Var>();
ASSERT_NE(var, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), var->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), var->type, "f32");
- ast::CheckIdentifier(p->builder().Symbols(), var->declared_address_space, "uniform");
+ ast::CheckIdentifier(var->name, "a");
+ ast::CheckIdentifier(var->type, "f32");
+ ast::CheckIdentifier(var->declared_address_space, "uniform");
EXPECT_EQ(var->source.range.begin.line, 1u);
EXPECT_EQ(var->source.range.begin.column, 36u);
diff --git a/src/tint/reader/wgsl/parser_impl_param_list_test.cc b/src/tint/reader/wgsl/parser_impl_param_list_test.cc
index eb4db45..1ebd651 100644
--- a/src/tint/reader/wgsl/parser_impl_param_list_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_param_list_test.cc
@@ -27,7 +27,7 @@
EXPECT_EQ(e.value.Length(), 1u);
EXPECT_EQ(e.value[0]->name->symbol, p->builder().Symbols().Get("a"));
- ast::CheckIdentifier(p->builder().Symbols(), e.value[0]->type, "i32");
+ ast::CheckIdentifier(e.value[0]->type, "i32");
EXPECT_TRUE(e.value[0]->Is<ast::Parameter>());
ASSERT_EQ(e.value[0]->source.range.begin.line, 1u);
@@ -45,7 +45,7 @@
EXPECT_EQ(e.value.Length(), 3u);
EXPECT_EQ(e.value[0]->name->symbol, p->builder().Symbols().Get("a"));
- ast::CheckIdentifier(p->builder().Symbols(), e.value[0]->type, "i32");
+ ast::CheckIdentifier(e.value[0]->type, "i32");
EXPECT_TRUE(e.value[0]->Is<ast::Parameter>());
ASSERT_EQ(e.value[0]->source.range.begin.line, 1u);
@@ -54,7 +54,7 @@
ASSERT_EQ(e.value[0]->source.range.end.column, 2u);
EXPECT_EQ(e.value[1]->name->symbol, p->builder().Symbols().Get("b"));
- ast::CheckIdentifier(p->builder().Symbols(), e.value[1]->type, "f32");
+ ast::CheckIdentifier(e.value[1]->type, "f32");
EXPECT_TRUE(e.value[1]->Is<ast::Parameter>());
ASSERT_EQ(e.value[1]->source.range.begin.line, 1u);
@@ -63,7 +63,7 @@
ASSERT_EQ(e.value[1]->source.range.end.column, 11u);
EXPECT_EQ(e.value[2]->name->symbol, p->builder().Symbols().Get("c"));
- ast::CheckIdentifier(p->builder().Symbols(), e.value[2]->type, ast::Template("vec2", "f32"));
+ ast::CheckIdentifier(e.value[2]->type, ast::Template("vec2", "f32"));
EXPECT_TRUE(e.value[2]->Is<ast::Parameter>());
ASSERT_EQ(e.value[2]->source.range.begin.line, 1u);
@@ -97,13 +97,12 @@
ASSERT_EQ(e.value.Length(), 2u);
EXPECT_EQ(e.value[0]->name->symbol, p->builder().Symbols().Get("coord"));
- ast::CheckIdentifier(p->builder().Symbols(), e.value[0]->type, ast::Template("vec4", "f32"));
+ ast::CheckIdentifier(e.value[0]->type, ast::Template("vec4", "f32"));
EXPECT_TRUE(e.value[0]->Is<ast::Parameter>());
auto attrs_0 = e.value[0]->attributes;
ASSERT_EQ(attrs_0.Length(), 1u);
EXPECT_TRUE(attrs_0[0]->Is<ast::BuiltinAttribute>());
- ast::CheckIdentifier(p->builder().Symbols(), attrs_0[0]->As<ast::BuiltinAttribute>()->builtin,
- "position");
+ ast::CheckIdentifier(attrs_0[0]->As<ast::BuiltinAttribute>()->builtin, "position");
ASSERT_EQ(e.value[0]->source.range.begin.line, 1u);
ASSERT_EQ(e.value[0]->source.range.begin.column, 20u);
@@ -111,7 +110,7 @@
ASSERT_EQ(e.value[0]->source.range.end.column, 25u);
EXPECT_EQ(e.value[1]->name->symbol, p->builder().Symbols().Get("loc1"));
- ast::CheckIdentifier(p->builder().Symbols(), e.value[1]->type, "f32");
+ ast::CheckIdentifier(e.value[1]->type, "f32");
EXPECT_TRUE(e.value[1]->Is<ast::Parameter>());
auto attrs_1 = e.value[1]->attributes;
ASSERT_EQ(attrs_1.Length(), 1u);
diff --git a/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc b/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc
index 5dab39f..904e881 100644
--- a/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc
@@ -27,7 +27,7 @@
EXPECT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e.value, nullptr);
ASSERT_TRUE(e->Is<ast::IdentifierExpression>());
- ast::CheckIdentifier(p->builder().Symbols(), e.value, "a");
+ ast::CheckIdentifier(e.value, "a");
}
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl) {
@@ -116,7 +116,7 @@
auto* call = e->As<ast::CallExpression>();
ASSERT_NE(call->target, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), call->target, "S");
+ ast::CheckIdentifier(call->target, "S");
ASSERT_EQ(call->args.Length(), 0u);
}
@@ -140,7 +140,7 @@
auto* call = e->As<ast::CallExpression>();
ASSERT_NE(call->target, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), call->target, "S");
+ ast::CheckIdentifier(call->target, "S");
ASSERT_EQ(call->args.Length(), 2u);
@@ -215,7 +215,7 @@
ASSERT_TRUE(e->Is<ast::CallExpression>());
auto* call = e->As<ast::CallExpression>();
- ast::CheckIdentifier(p->builder().Symbols(), call->target, "f32");
+ ast::CheckIdentifier(call->target, "f32");
ASSERT_EQ(call->args.Length(), 1u);
ASSERT_TRUE(call->args[0]->Is<ast::IntLiteralExpression>());
@@ -233,7 +233,7 @@
auto* c = e->As<ast::BitcastExpression>();
- ast::CheckIdentifier(p->builder().Symbols(), c->type, "f32");
+ ast::CheckIdentifier(c->type, "f32");
ASSERT_TRUE(c->expr->Is<ast::IntLiteralExpression>());
}
diff --git a/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc b/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc
index dfde6fa..8809ba5 100644
--- a/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc
@@ -98,7 +98,7 @@
ASSERT_TRUE(e->Is<ast::CallExpression>());
auto* c = e->As<ast::CallExpression>();
- ast::CheckIdentifier(p->builder().Symbols(), c->target, "a");
+ ast::CheckIdentifier(c->target, "a");
EXPECT_EQ(c->args.Length(), 0u);
}
@@ -114,7 +114,7 @@
ASSERT_TRUE(e->Is<ast::CallExpression>());
auto* c = e->As<ast::CallExpression>();
- ast::CheckIdentifier(p->builder().Symbols(), c->target, "test");
+ ast::CheckIdentifier(c->target, "test");
EXPECT_EQ(c->args.Length(), 3u);
EXPECT_TRUE(c->args[0]->Is<ast::IntLiteralExpression>());
diff --git a/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc b/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc
index a4fbe2c..5efa18d 100644
--- a/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc
@@ -30,7 +30,7 @@
const auto* mem = m.value[0];
EXPECT_EQ(mem->name->symbol, builder.Symbols().Get("a"));
- ast::CheckIdentifier(p->builder().Symbols(), mem->type, "i32");
+ ast::CheckIdentifier(mem->type, "i32");
EXPECT_EQ(mem->attributes.Length(), 0u);
}
@@ -46,7 +46,7 @@
const auto* mem = m.value[0];
EXPECT_EQ(mem->name->symbol, builder.Symbols().Get("a"));
- ast::CheckIdentifier(p->builder().Symbols(), mem->type, "i32");
+ ast::CheckIdentifier(mem->type, "i32");
EXPECT_EQ(mem->attributes.Length(), 0u);
}
diff --git a/src/tint/reader/wgsl/parser_impl_struct_member_test.cc b/src/tint/reader/wgsl/parser_impl_struct_member_test.cc
index 0af0ba2..9dc90a5 100644
--- a/src/tint/reader/wgsl/parser_impl_struct_member_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_struct_member_test.cc
@@ -26,8 +26,8 @@
ASSERT_FALSE(m.errored);
ASSERT_NE(m.value, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), m->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), m->type, "i32");
+ ast::CheckIdentifier(m->name, "a");
+ ast::CheckIdentifier(m->type, "i32");
EXPECT_EQ(m->attributes.Length(), 0u);
EXPECT_EQ(m->source.range, (Source::Range{{1u, 1u}, {1u, 2u}}));
@@ -42,8 +42,8 @@
ASSERT_FALSE(m.errored);
ASSERT_NE(m.value, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), m->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), m->type, "i32");
+ ast::CheckIdentifier(m->name, "a");
+ ast::CheckIdentifier(m->type, "i32");
EXPECT_EQ(m->attributes.Length(), 1u);
EXPECT_TRUE(m->attributes[0]->Is<ast::StructMemberAlignAttribute>());
@@ -65,8 +65,8 @@
ASSERT_FALSE(m.errored);
ASSERT_NE(m.value, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), m->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), m->type, "i32");
+ ast::CheckIdentifier(m->name, "a");
+ ast::CheckIdentifier(m->type, "i32");
EXPECT_EQ(m->attributes.Length(), 1u);
ASSERT_TRUE(m->attributes[0]->Is<ast::StructMemberSizeAttribute>());
auto* s = m->attributes[0]->As<ast::StructMemberSizeAttribute>();
@@ -87,8 +87,8 @@
ASSERT_FALSE(m.errored);
ASSERT_NE(m.value, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), m->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), m->type, "i32");
+ ast::CheckIdentifier(m->name, "a");
+ ast::CheckIdentifier(m->type, "i32");
EXPECT_EQ(m->attributes.Length(), 2u);
ASSERT_TRUE(m->attributes[0]->Is<ast::StructMemberSizeAttribute>());
auto* size_attr = m->attributes[0]->As<ast::StructMemberSizeAttribute>();
diff --git a/src/tint/reader/wgsl/parser_impl_type_alias_test.cc b/src/tint/reader/wgsl/parser_impl_type_alias_test.cc
index 1aa8bf9..08a0464 100644
--- a/src/tint/reader/wgsl/parser_impl_type_alias_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_type_alias_test.cc
@@ -28,7 +28,7 @@
ASSERT_NE(t.value, nullptr);
ASSERT_TRUE(t->Is<ast::Alias>());
auto* alias = t->As<ast::Alias>();
- ast::CheckIdentifier(p->builder().Symbols(), alias->type, "i32");
+ ast::CheckIdentifier(alias->type, "i32");
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 14u}}));
}
@@ -42,8 +42,8 @@
ASSERT_NE(t.value, nullptr);
ASSERT_TRUE(t.value->Is<ast::Alias>());
auto* alias = t.value->As<ast::Alias>();
- ast::CheckIdentifier(p->builder().Symbols(), alias->name, "a");
- ast::CheckIdentifier(p->builder().Symbols(), alias->type, "B");
+ ast::CheckIdentifier(alias->name, "a");
+ ast::CheckIdentifier(alias->type, "B");
EXPECT_EQ(alias->source.range, (Source::Range{{1u, 1u}, {1u, 12u}}));
}
@@ -61,8 +61,8 @@
ASSERT_NE(t.value, nullptr);
ASSERT_TRUE(t.value->Is<ast::Alias>());
auto* alias = t.value->As<ast::Alias>();
- ast::CheckIdentifier(p->builder().Symbols(), alias->name, ident);
- ast::CheckIdentifier(p->builder().Symbols(), alias->type, "i32");
+ ast::CheckIdentifier(alias->name, ident);
+ ast::CheckIdentifier(alias->type, "i32");
EXPECT_EQ(alias->source.range, (Source::Range{{1u, 1u}, {1u, 38u}}));
}
diff --git a/src/tint/reader/wgsl/parser_impl_type_decl_test.cc b/src/tint/reader/wgsl/parser_impl_type_decl_test.cc
index 25e60e0..dd0afed 100644
--- a/src/tint/reader/wgsl/parser_impl_type_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_type_decl_test.cc
@@ -38,7 +38,7 @@
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
- ast::CheckIdentifier(p->builder().Symbols(), t.value, "A");
+ ast::CheckIdentifier(t.value, "A");
EXPECT_EQ(t->expr->source.range, (Source::Range{{1u, 1u}, {1u, 2u}}));
}
@@ -49,7 +49,7 @@
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
- ast::CheckIdentifier(p->builder().Symbols(), t.value, "bool");
+ ast::CheckIdentifier(t.value, "bool");
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 5u}}));
}
@@ -60,7 +60,7 @@
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
- ast::CheckIdentifier(p->builder().Symbols(), t.value, "f16");
+ ast::CheckIdentifier(t.value, "f16");
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}}));
}
@@ -71,7 +71,7 @@
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
- ast::CheckIdentifier(p->builder().Symbols(), t.value, "f32");
+ ast::CheckIdentifier(t.value, "f32");
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}}));
}
@@ -82,7 +82,7 @@
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
- ast::CheckIdentifier(p->builder().Symbols(), t.value, "i32");
+ ast::CheckIdentifier(t.value, "i32");
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}}));
}
@@ -93,7 +93,7 @@
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
- ast::CheckIdentifier(p->builder().Symbols(), t.value, "u32");
+ ast::CheckIdentifier(t.value, "u32");
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}}));
}
@@ -117,8 +117,7 @@
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value,
- ast::Template("vec" + std::to_string(params.count), "f32"));
+ ast::CheckIdentifier(t.value, ast::Template("vec" + std::to_string(params.count), "f32"));
EXPECT_EQ(t.value->source.range, params.range);
}
INSTANTIATE_TEST_SUITE_P(ParserImplTest,
@@ -153,7 +152,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("ptr", "function", "f32"));
+ ast::CheckIdentifier(t.value, ast::Template("ptr", "function", "f32"));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 19u}}));
}
@@ -165,8 +164,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value,
- ast::Template("ptr", "function", "f32", "read"));
+ ast::CheckIdentifier(t.value, ast::Template("ptr", "function", "f32", "read"));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 25u}}));
}
@@ -178,8 +176,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value,
- ast::Template("ptr", "function", ast::Template("vec2", "f32")));
+ ast::CheckIdentifier(t.value, ast::Template("ptr", "function", ast::Template("vec2", "f32")));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 25}}));
}
@@ -232,7 +229,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("atomic", "f32"));
+ ast::CheckIdentifier(t.value, ast::Template("atomic", "f32"));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 12u}}));
}
@@ -244,8 +241,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value,
- ast::Template("atomic", ast::Template("vec2", "f32")));
+ ast::CheckIdentifier(t.value, ast::Template("atomic", ast::Template("vec2", "f32")));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 18u}}));
}
@@ -267,7 +263,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("array", "f32", 5_a));
+ ast::CheckIdentifier(t.value, ast::Template("array", "f32", 5_a));
}
TEST_F(ParserImplTest, TypeDecl_Array_SintLiteralSize) {
@@ -278,7 +274,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("array", "f32", 5_i));
+ ast::CheckIdentifier(t.value, ast::Template("array", "f32", 5_i));
}
TEST_F(ParserImplTest, TypeDecl_Array_UintLiteralSize) {
@@ -289,7 +285,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("array", "f32", 5_u));
+ ast::CheckIdentifier(t.value, ast::Template("array", "f32", 5_u));
}
TEST_F(ParserImplTest, TypeDecl_Array_ConstantSize) {
@@ -300,7 +296,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("array", "f32", "size"));
+ ast::CheckIdentifier(t.value, ast::Template("array", "f32", "size"));
}
TEST_F(ParserImplTest, TypeDecl_Array_ExpressionSize) {
@@ -311,17 +307,15 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- auto name_for = [&](const Symbol& sym) { return p->builder().Symbols().NameFor(sym); };
-
auto* arr = t->expr->identifier->As<ast::TemplatedIdentifier>();
- EXPECT_EQ(name_for(arr->symbol), "array");
+ EXPECT_EQ(arr->symbol.Name(), "array");
EXPECT_TRUE(arr->attributes.IsEmpty());
ASSERT_EQ(arr->arguments.Length(), 2u);
auto* ty = As<ast::IdentifierExpression>(arr->arguments[0]);
ASSERT_NE(ty, nullptr);
- EXPECT_EQ(name_for(ty->identifier->symbol), "f32");
+ EXPECT_EQ(ty->identifier->symbol.Name(), "f32");
auto* count = As<ast::BinaryExpression>(arr->arguments[1]);
ASSERT_NE(count, nullptr);
@@ -329,7 +323,7 @@
auto* count_lhs = As<ast::IdentifierExpression>(count->lhs);
ASSERT_NE(count_lhs, nullptr);
- EXPECT_EQ(name_for(count_lhs->identifier->symbol), "size");
+ EXPECT_EQ(count_lhs->identifier->symbol.Name(), "size");
auto* count_rhs = As<ast::IntLiteralExpression>(count->rhs);
ASSERT_NE(count_rhs, nullptr);
@@ -344,7 +338,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("array", "u32"));
+ ast::CheckIdentifier(t.value, ast::Template("array", "u32"));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 11u}}));
}
@@ -356,8 +350,7 @@
ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- ast::CheckIdentifier(p->builder().Symbols(), t.value,
- ast::Template("array", ast::Template("vec4", "u32")));
+ ast::CheckIdentifier(t.value, ast::Template("array", ast::Template("vec4", "u32")));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}}));
}
@@ -406,7 +399,7 @@
std::string expected_name =
"mat" + std::to_string(GetParam().columns) + "x" + std::to_string(GetParam().rows);
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template(expected_name, "f32"));
+ ast::CheckIdentifier(t.value, ast::Template(expected_name, "f32"));
EXPECT_EQ(t.value->source.range, params.range);
}
INSTANTIATE_TEST_SUITE_P(ParserImplTest,
@@ -453,7 +446,7 @@
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error();
- ast::CheckIdentifier(p->builder().Symbols(), t.value, "sampler");
+ ast::CheckIdentifier(t.value, "sampler");
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
}
@@ -465,7 +458,7 @@
EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), t.value, ast::Template("texture_cube", "f32"));
+ ast::CheckIdentifier(t.value, ast::Template("texture_cube", "f32"));
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 18u}}));
}
diff --git a/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc b/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc
index 07775c5..1751e98 100644
--- a/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc
@@ -39,8 +39,7 @@
EXPECT_EQ(exp->value, 4u);
ASSERT_TRUE(attr_1->Is<ast::BuiltinAttribute>());
- ast::CheckIdentifier(p->builder().Symbols(), attr_1->As<ast::BuiltinAttribute>()->builtin,
- "position");
+ ast::CheckIdentifier(attr_1->As<ast::BuiltinAttribute>()->builtin, "position");
}
TEST_F(ParserImplTest, AttributeList_Invalid) {
diff --git a/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc
index 2ca7da4..e67a18a 100644
--- a/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc
@@ -233,7 +233,7 @@
ASSERT_TRUE(var_attr->Is<ast::BuiltinAttribute>());
auto* builtin = var_attr->As<ast::BuiltinAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), builtin->builtin, str);
+ ast::CheckIdentifier(builtin->builtin, str);
}
TEST_P(BuiltinTest, Attribute_Builtin_TrailingComma) {
auto str = utils::ToString(GetParam());
@@ -249,7 +249,7 @@
ASSERT_TRUE(var_attr->Is<ast::BuiltinAttribute>());
auto* builtin = var_attr->As<ast::BuiltinAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), builtin->builtin, str);
+ ast::CheckIdentifier(builtin->builtin, str);
}
INSTANTIATE_TEST_SUITE_P(ParserImplTest,
BuiltinTest,
@@ -308,7 +308,7 @@
ASSERT_TRUE(var_attr->Is<ast::InterpolateAttribute>());
auto* interp = var_attr->As<ast::InterpolateAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), interp->type, "flat");
+ ast::CheckIdentifier(interp->type, "flat");
EXPECT_EQ(interp->sampling, nullptr);
}
@@ -324,7 +324,7 @@
ASSERT_TRUE(var_attr->Is<ast::InterpolateAttribute>());
auto* interp = var_attr->As<ast::InterpolateAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), interp->type, "flat");
+ ast::CheckIdentifier(interp->type, "flat");
EXPECT_EQ(interp->sampling, nullptr);
}
@@ -350,8 +350,8 @@
ASSERT_TRUE(var_attr->Is<ast::InterpolateAttribute>());
auto* interp = var_attr->As<ast::InterpolateAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), interp->type, "perspective");
- ast::CheckIdentifier(p->builder().Symbols(), interp->sampling, "center");
+ ast::CheckIdentifier(interp->type, "perspective");
+ ast::CheckIdentifier(interp->sampling, "center");
}
TEST_F(ParserImplTest, Attribute_Interpolate_Double_TrailingComma) {
@@ -366,8 +366,8 @@
ASSERT_TRUE(var_attr->Is<ast::InterpolateAttribute>());
auto* interp = var_attr->As<ast::InterpolateAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), interp->type, "perspective");
- ast::CheckIdentifier(p->builder().Symbols(), interp->sampling, "center");
+ ast::CheckIdentifier(interp->type, "perspective");
+ ast::CheckIdentifier(interp->sampling, "center");
}
TEST_F(ParserImplTest, Attribute_Interpolate_Perspective_Centroid) {
@@ -382,8 +382,8 @@
ASSERT_TRUE(var_attr->Is<ast::InterpolateAttribute>());
auto* interp = var_attr->As<ast::InterpolateAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), interp->type, "perspective");
- ast::CheckIdentifier(p->builder().Symbols(), interp->sampling, "centroid");
+ ast::CheckIdentifier(interp->type, "perspective");
+ ast::CheckIdentifier(interp->sampling, "centroid");
}
TEST_F(ParserImplTest, Attribute_Interpolate_Linear_Sample) {
@@ -398,8 +398,8 @@
ASSERT_TRUE(var_attr->Is<ast::InterpolateAttribute>());
auto* interp = var_attr->As<ast::InterpolateAttribute>();
- ast::CheckIdentifier(p->builder().Symbols(), interp->type, "linear");
- ast::CheckIdentifier(p->builder().Symbols(), interp->sampling, "sample");
+ ast::CheckIdentifier(interp->type, "linear");
+ ast::CheckIdentifier(interp->sampling, "sample");
}
TEST_F(ParserImplTest, Attribute_Interpolate_MissingLeftParen) {
diff --git a/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc b/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc
index 993ecb0..c8fb651 100644
--- a/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc
@@ -26,7 +26,7 @@
EXPECT_EQ(v->name, "my_var");
EXPECT_NE(v->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), v->type, "f32");
+ ast::CheckIdentifier(v->type, "f32");
EXPECT_EQ(v->source.range, (Source::Range{{1u, 5u}, {1u, 11u}}));
EXPECT_EQ(v->type->source.range, (Source::Range{{1u, 14u}, {1u, 17u}}));
@@ -46,7 +46,7 @@
EXPECT_EQ(v->name, ident);
EXPECT_NE(v->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), v->type, "f32");
+ ast::CheckIdentifier(v->type, "f32");
EXPECT_EQ(v->source.range, (Source::Range{{1u, 5u}, {1u, 48u}}));
EXPECT_EQ(v->type->source.range, (Source::Range{{1u, 51u}, {1u, 54u}}));
@@ -83,8 +83,8 @@
EXPECT_FALSE(p->has_error());
EXPECT_EQ(v->name, "my_var");
- ast::CheckIdentifier(p->builder().Symbols(), v->type, "f32");
- ast::CheckIdentifier(p->builder().Symbols(), v->address_space, "private");
+ ast::CheckIdentifier(v->type, "f32");
+ ast::CheckIdentifier(v->address_space, "private");
EXPECT_EQ(v->source.range.begin.line, 1u);
EXPECT_EQ(v->source.range.begin.column, 14u);
@@ -100,8 +100,8 @@
EXPECT_FALSE(p->has_error());
EXPECT_EQ(v->name, "my_var");
- ast::CheckIdentifier(p->builder().Symbols(), v->type, "f32");
- ast::CheckIdentifier(p->builder().Symbols(), v->address_space, "push_constant");
+ ast::CheckIdentifier(v->type, "f32");
+ ast::CheckIdentifier(v->address_space, "push_constant");
}
} // namespace
diff --git a/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc b/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc
index 467fa80..8de0a52 100644
--- a/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc
@@ -25,7 +25,7 @@
ASSERT_FALSE(decl.errored);
ASSERT_EQ(decl->name, "my_var");
ASSERT_NE(decl->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), decl->type, "f32");
+ ast::CheckIdentifier(decl->type, "f32");
EXPECT_EQ(decl->source.range, (Source::Range{{1u, 1u}, {1u, 7u}}));
EXPECT_EQ(decl->type->source.range, (Source::Range{{1u, 10u}, {1u, 13u}}));
@@ -38,7 +38,7 @@
ASSERT_FALSE(decl.errored);
ASSERT_EQ(decl->name, "my_var");
ASSERT_NE(decl->type, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), decl->type, "f32");
+ ast::CheckIdentifier(decl->type, "f32");
EXPECT_EQ(decl->source.range, (Source::Range{{1u, 1u}, {1u, 7u}}));
EXPECT_EQ(decl->type->source.range, (Source::Range{{1u, 10u}, {1u, 13u}}));
diff --git a/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc b/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc
index 3c25d85..d50a962 100644
--- a/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc
@@ -39,13 +39,12 @@
EXPECT_FALSE(sc.errored);
EXPECT_TRUE(sc.matched);
if (params.address_space != builtin::AddressSpace::kUndefined) {
- ast::CheckIdentifier(p->builder().Symbols(), sc->address_space,
- utils::ToString(params.address_space));
+ ast::CheckIdentifier(sc->address_space, utils::ToString(params.address_space));
} else {
EXPECT_EQ(sc->address_space, nullptr);
}
if (params.access != builtin::Access::kUndefined) {
- ast::CheckIdentifier(p->builder().Symbols(), sc->access, utils::ToString(params.access));
+ ast::CheckIdentifier(sc->access, utils::ToString(params.access));
} else {
EXPECT_EQ(sc->access, nullptr);
}
diff --git a/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc
index bd3ee19..b7df18c 100644
--- a/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc
@@ -81,7 +81,7 @@
ASSERT_NE(e->variable->initializer, nullptr);
auto* call = e->variable->initializer->As<ast::CallExpression>();
ASSERT_NE(call, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), call->target, ast::Template("array", "i32"));
+ ast::CheckIdentifier(call->target, ast::Template("array", "i32"));
}
TEST_F(ParserImplTest, VariableStmt_VariableDecl_ArrayInit_NoSpace) {
@@ -98,7 +98,7 @@
ASSERT_NE(e->variable->initializer, nullptr);
auto* call = e->variable->initializer->As<ast::CallExpression>();
ASSERT_NE(call, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), call->target, ast::Template("array", "i32"));
+ ast::CheckIdentifier(call->target, ast::Template("array", "i32"));
}
TEST_F(ParserImplTest, VariableStmt_VariableDecl_VecInit) {
@@ -114,7 +114,7 @@
ASSERT_NE(e->variable->initializer, nullptr);
auto* call = e->variable->initializer->As<ast::CallExpression>();
- ast::CheckIdentifier(p->builder().Symbols(), call->target, ast::Template("vec2", "i32"));
+ ast::CheckIdentifier(call->target, ast::Template("vec2", "i32"));
}
TEST_F(ParserImplTest, VariableStmt_VariableDecl_VecInit_NoSpace) {
@@ -131,7 +131,7 @@
ASSERT_NE(e->variable->initializer, nullptr);
auto* call = e->variable->initializer->As<ast::CallExpression>();
ASSERT_NE(call, nullptr);
- ast::CheckIdentifier(p->builder().Symbols(), call->target, ast::Template("vec2", "i32"));
+ ast::CheckIdentifier(call->target, ast::Template("vec2", "i32"));
}
TEST_F(ParserImplTest, VariableStmt_Let) {
@@ -168,11 +168,11 @@
ASSERT_TRUE(expr->lhs->Is<ast::IdentifierExpression>());
auto* ident_expr = expr->lhs->As<ast::IdentifierExpression>();
- ast::CheckIdentifier(p->builder().Symbols(), ident_expr->identifier, "collide");
+ ast::CheckIdentifier(ident_expr->identifier, "collide");
ASSERT_TRUE(expr->rhs->Is<ast::IdentifierExpression>());
ident_expr = expr->rhs->As<ast::IdentifierExpression>();
- ast::CheckIdentifier(p->builder().Symbols(), ident_expr->identifier, "collide_1");
+ ast::CheckIdentifier(ident_expr->identifier, "collide_1");
}
TEST_F(ParserImplTest, VariableStmt_Let_MissingEqual) {
diff --git a/src/tint/resolver/bitcast_validation_test.cc b/src/tint/resolver/bitcast_validation_test.cc
index b02cf7d..fb0b960 100644
--- a/src/tint/resolver/bitcast_validation_test.cc
+++ b/src/tint/resolver/bitcast_validation_test.cc
@@ -115,8 +115,7 @@
auto* cast = Bitcast(dst.ast(*this), Expr(Source{{12, 34}}, "src"));
WrapInFunction(Let("src", src.expr(*this, 0)), cast);
- auto expected =
- "12:34 error: '" + src.sem(*this)->FriendlyName(Symbols()) + "' cannot be bitcast";
+ auto expected = "12:34 error: '" + src.sem(*this)->FriendlyName() + "' cannot be bitcast";
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), expected);
@@ -150,8 +149,7 @@
Alias("T", dst.ast(*this));
WrapInFunction(Bitcast(ty(Source{{12, 34}}, "T"), src.expr(*this, 0)));
- auto expected =
- "12:34 error: cannot bitcast to '" + dst.sem(*this)->FriendlyName(Symbols()) + "'";
+ auto expected = "12:34 error: cannot bitcast to '" + dst.sem(*this)->FriendlyName() + "'";
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), expected);
@@ -183,8 +181,8 @@
WrapInFunction(Bitcast(Source{{12, 34}}, dst.ast(*this), src.expr(*this, 0)));
- auto expected = "12:34 error: cannot bitcast from '" + src.sem(*this)->FriendlyName(Symbols()) +
- "' to '" + dst.sem(*this)->FriendlyName(Symbols()) + "'";
+ auto expected = "12:34 error: cannot bitcast from '" + src.sem(*this)->FriendlyName() +
+ "' to '" + dst.sem(*this)->FriendlyName() + "'";
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), expected);
diff --git a/src/tint/resolver/builtin_test.cc b/src/tint/resolver/builtin_test.cc
index 80df98f..8cfbc67 100644
--- a/src/tint/resolver/builtin_test.cc
+++ b/src/tint/resolver/builtin_test.cc
@@ -2120,7 +2120,7 @@
}
void add_call_param(std::string name, ast::Type type, ExpressionList* call_params) {
- std::string type_name = Symbols().NameFor(type->identifier->symbol);
+ std::string type_name = type->identifier->symbol.Name();
if (utils::HasPrefix(type_name, "texture") || utils::HasPrefix(type_name, "sampler")) {
GlobalVar(name, type, Binding(0_a), Group(0_a));
} else {
diff --git a/src/tint/resolver/dependency_graph.cc b/src/tint/resolver/dependency_graph.cc
index 47e691c..ec6bda7 100644
--- a/src/tint/resolver/dependency_graph.cc
+++ b/src/tint/resolver/dependency_graph.cc
@@ -61,7 +61,6 @@
#include "src/tint/scope_stack.h"
#include "src/tint/sem/builtin.h"
#include "src/tint/switch.h"
-#include "src/tint/symbol_table.h"
#include "src/tint/utils/block_allocator.h"
#include "src/tint/utils/compiler_macros.h"
#include "src/tint/utils/defer.h"
@@ -143,19 +142,16 @@
class DependencyScanner {
public:
/// Constructor
- /// @param syms the program symbol table
/// @param globals_by_name map of global symbol to Global pointer
/// @param diagnostics diagnostic messages, appended with any errors found
/// @param graph the dependency graph to populate with resolved symbols
/// @param edges the map of globals-to-global dependency edges, which will
/// be populated by calls to Scan()
- DependencyScanner(const SymbolTable& syms,
- const GlobalMap& globals_by_name,
+ DependencyScanner(const GlobalMap& globals_by_name,
diag::List& diagnostics,
DependencyGraph& graph,
DependencyEdges& edges)
- : symbols_(syms),
- globals_(globals_by_name),
+ : globals_(globals_by_name),
diagnostics_(diagnostics),
graph_(graph),
dependency_edges_(edges) {
@@ -331,7 +327,7 @@
void Declare(Symbol symbol, const ast::Node* node) {
auto* old = scope_stack_.Set(symbol, node);
if (old != nullptr && node != old) {
- auto name = symbols_.NameFor(symbol);
+ auto name = symbol.Name();
AddError(diagnostics_, "redeclaration of '" + name + "'", node->source);
AddNote(diagnostics_, "'" + name + "' previously declared here", old->source);
}
@@ -440,7 +436,7 @@
void AddDependency(const ast::Identifier* from, Symbol to) {
auto* resolved = scope_stack_.Get(to);
if (!resolved) {
- auto s = symbols_.NameFor(to);
+ auto s = to.Name();
if (auto builtin_fn = builtin::ParseFunction(s);
builtin_fn != builtin::Function::kNone) {
graph_.resolved_identifiers.Add(from, ResolvedIdentifier(builtin_fn));
@@ -496,7 +492,6 @@
}
using VariableMap = utils::Hashmap<Symbol, const ast::Variable*, 32>;
- const SymbolTable& symbols_;
const GlobalMap& globals_;
diag::List& diagnostics_;
DependencyGraph& graph_;
@@ -510,8 +505,8 @@
struct DependencyAnalysis {
public:
/// Constructor
- DependencyAnalysis(const SymbolTable& symbols, diag::List& diagnostics, DependencyGraph& graph)
- : symbols_(symbols), diagnostics_(diagnostics), graph_(graph) {}
+ DependencyAnalysis(diag::List& diagnostics, DependencyGraph& graph)
+ : diagnostics_(diagnostics), graph_(graph) {}
/// Performs global dependency analysis on the module, emitting any errors to
/// #diagnostics.
@@ -562,7 +557,7 @@
/// @returns the name of the global declaration node
/// @note will raise an ICE if the node is not a type, function or variable
/// declaration
- std::string NameOf(const ast::Node* node) const { return symbols_.NameFor(SymbolOf(node)); }
+ std::string NameOf(const ast::Node* node) const { return SymbolOf(node).Name(); }
/// @param node the ast::Node of the global declaration
/// @returns a string representation of the global declaration kind
@@ -597,7 +592,7 @@
/// Walks the global declarations, determining the dependencies of each global
/// and adding these to each global's Global::deps field.
void DetermineDependencies() {
- DependencyScanner scanner(symbols_, globals_, diagnostics_, graph_, dependency_edges_);
+ DependencyScanner scanner(globals_, diagnostics_, graph_, dependency_edges_);
for (auto* global : declaration_order_) {
scanner.Scan(global);
}
@@ -762,7 +757,7 @@
for (auto* node : sorted_) {
auto symbol = SymbolOf(node);
auto* global = *globals_.Find(symbol);
- printf("%s depends on:\n", symbols_.NameFor(symbol).c_str());
+ printf("%s depends on:\n", symbol.Name().c_str());
for (auto* dep : global->deps) {
printf(" %s\n", NameOf(dep->node).c_str());
}
@@ -770,9 +765,6 @@
printf("=========================\n");
}
- /// Program symbols
- const SymbolTable& symbols_;
-
/// Program diagnostics
diag::List& diagnostics_;
@@ -802,37 +794,36 @@
DependencyGraph::~DependencyGraph() = default;
bool DependencyGraph::Build(const ast::Module& module,
- const SymbolTable& symbols,
diag::List& diagnostics,
DependencyGraph& output) {
- DependencyAnalysis da{symbols, diagnostics, output};
+ DependencyAnalysis da{diagnostics, output};
return da.Run(module);
}
-std::string ResolvedIdentifier::String(const SymbolTable& symbols, diag::List& diagnostics) const {
+std::string ResolvedIdentifier::String(diag::List& diagnostics) const {
if (auto* node = Node()) {
return Switch(
node,
[&](const ast::TypeDecl* n) { //
- return "type '" + symbols.NameFor(n->name->symbol) + "'";
+ return "type '" + n->name->symbol.Name() + "'";
},
[&](const ast::Var* n) { //
- return "var '" + symbols.NameFor(n->name->symbol) + "'";
+ return "var '" + n->name->symbol.Name() + "'";
},
[&](const ast::Let* n) { //
- return "let '" + symbols.NameFor(n->name->symbol) + "'";
+ return "let '" + n->name->symbol.Name() + "'";
},
[&](const ast::Const* n) { //
- return "const '" + symbols.NameFor(n->name->symbol) + "'";
+ return "const '" + n->name->symbol.Name() + "'";
},
[&](const ast::Override* n) { //
- return "override '" + symbols.NameFor(n->name->symbol) + "'";
+ return "override '" + n->name->symbol.Name() + "'";
},
[&](const ast::Function* n) { //
- return "function '" + symbols.NameFor(n->name->symbol) + "'";
+ return "function '" + n->name->symbol.Name() + "'";
},
[&](const ast::Parameter* n) { //
- return "parameter '" + symbols.NameFor(n->name->symbol) + "'";
+ return "parameter '" + n->name->symbol.Name() + "'";
},
[&](Default) {
TINT_UNREACHABLE(Resolver, diagnostics)
diff --git a/src/tint/resolver/dependency_graph.h b/src/tint/resolver/dependency_graph.h
index f58b2a2..e4f0348 100644
--- a/src/tint/resolver/dependency_graph.h
+++ b/src/tint/resolver/dependency_graph.h
@@ -27,7 +27,6 @@
#include "src/tint/builtin/interpolation_type.h"
#include "src/tint/builtin/texel_format.h"
#include "src/tint/diagnostic/diagnostic.h"
-#include "src/tint/symbol_table.h"
#include "src/tint/utils/hashmap.h"
namespace tint::resolver {
@@ -164,10 +163,9 @@
return !(*this == other);
}
- /// @param symbols the program's symbol table
/// @param diagnostics diagnostics used to report ICEs
/// @return a description of the resolved symbol
- std::string String(const SymbolTable& symbols, diag::List& diagnostics) const;
+ std::string String(diag::List& diagnostics) const;
private:
std::variant<UnresolvedIdentifier,
@@ -196,14 +194,10 @@
/// Build() performs symbol resolution and dependency analysis on `module`,
/// populating `output` with the resulting dependency graph.
/// @param module the AST module to analyse
- /// @param symbols the symbol table
/// @param diagnostics the diagnostic list to populate with errors / warnings
/// @param output the resulting DependencyGraph
/// @returns true on success, false on error
- static bool Build(const ast::Module& module,
- const SymbolTable& symbols,
- diag::List& diagnostics,
- DependencyGraph& output);
+ static bool Build(const ast::Module& module, diag::List& diagnostics, DependencyGraph& output);
/// All globals in dependency-sorted order.
utils::Vector<const ast::Node*, 32> ordered_globals;
diff --git a/src/tint/resolver/dependency_graph_test.cc b/src/tint/resolver/dependency_graph_test.cc
index c9ce3b8..1850d6f 100644
--- a/src/tint/resolver/dependency_graph_test.cc
+++ b/src/tint/resolver/dependency_graph_test.cc
@@ -35,8 +35,7 @@
public:
DependencyGraph Build(std::string expected_error = "") {
DependencyGraph graph;
- auto result =
- DependencyGraph::Build(this->AST(), this->Symbols(), this->Diagnostics(), graph);
+ auto result = DependencyGraph::Build(this->AST(), this->Diagnostics(), graph);
if (expected_error.empty()) {
EXPECT_TRUE(result) << this->Diagnostics().str();
} else {
@@ -1194,7 +1193,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
- EXPECT_EQ(resolved->BuiltinFunction(), builtin) << resolved->String(Symbols(), Diagnostics());
+ EXPECT_EQ(resolved->BuiltinFunction(), builtin) << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Types,
@@ -1234,7 +1233,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
EXPECT_EQ(resolved->BuiltinType(), builtin::ParseBuiltin(name))
- << resolved->String(Symbols(), Diagnostics());
+ << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Types,
@@ -1273,8 +1272,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
- EXPECT_EQ(resolved->Access(), builtin::ParseAccess(name))
- << resolved->String(Symbols(), Diagnostics());
+ EXPECT_EQ(resolved->Access(), builtin::ParseAccess(name)) << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Types,
@@ -1314,7 +1312,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
EXPECT_EQ(resolved->AddressSpace(), builtin::ParseAddressSpace(name))
- << resolved->String(Symbols(), Diagnostics());
+ << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Types,
@@ -1354,7 +1352,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
EXPECT_EQ(resolved->BuiltinValue(), builtin::ParseBuiltinValue(name))
- << resolved->String(Symbols(), Diagnostics());
+ << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Types,
@@ -1394,7 +1392,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
EXPECT_EQ(resolved->InterpolationSampling(), builtin::ParseInterpolationSampling(name))
- << resolved->String(Symbols(), Diagnostics());
+ << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Types,
@@ -1434,7 +1432,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
EXPECT_EQ(resolved->InterpolationType(), builtin::ParseInterpolationType(name))
- << resolved->String(Symbols(), Diagnostics());
+ << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(
@@ -1477,7 +1475,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
EXPECT_EQ(resolved->TexelFormat(), builtin::ParseTexelFormat(name))
- << resolved->String(Symbols(), Diagnostics());
+ << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Types,
@@ -1558,7 +1556,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
- EXPECT_EQ(resolved->Node(), decl) << resolved->String(Symbols(), Diagnostics());
+ EXPECT_EQ(resolved->Node(), decl) << resolved->String(Diagnostics());
}
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByStruct) {
@@ -1575,7 +1573,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
- EXPECT_EQ(resolved->Node(), decl) << resolved->String(Symbols(), Diagnostics());
+ EXPECT_EQ(resolved->Node(), decl) << resolved->String(Diagnostics());
}
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByFunc) {
@@ -1590,7 +1588,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
- EXPECT_EQ(resolved->Node(), decl) << resolved->String(Symbols(), Diagnostics());
+ EXPECT_EQ(resolved->Node(), decl) << resolved->String(Diagnostics());
}
INSTANTIATE_TEST_SUITE_P(Access,
diff --git a/src/tint/resolver/intrinsic_table.cc b/src/tint/resolver/intrinsic_table.cc
index 18e2f81..62dde26 100644
--- a/src/tint/resolver/intrinsic_table.cc
+++ b/src/tint/resolver/intrinsic_table.cc
@@ -65,7 +65,7 @@
// Stub implementations for type::Type conformance.
bool Equals(const type::UniqueNode&) const override { return false; }
- std::string FriendlyName(const SymbolTable&) const override { return "<any>"; }
+ std::string FriendlyName() const override { return "<any>"; }
type::Type* Clone(type::CloneContext&) const override { return nullptr; }
};
@@ -977,11 +977,9 @@
}
const sem::Struct* build_atomic_compare_exchange_result(MatchState& state, const type::Type* ty) {
- return build_struct(
- state.builder,
- "__atomic_compare_exchange_result" + ty->FriendlyName(state.builder.Symbols()),
- {{"old_value", const_cast<type::Type*>(ty)},
- {"exchanged", state.builder.create<type::Bool>()}});
+ return build_struct(state.builder, "__atomic_compare_exchange_result" + ty->FriendlyName(),
+ {{"old_value", const_cast<type::Type*>(ty)},
+ {"exchanged", state.builder.create<type::Bool>()}});
}
/// ParameterInfo describes a parameter
@@ -1230,14 +1228,13 @@
/// @return a string representing a call to a builtin with the given argument
/// types.
-std::string CallSignature(ProgramBuilder& builder,
- const char* intrinsic_name,
+std::string CallSignature(const char* intrinsic_name,
utils::VectorRef<const type::Type*> args,
const type::Type* template_arg = nullptr) {
utils::StringStream ss;
ss << intrinsic_name;
if (template_arg) {
- ss << "<" << template_arg->FriendlyName(builder.Symbols()) << ">";
+ ss << "<" << template_arg->FriendlyName() << ">";
}
ss << "(";
{
@@ -1247,7 +1244,7 @@
ss << ", ";
}
first = false;
- ss << arg->UnwrapRef()->FriendlyName(builder.Symbols());
+ ss << arg->UnwrapRef()->FriendlyName();
}
}
ss << ")";
@@ -1274,7 +1271,7 @@
// Generates an error when no overloads match the provided arguments
auto on_no_match = [&](utils::VectorRef<Candidate> candidates) {
utils::StringStream ss;
- ss << "no matching call to " << CallSignature(builder, intrinsic_name, args) << std::endl;
+ ss << "no matching call to " << CallSignature(intrinsic_name, args) << std::endl;
if (!candidates.IsEmpty()) {
ss << std::endl
<< candidates.Length() << " candidate function"
@@ -1343,7 +1340,7 @@
// Generates an error when no overloads match the provided arguments
auto on_no_match = [&, name = intrinsic_name](utils::VectorRef<Candidate> candidates) {
utils::StringStream ss;
- ss << "no matching overload for " << CallSignature(builder, name, args) << std::endl;
+ ss << "no matching overload for " << CallSignature(name, args) << std::endl;
if (!candidates.IsEmpty()) {
ss << std::endl
<< candidates.Length() << " candidate operator"
@@ -1421,7 +1418,7 @@
// Generates an error when no overloads match the provided arguments
auto on_no_match = [&, name = intrinsic_name](utils::VectorRef<Candidate> candidates) {
utils::StringStream ss;
- ss << "no matching overload for " << CallSignature(builder, name, args) << std::endl;
+ ss << "no matching overload for " << CallSignature(name, args) << std::endl;
if (!candidates.IsEmpty()) {
ss << std::endl
<< candidates.Length() << " candidate operator"
@@ -1456,7 +1453,7 @@
// Generates an error when no overloads match the provided arguments
auto on_no_match = [&](utils::VectorRef<Candidate> candidates) {
utils::StringStream ss;
- ss << "no matching constructor for " << CallSignature(builder, name, args, template_arg)
+ ss << "no matching constructor for " << CallSignature(name, args, template_arg)
<< std::endl;
Candidates ctor, conv;
for (auto candidate : candidates) {
@@ -1871,7 +1868,7 @@
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(builder.Symbols());
+ ss << ((i == 0) ? "<" : ", ") << ty->FriendlyName();
} else {
if (i > 0) {
ss << ">";
@@ -1886,7 +1883,7 @@
ss << ", ";
}
first = false;
- ss << arg->FriendlyName(builder.Symbols());
+ ss << arg->FriendlyName();
}
ss << "):\n";
for (auto& candidate : candidates) {
diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc
index d509b5c..a8dade1 100644
--- a/src/tint/resolver/resolver.cc
+++ b/src/tint/resolver/resolver.cc
@@ -128,8 +128,7 @@
// Pre-allocate the marked bitset with the total number of AST nodes.
marked_.Resize(builder_->ASTNodes().Count());
- if (!DependencyGraph::Build(builder_->AST(), builder_->Symbols(), diagnostics_,
- dependencies_)) {
+ if (!DependencyGraph::Build(builder_->AST(), diagnostics_, dependencies_)) {
return false;
}
@@ -266,8 +265,7 @@
if (!ApplyAddressSpaceUsageToType(builtin::AddressSpace::kUndefined,
const_cast<type::Type*>(ty), v->source)) {
- AddNote("while instantiating 'let' " + builder_->Symbols().NameFor(v->name->symbol),
- v->source);
+ AddNote("while instantiating 'let' " + v->name->symbol.Name(), v->source);
return nullptr;
}
@@ -329,8 +327,7 @@
if (!ApplyAddressSpaceUsageToType(builtin::AddressSpace::kUndefined,
const_cast<type::Type*>(ty), v->source)) {
- AddNote("while instantiating 'override' " + builder_->Symbols().NameFor(v->name->symbol),
- v->source);
+ AddNote("while instantiating 'override' " + v->name->symbol.Name(), v->source);
return nullptr;
}
@@ -423,8 +420,7 @@
if (!ApplyAddressSpaceUsageToType(builtin::AddressSpace::kUndefined,
const_cast<type::Type*>(ty), c->source)) {
- AddNote("while instantiating 'const' " + builder_->Symbols().NameFor(c->name->symbol),
- c->source);
+ AddNote("while instantiating 'const' " + c->name->symbol.Name(), c->source);
return nullptr;
}
@@ -524,8 +520,7 @@
if (!ApplyAddressSpaceUsageToType(address_space, var_ty,
var->type ? var->type->source : var->source)) {
- AddNote("while instantiating 'var' " + builder_->Symbols().NameFor(var->name->symbol),
- var->source);
+ AddNote("while instantiating 'var' " + var->name->symbol.Name(), var->source);
return nullptr;
}
@@ -611,8 +606,7 @@
Mark(param->name);
auto add_note = [&] {
- AddNote("while instantiating parameter " + builder_->Symbols().NameFor(param->name->symbol),
- param->source);
+ AddNote("while instantiating parameter " + param->name->symbol.Name(), param->source);
};
for (auto* attr : param->attributes) {
@@ -879,7 +873,7 @@
{ // Check the parameter name is unique for the function
if (auto added = parameter_names.Add(param->name->symbol, param->source); !added) {
- auto name = builder_->Symbols().NameFor(param->name->symbol);
+ auto name = param->name->symbol.Name();
AddError("redefinition of parameter '" + name + "'", param->source);
AddNote("previous definition is here", *added.value);
return nullptr;
@@ -944,8 +938,7 @@
if (auto* str = return_type->As<sem::Struct>()) {
if (!ApplyAddressSpaceUsageToType(builtin::AddressSpace::kUndefined, str, decl->source)) {
- AddNote("while instantiating return type for " +
- builder_->Symbols().NameFor(decl->name->symbol),
+ AddNote("while instantiating return type for " + decl->name->symbol.Name(),
decl->source);
return nullptr;
}
@@ -1577,7 +1570,7 @@
break;
case Alias::ModuleScope: {
auto* func = var.expr->Stmt()->Function();
- auto func_name = builder_->Symbols().NameFor(func->Declaration()->name->symbol);
+ auto func_name = func->Declaration()->name->symbol.Name();
AddNote(
"aliases with module-scope variable " + var.access + " in '" + func_name + "'",
var.expr->Declaration()->source);
@@ -2147,8 +2140,7 @@
auto resolved = dependencies_.resolved_identifiers.Get(ident);
if (!resolved) {
TINT_ICE(Resolver, diagnostics_)
- << "identifier '" << builder_->Symbols().NameFor(ident->symbol)
- << "' was not resolved";
+ << "identifier '" << ident->symbol.Name() << "' was not resolved";
return nullptr;
}
@@ -2355,27 +2347,27 @@
auto* tmpl_ident = ident->As<ast::TemplatedIdentifier>();
if (!tmpl_ident) {
if (TINT_UNLIKELY(min_args != 0)) {
- AddError("expected '<' for '" + b.Symbols().NameFor(ident->symbol) + "'",
+ AddError("expected '<' for '" + ident->symbol.Name() + "'",
Source{ident->source.range.end});
}
return nullptr;
}
if (min_args == max_args) {
if (TINT_UNLIKELY(tmpl_ident->arguments.Length() != min_args)) {
- AddError("'" + b.Symbols().NameFor(ident->symbol) + "' requires " +
- std::to_string(min_args) + " template arguments",
+ AddError("'" + ident->symbol.Name() + "' requires " + std::to_string(min_args) +
+ " template arguments",
ident->source);
return nullptr;
}
} else {
if (TINT_UNLIKELY(tmpl_ident->arguments.Length() < min_args)) {
- AddError("'" + b.Symbols().NameFor(ident->symbol) + "' requires at least " +
+ AddError("'" + ident->symbol.Name() + "' requires at least " +
std::to_string(min_args) + " template arguments",
ident->source);
return nullptr;
}
if (TINT_UNLIKELY(tmpl_ident->arguments.Length() > max_args)) {
- AddError("'" + b.Symbols().NameFor(ident->symbol) + "' requires at most " +
+ AddError("'" + ident->symbol.Name() + "' requires at most " +
std::to_string(max_args) + " template arguments",
ident->source);
return nullptr;
@@ -2752,7 +2744,7 @@
break;
}
- auto name = builder_->Symbols().NameFor(ident->symbol);
+ auto name = ident->symbol.Name();
TINT_ICE(Resolver, diagnostics_) << ident->source << " unhandled builtin type '" << name << "'";
return nullptr;
}
@@ -2940,7 +2932,7 @@
auto resolved = dependencies_.resolved_identifiers.Get(ident);
if (!resolved) {
TINT_ICE(Resolver, diagnostics_)
- << "identifier '" << builder_->Symbols().NameFor(ident->symbol) << "' was not resolved";
+ << "identifier '" << ident->symbol.Name() << "' was not resolved";
return nullptr;
}
@@ -2968,12 +2960,11 @@
if (auto decl = loop_block->Decls().Find(symbol)) {
if (decl->order >= loop_block->NumDeclsAtFirstContinue()) {
AddError("continue statement bypasses declaration of '" +
- builder_->Symbols().NameFor(symbol) + "'",
+ symbol.Name() + "'",
loop_block->FirstContinue()->source);
- AddNote("identifier '" + builder_->Symbols().NameFor(symbol) +
- "' declared here",
+ AddNote("identifier '" + symbol.Name() + "' declared here",
decl->variable->Declaration()->source);
- AddNote("identifier '" + builder_->Symbols().NameFor(symbol) +
+ AddNote("identifier '" + symbol.Name() +
"' referenced in continuing block here",
expr->source);
return nullptr;
@@ -3011,7 +3002,7 @@
// Note: The spec is currently vague around the rules here. See
// https://github.com/gpuweb/gpuweb/issues/3081. Remove this comment when
// resolved.
- std::string desc = "var '" + builder_->Symbols().NameFor(symbol) + "' ";
+ std::string desc = "var '" + symbol.Name() + "' ";
AddError(desc + "cannot be referenced at module-scope", expr->source);
AddNote(desc + "declared here", variable->Declaration()->source);
return nullptr;
@@ -3116,7 +3107,7 @@
}
TINT_UNREACHABLE(Resolver, diagnostics_)
- << "unhandled resolved identifier: " << resolved->String(builder_->Symbols(), diagnostics_);
+ << "unhandled resolved identifier: " << resolved->String(diagnostics_);
return nullptr;
}
@@ -3151,8 +3142,7 @@
}
if (member == nullptr) {
- AddError("struct member " + builder_->Symbols().NameFor(symbol) + " not found",
- expr->source);
+ AddError("struct member " + symbol.Name() + " not found", expr->source);
return nullptr;
}
@@ -3173,7 +3163,7 @@
},
[&](const type::Vector* vec) -> sem::ValueExpression* {
- std::string s = builder_->Symbols().NameFor(expr->member->symbol);
+ std::string s = expr->member->symbol.Name();
auto size = s.size();
utils::Vector<uint32_t, 4> swizzle;
swizzle.Reserve(s.size());
@@ -3474,7 +3464,7 @@
bool Resolver::DiagnosticControl(const ast::DiagnosticControl& control) {
Mark(control.rule_name);
- auto rule_name = builder_->Symbols().NameFor(control.rule_name->symbol);
+ auto rule_name = control.rule_name->symbol.Name();
auto rule = builtin::ParseDiagnosticRule(rule_name);
if (rule != builtin::DiagnosticRule::kUndefined) {
validator_.DiagnosticFilters().Set(rule, control.severity);
@@ -3646,7 +3636,7 @@
sem::Struct* Resolver::Structure(const ast::Struct* str) {
auto struct_name = [&] { //
- return builder_->Symbols().NameFor(str->name->symbol);
+ return str->name->symbol.Name();
};
if (validator_.IsValidationEnabled(str->attributes,
@@ -3687,8 +3677,7 @@
Mark(member);
Mark(member->name);
if (auto added = member_map.Add(member->name->symbol, member); !added) {
- AddError("redefinition of '" + builder_->Symbols().NameFor(member->name->symbol) + "'",
- member->source);
+ AddError("redefinition of '" + member->name->symbol.Name() + "'", member->source);
AddNote("previous definition is here", (*added.value)->source);
return nullptr;
}
@@ -4230,7 +4219,7 @@
address_space, const_cast<type::Type*>(member->Type()), decl->type->source)) {
utils::StringStream err;
err << "while analyzing structure member " << sem_.TypeNameOf(str) << "."
- << builder_->Symbols().NameFor(member->Name());
+ << member->Name().Name();
AddNote(err.str(), member->Source());
return false;
}
@@ -4369,9 +4358,9 @@
bool Resolver::CheckNotTemplated(const char* use, const ast::Identifier* ident) {
if (TINT_UNLIKELY(ident->Is<ast::TemplatedIdentifier>())) {
- AddError(std::string(use) + " '" + builder_->Symbols().NameFor(ident->symbol) +
- "' does not take template arguments",
- ident->source);
+ AddError(
+ std::string(use) + " '" + ident->symbol.Name() + "' does not take template arguments",
+ ident->source);
if (auto resolved = dependencies_.resolved_identifiers.Get(ident)) {
if (auto* ast_node = resolved->Node()) {
sem_.NoteDeclarationSource(ast_node);
@@ -4385,9 +4374,7 @@
void Resolver::ErrorMismatchedResolvedIdentifier(const Source& source,
const ResolvedIdentifier& resolved,
std::string_view wanted) {
- AddError("cannot use " + resolved.String(builder_->Symbols(), diagnostics_) + " as " +
- std::string(wanted),
- source);
+ AddError("cannot use " + resolved.String(diagnostics_) + " as " + std::string(wanted), source);
sem_.NoteDeclarationSource(resolved.Node());
}
diff --git a/src/tint/resolver/resolver_test_helper.h b/src/tint/resolver/resolver_test_helper.h
index 0e1b7d5..1afa838 100644
--- a/src/tint/resolver/resolver_test_helper.h
+++ b/src/tint/resolver/resolver_test_helper.h
@@ -112,12 +112,12 @@
/// @param type a type
/// @returns the name for `type` that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(ast::Type type) { return Symbols().NameFor(type->identifier->symbol); }
+ std::string FriendlyName(ast::Type type) { return type->identifier->symbol.Name(); }
/// @param type a type
/// @returns the name for `type` that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const type::Type* type) { return type->FriendlyName(Symbols()); }
+ std::string FriendlyName(const type::Type* type) { return type->FriendlyName(); }
private:
std::unique_ptr<Resolver> resolver_;
diff --git a/src/tint/resolver/sem_helper.cc b/src/tint/resolver/sem_helper.cc
index 36cc4c7..2357ce1 100644
--- a/src/tint/resolver/sem_helper.cc
+++ b/src/tint/resolver/sem_helper.cc
@@ -32,7 +32,7 @@
}
std::string SemHelper::RawTypeNameOf(const type::Type* ty) const {
- return ty->FriendlyName(builder_->Symbols());
+ return ty->FriendlyName();
}
type::Type* SemHelper::TypeOf(const ast::Expression* expr) const {
@@ -45,7 +45,7 @@
expr, //
[&](const sem::VariableUser* var_expr) {
auto* variable = var_expr->Variable()->Declaration();
- auto name = builder_->Symbols().NameFor(variable->name->symbol);
+ auto name = variable->name->symbol.Name();
auto* kind = Switch(
variable, //
[&](const ast::Var*) { return "var"; }, //
@@ -57,16 +57,16 @@
return std::string(kind) + " '" + name + "'";
},
[&](const sem::ValueExpression* val_expr) {
- auto type = val_expr->Type()->FriendlyName(builder_->Symbols());
+ auto type = val_expr->Type()->FriendlyName();
return "value expression of type '" + type + "'";
},
[&](const sem::TypeExpression* ty_expr) {
- auto name = ty_expr->Type()->FriendlyName(builder_->Symbols());
+ auto name = ty_expr->Type()->FriendlyName();
return "type '" + name + "'";
},
[&](const sem::FunctionExpression* fn_expr) {
auto* fn = fn_expr->Function()->Declaration();
- auto name = builder_->Symbols().NameFor(fn->name->symbol);
+ auto name = fn->name->symbol.Name();
return "function '" + name + "'";
},
[&](const sem::BuiltinEnumExpression<builtin::Access>* access) {
@@ -128,37 +128,28 @@
Switch(
node,
[&](const ast::Struct* n) {
- AddNote("struct '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("struct '" + n->name->symbol.Name() + "' declared here", n->source);
},
[&](const ast::Alias* n) {
- AddNote("alias '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("alias '" + n->name->symbol.Name() + "' declared here", n->source);
},
[&](const ast::Var* n) {
- AddNote("var '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("var '" + n->name->symbol.Name() + "' declared here", n->source);
},
[&](const ast::Let* n) {
- AddNote("let '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("let '" + n->name->symbol.Name() + "' declared here", n->source);
},
[&](const ast::Override* n) {
- AddNote("override '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("override '" + n->name->symbol.Name() + "' declared here", n->source);
},
[&](const ast::Const* n) {
- AddNote("const '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("const '" + n->name->symbol.Name() + "' declared here", n->source);
},
[&](const ast::Parameter* n) {
- AddNote(
- "parameter '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("parameter '" + n->name->symbol.Name() + "' declared here", n->source);
},
[&](const ast::Function* n) {
- AddNote("function '" + builder_->Symbols().NameFor(n->name->symbol) + "' declared here",
- n->source);
+ AddNote("function '" + n->name->symbol.Name() + "' declared here", n->source);
});
}
diff --git a/src/tint/resolver/uniformity.cc b/src/tint/resolver/uniformity.cc
index 7a4d25e..fc84826 100644
--- a/src/tint/resolver/uniformity.cc
+++ b/src/tint/resolver/uniformity.cc
@@ -178,7 +178,7 @@
/// @param func the AST function
/// @param builder the program builder
FunctionInfo(const ast::Function* func, const ProgramBuilder* builder) {
- name = builder->Symbols().NameFor(func->name->symbol);
+ name = func->name->symbol.Name();
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
function_tag = NoRestriction;
@@ -196,7 +196,7 @@
parameters.Resize(func->params.Length());
for (size_t i = 0; i < func->params.Length(); i++) {
auto* param = func->params[i];
- auto param_name = builder->Symbols().NameFor(param->name->symbol);
+ auto param_name = param->name->symbol.Name();
auto* sem = builder->Sem().Get<sem::Parameter>(param);
parameters[i].sem = sem;
@@ -397,14 +397,12 @@
/// @param expr the expression to get the symbol name of
/// @returns the symbol name
inline std::string NameFor(const ast::IdentifierExpression* expr) {
- return builder_->Symbols().NameFor(expr->identifier->symbol);
+ return expr->identifier->symbol.Name();
}
/// @param var the variable to get the name of
/// @returns the name of the variable @p var
- inline std::string NameFor(const ast::Variable* var) {
- return builder_->Symbols().NameFor(var->name->symbol);
- }
+ inline std::string NameFor(const ast::Variable* var) { return var->name->symbol.Name(); }
/// @param var the variable to get the name of
/// @returns the name of the variable @p var
@@ -413,7 +411,7 @@
/// @param fn the function to get the name of
/// @returns the name of the function @p fn
inline std::string NameFor(const sem::Function* fn) {
- return builder_->Symbols().NameFor(fn->Declaration()->name->symbol);
+ return fn->Declaration()->name->symbol.Name();
}
/// Process a function.
diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc
index b005779d..65d7310 100644
--- a/src/tint/resolver/validator.cc
+++ b/src/tint/resolver/validator.cc
@@ -413,9 +413,7 @@
return required_align;
};
- auto member_name_of = [this](const sem::StructMember* sm) {
- return symbols_.NameFor(sm->Name());
- };
+ auto member_name_of = [](const sem::StructMember* sm) { return sm->Name().Name(); };
// Only validate the [type + address space] once
if (!valid_type_storage_layouts_.Add(TypeAndAddressSpace{store_ty, address_space})) {
@@ -427,7 +425,7 @@
}
auto note_usage = [&] {
- AddNote("'" + store_ty->FriendlyName(symbols_) + "' used in address space '" +
+ AddNote("'" + store_ty->FriendlyName() + "' used in address space '" +
utils::ToString(address_space) + "' here",
source);
};
@@ -447,7 +445,7 @@
// Recurse into the member type.
if (!AddressSpaceLayout(m->Type(), address_space, m->Declaration()->type->source)) {
- AddNote("see layout of struct:\n" + str->Layout(symbols_), str->Source());
+ AddNote("see layout of struct:\n" + str->Layout(), str->Source());
note_usage();
return false;
}
@@ -457,18 +455,18 @@
!enabled_extensions_.Contains(
builtin::Extension::kChromiumInternalRelaxedUniformLayout)) {
AddError("the offset of a struct member of type '" +
- m->Type()->UnwrapRef()->FriendlyName(symbols_) +
- "' in address space '" + utils::ToString(address_space) +
- "' must be a multiple of " + std::to_string(required_align) +
- " bytes, but '" + member_name_of(m) + "' is currently at offset " +
- std::to_string(m->Offset()) + ". Consider setting @align(" +
- std::to_string(required_align) + ") on this member",
+ m->Type()->UnwrapRef()->FriendlyName() + "' in address space '" +
+ utils::ToString(address_space) + "' must be a multiple of " +
+ std::to_string(required_align) + " bytes, but '" + member_name_of(m) +
+ "' is currently at offset " + std::to_string(m->Offset()) +
+ ". Consider setting @align(" + std::to_string(required_align) +
+ ") on this member",
m->Source());
- AddNote("see layout of struct:\n" + str->Layout(symbols_), str->Source());
+ AddNote("see layout of struct:\n" + str->Layout(), str->Source());
if (auto* member_str = m->Type()->As<sem::Struct>()) {
- AddNote("and layout of struct member:\n" + member_str->Layout(symbols_),
+ AddNote("and layout of struct member:\n" + member_str->Layout(),
member_str->Source());
}
@@ -493,11 +491,10 @@
"'. Consider setting @align(16) on this member",
m->Source());
- AddNote("see layout of struct:\n" + str->Layout(symbols_), str->Source());
+ AddNote("see layout of struct:\n" + str->Layout(), str->Source());
auto* prev_member_str = prev_member->Type()->As<sem::Struct>();
- AddNote("and layout of previous member struct:\n" +
- prev_member_str->Layout(symbols_),
+ AddNote("and layout of previous member struct:\n" + prev_member_str->Layout(),
prev_member_str->Source());
note_usage();
return false;
@@ -540,7 +537,7 @@
AddError(
"uniform storage requires that array elements are aligned to 16 bytes, but "
"array element of type '" +
- arr->ElemType()->FriendlyName(symbols_) + "' has a stride of " +
+ arr->ElemType()->FriendlyName() + "' has a stride of " +
std::to_string(arr->Stride()) + " bytes. " + hint,
source);
return false;
@@ -1070,7 +1067,7 @@
} else if (TINT_UNLIKELY(IsValidationEnabled(
decl->attributes, ast::DisabledValidation::kFunctionHasNoBody))) {
TINT_ICE(Resolver, diagnostics_)
- << "Function " << symbols_.NameFor(decl->name->symbol) << " has no body";
+ << "Function " << decl->name->symbol.Name() << " has no body";
}
for (auto* attr : decl->return_type_attributes) {
@@ -1102,7 +1099,7 @@
// a function behavior is always one of {}, or {Next}.
if (TINT_UNLIKELY(func->Behaviors() != sem::Behaviors{} &&
func->Behaviors() != sem::Behavior::kNext)) {
- auto name = symbols_.NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
TINT_ICE(Resolver, diagnostics_)
<< "function '" << name << "' behaviors are: " << func->Behaviors();
}
@@ -1284,8 +1281,7 @@
member->Declaration()->attributes, member->Type(), member->Source(),
param_or_ret,
/*is_struct_member*/ true, member->Location())) {
- AddNote("while analyzing entry point '" +
- symbols_.NameFor(decl->name->symbol) + "'",
+ AddNote("while analyzing entry point '" + decl->name->symbol.Name() + "'",
decl->source);
return false;
}
@@ -1364,7 +1360,7 @@
// Bindings must not alias within a shader stage: two different variables in the
// resource interface of a given shader must not have the same group and binding values,
// when considered as a pair of values.
- auto func_name = symbols_.NameFor(decl->name->symbol);
+ auto func_name = decl->name->symbol.Name();
AddError(
"entry point '" + func_name +
"' references multiple variables that use the same resource binding @group(" +
@@ -1505,8 +1501,7 @@
call->Target(), //
[&](const sem::Function* fn) {
AddError("ignoring return value of function '" +
- symbols_.NameFor(fn->Declaration()->name->symbol) +
- "' annotated with @must_use",
+ fn->Declaration()->name->symbol.Name() + "' annotated with @must_use",
call->Declaration()->source);
sem_.NoteDeclarationSource(fn->Declaration());
},
@@ -1741,7 +1736,7 @@
auto* decl = call->Declaration();
auto* target = call->Target()->As<sem::Function>();
auto sym = target->Declaration()->name->symbol;
- auto name = symbols_.NameFor(sym);
+ auto name = sym.Name();
if (!current_statement) { // Function call at module-scope.
AddError("functions cannot be called at module-scope", decl->source);
@@ -1928,13 +1923,12 @@
auto backtrace = [&](const sem::Function* func, const sem::Function* entry_point) {
if (func != entry_point) {
TraverseCallChain(diagnostics_, entry_point, func, [&](const sem::Function* f) {
- AddNote(
- "called by function '" + symbols_.NameFor(f->Declaration()->name->symbol) + "'",
- f->Declaration()->source);
+ AddNote("called by function '" + f->Declaration()->name->symbol.Name() + "'",
+ f->Declaration()->source);
});
- AddNote("called by entry point '" +
- symbols_.NameFor(entry_point->Declaration()->name->symbol) + "'",
- entry_point->Declaration()->source);
+ AddNote(
+ "called by entry point '" + entry_point->Declaration()->name->symbol.Name() + "'",
+ entry_point->Declaration()->source);
}
};
@@ -2040,33 +2034,33 @@
continue;
}
- AddError("entry point '" + symbols_.NameFor(ep->Declaration()->name->symbol) +
+ AddError("entry point '" + ep->Declaration()->name->symbol.Name() +
"' uses two different 'push_constant' variables.",
ep->Declaration()->source);
AddNote("first 'push_constant' variable declaration is here",
var->Declaration()->source);
if (func != ep) {
TraverseCallChain(diagnostics_, ep, func, [&](const sem::Function* f) {
- AddNote("called by function '" +
- symbols_.NameFor(f->Declaration()->name->symbol) + "'",
- f->Declaration()->source);
+ AddNote(
+ "called by function '" + f->Declaration()->name->symbol.Name() + "'",
+ f->Declaration()->source);
});
- AddNote("called by entry point '" +
- symbols_.NameFor(ep->Declaration()->name->symbol) + "'",
- ep->Declaration()->source);
+ AddNote(
+ "called by entry point '" + ep->Declaration()->name->symbol.Name() + "'",
+ ep->Declaration()->source);
}
AddNote("second 'push_constant' variable declaration is here",
push_constant_var->Declaration()->source);
if (push_constant_func != ep) {
- TraverseCallChain(
- diagnostics_, ep, push_constant_func, [&](const sem::Function* f) {
- AddNote("called by function '" +
- symbols_.NameFor(f->Declaration()->name->symbol) + "'",
- f->Declaration()->source);
- });
- AddNote("called by entry point '" +
- symbols_.NameFor(ep->Declaration()->name->symbol) + "'",
- ep->Declaration()->source);
+ TraverseCallChain(diagnostics_, ep, push_constant_func,
+ [&](const sem::Function* f) {
+ AddNote("called by function '" +
+ f->Declaration()->name->symbol.Name() + "'",
+ f->Declaration()->source);
+ });
+ AddNote(
+ "called by entry point '" + ep->Declaration()->name->symbol.Name() + "'",
+ ep->Declaration()->source);
}
return false;
}
@@ -2484,7 +2478,7 @@
[&](const ast::Override*) { return "cannot modify 'override'"; });
if (err) {
AddError(err, lhs->source);
- AddNote("'" + symbols_.NameFor(v->name->symbol) + "' is declared here:", v->source);
+ AddNote("'" + v->name->symbol.Name() + "' is declared here:", v->source);
return false;
}
}
@@ -2544,7 +2538,7 @@
}
{
utils::StringStream ss;
- ss << "severity of '" << symbols_.NameFor(dc->rule_name->symbol) << "' set to '"
+ ss << "severity of '" << dc->rule_name->symbol.Name() << "' set to '"
<< dc->severity << "' here";
AddNote(ss.str(), (*diag_added.value)->rule_name->source);
}
@@ -2589,7 +2583,7 @@
std::string Validator::VectorPretty(uint32_t size, const type::Type* element_type) const {
type::Vector vec_type(element_type, size);
- return vec_type.FriendlyName(symbols_);
+ return vec_type.FriendlyName();
}
bool Validator::CheckTypeAccessAddressSpace(
diff --git a/src/tint/sem/array_count.cc b/src/tint/sem/array_count.cc
index d0f5145..90abb69 100644
--- a/src/tint/sem/array_count.cc
+++ b/src/tint/sem/array_count.cc
@@ -33,8 +33,8 @@
return false;
}
-std::string NamedOverrideArrayCount::FriendlyName(const SymbolTable& symbols) const {
- return symbols.NameFor(variable->Declaration()->name->symbol);
+std::string NamedOverrideArrayCount::FriendlyName() const {
+ return variable->Declaration()->name->symbol.Name();
}
type::ArrayCount* NamedOverrideArrayCount::Clone(type::CloneContext&) const {
@@ -53,7 +53,7 @@
return false;
}
-std::string UnnamedOverrideArrayCount::FriendlyName(const SymbolTable&) const {
+std::string UnnamedOverrideArrayCount::FriendlyName() const {
return "[unnamed override-expression]";
}
diff --git a/src/tint/sem/array_count.h b/src/tint/sem/array_count.h
index 9147160..a4143d8 100644
--- a/src/tint/sem/array_count.h
+++ b/src/tint/sem/array_count.h
@@ -40,9 +40,8 @@
/// @returns true if this array count is equal @p other
bool Equals(const type::UniqueNode& other) const override;
- /// @param symbols the symbol table
/// @returns the friendly name for this array count
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
@@ -70,9 +69,8 @@
/// @returns true if this array count is equal @p other
bool Equals(const type::UniqueNode& other) const override;
- /// @param symbols the symbol table
/// @returns the friendly name for this array count
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/sem/struct_test.cc b/src/tint/sem/struct_test.cc
index 1686e823..424930d 100644
--- a/src/tint/sem/struct_test.cc
+++ b/src/tint/sem/struct_test.cc
@@ -52,7 +52,7 @@
auto* impl = create<ast::Struct>(Ident(name), utils::Empty, utils::Empty);
auto* s = create<sem::Struct>(impl, impl->source, impl->name->symbol, utils::Empty,
4u /* align */, 4u /* size */, 4u /* size_no_padding */);
- EXPECT_EQ(s->FriendlyName(Symbols()), "my_struct");
+ EXPECT_EQ(s->FriendlyName(), "my_struct");
}
} // namespace
diff --git a/src/tint/symbol_table.cc b/src/tint/symbol_table.cc
index c82a284..aae76ff 100644
--- a/src/tint/symbol_table.cc
+++ b/src/tint/symbol_table.cc
@@ -56,11 +56,6 @@
return it ? *it : Symbol();
}
-std::string SymbolTable::NameFor(const Symbol symbol) const {
- TINT_ASSERT_PROGRAM_IDS_EQUAL(Symbol, program_id_, symbol);
- return symbol.Name();
-}
-
Symbol SymbolTable::New(std::string prefix /* = "" */) {
if (prefix.empty()) {
prefix = "tint_symbol";
diff --git a/src/tint/symbol_table.h b/src/tint/symbol_table.h
index ea9199e..5eeaec2 100644
--- a/src/tint/symbol_table.h
+++ b/src/tint/symbol_table.h
@@ -63,11 +63,6 @@
/// @returns the symbol for the name or Symbol() if not found.
Symbol Get(const std::string& name) const;
- /// Returns the name for the given symbol
- /// @param symbol the symbol to retrieve the name for
- /// @returns the symbol name or "" if not found
- std::string NameFor(const Symbol symbol) const;
-
/// Returns a new unique symbol with the given name, possibly suffixed with a
/// unique number.
/// @param name the symbol name
diff --git a/src/tint/symbol_table_test.cc b/src/tint/symbol_table_test.cc
index 28f664d..ebdb6d8 100644
--- a/src/tint/symbol_table_test.cc
+++ b/src/tint/symbol_table_test.cc
@@ -36,19 +36,6 @@
EXPECT_EQ(Symbol(1, program_id, "name"), s.Register("name"));
}
-TEST_F(SymbolTableTest, ReturnsNameForSymbol) {
- auto program_id = ProgramID::New();
- SymbolTable s{program_id};
- auto sym = s.Register("name");
- EXPECT_EQ("name", s.NameFor(sym));
-}
-
-TEST_F(SymbolTableTest, ReturnsBlankForMissingSymbol) {
- auto program_id = ProgramID::New();
- SymbolTable s{program_id};
- EXPECT_EQ("$2", s.NameFor(Symbol(2, program_id, "$2")));
-}
-
TEST_F(SymbolTableTest, AssertsForBlankString) {
EXPECT_FATAL_FAILURE(
{
diff --git a/src/tint/transform/add_block_attribute.cc b/src/tint/transform/add_block_attribute.cc
index c486936..a629fc4 100644
--- a/src/tint/transform/add_block_attribute.cc
+++ b/src/tint/transform/add_block_attribute.cc
@@ -70,7 +70,7 @@
auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] {
auto* block = b.ASTNodes().Create<BlockAttribute>(b.ID(), b.AllocateNodeID());
- auto wrapper_name = src->Symbols().NameFor(global->name->symbol) + "_block";
+ auto wrapper_name = global->name->symbol.Name() + "_block";
auto* ret = b.create<ast::Struct>(
b.Ident(b.Symbols().New(wrapper_name)),
utils::Vector{b.Member(kMemberName, CreateASTTypeFor(ctx, ty))},
diff --git a/src/tint/transform/canonicalize_entry_point_io.cc b/src/tint/transform/canonicalize_entry_point_io.cc
index 3c9c6d0..840f8ff 100644
--- a/src/tint/transform/canonicalize_entry_point_io.cc
+++ b/src/tint/transform/canonicalize_entry_point_io.cc
@@ -351,7 +351,7 @@
}
}
- auto name = ctx.src->Symbols().NameFor(param->Declaration()->name->symbol);
+ auto name = param->Declaration()->name->symbol.Name();
auto* input_expr = AddInput(name, param->Type(), param->Location(), std::move(attributes));
inner_call_parameters.Push(input_expr);
}
@@ -376,7 +376,7 @@
continue;
}
- auto name = ctx.src->Symbols().NameFor(member->Name());
+ auto name = member->Name().Name();
auto attributes =
CloneShaderIOAttributes(member->Declaration()->attributes, do_interpolate);
@@ -405,7 +405,7 @@
continue;
}
- auto name = ctx.src->Symbols().NameFor(member->Name());
+ auto name = member->Name().Name();
auto attributes =
CloneShaderIOAttributes(member->Declaration()->attributes, do_interpolate);
@@ -530,7 +530,7 @@
} else {
name = ctx.dst->Symbols().Register(outval.name);
}
- member_names.insert(ctx.dst->Symbols().NameFor(name));
+ member_names.insert(name.Name());
wrapper_struct_output_members.Push({
ctx.dst->Member(name, outval.type, std::move(outval.attributes)),
@@ -598,7 +598,7 @@
} else {
// Add a suffix to the function name, as the wrapper function will take
// the original entry point name.
- auto ep_name = ctx.src->Symbols().NameFor(func_ast->name->symbol);
+ auto ep_name = func_ast->name->symbol.Name();
inner_name = ctx.dst->Symbols().New(ep_name + "_inner");
}
diff --git a/src/tint/transform/clamp_frag_depth.cc b/src/tint/transform/clamp_frag_depth.cc
index 77d897d..4948ec5 100644
--- a/src/tint/transform/clamp_frag_depth.cc
+++ b/src/tint/transform/clamp_frag_depth.cc
@@ -127,7 +127,7 @@
auto helper = io_structs_clamp_helpers.GetOrCreate(struct_ty, [&] {
auto return_ty = fn->return_type;
auto fn_sym =
- b.Symbols().New("clamp_frag_depth_" + sym.NameFor(struct_ty->name->symbol));
+ b.Symbols().New("clamp_frag_depth_" + struct_ty->name->symbol.Name());
utils::Vector<const ast::Expression*, 8u> initializer_args;
for (auto* member : struct_ty->members) {
diff --git a/src/tint/transform/combine_samplers.cc b/src/tint/transform/combine_samplers.cc
index ca8111c..aa1a686 100644
--- a/src/tint/transform/combine_samplers.cc
+++ b/src/tint/transform/combine_samplers.cc
@@ -183,11 +183,9 @@
for (auto pair : fn->TextureSamplerPairs()) {
const sem::Variable* texture_var = pair.first;
const sem::Variable* sampler_var = pair.second;
- std::string name =
- ctx.src->Symbols().NameFor(texture_var->Declaration()->name->symbol);
+ std::string name = texture_var->Declaration()->name->symbol.Name();
if (sampler_var) {
- name += "_" + ctx.src->Symbols().NameFor(
- sampler_var->Declaration()->name->symbol);
+ name += "_" + sampler_var->Declaration()->name->symbol.Name();
}
if (IsGlobal(pair)) {
// Both texture and sampler are global; add a new global variable
diff --git a/src/tint/transform/decompose_memory_access.cc b/src/tint/transform/decompose_memory_access.cc
index f2146f3..fb8dc62 100644
--- a/src/tint/transform/decompose_memory_access.cc
+++ b/src/tint/transform/decompose_memory_access.cc
@@ -468,7 +468,7 @@
return utils::GetOrCreate(load_funcs, LoadStoreKey{el_ty, buffer}, [&] {
utils::Vector params{b.Param("offset", b.ty.u32())};
- auto name = b.Symbols().New(ctx.dst->Symbols().NameFor(buffer) + "_load");
+ auto name = b.Symbols().New(buffer.Name() + "_load");
if (auto* intrinsic = IntrinsicLoadFor(ctx.dst, el_ty, address_space, buffer)) {
auto el_ast_ty = CreateASTTypeFor(ctx, el_ty);
@@ -551,7 +551,7 @@
b.Param("value", CreateASTTypeFor(ctx, el_ty)),
};
- auto name = b.Symbols().New(ctx.dst->Symbols().NameFor(buffer) + "_store");
+ auto name = b.Symbols().New(buffer.Name() + "_store");
if (auto* intrinsic = IntrinsicStoreFor(ctx.dst, el_ty, buffer)) {
b.Func(name, params, b.ty.void_(), nullptr,
@@ -677,7 +677,7 @@
ret_ty = CreateASTTypeFor(ctx, intrinsic->ReturnType());
}
- auto name = b.Symbols().New(ctx.dst->Symbols().NameFor(buffer) + intrinsic->str());
+ auto name = b.Symbols().New(buffer.Name() + intrinsic->str());
b.Func(name, std::move(params), ret_ty, nullptr,
utils::Vector{
atomic,
diff --git a/src/tint/transform/direct_variable_access.cc b/src/tint/transform/direct_variable_access.cc
index 00d1e67..8c06afc 100644
--- a/src/tint/transform/direct_variable_access.cc
+++ b/src/tint/transform/direct_variable_access.cc
@@ -689,7 +689,7 @@
// This is derived from the original function name and the pointer parameter
// chains.
utils::StringStream ss;
- ss << ctx.src->Symbols().NameFor(target->Declaration()->name->symbol);
+ ss << target->Declaration()->name->symbol.Name();
for (auto* param : target->Parameters()) {
if (auto indices = target_signature.Find(param)) {
ss << "_" << AccessShapeName(*indices);
@@ -1086,7 +1086,7 @@
if (IsPrivateOrFunction(shape.root.address_space)) {
ss << "F";
} else {
- ss << ctx.src->Symbols().NameFor(shape.root.variable->Declaration()->name->symbol);
+ ss << shape.root.variable->Declaration()->name->symbol.Name();
}
for (auto& op : shape.ops) {
@@ -1100,7 +1100,7 @@
auto* member = std::get_if<Symbol>(&op);
if (TINT_LIKELY(member)) {
- ss << sym.NameFor(*member);
+ ss << member->Name();
continue;
}
@@ -1160,7 +1160,7 @@
/// @returns a new Symbol starting with @p symbol concatenated with @p suffix, and possibly an
/// underscore and number, if the symbol is already taken.
Symbol UniqueSymbolWithSuffix(Symbol symbol, const std::string& suffix) {
- auto str = ctx.src->Symbols().NameFor(symbol) + suffix;
+ auto str = symbol.Name() + suffix;
return unique_symbols.GetOrCreate(str, [&] { return b.Symbols().New(str); });
}
diff --git a/src/tint/transform/packed_vec3.cc b/src/tint/transform/packed_vec3.cc
index 8a23221..9ef78a6 100644
--- a/src/tint/transform/packed_vec3.cc
+++ b/src/tint/transform/packed_vec3.cc
@@ -120,7 +120,7 @@
// type, to avoid changing the array element stride.
return b.ty(packed_vec3_wrapper_struct_names.GetOrCreate(vec, [&]() {
auto name = b.Symbols().New(
- "tint_packed_vec3_" + vec->type()->FriendlyName(src->Symbols()) +
+ "tint_packed_vec3_" + vec->type()->FriendlyName() +
(array_element ? "_array_element" : "_struct_member"));
auto* member =
b.Member(kStructMemberName, MakePackedVec3(vec),
@@ -191,9 +191,8 @@
}
}
// Create the new structure.
- auto struct_name = b.Symbols().New(
- src->Symbols().NameFor(str->Declaration()->name->symbol) +
- "_tint_packed_vec3");
+ auto struct_name = b.Symbols().New(str->Declaration()->name->symbol.Name() +
+ "_tint_packed_vec3");
b.Structure(struct_name, std::move(members));
return struct_name;
});
diff --git a/src/tint/transform/pad_structs.cc b/src/tint/transform/pad_structs.cc
index 8516aa3..90f2e59 100644
--- a/src/tint/transform/pad_structs.cc
+++ b/src/tint/transform/pad_structs.cc
@@ -71,7 +71,7 @@
bool has_runtime_sized_array = false;
utils::Vector<const ast::StructMember*, 8> new_members;
for (auto* mem : str->Members()) {
- auto name = src->Symbols().NameFor(mem->Name());
+ auto name = mem->Name().Name();
if (offset < mem->Offset()) {
CreatePadding(&new_members, &padding_members, ctx.dst, mem->Offset() - offset);
diff --git a/src/tint/transform/preserve_padding.cc b/src/tint/transform/preserve_padding.cc
index e8c95e3..6df1a1c 100644
--- a/src/tint/transform/preserve_padding.cc
+++ b/src/tint/transform/preserve_padding.cc
@@ -165,7 +165,7 @@
return call_helper([&]() {
utils::Vector<const ast::Statement*, 8> body;
for (auto member : str->Members()) {
- auto name = sym.NameFor(member->Declaration()->name->symbol);
+ auto name = member->Declaration()->name->symbol.Name();
body.Push(MakeAssignment(member->Type(),
b.MemberAccessor(b.Deref(kDestParamName), name),
b.MemberAccessor(kValueParamName, name)));
diff --git a/src/tint/transform/renamer.cc b/src/tint/transform/renamer.cc
index 708c6ec..af26109 100644
--- a/src/tint/transform/renamer.cc
+++ b/src/tint/transform/renamer.cc
@@ -1332,7 +1332,7 @@
if (target == Target::kAll) {
return true;
}
- auto name = src->Symbols().NameFor(symbol);
+ auto name = symbol.Name();
if (!text::utf8::IsASCII(name)) {
// name is non-ascii. All of the backend keywords are ascii, so rename if we're not
// preserving unicode symbols.
@@ -1388,7 +1388,7 @@
Data::Remappings out;
for (auto it : remappings) {
- out[ctx.src->Symbols().NameFor(it.key)] = ctx.dst->Symbols().NameFor(it.value);
+ out[it.key.Name()] = it.value.Name();
}
outputs.Add<Data>(std::move(out));
diff --git a/src/tint/transform/robustness.cc b/src/tint/transform/robustness.cc
index 2eb74a1..c25bcac 100644
--- a/src/tint/transform/robustness.cc
+++ b/src/tint/transform/robustness.cc
@@ -264,8 +264,7 @@
auto* sem_param = sem.Get(param);
if (auto* ptr = sem_param->Type()->As<type::Pointer>()) {
if (ActionFor(ptr->AddressSpace()) == Action::kPredicate) {
- auto name = b.Symbols().New(src->Symbols().NameFor(param->name->symbol) +
- "_predicate");
+ auto name = b.Symbols().New(param->name->symbol.Name() + "_predicate");
ctx.InsertAfter(fn->params, param, b.Param(name, b.ty.bool_()));
// Associate the pointer parameter expressions with the predicate.
diff --git a/src/tint/transform/simplify_pointers.cc b/src/tint/transform/simplify_pointers.cc
index b5af458..e8c2bf9 100644
--- a/src/tint/transform/simplify_pointers.cc
+++ b/src/tint/transform/simplify_pointers.cc
@@ -166,8 +166,7 @@
// We have a sub-expression that needs to be saved.
// Create a new variable
auto saved_name = ctx.dst->Symbols().New(
- ctx.src->Symbols().NameFor(var->Declaration()->name->symbol) +
- "_save");
+ var->Declaration()->name->symbol.Name() + "_save");
auto* decl =
ctx.dst->Decl(ctx.dst->Let(saved_name, ctx.Clone(idx_expr)));
saved.Push(decl);
diff --git a/src/tint/transform/single_entry_point.cc b/src/tint/transform/single_entry_point.cc
index 8be90bb..5e80812 100644
--- a/src/tint/transform/single_entry_point.cc
+++ b/src/tint/transform/single_entry_point.cc
@@ -50,7 +50,7 @@
if (!f->IsEntryPoint()) {
continue;
}
- if (src->Symbols().NameFor(f->name->symbol) == cfg->entry_point_name) {
+ if (f->name->symbol.Name() == cfg->entry_point_name) {
entry_point = f;
break;
}
diff --git a/src/tint/transform/spirv_atomic.cc b/src/tint/transform/spirv_atomic.cc
index f41fbb7..82b955c 100644
--- a/src/tint/transform/spirv_atomic.cc
+++ b/src/tint/transform/spirv_atomic.cc
@@ -133,7 +133,7 @@
auto* member = str->members[i];
if (forked.atomic_members.count(i)) {
auto type = AtomicTypeFor(ctx.src->Sem().Get(member)->Type());
- auto name = ctx.src->Symbols().NameFor(member->name->symbol);
+ auto name = member->name->symbol.Name();
members.Push(b.Member(name, type, ctx.Clone(member->attributes)));
} else {
members.Push(ctx.Clone(member));
@@ -157,8 +157,7 @@
ForkedStruct& Fork(const ast::Struct* str) {
auto& forked = forked_structs[str];
if (!forked.name.IsValid()) {
- forked.name =
- b.Symbols().New(ctx.src->Symbols().NameFor(str->name->symbol) + "_atomic");
+ forked.name = b.Symbols().New(str->name->symbol.Name() + "_atomic");
}
return forked;
}
@@ -220,8 +219,7 @@
},
[&](const type::Reference* ref) { return AtomicTypeFor(ref->StoreType()); },
[&](Default) {
- TINT_ICE(Transform, b.Diagnostics())
- << "unhandled type: " << ty->FriendlyName(ctx.src->Symbols());
+ TINT_ICE(Transform, b.Diagnostics()) << "unhandled type: " << ty->FriendlyName();
return ast::Type{};
});
}
diff --git a/src/tint/transform/std140.cc b/src/tint/transform/std140.cc
index bfd8c80..b22a6e0 100644
--- a/src/tint/transform/std140.cc
+++ b/src/tint/transform/std140.cc
@@ -313,8 +313,7 @@
// Member is of a type that requires forking for std140-layout
fork_std140 = true;
auto attrs = ctx.Clone(member->Declaration()->attributes);
- members.Push(
- b.Member(sym.NameFor(member->Name()), std140_ty, std::move(attrs)));
+ members.Push(b.Member(member->Name().Name(), std140_ty, std::move(attrs)));
continue; // Next member
}
@@ -335,7 +334,7 @@
}
// Create a new forked structure, and insert it just under the original
// structure.
- auto name = b.Symbols().New(sym.NameFor(str->Name()) + "_std140");
+ auto name = b.Symbols().New(str->Name().Name() + "_std140");
auto* std140 = b.create<ast::Struct>(b.Ident(name), std::move(members),
ctx.Clone(str->Declaration()->attributes));
ctx.InsertAfter(src->AST().GlobalDeclarations(), global, std140);
@@ -371,7 +370,7 @@
std::string PrefixForUniqueNames(const ast::Struct* str,
Symbol unsuffixed,
uint32_t count) const {
- auto prefix = sym.NameFor(unsuffixed);
+ auto prefix = unsuffixed.Name();
// Keep on inserting '_' between the unsuffixed name and the suffix numbers until the name
// is unique.
while (true) {
@@ -385,7 +384,7 @@
bool unique = true;
for (auto* member : str->members) {
// The member name must be unique over the entire set of `count` suffixed names.
- if (strings.Contains(sym.NameFor(member->name->symbol))) {
+ if (strings.Contains(member->name->symbol.Name())) {
unique = false;
break;
}
@@ -529,7 +528,7 @@
}
TINT_ICE(Transform, b.Diagnostics())
<< "unexpected variable found walking access chain: "
- << sym.NameFor(user->Variable()->Declaration()->name->symbol);
+ << user->Variable()->Declaration()->name->symbol.Name();
return Action::kError;
},
[&](const sem::StructMemberAccess* a) {
@@ -632,7 +631,7 @@
const std::string ConvertSuffix(const type::Type* ty) {
return Switch(
ty, //
- [&](const sem::Struct* str) { return sym.NameFor(str->Name()); },
+ [&](const sem::Struct* str) { return str->Name().Name(); },
[&](const type::Array* arr) {
auto count = arr->ConstantCount();
if (TINT_UNLIKELY(!count)) {
@@ -710,9 +709,8 @@
args.Push(b.Call(mat_ty, std::move(mat_args)));
} else {
// Convert the member
- args.Push(
- Convert(member->Type(),
- b.MemberAccessor(param, sym.NameFor(member->Name()))));
+ args.Push(Convert(member->Type(),
+ b.MemberAccessor(param, member->Name().Name())));
}
}
stmts.Push(b.Return(b.Call(CreateASTTypeFor(ctx, ty), std::move(args))));
@@ -920,8 +918,8 @@
auto mat_member_idx = std::get<u32>(chain.indices[std140_mat_idx]);
auto* mat_member = str->Members()[mat_member_idx];
if (column_idx == 0) {
- name += "_" + sym.NameFor(mat_member->Name()) + "_p" +
- std::to_string(column_param_idx);
+ name +=
+ "_" + mat_member->Name().Name() + "_p" + std::to_string(column_param_idx);
}
auto mat_columns = *std140_mat_members.Get(mat_member);
expr = b.MemberAccessor(expr, mat_columns[column_idx]->name->symbol);
@@ -1023,7 +1021,7 @@
return b.MemberAccessor(b.Deref(let), column_member->name->symbol);
});
ty = mat_member->Type();
- name += "_" + sym.NameFor(mat_member->Name());
+ name += "_" + mat_member->Name().Name();
} else {
// Non-structure-member matrix. The columns are decomposed into a new, bespoke
// std140 structure.
@@ -1079,7 +1077,7 @@
if (std::get_if<UniformVariable>(&access)) {
const auto symbol = chain.var->Declaration()->name->symbol;
const auto* expr = b.Expr(ctx.Clone(symbol));
- const auto name = src->Symbols().NameFor(symbol);
+ const auto name = symbol.Name();
ty = chain.var->Type()->UnwrapRef();
return {expr, ty, name};
}
@@ -1137,7 +1135,7 @@
ty, //
[&](const sem::Struct* str) -> ExprTypeName {
auto* member = str->Members()[idx];
- auto member_name = sym.NameFor(member->Name());
+ auto member_name = member->Name().Name();
auto* expr = b.MemberAccessor(lhs, member_name);
ty = member->Type();
return {expr, ty, member_name};
diff --git a/src/tint/transform/transform_test.cc b/src/tint/transform/transform_test.cc
index deffae3..1201e98 100644
--- a/src/tint/transform/transform_test.cc
+++ b/src/tint/transform/transform_test.cc
@@ -45,7 +45,7 @@
TEST_F(CreateASTTypeForTest, Basic) {
auto check = [&](ast::Type ty, const char* expect) {
- ast::CheckIdentifier(ast_type_builder.Symbols(), ty->identifier, expect);
+ ast::CheckIdentifier(ty->identifier, expect);
};
check(create([](ProgramBuilder& b) { return b.create<type::I32>(); }), "i32");
@@ -61,14 +61,14 @@
return b.create<type::Matrix>(column_type, 3u);
});
- ast::CheckIdentifier(ast_type_builder.Symbols(), mat, ast::Template("mat3x2", "f32"));
+ ast::CheckIdentifier(mat, ast::Template("mat3x2", "f32"));
}
TEST_F(CreateASTTypeForTest, Vector) {
auto vec =
create([](ProgramBuilder& b) { return b.create<type::Vector>(b.create<type::F32>(), 2u); });
- ast::CheckIdentifier(ast_type_builder.Symbols(), vec, ast::Template("vec2", "f32"));
+ ast::CheckIdentifier(vec, ast::Template("vec2", "f32"));
}
TEST_F(CreateASTTypeForTest, ArrayImplicitStride) {
@@ -77,7 +77,7 @@
4u, 4u, 32u, 32u);
});
- ast::CheckIdentifier(ast_type_builder.Symbols(), arr, ast::Template("array", "f32", 2_u));
+ ast::CheckIdentifier(arr, ast::Template("array", "f32", 2_u));
auto* tmpl_attr = arr->identifier->As<ast::TemplatedIdentifier>();
ASSERT_NE(tmpl_attr, nullptr);
EXPECT_TRUE(tmpl_attr->attributes.IsEmpty());
@@ -88,7 +88,7 @@
return b.create<type::Array>(b.create<type::F32>(), b.create<type::ConstantArrayCount>(2u),
4u, 4u, 64u, 32u);
});
- ast::CheckIdentifier(ast_type_builder.Symbols(), arr, ast::Template("array", "f32", 2_u));
+ ast::CheckIdentifier(arr, ast::Template("array", "f32", 2_u));
auto* tmpl_attr = arr->identifier->As<ast::TemplatedIdentifier>();
ASSERT_NE(tmpl_attr, nullptr);
ASSERT_EQ(tmpl_attr->attributes.Length(), 1u);
@@ -114,7 +114,7 @@
CloneContext ctx(&ast_type_builder, &program, false);
auto ast_ty = CreateASTTypeFor(ctx, arr_ty);
- ast::CheckIdentifier(ast_type_builder.Symbols(), ast_ty, "A");
+ ast::CheckIdentifier(ast_ty, "A");
}
TEST_F(CreateASTTypeForTest, Struct) {
@@ -124,7 +124,7 @@
4u /* align */, 4u /* size */, 4u /* size_no_padding */);
});
- ast::CheckIdentifier(ast_type_builder.Symbols(), str, "S");
+ ast::CheckIdentifier(str, "S");
}
TEST_F(CreateASTTypeForTest, PrivatePointer) {
@@ -133,7 +133,7 @@
builtin::Access::kReadWrite);
});
- ast::CheckIdentifier(ast_type_builder.Symbols(), ptr, ast::Template("ptr", "private", "i32"));
+ ast::CheckIdentifier(ptr, ast::Template("ptr", "private", "i32"));
}
TEST_F(CreateASTTypeForTest, StorageReadWritePointer) {
@@ -142,8 +142,7 @@
builtin::Access::kReadWrite);
});
- ast::CheckIdentifier(ast_type_builder.Symbols(), ptr,
- ast::Template("ptr", "storage", "i32", "read_write"));
+ ast::CheckIdentifier(ptr, ast::Template("ptr", "storage", "i32", "read_write"));
}
} // namespace
diff --git a/src/tint/transform/unshadow.cc b/src/tint/transform/unshadow.cc
index 9639cfc..1dd4234 100644
--- a/src/tint/transform/unshadow.cc
+++ b/src/tint/transform/unshadow.cc
@@ -52,7 +52,7 @@
auto rename = [&](const sem::Variable* v) -> const ast::Variable* {
auto* decl = v->Declaration();
- auto name = src->Symbols().NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
auto symbol = b.Symbols().New(name);
renamed_to.Add(v, symbol);
diff --git a/src/tint/transform/vertex_pulling.cc b/src/tint/transform/vertex_pulling.cc
index d887198..064be00 100644
--- a/src/tint/transform/vertex_pulling.cc
+++ b/src/tint/transform/vertex_pulling.cc
@@ -385,7 +385,7 @@
err << "VertexAttributeDescriptor for location "
<< std::to_string(attribute_desc.shader_location) << " has format "
<< attribute_desc.format << " but shader expects "
- << var.type->FriendlyName(src->Symbols());
+ << var.type->FriendlyName();
b.Diagnostics().add_error(diag::System::Transform, err.str());
return nullptr;
}
diff --git a/src/tint/transform/zero_init_workgroup_memory.cc b/src/tint/transform/zero_init_workgroup_memory.cc
index 9040e09..8572ef2 100644
--- a/src/tint/transform/zero_init_workgroup_memory.cc
+++ b/src/tint/transform/zero_init_workgroup_memory.cc
@@ -365,7 +365,7 @@
}
TINT_UNREACHABLE(Transform, b.Diagnostics())
- << "could not zero workgroup type: " << ty->FriendlyName(ctx.src->Symbols());
+ << "could not zero workgroup type: " << ty->FriendlyName();
return false;
}
diff --git a/src/tint/type/abstract_float.cc b/src/tint/type/abstract_float.cc
index 46cbf15..74e5d34 100644
--- a/src/tint/type/abstract_float.cc
+++ b/src/tint/type/abstract_float.cc
@@ -28,7 +28,7 @@
return other.Is<AbstractFloat>();
}
-std::string AbstractFloat::FriendlyName(const SymbolTable&) const {
+std::string AbstractFloat::FriendlyName() const {
return "abstract-float";
}
diff --git a/src/tint/type/abstract_float.h b/src/tint/type/abstract_float.h
index 8ec0882..2c6ac09 100644
--- a/src/tint/type/abstract_float.h
+++ b/src/tint/type/abstract_float.h
@@ -35,9 +35,8 @@
/// @returns true if this type is equal to the given type
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type when printed in diagnostics.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/abstract_int.cc b/src/tint/type/abstract_int.cc
index 4b40937..7fc883d 100644
--- a/src/tint/type/abstract_int.cc
+++ b/src/tint/type/abstract_int.cc
@@ -29,7 +29,7 @@
return other.Is<AbstractInt>();
}
-std::string AbstractInt::FriendlyName(const SymbolTable&) const {
+std::string AbstractInt::FriendlyName() const {
return "abstract-int";
}
diff --git a/src/tint/type/abstract_int.h b/src/tint/type/abstract_int.h
index 7c96c8f..f1f67d8 100644
--- a/src/tint/type/abstract_int.h
+++ b/src/tint/type/abstract_int.h
@@ -35,9 +35,8 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type when printed in diagnostics.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/array.cc b/src/tint/type/array.cc
index 96c745c..71ec6b3 100644
--- a/src/tint/type/array.cc
+++ b/src/tint/type/array.cc
@@ -81,14 +81,14 @@
return false;
}
-std::string Array::FriendlyName(const SymbolTable& symbols) const {
+std::string Array::FriendlyName() const {
utils::StringStream out;
if (!IsStrideImplicit()) {
out << "@stride(" << stride_ << ") ";
}
- out << "array<" << element_->FriendlyName(symbols);
+ out << "array<" << element_->FriendlyName();
- auto count_str = count_->FriendlyName(symbols);
+ auto count_str = count_->FriendlyName();
if (!count_str.empty()) {
out << ", " << count_str;
}
diff --git a/src/tint/type/array.h b/src/tint/type/array.h
index 95ed164..79b8e3c 100644
--- a/src/tint/type/array.h
+++ b/src/tint/type/array.h
@@ -93,10 +93,9 @@
/// natural stride
bool IsStrideImplicit() const { return stride_ == implicit_stride_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/array_count.cc b/src/tint/type/array_count.cc
index e50db29..8ddda4c 100644
--- a/src/tint/type/array_count.cc
+++ b/src/tint/type/array_count.cc
@@ -36,7 +36,7 @@
return false;
}
-std::string ConstantArrayCount::FriendlyName(const SymbolTable&) const {
+std::string ConstantArrayCount::FriendlyName() const {
return std::to_string(value);
}
@@ -52,7 +52,7 @@
return other.Is<RuntimeArrayCount>();
}
-std::string RuntimeArrayCount::FriendlyName(const SymbolTable&) const {
+std::string RuntimeArrayCount::FriendlyName() const {
return "";
}
diff --git a/src/tint/type/array_count.h b/src/tint/type/array_count.h
index 90fc253..94dc135 100644
--- a/src/tint/type/array_count.h
+++ b/src/tint/type/array_count.h
@@ -29,9 +29,8 @@
public:
~ArrayCount() override;
- /// @param symbols the symbol table
/// @returns the friendly name for this array count
- virtual std::string FriendlyName(const SymbolTable& symbols) const = 0;
+ virtual std::string FriendlyName() const = 0;
/// @param ctx the clone context
/// @returns a clone of this type
@@ -60,9 +59,8 @@
/// @returns true if this array count is equal to other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the symbol table
/// @returns the friendly name for this array count
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
@@ -87,9 +85,8 @@
/// @returns true if this array count is equal to other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the symbol table
/// @returns the friendly name for this array count
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/array_test.cc b/src/tint/type/array_test.cc
index 8f80a63..545fd74 100644
--- a/src/tint/type/array_test.cc
+++ b/src/tint/type/array_test.cc
@@ -98,22 +98,22 @@
TEST_F(ArrayTest, FriendlyNameRuntimeSized) {
auto* arr = create<Array>(create<I32>(), create<RuntimeArrayCount>(), 0u, 4u, 4u, 4u);
- EXPECT_EQ(arr->FriendlyName(Symbols()), "array<i32>");
+ EXPECT_EQ(arr->FriendlyName(), "array<i32>");
}
TEST_F(ArrayTest, FriendlyNameStaticSized) {
auto* arr = create<Array>(create<I32>(), create<ConstantArrayCount>(5u), 4u, 20u, 4u, 4u);
- EXPECT_EQ(arr->FriendlyName(Symbols()), "array<i32, 5>");
+ EXPECT_EQ(arr->FriendlyName(), "array<i32, 5>");
}
TEST_F(ArrayTest, FriendlyNameRuntimeSizedNonImplicitStride) {
auto* arr = create<Array>(create<I32>(), create<RuntimeArrayCount>(), 0u, 4u, 8u, 4u);
- EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array<i32>");
+ EXPECT_EQ(arr->FriendlyName(), "@stride(8) array<i32>");
}
TEST_F(ArrayTest, FriendlyNameStaticSizedNonImplicitStride) {
auto* arr = create<Array>(create<I32>(), create<ConstantArrayCount>(5u), 4u, 20u, 8u, 4u);
- EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array<i32, 5>");
+ EXPECT_EQ(arr->FriendlyName(), "@stride(8) array<i32, 5>");
}
TEST_F(ArrayTest, IsConstructable) {
diff --git a/src/tint/type/atomic.cc b/src/tint/type/atomic.cc
index 39e2aae..a1d5da1 100644
--- a/src/tint/type/atomic.cc
+++ b/src/tint/type/atomic.cc
@@ -42,9 +42,9 @@
return false;
}
-std::string Atomic::FriendlyName(const SymbolTable& symbols) const {
+std::string Atomic::FriendlyName() const {
utils::StringStream out;
- out << "atomic<" << subtype_->FriendlyName(symbols) << ">";
+ out << "atomic<" << subtype_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/type/atomic.h b/src/tint/type/atomic.h
index 9b3d4fc..4f304f0 100644
--- a/src/tint/type/atomic.h
+++ b/src/tint/type/atomic.h
@@ -38,10 +38,9 @@
/// @returns the atomic type
const type::Type* Type() const { return subtype_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the size in bytes of the type.
uint32_t Size() const override;
diff --git a/src/tint/type/atomic_test.cc b/src/tint/type/atomic_test.cc
index e7126cb..261d4ae 100644
--- a/src/tint/type/atomic_test.cc
+++ b/src/tint/type/atomic_test.cc
@@ -47,7 +47,7 @@
TEST_F(AtomicTest, FriendlyName) {
auto* a = create<Atomic>(create<I32>());
- EXPECT_EQ(a->FriendlyName(Symbols()), "atomic<i32>");
+ EXPECT_EQ(a->FriendlyName(), "atomic<i32>");
}
TEST_F(AtomicTest, Clone) {
diff --git a/src/tint/type/bool.cc b/src/tint/type/bool.cc
index 31fcb27..6c972c3 100644
--- a/src/tint/type/bool.cc
+++ b/src/tint/type/bool.cc
@@ -34,7 +34,7 @@
return other.Is<Bool>();
}
-std::string Bool::FriendlyName(const SymbolTable&) const {
+std::string Bool::FriendlyName() const {
return "bool";
}
diff --git a/src/tint/type/bool.h b/src/tint/type/bool.h
index d73341c..6173bbb 100644
--- a/src/tint/type/bool.h
+++ b/src/tint/type/bool.h
@@ -40,10 +40,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the size in bytes of the type.
/// @note: booleans are not host-sharable, but still may exist in workgroup
diff --git a/src/tint/type/bool_test.cc b/src/tint/type/bool_test.cc
index b061927..347ccd6 100644
--- a/src/tint/type/bool_test.cc
+++ b/src/tint/type/bool_test.cc
@@ -41,7 +41,7 @@
TEST_F(BoolTest, FriendlyName) {
Bool b;
- EXPECT_EQ(b.FriendlyName(Symbols()), "bool");
+ EXPECT_EQ(b.FriendlyName(), "bool");
}
TEST_F(BoolTest, Clone) {
diff --git a/src/tint/type/depth_multisampled_texture.cc b/src/tint/type/depth_multisampled_texture.cc
index fc3b753..765fec3 100644
--- a/src/tint/type/depth_multisampled_texture.cc
+++ b/src/tint/type/depth_multisampled_texture.cc
@@ -46,7 +46,7 @@
return false;
}
-std::string DepthMultisampledTexture::FriendlyName(const SymbolTable&) const {
+std::string DepthMultisampledTexture::FriendlyName() const {
utils::StringStream out;
out << "texture_depth_multisampled_" << dim();
return out.str();
diff --git a/src/tint/type/depth_multisampled_texture.h b/src/tint/type/depth_multisampled_texture.h
index 31efaeb..4a6d3c2 100644
--- a/src/tint/type/depth_multisampled_texture.h
+++ b/src/tint/type/depth_multisampled_texture.h
@@ -36,10 +36,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/depth_multisampled_texture_test.cc b/src/tint/type/depth_multisampled_texture_test.cc
index c0830c6..8f718f5 100644
--- a/src/tint/type/depth_multisampled_texture_test.cc
+++ b/src/tint/type/depth_multisampled_texture_test.cc
@@ -55,7 +55,7 @@
TEST_F(DepthMultisampledTextureTest, FriendlyName) {
DepthMultisampledTexture d(TextureDimension::k2d);
- EXPECT_EQ(d.FriendlyName(Symbols()), "texture_depth_multisampled_2d");
+ EXPECT_EQ(d.FriendlyName(), "texture_depth_multisampled_2d");
}
TEST_F(DepthMultisampledTextureTest, Clone) {
diff --git a/src/tint/type/depth_texture.cc b/src/tint/type/depth_texture.cc
index 90a6127..1d6eab5 100644
--- a/src/tint/type/depth_texture.cc
+++ b/src/tint/type/depth_texture.cc
@@ -47,7 +47,7 @@
return false;
}
-std::string DepthTexture::FriendlyName(const SymbolTable&) const {
+std::string DepthTexture::FriendlyName() const {
utils::StringStream out;
out << "texture_depth_" << dim();
return out.str();
diff --git a/src/tint/type/depth_texture.h b/src/tint/type/depth_texture.h
index 70a0b73..079b5fb 100644
--- a/src/tint/type/depth_texture.h
+++ b/src/tint/type/depth_texture.h
@@ -36,10 +36,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/depth_texture_test.cc b/src/tint/type/depth_texture_test.cc
index 4ff970a..14ec2e4 100644
--- a/src/tint/type/depth_texture_test.cc
+++ b/src/tint/type/depth_texture_test.cc
@@ -67,7 +67,7 @@
TEST_F(DepthTextureTest, FriendlyName) {
DepthTexture d(TextureDimension::kCube);
- EXPECT_EQ(d.FriendlyName(Symbols()), "texture_depth_cube");
+ EXPECT_EQ(d.FriendlyName(), "texture_depth_cube");
}
TEST_F(DepthTextureTest, Clone) {
diff --git a/src/tint/type/external_texture.cc b/src/tint/type/external_texture.cc
index 986c2b4..85469a7 100644
--- a/src/tint/type/external_texture.cc
+++ b/src/tint/type/external_texture.cc
@@ -31,7 +31,7 @@
return other.Is<ExternalTexture>();
}
-std::string ExternalTexture::FriendlyName(const SymbolTable&) const {
+std::string ExternalTexture::FriendlyName() const {
return "texture_external";
}
diff --git a/src/tint/type/external_texture.h b/src/tint/type/external_texture.h
index 947eb88..be46048 100644
--- a/src/tint/type/external_texture.h
+++ b/src/tint/type/external_texture.h
@@ -34,10 +34,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/external_texture_test.cc b/src/tint/type/external_texture_test.cc
index 0752590..5610ae5 100644
--- a/src/tint/type/external_texture_test.cc
+++ b/src/tint/type/external_texture_test.cc
@@ -64,7 +64,7 @@
TEST_F(ExternalTextureTest, FriendlyName) {
ExternalTexture s;
- EXPECT_EQ(s.FriendlyName(Symbols()), "texture_external");
+ EXPECT_EQ(s.FriendlyName(), "texture_external");
}
TEST_F(ExternalTextureTest, Clone) {
diff --git a/src/tint/type/f16.cc b/src/tint/type/f16.cc
index 45b88dd..842d147 100644
--- a/src/tint/type/f16.cc
+++ b/src/tint/type/f16.cc
@@ -34,7 +34,7 @@
return other.Is<F16>();
}
-std::string F16::FriendlyName(const SymbolTable&) const {
+std::string F16::FriendlyName() const {
return "f16";
}
diff --git a/src/tint/type/f16.h b/src/tint/type/f16.h
index c35d878..21100ff 100644
--- a/src/tint/type/f16.h
+++ b/src/tint/type/f16.h
@@ -34,10 +34,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the size in bytes of the type.
uint32_t Size() const override;
diff --git a/src/tint/type/f16_test.cc b/src/tint/type/f16_test.cc
index a9a2fe0..a477f70 100644
--- a/src/tint/type/f16_test.cc
+++ b/src/tint/type/f16_test.cc
@@ -41,7 +41,7 @@
TEST_F(F16Test, FriendlyName) {
F16 f;
- EXPECT_EQ(f.FriendlyName(Symbols()), "f16");
+ EXPECT_EQ(f.FriendlyName(), "f16");
}
TEST_F(F16Test, Clone) {
diff --git a/src/tint/type/f32.cc b/src/tint/type/f32.cc
index 8af826c..b7c5135 100644
--- a/src/tint/type/f32.cc
+++ b/src/tint/type/f32.cc
@@ -34,7 +34,7 @@
return other.Is<F32>();
}
-std::string F32::FriendlyName(const SymbolTable&) const {
+std::string F32::FriendlyName() const {
return "f32";
}
diff --git a/src/tint/type/f32.h b/src/tint/type/f32.h
index 12b298f..397911d 100644
--- a/src/tint/type/f32.h
+++ b/src/tint/type/f32.h
@@ -34,10 +34,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the size in bytes of the type.
uint32_t Size() const override;
diff --git a/src/tint/type/f32_test.cc b/src/tint/type/f32_test.cc
index 43d7823..ae9e6d4 100644
--- a/src/tint/type/f32_test.cc
+++ b/src/tint/type/f32_test.cc
@@ -41,7 +41,7 @@
TEST_F(F32Test, FriendlyName) {
F32 f;
- EXPECT_EQ(f.FriendlyName(Symbols()), "f32");
+ EXPECT_EQ(f.FriendlyName(), "f32");
}
TEST_F(F32Test, Clone) {
diff --git a/src/tint/type/i32.cc b/src/tint/type/i32.cc
index 9ca1c69..045706d 100644
--- a/src/tint/type/i32.cc
+++ b/src/tint/type/i32.cc
@@ -34,7 +34,7 @@
return other.Is<I32>();
}
-std::string I32::FriendlyName(const SymbolTable&) const {
+std::string I32::FriendlyName() const {
return "i32";
}
diff --git a/src/tint/type/i32.h b/src/tint/type/i32.h
index bdbf559..ddf59b4 100644
--- a/src/tint/type/i32.h
+++ b/src/tint/type/i32.h
@@ -34,10 +34,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the size in bytes of the type.
uint32_t Size() const override;
diff --git a/src/tint/type/i32_test.cc b/src/tint/type/i32_test.cc
index 97c90b1..6535667 100644
--- a/src/tint/type/i32_test.cc
+++ b/src/tint/type/i32_test.cc
@@ -41,7 +41,7 @@
TEST_F(I32Test, FriendlyName) {
I32 i;
- EXPECT_EQ(i.FriendlyName(Symbols()), "i32");
+ EXPECT_EQ(i.FriendlyName(), "i32");
}
TEST_F(I32Test, Clone) {
diff --git a/src/tint/type/matrix.cc b/src/tint/type/matrix.cc
index 195a9e9..59dfaa9 100644
--- a/src/tint/type/matrix.cc
+++ b/src/tint/type/matrix.cc
@@ -51,9 +51,9 @@
return false;
}
-std::string Matrix::FriendlyName(const SymbolTable& symbols) const {
+std::string Matrix::FriendlyName() const {
utils::StringStream out;
- out << "mat" << columns_ << "x" << rows_ << "<" << subtype_->FriendlyName(symbols) << ">";
+ out << "mat" << columns_ << "x" << rows_ << "<" << subtype_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/type/matrix.h b/src/tint/type/matrix.h
index 72bb2e5..c6707a2 100644
--- a/src/tint/type/matrix.h
+++ b/src/tint/type/matrix.h
@@ -51,10 +51,9 @@
/// @returns the column-vector type of the matrix
const Vector* ColumnType() const { return column_type_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the size in bytes of the type. This may include tail padding.
uint32_t Size() const override;
diff --git a/src/tint/type/matrix_test.cc b/src/tint/type/matrix_test.cc
index 09b46f1..e9c81a7 100644
--- a/src/tint/type/matrix_test.cc
+++ b/src/tint/type/matrix_test.cc
@@ -62,7 +62,7 @@
I32 i32;
Vector c{&i32, 3};
Matrix m{&c, 2};
- EXPECT_EQ(m.FriendlyName(Symbols()), "mat2x3<i32>");
+ EXPECT_EQ(m.FriendlyName(), "mat2x3<i32>");
}
TEST_F(MatrixTest, Clone) {
diff --git a/src/tint/type/multisampled_texture.cc b/src/tint/type/multisampled_texture.cc
index 0b2dfd0..b63c681 100644
--- a/src/tint/type/multisampled_texture.cc
+++ b/src/tint/type/multisampled_texture.cc
@@ -40,9 +40,9 @@
return false;
}
-std::string MultisampledTexture::FriendlyName(const SymbolTable& symbols) const {
+std::string MultisampledTexture::FriendlyName() const {
utils::StringStream out;
- out << "texture_multisampled_" << dim() << "<" << type_->FriendlyName(symbols) << ">";
+ out << "texture_multisampled_" << dim() << "<" << type_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/type/multisampled_texture.h b/src/tint/type/multisampled_texture.h
index c5e66d7..d6c2e50 100644
--- a/src/tint/type/multisampled_texture.h
+++ b/src/tint/type/multisampled_texture.h
@@ -40,10 +40,9 @@
/// @returns the subtype of the sampled texture
const Type* type() const { return type_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/multisampled_texture_test.cc b/src/tint/type/multisampled_texture_test.cc
index 1a4c2b0..e02a109 100644
--- a/src/tint/type/multisampled_texture_test.cc
+++ b/src/tint/type/multisampled_texture_test.cc
@@ -79,7 +79,7 @@
TEST_F(MultisampledTextureTest, FriendlyName) {
F32 f32;
MultisampledTexture s(TextureDimension::k3d, &f32);
- EXPECT_EQ(s.FriendlyName(Symbols()), "texture_multisampled_3d<f32>");
+ EXPECT_EQ(s.FriendlyName(), "texture_multisampled_3d<f32>");
}
TEST_F(MultisampledTextureTest, Clone) {
diff --git a/src/tint/type/pointer.cc b/src/tint/type/pointer.cc
index aa77816..2922b0e 100644
--- a/src/tint/type/pointer.cc
+++ b/src/tint/type/pointer.cc
@@ -43,13 +43,13 @@
return false;
}
-std::string Pointer::FriendlyName(const SymbolTable& symbols) const {
+std::string Pointer::FriendlyName() const {
utils::StringStream out;
out << "ptr<";
if (address_space_ != builtin::AddressSpace::kUndefined) {
out << address_space_ << ", ";
}
- out << subtype_->FriendlyName(symbols) << ", " << access_;
+ out << subtype_->FriendlyName() << ", " << access_;
out << ">";
return out.str();
}
diff --git a/src/tint/type/pointer.h b/src/tint/type/pointer.h
index 6e73999..0eed27c 100644
--- a/src/tint/type/pointer.h
+++ b/src/tint/type/pointer.h
@@ -48,10 +48,9 @@
/// @returns the access control of the reference
builtin::Access Access() const { return access_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/pointer_test.cc b/src/tint/type/pointer_test.cc
index ff030cc..6399242 100644
--- a/src/tint/type/pointer_test.cc
+++ b/src/tint/type/pointer_test.cc
@@ -74,13 +74,13 @@
TEST_F(PointerTest, FriendlyName) {
auto* r =
create<Pointer>(create<I32>(), builtin::AddressSpace::kUndefined, builtin::Access::kRead);
- EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<i32, read>");
+ EXPECT_EQ(r->FriendlyName(), "ptr<i32, read>");
}
TEST_F(PointerTest, FriendlyNameWithAddressSpace) {
auto* r =
create<Pointer>(create<I32>(), builtin::AddressSpace::kWorkgroup, builtin::Access::kRead);
- EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<workgroup, i32, read>");
+ EXPECT_EQ(r->FriendlyName(), "ptr<workgroup, i32, read>");
}
TEST_F(PointerTest, Clone) {
diff --git a/src/tint/type/reference.cc b/src/tint/type/reference.cc
index 03ed224..bf2d22c 100644
--- a/src/tint/type/reference.cc
+++ b/src/tint/type/reference.cc
@@ -44,13 +44,13 @@
return false;
}
-std::string Reference::FriendlyName(const SymbolTable& symbols) const {
+std::string Reference::FriendlyName() const {
utils::StringStream out;
out << "ref<";
if (address_space_ != builtin::AddressSpace::kUndefined) {
out << address_space_ << ", ";
}
- out << subtype_->FriendlyName(symbols) << ", " << access_;
+ out << subtype_->FriendlyName() << ", " << access_;
out << ">";
return out.str();
}
diff --git a/src/tint/type/reference.h b/src/tint/type/reference.h
index 8bc5e33..794b48b 100644
--- a/src/tint/type/reference.h
+++ b/src/tint/type/reference.h
@@ -48,10 +48,9 @@
/// @returns the resolved access control of the reference.
builtin::Access Access() const { return access_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/reference_test.cc b/src/tint/type/reference_test.cc
index 634b17a..a34ffa1 100644
--- a/src/tint/type/reference_test.cc
+++ b/src/tint/type/reference_test.cc
@@ -74,13 +74,13 @@
TEST_F(ReferenceTest, FriendlyName) {
auto* r =
create<Reference>(create<I32>(), builtin::AddressSpace::kUndefined, builtin::Access::kRead);
- EXPECT_EQ(r->FriendlyName(Symbols()), "ref<i32, read>");
+ EXPECT_EQ(r->FriendlyName(), "ref<i32, read>");
}
TEST_F(ReferenceTest, FriendlyNameWithAddressSpace) {
auto* r =
create<Reference>(create<I32>(), builtin::AddressSpace::kWorkgroup, builtin::Access::kRead);
- EXPECT_EQ(r->FriendlyName(Symbols()), "ref<workgroup, i32, read>");
+ EXPECT_EQ(r->FriendlyName(), "ref<workgroup, i32, read>");
}
TEST_F(ReferenceTest, Clone) {
diff --git a/src/tint/type/sampled_texture.cc b/src/tint/type/sampled_texture.cc
index b3e6e10..8a4e440 100644
--- a/src/tint/type/sampled_texture.cc
+++ b/src/tint/type/sampled_texture.cc
@@ -39,9 +39,9 @@
return false;
}
-std::string SampledTexture::FriendlyName(const SymbolTable& symbols) const {
+std::string SampledTexture::FriendlyName() const {
utils::StringStream out;
- out << "texture_" << dim() << "<" << type_->FriendlyName(symbols) << ">";
+ out << "texture_" << dim() << "<" << type_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/type/sampled_texture.h b/src/tint/type/sampled_texture.h
index 1a83165..35208b7 100644
--- a/src/tint/type/sampled_texture.h
+++ b/src/tint/type/sampled_texture.h
@@ -40,10 +40,9 @@
/// @returns the subtype of the sampled texture
Type* type() const { return const_cast<Type*>(type_); }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/sampled_texture_test.cc b/src/tint/type/sampled_texture_test.cc
index 2363541..bfe2354 100644
--- a/src/tint/type/sampled_texture_test.cc
+++ b/src/tint/type/sampled_texture_test.cc
@@ -83,7 +83,7 @@
TEST_F(SampledTextureTest, FriendlyName) {
F32 f32;
SampledTexture s(TextureDimension::k3d, &f32);
- EXPECT_EQ(s.FriendlyName(Symbols()), "texture_3d<f32>");
+ EXPECT_EQ(s.FriendlyName(), "texture_3d<f32>");
}
TEST_F(SampledTextureTest, Clone) {
diff --git a/src/tint/type/sampler.cc b/src/tint/type/sampler.cc
index b7e0aa2..271b8be 100644
--- a/src/tint/type/sampler.cc
+++ b/src/tint/type/sampler.cc
@@ -33,7 +33,7 @@
return false;
}
-std::string Sampler::FriendlyName(const SymbolTable&) const {
+std::string Sampler::FriendlyName() const {
return kind_ == SamplerKind::kSampler ? "sampler" : "sampler_comparison";
}
diff --git a/src/tint/type/sampler.h b/src/tint/type/sampler.h
index fb2ebb4..9a3554f 100644
--- a/src/tint/type/sampler.h
+++ b/src/tint/type/sampler.h
@@ -42,10 +42,9 @@
/// @returns true if this is a comparison sampler
bool IsComparison() const { return kind_ == SamplerKind::kComparisonSampler; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/type/sampler_test.cc b/src/tint/type/sampler_test.cc
index 8323e29..fd0b1d4 100644
--- a/src/tint/type/sampler_test.cc
+++ b/src/tint/type/sampler_test.cc
@@ -55,12 +55,12 @@
TEST_F(SamplerTest, FriendlyNameSampler) {
Sampler s{SamplerKind::kSampler};
- EXPECT_EQ(s.FriendlyName(Symbols()), "sampler");
+ EXPECT_EQ(s.FriendlyName(), "sampler");
}
TEST_F(SamplerTest, FriendlyNameComparisonSampler) {
Sampler s{SamplerKind::kComparisonSampler};
- EXPECT_EQ(s.FriendlyName(Symbols()), "sampler_comparison");
+ EXPECT_EQ(s.FriendlyName(), "sampler_comparison");
}
TEST_F(SamplerTest, Clone) {
diff --git a/src/tint/type/storage_texture.cc b/src/tint/type/storage_texture.cc
index 180db4f..7aa84c1 100644
--- a/src/tint/type/storage_texture.cc
+++ b/src/tint/type/storage_texture.cc
@@ -43,7 +43,7 @@
return false;
}
-std::string StorageTexture::FriendlyName(const SymbolTable&) const {
+std::string StorageTexture::FriendlyName() const {
utils::StringStream out;
out << "texture_storage_" << dim() << "<" << texel_format_ << ", " << access_ << ">";
return out.str();
diff --git a/src/tint/type/storage_texture.h b/src/tint/type/storage_texture.h
index de1b6de..206e403 100644
--- a/src/tint/type/storage_texture.h
+++ b/src/tint/type/storage_texture.h
@@ -58,10 +58,9 @@
/// @returns the access control
builtin::Access access() const { return access_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param format the storage texture image format
/// @param type_mgr the Manager used to build the returned type
diff --git a/src/tint/type/storage_texture_test.cc b/src/tint/type/storage_texture_test.cc
index 8e0174e..1779a9f 100644
--- a/src/tint/type/storage_texture_test.cc
+++ b/src/tint/type/storage_texture_test.cc
@@ -96,7 +96,7 @@
TEST_F(StorageTextureTest, FriendlyName) {
auto* s = Create(TextureDimension::k2dArray, builtin::TexelFormat::kRgba32Float,
builtin::Access::kReadWrite);
- EXPECT_EQ(s->FriendlyName(Symbols()), "texture_storage_2d_array<rgba32float, read_write>");
+ EXPECT_EQ(s->FriendlyName(), "texture_storage_2d_array<rgba32float, read_write>");
}
TEST_F(StorageTextureTest, F32) {
diff --git a/src/tint/type/struct.cc b/src/tint/type/struct.cc
index 7649691..bffaa21 100644
--- a/src/tint/type/struct.cc
+++ b/src/tint/type/struct.cc
@@ -92,14 +92,14 @@
return size_;
}
-std::string Struct::FriendlyName(const SymbolTable& symbols) const {
- return symbols.NameFor(name_);
+std::string Struct::FriendlyName() const {
+ return name_.Name();
}
-std::string Struct::Layout(const tint::SymbolTable& symbols) const {
+std::string Struct::Layout() const {
utils::StringStream ss;
- auto member_name_of = [&](const StructMember* sm) { return symbols.NameFor(sm->Name()); };
+ auto member_name_of = [&](const StructMember* sm) { return sm->Name().Name(); };
if (Members().IsEmpty()) {
return {};
@@ -128,7 +128,7 @@
<< align << ") size(" << std::setw(size_w) << size << ") */ " << s << ";\n";
};
- print_struct_begin_line(Align(), Size(), UnwrapRef()->FriendlyName(symbols));
+ print_struct_begin_line(Align(), Size(), UnwrapRef()->FriendlyName());
for (size_t i = 0; i < Members().Length(); ++i) {
auto* const m = Members()[i];
@@ -147,7 +147,7 @@
// Output member
std::string member_name = member_name_of(m);
print_member_line(m->Offset(), m->Align(), m->Size(),
- member_name + " : " + m->Type()->UnwrapRef()->FriendlyName(symbols));
+ member_name + " : " + m->Type()->UnwrapRef()->FriendlyName());
}
// Output struct size padding, if any
@@ -163,7 +163,7 @@
}
Struct* Struct::Clone(CloneContext& ctx) const {
- auto sym = ctx.dst.st->Register(ctx.src.st->NameFor(name_));
+ auto sym = ctx.dst.st->Register(name_.Name());
utils::Vector<const StructMember*, 4> members;
for (const auto& mem : members_) {
@@ -192,7 +192,7 @@
StructMember::~StructMember() = default;
StructMember* StructMember::Clone(CloneContext& ctx) const {
- auto sym = ctx.dst.st->Register(ctx.src.st->NameFor(name_));
+ auto sym = ctx.dst.st->Register(name_.Name());
auto* ty = type_->Clone(ctx);
return ctx.dst.mgr->Get<StructMember>(source_, sym, ty, index_, offset_, align_, size_,
location_);
diff --git a/src/tint/type/struct.h b/src/tint/type/struct.h
index 0130111..035ea7c 100644
--- a/src/tint/type/struct.h
+++ b/src/tint/type/struct.h
@@ -131,15 +131,13 @@
return pipeline_stage_uses_;
}
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
- /// @param symbols the program's symbol table
/// @returns a multiline string that describes the layout of this struct,
/// including size and alignment information.
- std::string Layout(const tint::SymbolTable& symbols) const;
+ std::string Layout() const;
/// @param concrete the conversion-rank ordered concrete versions of this abstract structure.
void SetConcreteTypes(utils::VectorRef<const Struct*> concrete) { concrete_types_ = concrete; }
diff --git a/src/tint/type/struct_test.cc b/src/tint/type/struct_test.cc
index 6434a24..7bfb437 100644
--- a/src/tint/type/struct_test.cc
+++ b/src/tint/type/struct_test.cc
@@ -46,7 +46,7 @@
auto name = Sym("my_struct");
auto* s = create<Struct>(Source{}, name, utils::Empty, 4u /* align */, 4u /* size */,
4u /* size_no_padding */);
- EXPECT_EQ(s->FriendlyName(Symbols()), "my_struct");
+ EXPECT_EQ(s->FriendlyName(), "my_struct");
}
TEST_F(TypeStructTest, Layout) {
@@ -70,7 +70,7 @@
auto* sem_inner_st = p.Sem().Get(inner_st);
auto* sem_outer_st = p.Sem().Get(outer_st);
- EXPECT_EQ(sem_inner_st->Layout(p.Symbols()),
+ EXPECT_EQ(sem_inner_st->Layout(),
R"(/* align(16) size(64) */ struct Inner {
/* offset( 0) align( 4) size( 4) */ a : i32;
/* offset( 4) align( 4) size( 4) */ b : u32;
@@ -81,7 +81,7 @@
/* offset(32) align( 8) size(32) */ e : mat4x2<f32>;
/* */ };)");
- EXPECT_EQ(sem_outer_st->Layout(p.Symbols()),
+ EXPECT_EQ(sem_outer_st->Layout(),
R"(/* align(16) size(80) */ struct Outer {
/* offset( 0) align(16) size(64) */ inner : Inner;
/* offset(64) align( 4) size( 4) */ a : i32;
@@ -224,7 +224,7 @@
auto* st = s->Clone(ctx);
EXPECT_TRUE(new_st.Get("my_struct").IsValid());
- EXPECT_EQ(new_st.NameFor(st->Name()), "my_struct");
+ EXPECT_EQ(st->Name().Name(), "my_struct");
EXPECT_EQ(st->Align(), 4u);
EXPECT_EQ(st->Size(), 8u);
@@ -233,14 +233,14 @@
auto members = st->Members();
ASSERT_EQ(members.Length(), 2u);
- EXPECT_EQ(new_st.NameFor(members[0]->Name()), "b");
+ EXPECT_EQ(members[0]->Name().Name(), "b");
EXPECT_TRUE(members[0]->Type()->Is<Vector>());
EXPECT_EQ(members[0]->Index(), 0u);
EXPECT_EQ(members[0]->Offset(), 0u);
EXPECT_EQ(members[0]->Align(), 16u);
EXPECT_EQ(members[0]->Size(), 12u);
- EXPECT_EQ(new_st.NameFor(members[1]->Name()), "a");
+ EXPECT_EQ(members[1]->Name().Name(), "a");
EXPECT_TRUE(members[1]->Type()->Is<I32>());
EXPECT_EQ(members[1]->Index(), 1u);
EXPECT_EQ(members[1]->Offset(), 16u);
diff --git a/src/tint/type/type.h b/src/tint/type/type.h
index a02c9ac..083934e 100644
--- a/src/tint/type/type.h
+++ b/src/tint/type/type.h
@@ -52,10 +52,9 @@
/// Destructor
~Type() override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- virtual std::string FriendlyName(const SymbolTable& symbols) const = 0;
+ virtual std::string FriendlyName() const = 0;
/// @returns the inner most pointee type if this is a pointer, `this`
/// otherwise
diff --git a/src/tint/type/u32.cc b/src/tint/type/u32.cc
index 249a47d..f1eaf66 100644
--- a/src/tint/type/u32.cc
+++ b/src/tint/type/u32.cc
@@ -34,7 +34,7 @@
return other.Is<U32>();
}
-std::string U32::FriendlyName(const SymbolTable&) const {
+std::string U32::FriendlyName() const {
return "u32";
}
diff --git a/src/tint/type/u32.h b/src/tint/type/u32.h
index 8d79642..456436a 100644
--- a/src/tint/type/u32.h
+++ b/src/tint/type/u32.h
@@ -34,10 +34,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the size in bytes of the type.
uint32_t Size() const override;
diff --git a/src/tint/type/u32_test.cc b/src/tint/type/u32_test.cc
index 8f17e62..9c64dcb 100644
--- a/src/tint/type/u32_test.cc
+++ b/src/tint/type/u32_test.cc
@@ -41,7 +41,7 @@
TEST_F(U32Test, FriendlyName) {
U32 u;
- EXPECT_EQ(u.FriendlyName(Symbols()), "u32");
+ EXPECT_EQ(u.FriendlyName(), "u32");
}
TEST_F(U32Test, Clone) {
diff --git a/src/tint/type/vector.cc b/src/tint/type/vector.cc
index 9f1f415..3ee68e9 100644
--- a/src/tint/type/vector.cc
+++ b/src/tint/type/vector.cc
@@ -47,12 +47,12 @@
return false;
}
-std::string Vector::FriendlyName(const SymbolTable& symbols) const {
+std::string Vector::FriendlyName() const {
utils::StringStream out;
if (packed_) {
out << "__packed_";
}
- out << "vec" << width_ << "<" << subtype_->FriendlyName(symbols) << ">";
+ out << "vec" << width_ << "<" << subtype_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/type/vector.h b/src/tint/type/vector.h
index e7fd881..04e349a 100644
--- a/src/tint/type/vector.h
+++ b/src/tint/type/vector.h
@@ -40,10 +40,9 @@
/// @returns the type of the vector elements
const Type* type() const { return subtype_; }
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @returns the number of elements in the vector
uint32_t Width() const { return width_; }
diff --git a/src/tint/type/vector_test.cc b/src/tint/type/vector_test.cc
index acc62ed..7d40be4 100644
--- a/src/tint/type/vector_test.cc
+++ b/src/tint/type/vector_test.cc
@@ -71,13 +71,13 @@
TEST_F(VectorTest, FriendlyName) {
auto* f32 = create<F32>();
auto* v = create<Vector>(f32, 3u);
- EXPECT_EQ(v->FriendlyName(Symbols()), "vec3<f32>");
+ EXPECT_EQ(v->FriendlyName(), "vec3<f32>");
}
TEST_F(VectorTest, FriendlyName_Packed) {
auto* f32 = create<F32>();
auto* v = create<Vector>(f32, 3u, true);
- EXPECT_EQ(v->FriendlyName(Symbols()), "__packed_vec3<f32>");
+ EXPECT_EQ(v->FriendlyName(), "__packed_vec3<f32>");
}
TEST_F(VectorTest, Clone) {
diff --git a/src/tint/type/void.cc b/src/tint/type/void.cc
index bfe2baf..c562a52 100644
--- a/src/tint/type/void.cc
+++ b/src/tint/type/void.cc
@@ -28,7 +28,7 @@
return other.Is<Void>();
}
-std::string Void::FriendlyName(const SymbolTable&) const {
+std::string Void::FriendlyName() const {
return "void";
}
diff --git a/src/tint/type/void.h b/src/tint/type/void.h
index 02b2eee..b24ea9f 100644
--- a/src/tint/type/void.h
+++ b/src/tint/type/void.h
@@ -34,10 +34,9 @@
/// @returns true if the this type is equal to @p other
bool Equals(const UniqueNode& other) const override;
- /// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
- std::string FriendlyName(const SymbolTable& symbols) const override;
+ std::string FriendlyName() const override;
/// @param ctx the clone context
/// @returns a clone of this type
diff --git a/src/tint/writer/append_vector_test.cc b/src/tint/writer/append_vector_test.cc
index d2a77df..ff58ba3 100644
--- a/src/tint/writer/append_vector_test.cc
+++ b/src/tint/writer/append_vector_test.cc
@@ -89,7 +89,7 @@
EXPECT_EQ(vec_123->args[1], scalar_2);
auto* u32_to_i32 = vec_123->args[2]->As<ast::CallExpression>();
ASSERT_NE(u32_to_i32, nullptr);
- ast::CheckIdentifier(Symbols(), u32_to_i32->target, "i32");
+ ast::CheckIdentifier(u32_to_i32->target, "i32");
ASSERT_EQ(u32_to_i32->args.Length(), 1u);
EXPECT_EQ(u32_to_i32->args[0], scalar_3);
@@ -136,13 +136,13 @@
auto* v2u32_to_v2i32 = vec_123->args[0]->As<ast::CallExpression>();
ASSERT_NE(v2u32_to_v2i32, nullptr);
- ast::CheckIdentifier(Symbols(), v2u32_to_v2i32->target, ast::Template("vec2", "i32"));
+ ast::CheckIdentifier(v2u32_to_v2i32->target, ast::Template("vec2", "i32"));
EXPECT_EQ(v2u32_to_v2i32->args.Length(), 1u);
EXPECT_EQ(v2u32_to_v2i32->args[0], uvec_12);
auto* u32_to_i32 = vec_123->args[1]->As<ast::CallExpression>();
ASSERT_NE(u32_to_i32, nullptr);
- ast::CheckIdentifier(Symbols(), u32_to_i32->target, "i32");
+ ast::CheckIdentifier(u32_to_i32->target, "i32");
ASSERT_EQ(u32_to_i32->args.Length(), 1u);
EXPECT_EQ(u32_to_i32->args[0], scalar_3);
@@ -186,7 +186,7 @@
EXPECT_EQ(vec_123->args[1], scalar_2);
auto* f32_to_i32 = vec_123->args[2]->As<ast::CallExpression>();
ASSERT_NE(f32_to_i32, nullptr);
- ast::CheckIdentifier(Symbols(), f32_to_i32->target, "i32");
+ ast::CheckIdentifier(f32_to_i32->target, "i32");
ASSERT_EQ(f32_to_i32->args.Length(), 1u);
EXPECT_EQ(f32_to_i32->args[0], scalar_3);
@@ -392,7 +392,7 @@
EXPECT_EQ(vec_123->args[0], vec_12);
auto* f32_to_i32 = vec_123->args[1]->As<ast::CallExpression>();
ASSERT_NE(f32_to_i32, nullptr);
- ast::CheckIdentifier(Symbols(), f32_to_i32->target, "i32");
+ ast::CheckIdentifier(f32_to_i32->target, "i32");
ASSERT_EQ(f32_to_i32->args.Length(), 1u);
EXPECT_EQ(f32_to_i32->args[0], scalar_3);
diff --git a/src/tint/writer/glsl/generator.cc b/src/tint/writer/glsl/generator.cc
index 41d2cdf..32f14aa 100644
--- a/src/tint/writer/glsl/generator.cc
+++ b/src/tint/writer/glsl/generator.cc
@@ -52,7 +52,7 @@
// Collect the list of entry points in the sanitized program.
for (auto* func : sanitized_result.program.AST().Functions()) {
if (func->IsEntryPoint()) {
- auto name = sanitized_result.program.Symbols().NameFor(func->name->symbol);
+ auto name = func->name->symbol.Name();
result.entry_points.push_back({name, func->PipelineStage()});
}
}
diff --git a/src/tint/writer/glsl/generator_bench.cc b/src/tint/writer/glsl/generator_bench.cc
index 5a8e277..f591011 100644
--- a/src/tint/writer/glsl/generator_bench.cc
+++ b/src/tint/writer/glsl/generator_bench.cc
@@ -31,7 +31,7 @@
std::vector<std::string> entry_points;
for (auto& fn : program.AST().Functions()) {
if (fn->IsEntryPoint()) {
- entry_points.emplace_back(program.Symbols().NameFor(fn->name->symbol));
+ entry_points.emplace_back(fn->name->symbol.Name());
}
}
diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc
index a666eaa..4f46e66 100644
--- a/src/tint/writer/glsl/generator_impl.cc
+++ b/src/tint/writer/glsl/generator_impl.cc
@@ -375,9 +375,8 @@
auto* dst_type = TypeOf(expr)->UnwrapRef();
if (!dst_type->is_integer_scalar_or_vector() && !dst_type->is_float_scalar_or_vector()) {
- diagnostics_.add_error(
- diag::System::Writer,
- "Unable to do bitcast to type " + dst_type->FriendlyName(builder_.Symbols()));
+ diagnostics_.add_error(diag::System::Writer,
+ "Unable to do bitcast to type " + dst_type->FriendlyName());
return false;
}
@@ -751,7 +750,7 @@
const auto& args = call->Arguments();
auto* ident = fn->Declaration()->name;
- out << builder_.Symbols().NameFor(ident->symbol);
+ out << ident->symbol.Name();
ScopedParen sp(out);
bool first = true;
@@ -1880,7 +1879,7 @@
bool GeneratorImpl::EmitIdentifier(utils::StringStream& out,
const ast::IdentifierExpression* expr) {
- out << builder_.Symbols().NameFor(expr->identifier->symbol);
+ out << expr->identifier->symbol.Name();
return true;
}
@@ -1925,7 +1924,7 @@
{
auto out = line();
- auto name = builder_.Symbols().NameFor(func->name->symbol);
+ auto name = func->name->symbol.Name();
if (!EmitType(out, sem->ReturnType(), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) {
return false;
@@ -1959,7 +1958,7 @@
// correctly translate the parameter to a [RW]ByteAddressBuffer for
// storage buffers and a uint4[N] for uniform buffers.
if (!EmitTypeAndName(out, type, v->AddressSpace(), v->Access(),
- builder_.Symbols().NameFor(v->Declaration()->name->symbol))) {
+ v->Declaration()->name->symbol.Name())) {
return false;
}
}
@@ -2039,7 +2038,7 @@
out << ") uniform " << UniqueIdentifier(StructName(str) + "_ubo") << " {";
}
EmitStructMembers(current_buffer_, str);
- auto name = builder_.Symbols().NameFor(var->name->symbol);
+ auto name = var->name->symbol.Name();
line() << "} " << name << ";";
line();
@@ -2057,7 +2056,7 @@
line() << "layout(binding = " << bp.binding << ", std430) buffer "
<< UniqueIdentifier(StructName(str) + "_ssbo") << " {";
EmitStructMembers(current_buffer_, str);
- auto name = builder_.Symbols().NameFor(var->name->symbol);
+ auto name = var->name->symbol.Name();
line() << "} " << name << ";";
line();
@@ -2067,7 +2066,7 @@
bool GeneratorImpl::EmitHandleVariable(const ast::Var* var, const sem::Variable* sem) {
auto out = line();
- auto name = builder_.Symbols().NameFor(var->name->symbol);
+ auto name = var->name->symbol.Name();
auto* type = sem->Type()->UnwrapRef();
if (type->Is<type::Sampler>()) {
// GLSL ignores Sampler variables.
@@ -2146,7 +2145,7 @@
auto* decl = var->Declaration();
auto out = line();
- auto name = builder_.Symbols().NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
auto* type = var->Type()->UnwrapRef();
if (!EmitTypeAndName(out, type, var->AddressSpace(), var->Access(), name)) {
return false;
@@ -2173,7 +2172,7 @@
out << "shared ";
- auto name = builder_.Symbols().NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
auto* type = var->Type()->UnwrapRef();
if (!EmitTypeAndName(out, type, var->AddressSpace(), var->Access(), name)) {
return false;
@@ -2207,7 +2206,7 @@
EmitAttributes(out, var, decl->attributes);
EmitInterpolationQualifiers(out, decl->attributes);
- auto name = builder_.Symbols().NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
auto* type = var->Type()->UnwrapRef();
if (!EmitTypeAndName(out, type, var->AddressSpace(), var->Access(), name)) {
return false;
@@ -2315,8 +2314,7 @@
{
auto out = line();
if (!EmitTypeAndName(out, func_sem->ReturnType(), builtin::AddressSpace::kUndefined,
- builtin::Access::kUndefined,
- builder_.Symbols().NameFor(func->name->symbol))) {
+ builtin::Access::kUndefined, func->name->symbol.Name())) {
return false;
}
out << "(";
@@ -2339,7 +2337,7 @@
first = false;
if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(),
- builder_.Symbols().NameFor(var->name->symbol))) {
+ var->name->symbol.Name())) {
return false;
}
}
@@ -2598,8 +2596,8 @@
EmitZeroValue(out, arr->ElemType());
}
} else {
- diagnostics_.add_error(diag::System::Writer, "Invalid type for zero emission: " +
- type->FriendlyName(builder_.Symbols()));
+ diagnostics_.add_error(diag::System::Writer,
+ "Invalid type for zero emission: " + type->FriendlyName());
return false;
}
return true;
@@ -2804,11 +2802,11 @@
sem,
[&](const sem::Swizzle*) {
// Swizzles output the name directly
- out << builder_.Symbols().NameFor(expr->member->symbol);
+ out << expr->member->symbol.Name();
return true;
},
[&](const sem::StructMemberAccess* member_access) {
- out << program_->Symbols().NameFor(member_access->Member()->Name());
+ out << member_access->Member()->Name().Name();
return true;
},
[&](Default) {
@@ -3116,7 +3114,7 @@
bool GeneratorImpl::EmitStructMembers(TextBuffer* b, const sem::Struct* str) {
ScopedIndent si(b);
for (auto* mem : str->Members()) {
- auto name = builder_.Symbols().NameFor(mem->Name());
+ auto name = mem->Name().Name();
auto* ty = mem->Type();
@@ -3164,8 +3162,7 @@
auto* type = sem->Type()->UnwrapRef();
auto out = line();
- if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(),
- builder_.Symbols().NameFor(var->name->symbol))) {
+ if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(), var->name->symbol.Name())) {
return false;
}
@@ -3192,7 +3189,7 @@
auto out = line();
// TODO(senorblanco): handle const
if (!EmitTypeAndName(out, type, builtin::AddressSpace::kUndefined, builtin::Access::kUndefined,
- builder_.Symbols().NameFor(let->name->symbol))) {
+ let->name->symbol.Name())) {
return false;
}
@@ -3214,7 +3211,7 @@
auto out = line();
out << "const ";
if (!EmitTypeAndName(out, type, builtin::AddressSpace::kUndefined, builtin::Access::kUndefined,
- builder_.Symbols().NameFor(var->name->symbol))) {
+ var->name->symbol.Name())) {
return false;
}
out << " = ";
diff --git a/src/tint/writer/hlsl/generator.cc b/src/tint/writer/hlsl/generator.cc
index cc3bc91..17437bf 100644
--- a/src/tint/writer/hlsl/generator.cc
+++ b/src/tint/writer/hlsl/generator.cc
@@ -51,7 +51,7 @@
// Collect the list of entry points in the sanitized program.
for (auto* func : sanitized_result.program.AST().Functions()) {
if (func->IsEntryPoint()) {
- auto name = sanitized_result.program.Symbols().NameFor(func->name->symbol);
+ auto name = func->name->symbol.Name();
result.entry_points.push_back({name, func->PipelineStage()});
}
}
diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc
index 5e4ae33..b37ebdc 100644
--- a/src/tint/writer/hlsl/generator_impl.cc
+++ b/src/tint/writer/hlsl/generator_impl.cc
@@ -661,8 +661,8 @@
}
if (!type->is_integer_scalar() && !type->is_float_scalar()) {
- diagnostics_.add_error(diag::System::Writer, "Unable to do bitcast to type " +
- type->FriendlyName(builder_.Symbols()));
+ diagnostics_.add_error(diag::System::Writer,
+ "Unable to do bitcast to type " + type->FriendlyName());
return false;
}
@@ -950,7 +950,7 @@
}
}
- out << builder_.Symbols().NameFor(func->Declaration()->name->symbol) << "(";
+ out << func->Declaration()->name->symbol.Name() << "(";
bool first = true;
for (auto* arg : call->Arguments()) {
@@ -1140,7 +1140,7 @@
utils::StringStream& out,
const ast::CallExpression* expr,
const transform::DecomposeMemoryAccess::Intrinsic* intrinsic) {
- auto const buffer = program_->Symbols().NameFor(intrinsic->Buffer()->identifier->symbol);
+ auto const buffer = intrinsic->Buffer()->identifier->symbol.Name();
auto* const offset = expr->args[0];
// offset in bytes
@@ -1428,7 +1428,7 @@
utils::StringStream& out,
const ast::CallExpression* expr,
const transform::DecomposeMemoryAccess::Intrinsic* intrinsic) {
- auto const buffer = program_->Symbols().NameFor(intrinsic->Buffer()->identifier->symbol);
+ auto const buffer = intrinsic->Buffer()->identifier->symbol.Name();
auto* const offset = expr->args[0];
auto* const value = expr->args[1];
@@ -1593,10 +1593,10 @@
const sem::Function* sem_func = builder_.Sem().Get(func);
auto* result_ty = sem_func->ReturnType();
- const auto name = builder_.Symbols().NameFor(func->name->symbol);
+ const auto name = func->name->symbol.Name();
auto& buf = *current_buffer_;
- auto const buffer = program_->Symbols().NameFor(intrinsic->Buffer()->identifier->symbol);
+ auto const buffer = intrinsic->Buffer()->identifier->symbol.Name();
auto rmw = [&](const char* hlsl) -> bool {
{
@@ -2847,7 +2847,7 @@
bool GeneratorImpl::EmitIdentifier(utils::StringStream& out,
const ast::IdentifierExpression* expr) {
- out << builder_.Symbols().NameFor(expr->identifier->symbol);
+ out << expr->identifier->symbol.Name();
return true;
}
@@ -2903,7 +2903,7 @@
{
auto out = line();
- auto name = builder_.Symbols().NameFor(func->name->symbol);
+ auto name = func->name->symbol.Name();
// If the function returns an array, then we need to declare a typedef for
// this.
if (sem->ReturnType()->Is<type::Array>()) {
@@ -2962,7 +2962,7 @@
// correctly translate the parameter to a [RW]ByteAddressBuffer for
// storage buffers and a uint4[N] for uniform buffers.
if (!EmitTypeAndName(out, type, address_space, access,
- builder_.Symbols().NameFor(v->Declaration()->name->symbol))) {
+ v->Declaration()->name->symbol.Name())) {
return false;
}
}
@@ -3005,7 +3005,7 @@
line() << "}";
// Return an unused result that matches the type of the return value
- auto name = builder_.Symbols().NameFor(builder_.Symbols().New("unused"));
+ auto name = builder_.Symbols().New("unused").Name();
{
auto out = line();
if (!EmitTypeAndName(out, sem->ReturnType(), builtin::AddressSpace::kUndefined,
@@ -3068,7 +3068,7 @@
bool GeneratorImpl::EmitUniformVariable(const ast::Var* var, const sem::Variable* sem) {
auto binding_point = sem->As<sem::GlobalVariable>()->BindingPoint();
auto* type = sem->Type()->UnwrapRef();
- auto name = builder_.Symbols().NameFor(var->name->symbol);
+ auto name = var->name->symbol.Name();
line() << "cbuffer cbuffer_" << name << RegisterAndSpace('b', binding_point) << " {";
{
@@ -3089,7 +3089,7 @@
auto* type = sem->Type()->UnwrapRef();
auto out = line();
if (!EmitTypeAndName(out, type, builtin::AddressSpace::kStorage, sem->Access(),
- builder_.Symbols().NameFor(var->name->symbol))) {
+ var->name->symbol.Name())) {
return false;
}
@@ -3105,7 +3105,7 @@
auto* unwrapped_type = sem->Type()->UnwrapRef();
auto out = line();
- auto name = builder_.Symbols().NameFor(var->name->symbol);
+ auto name = var->name->symbol.Name();
auto* type = sem->Type()->UnwrapRef();
if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(), name)) {
return false;
@@ -3145,7 +3145,7 @@
out << "static ";
- auto name = builder_.Symbols().NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
auto* type = var->Type()->UnwrapRef();
if (!EmitTypeAndName(out, type, var->AddressSpace(), var->Access(), name)) {
return false;
@@ -3172,7 +3172,7 @@
out << "groupshared ";
- auto name = builder_.Symbols().NameFor(decl->name->symbol);
+ auto name = decl->name->symbol.Name();
auto* type = var->Type()->UnwrapRef();
if (!EmitTypeAndName(out, type, var->AddressSpace(), var->Access(), name)) {
return false;
@@ -3276,8 +3276,7 @@
}
if (!EmitTypeAndName(out, func_sem->ReturnType(), builtin::AddressSpace::kUndefined,
- builtin::Access::kUndefined,
- builder_.Symbols().NameFor(func->name->symbol))) {
+ builtin::Access::kUndefined, func->name->symbol.Name())) {
return false;
}
out << "(";
@@ -3300,7 +3299,7 @@
first = false;
if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(),
- builder_.Symbols().NameFor(var->name->symbol))) {
+ var->name->symbol.Name())) {
return false;
}
}
@@ -3594,9 +3593,8 @@
builtin::Access::kUndefined, "");
},
[&](Default) {
- diagnostics_.add_error(
- diag::System::Writer,
- "Invalid type for value emission: " + type->FriendlyName(builder_.Symbols()));
+ diagnostics_.add_error(diag::System::Writer,
+ "Invalid type for value emission: " + type->FriendlyName());
return false;
});
}
@@ -3803,11 +3801,11 @@
sem,
[&](const sem::Swizzle*) {
// Swizzles output the name directly
- out << builder_.Symbols().NameFor(expr->member->symbol);
+ out << expr->member->symbol.Name();
return true;
},
[&](const sem::StructMemberAccess* member_access) {
- out << program_->Symbols().NameFor(member_access->Member()->Name());
+ out << member_access->Member()->Name().Name();
return true;
},
[&](Default) {
@@ -4214,7 +4212,7 @@
{
ScopedIndent si(b);
for (auto* mem : str->Members()) {
- auto mem_name = builder_.Symbols().NameFor(mem->Name());
+ auto mem_name = mem->Name().Name();
auto* ty = mem->Type();
auto out = line(b);
std::string pre, post;
@@ -4331,8 +4329,7 @@
auto* type = sem->Type()->UnwrapRef();
auto out = line();
- if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(),
- builder_.Symbols().NameFor(var->name->symbol))) {
+ if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(), var->name->symbol.Name())) {
return false;
}
@@ -4359,7 +4356,7 @@
auto out = line();
out << "const ";
if (!EmitTypeAndName(out, type, builtin::AddressSpace::kUndefined, builtin::Access::kUndefined,
- builder_.Symbols().NameFor(let->name->symbol))) {
+ let->name->symbol.Name())) {
return false;
}
out << " = ";
diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc
index ed459e6..842f6cb 100644
--- a/src/tint/writer/msl/generator_impl.cc
+++ b/src/tint/writer/msl/generator_impl.cc
@@ -368,8 +368,7 @@
return false;
}
} else {
- diagnostics_.add_error(diag::System::Writer,
- "unknown alias type: " + ty->FriendlyName(builder_.Symbols()));
+ diagnostics_.add_error(diag::System::Writer, "unknown alias type: " + ty->FriendlyName());
return false;
}
@@ -661,7 +660,7 @@
bool GeneratorImpl::EmitFunctionCall(utils::StringStream& out,
const sem::Call* call,
const sem::Function* fn) {
- out << program_->Symbols().NameFor(fn->Declaration()->name->symbol) << "(";
+ out << fn->Declaration()->name->symbol.Name() << "(";
bool first = true;
for (auto* arg : call->Arguments()) {
@@ -852,7 +851,7 @@
if (auto* struct_ty = type->As<sem::Struct>()) {
// Emit field designators for structures to account for padding members.
auto* member = struct_ty->Members()[i]->Declaration();
- auto name = program_->Symbols().NameFor(member->name->symbol);
+ auto name = member->name->symbol.Name();
out << "." << name << "=";
}
@@ -1664,9 +1663,8 @@
return true;
},
[&](Default) {
- diagnostics_.add_error(
- diag::System::Writer,
- "Invalid type for zero emission: " + type->FriendlyName(builder_.Symbols()));
+ diagnostics_.add_error(diag::System::Writer,
+ "Invalid type for zero emission: " + type->FriendlyName());
return false;
});
}
@@ -1782,7 +1780,7 @@
if (i > 0) {
out << ", ";
}
- out << "." << program_->Symbols().NameFor(members[i]->Name()) << "=";
+ out << "." << members[i]->Name().Name() << "=";
if (!EmitConstant(out, constant->Index(i))) {
return false;
}
@@ -1882,7 +1880,7 @@
if (!EmitType(out, func_sem->ReturnType(), "")) {
return false;
}
- out << " " << program_->Symbols().NameFor(func->name->symbol) << "(";
+ out << " " << func->name->symbol.Name() << "(";
bool first = true;
for (auto* v : func->params) {
@@ -1893,13 +1891,13 @@
auto* type = program_->Sem().Get(v)->Type();
- std::string param_name = "const " + program_->Symbols().NameFor(v->name->symbol);
+ std::string param_name = "const " + v->name->symbol.Name();
if (!EmitType(out, type, param_name)) {
return false;
}
// Parameter name is output as part of the type for pointers.
if (!type->Is<type::Pointer>()) {
- out << " " << program_->Symbols().NameFor(v->name->symbol);
+ out << " " << v->name->symbol.Name();
}
}
@@ -1985,7 +1983,7 @@
bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) {
auto* func_sem = builder_.Sem().Get(func);
- auto func_name = program_->Symbols().NameFor(func->name->symbol);
+ auto func_name = func->name->symbol.Name();
// Returns the binding index of a variable, requiring that the group
// attribute have a value of zero.
@@ -2026,7 +2024,7 @@
auto* type = program_->Sem().Get(param)->Type()->UnwrapRef();
- auto param_name = program_->Symbols().NameFor(param->name->symbol);
+ auto param_name = param->name->symbol.Name();
if (!EmitType(out, type, param_name)) {
return false;
}
@@ -2136,7 +2134,7 @@
bool GeneratorImpl::EmitIdentifier(utils::StringStream& out,
const ast::IdentifierExpression* expr) {
- out << program_->Symbols().NameFor(expr->identifier->symbol);
+ out << expr->identifier->symbol.Name();
return true;
}
@@ -2398,7 +2396,7 @@
if (!write_lhs()) {
return false;
}
- out << "." << program_->Symbols().NameFor(expr->member->symbol);
+ out << "." << expr->member->symbol.Name();
}
return true;
},
@@ -2406,7 +2404,7 @@
if (!write_lhs()) {
return false;
}
- out << "." << program_->Symbols().NameFor(member_access->Member()->Name());
+ out << "." << member_access->Member()->Name().Name();
return true;
},
[&](Default) {
@@ -2570,7 +2568,7 @@
return true;
}
TINT_ICE(Writer, diagnostics_)
- << "unhandled atomic type " << atomic->Type()->FriendlyName(builder_.Symbols());
+ << "unhandled atomic type " << atomic->Type()->FriendlyName();
return false;
},
[&](const type::Array* arr) {
@@ -2751,9 +2749,8 @@
return true;
},
[&](Default) {
- diagnostics_.add_error(
- diag::System::Writer,
- "unknown type in EmitType: " + type->FriendlyName(builder_.Symbols()));
+ diagnostics_.add_error(diag::System::Writer,
+ "unknown type in EmitType: " + type->FriendlyName());
return false;
});
}
@@ -2827,7 +2824,7 @@
uint32_t msl_offset = 0;
for (auto* mem : str->Members()) {
auto out = line(b);
- auto mem_name = program_->Symbols().NameFor(mem->Name());
+ auto mem_name = mem->Name().Name();
auto wgsl_offset = mem->Offset();
if (is_host_shareable) {
@@ -2946,8 +2943,7 @@
auto size_align = MslPackedTypeSizeAndAlign(ty);
if (TINT_UNLIKELY(msl_offset % size_align.align)) {
TINT_ICE(Writer, diagnostics_)
- << "Misaligned MSL structure member " << ty->FriendlyName(program_->Symbols())
- << " " << mem_name;
+ << "Misaligned MSL structure member " << ty->FriendlyName() << " " << mem_name;
return false;
}
msl_offset += size_align.size;
@@ -3058,7 +3054,7 @@
return false;
}
- std::string name = program_->Symbols().NameFor(var->name->symbol);
+ std::string name = var->name->symbol.Name();
if (!EmitType(out, type, name)) {
return false;
}
@@ -3107,7 +3103,7 @@
return false;
}
- std::string name = "const " + program_->Symbols().NameFor(let->name->symbol);
+ std::string name = "const " + let->name->symbol.Name();
if (!EmitType(out, type, name)) {
return false;
}
diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc
index ae14acd..0a3009c 100644
--- a/src/tint/writer/spirv/builder.cc
+++ b/src/tint/writer/spirv/builder.cc
@@ -309,8 +309,7 @@
uint32_t Builder::LookupVariableID(const sem::Variable* var) {
auto it = var_to_id_.find(var);
if (it == var_to_id_.end()) {
- error_ = "unable to find ID for variable: " +
- builder_.Symbols().NameFor(var->Declaration()->name->symbol);
+ error_ = "unable to find ID for variable: " + var->Declaration()->name->symbol.Name();
return 0;
}
return it->second;
@@ -498,8 +497,7 @@
return false;
}
- OperandList operands = {Operand(stage), Operand(id),
- Operand(builder_.Symbols().NameFor(func->name->symbol))};
+ OperandList operands = {Operand(stage), Operand(id), Operand(func->name->symbol.Name())};
auto* func_sem = builder_.Sem().Get(func);
for (const auto* var : func_sem->TransitivelyReferencedGlobals()) {
@@ -512,8 +510,8 @@
uint32_t var_id = LookupVariableID(var);
if (var_id == 0) {
- error_ = "unable to find ID for global variable: " +
- builder_.Symbols().NameFor(var->Declaration()->name->symbol);
+ error_ =
+ "unable to find ID for global variable: " + var->Declaration()->name->symbol.Name();
return false;
}
@@ -601,8 +599,7 @@
auto func_op = result_op();
auto func_id = std::get<uint32_t>(func_op);
- push_debug(spv::Op::OpName,
- {Operand(func_id), Operand(builder_.Symbols().NameFor(func_ast->name->symbol))});
+ push_debug(spv::Op::OpName, {Operand(func_id), Operand(func_ast->name->symbol.Name())});
auto ret_id = GenerateTypeIfNeeded(func->ReturnType());
if (ret_id == 0) {
@@ -627,8 +624,7 @@
}
push_debug(spv::Op::OpName,
- {Operand(param_id),
- Operand(builder_.Symbols().NameFor(param->Declaration()->name->symbol))});
+ {Operand(param_id), Operand(param->Declaration()->name->symbol.Name())});
params.push_back(
Instruction{spv::Op::OpFunctionParameter, {Operand(param_type_id), param_op}});
@@ -725,8 +721,7 @@
return false;
}
- push_debug(spv::Op::OpName,
- {Operand(var_id), Operand(builder_.Symbols().NameFor(v->name->symbol))});
+ push_debug(spv::Op::OpName, {Operand(var_id), Operand(v->name->symbol.Name())});
// TODO(dsinclair) We could detect if the initializer is fully const and emit
// an initializer value for the variable instead of doing the OpLoad.
@@ -787,8 +782,7 @@
return false;
}
- push_debug(spv::Op::OpName,
- {Operand(var_id), Operand(builder_.Symbols().NameFor(v->name->symbol))});
+ push_debug(spv::Op::OpName, {Operand(var_id), Operand(v->name->symbol.Name())});
OperandList ops = {Operand(type_id), result, U32Operand(ConvertAddressSpace(sc))};
@@ -1163,8 +1157,7 @@
return LookupVariableID(user->Variable());
}
}
- error_ = "identifier '" + builder_.Symbols().NameFor(expr->identifier->symbol) +
- "' does not resolve to a variable";
+ error_ = "identifier '" + expr->identifier->symbol.Name() + "' does not resolve to a variable";
return 0;
}
@@ -1597,9 +1590,9 @@
}
if (op == spv::Op::OpNop) {
- error_ = "unable to determine conversion type for cast, from: " +
- from_type->FriendlyName(builder_.Symbols()) +
- " to: " + to_type->FriendlyName(builder_.Symbols());
+ error_ =
+ "unable to determine conversion type for cast, from: " + from_type->FriendlyName() +
+ " to: " + to_type->FriendlyName();
return 0;
}
@@ -2274,7 +2267,7 @@
auto func_id = func_symbol_to_id_[ident->symbol];
if (func_id == 0) {
- error_ = "unable to find called function: " + builder_.Symbols().NameFor(ident->symbol);
+ error_ = "unable to find called function: " + ident->symbol.Name();
return 0;
}
ops.push_back(Operand(func_id));
@@ -2399,8 +2392,7 @@
auto* type = TypeOf(accessor->object)->UnwrapRef();
if (!type->Is<sem::Struct>()) {
- error_ = "invalid type (" + type->FriendlyName(builder_.Symbols()) +
- ") for runtime array length";
+ error_ = "invalid type (" + type->FriendlyName() + ") for runtime array length";
return 0;
}
// Runtime array must be the last member in the structure
@@ -3756,7 +3748,7 @@
return true;
},
[&](Default) {
- error_ = "unable to convert type: " + type->FriendlyName(builder_.Symbols());
+ error_ = "unable to convert type: " + type->FriendlyName();
return false;
});
@@ -3926,8 +3918,7 @@
auto struct_id = std::get<uint32_t>(result);
if (struct_type->Name().IsValid()) {
- push_debug(spv::Op::OpName,
- {Operand(struct_id), Operand(builder_.Symbols().NameFor(struct_type->Name()))});
+ push_debug(spv::Op::OpName, {Operand(struct_id), Operand(struct_type->Name().Name())});
}
OperandList ops;
@@ -3954,8 +3945,8 @@
uint32_t Builder::GenerateStructMember(uint32_t struct_id,
uint32_t idx,
const sem::StructMember* member) {
- push_debug(spv::Op::OpMemberName, {Operand(struct_id), Operand(idx),
- Operand(builder_.Symbols().NameFor(member->Name()))});
+ push_debug(spv::Op::OpMemberName,
+ {Operand(struct_id), Operand(idx), Operand(member->Name().Name())});
// Note: This will generate layout annotations for *all* structs, whether or
// not they are used in host-shareable variables. This is officially ok in
diff --git a/src/tint/writer/syntax_tree/generator_impl.cc b/src/tint/writer/syntax_tree/generator_impl.cc
index 4d5f9be..be30289 100644
--- a/src/tint/writer/syntax_tree/generator_impl.cc
+++ b/src/tint/writer/syntax_tree/generator_impl.cc
@@ -66,7 +66,7 @@
void GeneratorImpl::EmitDiagnosticControl(const ast::DiagnosticControl& diagnostic) {
line() << "DiagnosticControl [severity: " << diagnostic.severity
- << ", rule: " << program_->Symbols().NameFor(diagnostic.rule_name->symbol) << "]";
+ << ", rule: " << diagnostic.rule_name->symbol.Name() << "]";
}
void GeneratorImpl::EmitEnable(const ast::Enable* enable) {
@@ -89,7 +89,7 @@
{
ScopedIndent ai(this);
- line() << "name: " << program_->Symbols().NameFor(alias->name->symbol);
+ line() << "name: " << alias->name->symbol.Name();
line() << "expr: ";
{
ScopedIndent ex(this);
@@ -149,7 +149,7 @@
ScopedIndent obj(this);
EmitExpression(expr->object);
}
- line() << "member: " << program_->Symbols().NameFor(expr->member->symbol);
+ line() << "member: " << expr->member->symbol.Name();
}
line() << "]";
}
@@ -252,7 +252,7 @@
}
line() << "]";
}
- line() << "name: " << program_->Symbols().NameFor(ident->symbol);
+ line() << "name: " << ident->symbol.Name();
if (!tmpl_ident->arguments.IsEmpty()) {
line() << "args: [";
{
@@ -266,7 +266,7 @@
}
line() << "]";
} else {
- line() << program_->Symbols().NameFor(ident->symbol);
+ line() << ident->symbol.Name();
}
}
line() << "]";
@@ -285,7 +285,7 @@
}
line() << "]";
}
- line() << "name: " << program_->Symbols().NameFor(func->name->symbol);
+ line() << "name: " << func->name->symbol.Name();
if (!func->params.IsEmpty()) {
line() << "params: [";
@@ -295,7 +295,7 @@
line() << "param: [";
{
ScopedIndent param(this);
- line() << "name: " << program_->Symbols().NameFor(v->name->symbol);
+ line() << "name: " << v->name->symbol.Name();
if (!v->attributes.IsEmpty()) {
line() << "attrs: [";
{
@@ -372,7 +372,7 @@
}
line() << "]";
}
- line() << "name: " << program_->Symbols().NameFor(str->name->symbol);
+ line() << "name: " << str->name->symbol.Name();
line() << "members: [";
{
ScopedIndent membs(this);
@@ -390,7 +390,7 @@
line() << "]";
}
- line() << "name: " << program_->Symbols().NameFor(mem->name->symbol);
+ line() << "name: " << mem->name->symbol.Name();
line() << "type: [";
{
ScopedIndent ty(this);
@@ -453,7 +453,7 @@
TINT_ICE(Writer, diagnostics_) << "unhandled variable type " << v->TypeInfo().name;
});
- line() << "name: " << program_->Symbols().NameFor(v->name->symbol);
+ line() << "name: " << v->name->symbol.Name();
if (auto ty = v->type) {
line() << "type: [";
diff --git a/src/tint/writer/text_generator.cc b/src/tint/writer/text_generator.cc
index 20c5fe7..8d18b9a 100644
--- a/src/tint/writer/text_generator.cc
+++ b/src/tint/writer/text_generator.cc
@@ -27,11 +27,11 @@
TextGenerator::~TextGenerator() = default;
std::string TextGenerator::UniqueIdentifier(const std::string& prefix) {
- return builder_.Symbols().NameFor(builder_.Symbols().New(prefix));
+ return builder_.Symbols().New(prefix).Name();
}
std::string TextGenerator::StructName(const sem::Struct* s) {
- auto name = builder_.Symbols().NameFor(s->Name());
+ auto name = s->Name().Name();
if (name.size() > 1 && name[0] == '_' && name[1] == '_') {
name = utils::GetOrCreate(builtin_struct_names_, s,
[&] { return UniqueIdentifier(name.substr(2)); });
diff --git a/src/tint/writer/wgsl/generator_impl.cc b/src/tint/writer/wgsl/generator_impl.cc
index 744bbd2..2a2f0e7 100644
--- a/src/tint/writer/wgsl/generator_impl.cc
+++ b/src/tint/writer/wgsl/generator_impl.cc
@@ -82,8 +82,8 @@
void GeneratorImpl::EmitDiagnosticControl(utils::StringStream& out,
const ast::DiagnosticControl& diagnostic) {
- out << "diagnostic(" << diagnostic.severity << ", "
- << program_->Symbols().NameFor(diagnostic.rule_name->symbol) << ")";
+ out << "diagnostic(" << diagnostic.severity << ", " << diagnostic.rule_name->symbol.Name()
+ << ")";
}
void GeneratorImpl::EmitEnable(const ast::Enable* enable) {
@@ -103,7 +103,7 @@
ty, //
[&](const ast::Alias* alias) {
auto out = line();
- out << "alias " << program_->Symbols().NameFor(alias->name->symbol) << " = ";
+ out << "alias " << alias->name->symbol.Name() << " = ";
EmitExpression(out, alias->type);
out << ";";
},
@@ -160,7 +160,7 @@
out << ")";
}
- out << "." << program_->Symbols().NameFor(expr->member->symbol);
+ out << "." << expr->member->symbol.Name();
}
void GeneratorImpl::EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr) {
@@ -219,7 +219,7 @@
EmitAttributes(out, tmpl_ident->attributes);
out << " ";
}
- out << program_->Symbols().NameFor(ident->symbol) << "<";
+ out << ident->symbol.Name() << "<";
TINT_DEFER(out << ">");
for (auto* expr : tmpl_ident->arguments) {
if (expr != tmpl_ident->arguments.Front()) {
@@ -228,7 +228,7 @@
EmitExpression(out, expr);
}
} else {
- out << program_->Symbols().NameFor(ident->symbol);
+ out << ident->symbol.Name();
}
}
@@ -238,7 +238,7 @@
}
{
auto out = line();
- out << "fn " << program_->Symbols().NameFor(func->name->symbol) << "(";
+ out << "fn " << func->name->symbol.Name() << "(";
bool first = true;
for (auto* v : func->params) {
@@ -252,7 +252,7 @@
out << " ";
}
- out << program_->Symbols().NameFor(v->name->symbol) << " : ";
+ out << v->name->symbol.Name() << " : ";
EmitExpression(out, v->type);
}
@@ -297,7 +297,7 @@
if (str->attributes.Length()) {
EmitAttributes(line(), str->attributes);
}
- line() << "struct " << program_->Symbols().NameFor(str->name->symbol) << " {";
+ line() << "struct " << str->name->symbol.Name() << " {";
auto add_padding = [&](uint32_t size) {
line() << "@size(" << size << ")";
@@ -342,7 +342,7 @@
}
auto out = line();
- out << program_->Symbols().NameFor(mem->name->symbol) << " : ";
+ out << mem->name->symbol.Name() << " : ";
EmitExpression(out, mem->type);
out << ",";
}
@@ -377,7 +377,7 @@
TINT_ICE(Writer, diagnostics_) << "unhandled variable type " << v->TypeInfo().name;
});
- out << " " << program_->Symbols().NameFor(v->name->symbol);
+ out << " " << v->name->symbol.Name();
if (auto ty = v->type) {
out << " : ";