tint/ast: Change Variable::symbol to Variable::name

Variable::name is an ast::Identifier.

The goal here is to have all AST nodes use an identifier instead of
symbols directly. This will greatly simplify the renamer transform,
and gives the symbol a Source location, which is helpful for
diagnostics and tooling.

Change-Id: I71fe3e8df3d22b12d4a3430c41f236ddf5bc0b9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119282
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2023-02-09 10:34:14 +00:00
parent 199440e37c
commit 651d9e2558
51 changed files with 237 additions and 219 deletions

View File

@@ -711,13 +711,13 @@ struct DirectVariableAccess::State {
PtrParamSymbols symbols;
if (requires_base_ptr_param && requires_indices_param) {
auto original_name = param->Declaration()->symbol;
auto original_name = param->Declaration()->name->symbol;
symbols.base_ptr = UniqueSymbolWithSuffix(original_name, "_base");
symbols.indices = UniqueSymbolWithSuffix(original_name, "_indices");
} else if (requires_base_ptr_param) {
symbols.base_ptr = ctx.Clone(param->Declaration()->symbol);
symbols.base_ptr = ctx.Clone(param->Declaration()->name->symbol);
} else if (requires_indices_param) {
symbols.indices = ctx.Clone(param->Declaration()->symbol);
symbols.indices = ctx.Clone(param->Declaration()->name->symbol);
}
// Remember this base pointer name.
@@ -1085,7 +1085,7 @@ struct DirectVariableAccess::State {
if (IsPrivateOrFunction(shape.root.address_space)) {
ss << "F";
} else {
ss << ctx.src->Symbols().NameFor(shape.root.variable->Declaration()->symbol);
ss << ctx.src->Symbols().NameFor(shape.root.variable->Declaration()->name->symbol);
}
for (auto& op : shape.ops) {
@@ -1122,7 +1122,7 @@ struct DirectVariableAccess::State {
}
}
const ast::Expression* expr = b.Expr(ctx.Clone(root.variable->Declaration()->symbol));
const ast::Expression* expr = b.Expr(ctx.Clone(root.variable->Declaration()->name->symbol));
if (deref) {
if (root.variable->Type()->Is<type::Pointer>()) {
expr = b.Deref(expr);