Rename CloneContext::mod to CloneContext::dst

In the future, CloneContext will be operating on `Program`s so a field called `mod` is poorly named.
CloneContext has a `src` member, so rename to `dst` to keep symmetry.

Bug: tint:390
Change-Id: Ic724f8a18b46ef719790394cdc810f7eb3681234
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38364
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2021-01-22 13:41:06 +00:00
committed by Commit Bot service account
parent 6761160dc1
commit 5c243f824c
67 changed files with 81 additions and 81 deletions

View File

@@ -75,7 +75,7 @@ ast::ArrayAccessorExpression* BoundArrayAccessors::Transform(
return nullptr;
}
ast::Builder b(ctx->mod);
ast::Builder b(ctx->dst);
using u32 = ast::Builder::u32;
uint32_t size = 0;

View File

@@ -64,9 +64,9 @@ constexpr char kIndexOffsetPrefix[] = "tint_first_index_offset_";
ast::Variable* clone_variable_with_new_name(CloneContext* ctx,
ast::Variable* in,
std::string new_name) {
return ctx->mod->create<ast::Variable>(
return ctx->dst->create<ast::Variable>(
ctx->Clone(in->source()), // source
ctx->mod->RegisterSymbol(new_name), // symbol
ctx->dst->RegisterSymbol(new_name), // symbol
in->storage_class(), // storage_class
ctx->Clone(in->type()), // type
in->is_const(), // is_const
@@ -152,7 +152,7 @@ Transform::Output FirstIndexOffset::Run(ast::Module* in) {
// which determines the original builtin variable names,
// but this should be fine, as variables are cloned first.
[&](CloneContext* ctx, ast::Function* func) -> ast::Function* {
maybe_create_buffer_var(ctx->mod);
maybe_create_buffer_var(ctx->dst);
if (buffer_var == nullptr) {
return nullptr; // no transform need, just clone func
}
@@ -162,11 +162,11 @@ Transform::Output FirstIndexOffset::Run(ast::Module* in) {
if (data.second->value() == ast::Builtin::kVertexIndex) {
statements.emplace_back(CreateFirstIndexOffset(
in->SymbolToName(vertex_index_sym), kFirstVertexName,
buffer_var, ctx->mod));
buffer_var, ctx->dst));
} else if (data.second->value() == ast::Builtin::kInstanceIndex) {
statements.emplace_back(CreateFirstIndexOffset(
in->SymbolToName(instance_index_sym), kFirstInstanceName,
buffer_var, ctx->mod));
buffer_var, ctx->dst));
}
}
return CloneWithStatementsAtStart(ctx, func, statements);

View File

@@ -31,10 +31,10 @@ ast::Function* Transform::CloneWithStatementsAtStart(
for (auto* s : *in->body()) {
statements.emplace_back(ctx->Clone(s));
}
return ctx->mod->create<ast::Function>(
return ctx->dst->create<ast::Function>(
ctx->Clone(in->source()), ctx->Clone(in->symbol()),
ctx->Clone(in->params()), ctx->Clone(in->return_type()),
ctx->mod->create<ast::BlockStatement>(ctx->Clone(in->body()->source()),
ctx->dst->create<ast::BlockStatement>(ctx->Clone(in->body()->source()),
statements),
ctx->Clone(in->decorations()));
}