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>
diff --git a/src/ast/access_decoration.cc b/src/ast/access_decoration.cc
index 50d35a9..51e2b73 100644
--- a/src/ast/access_decoration.cc
+++ b/src/ast/access_decoration.cc
@@ -33,7 +33,7 @@
}
AccessDecoration* AccessDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<AccessDecoration>(ctx->Clone(source()), value_);
+ return ctx->dst->create<AccessDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast
diff --git a/src/ast/array_accessor_expression.cc b/src/ast/array_accessor_expression.cc
index 7fd6d2e..ad5b1ee 100644
--- a/src/ast/array_accessor_expression.cc
+++ b/src/ast/array_accessor_expression.cc
@@ -34,7 +34,7 @@
ArrayAccessorExpression* ArrayAccessorExpression::Clone(
CloneContext* ctx) const {
- return ctx->mod->create<ArrayAccessorExpression>(
+ return ctx->dst->create<ArrayAccessorExpression>(
ctx->Clone(source()), ctx->Clone(array_), ctx->Clone(idx_expr_));
}
diff --git a/src/ast/assignment_statement.cc b/src/ast/assignment_statement.cc
index 896b206..02b7c2b 100644
--- a/src/ast/assignment_statement.cc
+++ b/src/ast/assignment_statement.cc
@@ -32,7 +32,7 @@
AssignmentStatement::~AssignmentStatement() = default;
AssignmentStatement* AssignmentStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<AssignmentStatement>(
+ return ctx->dst->create<AssignmentStatement>(
ctx->Clone(source()), ctx->Clone(lhs_), ctx->Clone(rhs_));
}
diff --git a/src/ast/binary_expression.cc b/src/ast/binary_expression.cc
index 8851a62..e9970f8 100644
--- a/src/ast/binary_expression.cc
+++ b/src/ast/binary_expression.cc
@@ -33,7 +33,7 @@
BinaryExpression::~BinaryExpression() = default;
BinaryExpression* BinaryExpression::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BinaryExpression>(ctx->Clone(source()), op_,
+ return ctx->dst->create<BinaryExpression>(ctx->Clone(source()), op_,
ctx->Clone(lhs_), ctx->Clone(rhs_));
}
diff --git a/src/ast/binding_decoration.cc b/src/ast/binding_decoration.cc
index febb264..9f686a2 100644
--- a/src/ast/binding_decoration.cc
+++ b/src/ast/binding_decoration.cc
@@ -33,7 +33,7 @@
}
BindingDecoration* BindingDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BindingDecoration>(ctx->Clone(source()), value_);
+ return ctx->dst->create<BindingDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast
diff --git a/src/ast/bitcast_expression.cc b/src/ast/bitcast_expression.cc
index be772ba..39fc72f 100644
--- a/src/ast/bitcast_expression.cc
+++ b/src/ast/bitcast_expression.cc
@@ -31,7 +31,7 @@
BitcastExpression::~BitcastExpression() = default;
BitcastExpression* BitcastExpression::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BitcastExpression>(
+ return ctx->dst->create<BitcastExpression>(
ctx->Clone(source()), ctx->Clone(type_), ctx->Clone(expr_));
}
diff --git a/src/ast/block_statement.cc b/src/ast/block_statement.cc
index a9efd64..dfbf12f 100644
--- a/src/ast/block_statement.cc
+++ b/src/ast/block_statement.cc
@@ -31,7 +31,7 @@
BlockStatement::~BlockStatement() = default;
BlockStatement* BlockStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BlockStatement>(ctx->Clone(source()),
+ return ctx->dst->create<BlockStatement>(ctx->Clone(source()),
ctx->Clone(statements_));
}
diff --git a/src/ast/bool_literal.cc b/src/ast/bool_literal.cc
index 43b5281..d7c5346 100644
--- a/src/ast/bool_literal.cc
+++ b/src/ast/bool_literal.cc
@@ -36,7 +36,7 @@
}
BoolLiteral* BoolLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BoolLiteral>(ctx->Clone(source()), ctx->Clone(type()),
+ return ctx->dst->create<BoolLiteral>(ctx->Clone(source()), ctx->Clone(type()),
value_);
}
diff --git a/src/ast/break_statement.cc b/src/ast/break_statement.cc
index 4951304..4115174 100644
--- a/src/ast/break_statement.cc
+++ b/src/ast/break_statement.cc
@@ -29,7 +29,7 @@
BreakStatement::~BreakStatement() = default;
BreakStatement* BreakStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BreakStatement>(ctx->Clone(source()));
+ return ctx->dst->create<BreakStatement>(ctx->Clone(source()));
}
bool BreakStatement::IsValid() const {
diff --git a/src/ast/builtin_decoration.cc b/src/ast/builtin_decoration.cc
index ffeb76b..0cfd811 100644
--- a/src/ast/builtin_decoration.cc
+++ b/src/ast/builtin_decoration.cc
@@ -33,7 +33,7 @@
}
BuiltinDecoration* BuiltinDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BuiltinDecoration>(ctx->Clone(source()), builtin_);
+ return ctx->dst->create<BuiltinDecoration>(ctx->Clone(source()), builtin_);
}
} // namespace ast
diff --git a/src/ast/call_expression.cc b/src/ast/call_expression.cc
index ce33267..6144b4d 100644
--- a/src/ast/call_expression.cc
+++ b/src/ast/call_expression.cc
@@ -32,7 +32,7 @@
CallExpression::~CallExpression() = default;
CallExpression* CallExpression::Clone(CloneContext* ctx) const {
- return ctx->mod->create<CallExpression>(
+ return ctx->dst->create<CallExpression>(
ctx->Clone(source()), ctx->Clone(func_), ctx->Clone(params_));
}
diff --git a/src/ast/call_statement.cc b/src/ast/call_statement.cc
index 7e0c5e9..f70f36b 100644
--- a/src/ast/call_statement.cc
+++ b/src/ast/call_statement.cc
@@ -31,7 +31,7 @@
CallStatement::~CallStatement() = default;
CallStatement* CallStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<CallStatement>(ctx->Clone(source()),
+ return ctx->dst->create<CallStatement>(ctx->Clone(source()),
ctx->Clone(call_));
}
diff --git a/src/ast/case_statement.cc b/src/ast/case_statement.cc
index 7ad253d..62cae3f 100644
--- a/src/ast/case_statement.cc
+++ b/src/ast/case_statement.cc
@@ -32,7 +32,7 @@
CaseStatement::~CaseStatement() = default;
CaseStatement* CaseStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<CaseStatement>(
+ return ctx->dst->create<CaseStatement>(
ctx->Clone(source()), ctx->Clone(selectors_), ctx->Clone(body_));
}
diff --git a/src/ast/constant_id_decoration.cc b/src/ast/constant_id_decoration.cc
index 5dc4156..c97c84d 100644
--- a/src/ast/constant_id_decoration.cc
+++ b/src/ast/constant_id_decoration.cc
@@ -33,7 +33,7 @@
}
ConstantIdDecoration* ConstantIdDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<ConstantIdDecoration>(ctx->Clone(source()), value_);
+ return ctx->dst->create<ConstantIdDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast
diff --git a/src/ast/continue_statement.cc b/src/ast/continue_statement.cc
index 00b8f81..d380a83 100644
--- a/src/ast/continue_statement.cc
+++ b/src/ast/continue_statement.cc
@@ -29,7 +29,7 @@
ContinueStatement::~ContinueStatement() = default;
ContinueStatement* ContinueStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<ContinueStatement>(ctx->Clone(source()));
+ return ctx->dst->create<ContinueStatement>(ctx->Clone(source()));
}
bool ContinueStatement::IsValid() const {
diff --git a/src/ast/discard_statement.cc b/src/ast/discard_statement.cc
index 01a364f..a8f0d3c 100644
--- a/src/ast/discard_statement.cc
+++ b/src/ast/discard_statement.cc
@@ -29,7 +29,7 @@
DiscardStatement::~DiscardStatement() = default;
DiscardStatement* DiscardStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<DiscardStatement>(ctx->Clone(source()));
+ return ctx->dst->create<DiscardStatement>(ctx->Clone(source()));
}
bool DiscardStatement::IsValid() const {
diff --git a/src/ast/else_statement.cc b/src/ast/else_statement.cc
index 7b44308..a9d5cf1 100644
--- a/src/ast/else_statement.cc
+++ b/src/ast/else_statement.cc
@@ -32,7 +32,7 @@
ElseStatement::~ElseStatement() = default;
ElseStatement* ElseStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<ElseStatement>(
+ return ctx->dst->create<ElseStatement>(
ctx->Clone(source()), ctx->Clone(condition_), ctx->Clone(body_));
}
diff --git a/src/ast/fallthrough_statement.cc b/src/ast/fallthrough_statement.cc
index 46bb30f..378c5fc 100644
--- a/src/ast/fallthrough_statement.cc
+++ b/src/ast/fallthrough_statement.cc
@@ -30,7 +30,7 @@
FallthroughStatement::~FallthroughStatement() = default;
FallthroughStatement* FallthroughStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<FallthroughStatement>(ctx->Clone(source()));
+ return ctx->dst->create<FallthroughStatement>(ctx->Clone(source()));
}
bool FallthroughStatement::IsValid() const {
diff --git a/src/ast/float_literal.cc b/src/ast/float_literal.cc
index b715407..8795e0f 100644
--- a/src/ast/float_literal.cc
+++ b/src/ast/float_literal.cc
@@ -43,7 +43,7 @@
}
FloatLiteral* FloatLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<FloatLiteral>(ctx->Clone(source()),
+ return ctx->dst->create<FloatLiteral>(ctx->Clone(source()),
ctx->Clone(type()), value_);
}
diff --git a/src/ast/function.cc b/src/ast/function.cc
index 66147f9..96fd6d2 100644
--- a/src/ast/function.cc
+++ b/src/ast/function.cc
@@ -225,7 +225,7 @@
}
Function* Function::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Function>(
+ return ctx->dst->create<Function>(
ctx->Clone(source()), ctx->Clone(symbol()), ctx->Clone(params_),
ctx->Clone(return_type_), ctx->Clone(body_), ctx->Clone(decorations_));
}
diff --git a/src/ast/group_decoration.cc b/src/ast/group_decoration.cc
index c60ec48..599493e 100644
--- a/src/ast/group_decoration.cc
+++ b/src/ast/group_decoration.cc
@@ -33,7 +33,7 @@
}
GroupDecoration* GroupDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<GroupDecoration>(ctx->Clone(source()), value_);
+ return ctx->dst->create<GroupDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast
diff --git a/src/ast/identifier_expression.cc b/src/ast/identifier_expression.cc
index cd79099..05c771f 100644
--- a/src/ast/identifier_expression.cc
+++ b/src/ast/identifier_expression.cc
@@ -30,7 +30,7 @@
IdentifierExpression::~IdentifierExpression() = default;
IdentifierExpression* IdentifierExpression::Clone(CloneContext* ctx) const {
- return ctx->mod->create<IdentifierExpression>(ctx->Clone(source()),
+ return ctx->dst->create<IdentifierExpression>(ctx->Clone(source()),
ctx->Clone(symbol()));
}
diff --git a/src/ast/if_statement.cc b/src/ast/if_statement.cc
index 0c3fcc5..80171b1 100644
--- a/src/ast/if_statement.cc
+++ b/src/ast/if_statement.cc
@@ -37,7 +37,7 @@
IfStatement::~IfStatement() = default;
IfStatement* IfStatement::Clone(CloneContext* ctx) const {
- auto* cloned = ctx->mod->create<IfStatement>(
+ auto* cloned = ctx->dst->create<IfStatement>(
ctx->Clone(source()), ctx->Clone(condition_), ctx->Clone(body_),
ctx->Clone(else_statements_));
return cloned;
diff --git a/src/ast/location_decoration.cc b/src/ast/location_decoration.cc
index e660e13..8202dfe 100644
--- a/src/ast/location_decoration.cc
+++ b/src/ast/location_decoration.cc
@@ -33,7 +33,7 @@
}
LocationDecoration* LocationDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<LocationDecoration>(ctx->Clone(source()), value_);
+ return ctx->dst->create<LocationDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast
diff --git a/src/ast/loop_statement.cc b/src/ast/loop_statement.cc
index e58476f..14fb504 100644
--- a/src/ast/loop_statement.cc
+++ b/src/ast/loop_statement.cc
@@ -32,7 +32,7 @@
LoopStatement::~LoopStatement() = default;
LoopStatement* LoopStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<LoopStatement>(
+ return ctx->dst->create<LoopStatement>(
ctx->Clone(source()), ctx->Clone(body_), ctx->Clone(continuing_));
}
diff --git a/src/ast/member_accessor_expression.cc b/src/ast/member_accessor_expression.cc
index a75df00..4cbb2db 100644
--- a/src/ast/member_accessor_expression.cc
+++ b/src/ast/member_accessor_expression.cc
@@ -34,7 +34,7 @@
MemberAccessorExpression* MemberAccessorExpression::Clone(
CloneContext* ctx) const {
- return ctx->mod->create<MemberAccessorExpression>(
+ return ctx->dst->create<MemberAccessorExpression>(
ctx->Clone(source()), ctx->Clone(struct_), ctx->Clone(member_));
}
diff --git a/src/ast/module.cc b/src/ast/module.cc
index 0a73dd0..39bd5e4 100644
--- a/src/ast/module.cc
+++ b/src/ast/module.cc
@@ -38,13 +38,13 @@
void Module::Clone(CloneContext* ctx) const {
for (auto* ty : constructed_types_) {
- ctx->mod->constructed_types_.emplace_back(ctx->Clone(ty));
+ ctx->dst->constructed_types_.emplace_back(ctx->Clone(ty));
}
for (auto* var : global_variables_) {
- ctx->mod->global_variables_.emplace_back(ctx->Clone(var));
+ ctx->dst->global_variables_.emplace_back(ctx->Clone(var));
}
for (auto* func : functions_) {
- ctx->mod->functions_.emplace_back(ctx->Clone(func));
+ ctx->dst->functions_.emplace_back(ctx->Clone(func));
}
}
diff --git a/src/ast/null_literal.cc b/src/ast/null_literal.cc
index 61f4cf5..1bb8cc1 100644
--- a/src/ast/null_literal.cc
+++ b/src/ast/null_literal.cc
@@ -36,7 +36,7 @@
}
NullLiteral* NullLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<NullLiteral>(ctx->Clone(source()),
+ return ctx->dst->create<NullLiteral>(ctx->Clone(source()),
ctx->Clone(type()));
}
diff --git a/src/ast/return_statement.cc b/src/ast/return_statement.cc
index 94eb8c8..105e7e5 100644
--- a/src/ast/return_statement.cc
+++ b/src/ast/return_statement.cc
@@ -33,7 +33,7 @@
ReturnStatement::~ReturnStatement() = default;
ReturnStatement* ReturnStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<ReturnStatement>(ctx->Clone(source()),
+ return ctx->dst->create<ReturnStatement>(ctx->Clone(source()),
ctx->Clone(value_));
}
diff --git a/src/ast/scalar_constructor_expression.cc b/src/ast/scalar_constructor_expression.cc
index ed26446..4658081 100644
--- a/src/ast/scalar_constructor_expression.cc
+++ b/src/ast/scalar_constructor_expression.cc
@@ -33,7 +33,7 @@
ScalarConstructorExpression* ScalarConstructorExpression::Clone(
CloneContext* ctx) const {
- return ctx->mod->create<ScalarConstructorExpression>(ctx->Clone(source()),
+ return ctx->dst->create<ScalarConstructorExpression>(ctx->Clone(source()),
ctx->Clone(literal_));
}
diff --git a/src/ast/sint_literal.cc b/src/ast/sint_literal.cc
index 3b1aa0b..e5a2210 100644
--- a/src/ast/sint_literal.cc
+++ b/src/ast/sint_literal.cc
@@ -36,7 +36,7 @@
}
SintLiteral* SintLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<SintLiteral>(ctx->Clone(source()), ctx->Clone(type()),
+ return ctx->dst->create<SintLiteral>(ctx->Clone(source()), ctx->Clone(type()),
value_);
}
diff --git a/src/ast/stage_decoration.cc b/src/ast/stage_decoration.cc
index 786e86e..4867d7b 100644
--- a/src/ast/stage_decoration.cc
+++ b/src/ast/stage_decoration.cc
@@ -33,7 +33,7 @@
}
StageDecoration* StageDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<StageDecoration>(ctx->Clone(source()), stage_);
+ return ctx->dst->create<StageDecoration>(ctx->Clone(source()), stage_);
}
} // namespace ast
diff --git a/src/ast/stride_decoration.cc b/src/ast/stride_decoration.cc
index 9d86e29..16d7a14 100644
--- a/src/ast/stride_decoration.cc
+++ b/src/ast/stride_decoration.cc
@@ -33,7 +33,7 @@
}
StrideDecoration* StrideDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<StrideDecoration>(ctx->Clone(source()), stride_);
+ return ctx->dst->create<StrideDecoration>(ctx->Clone(source()), stride_);
}
} // namespace ast
diff --git a/src/ast/struct.cc b/src/ast/struct.cc
index 146a9ef..1302d8d 100644
--- a/src/ast/struct.cc
+++ b/src/ast/struct.cc
@@ -53,7 +53,7 @@
}
Struct* Struct::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Struct>(ctx->Clone(source()), ctx->Clone(members_),
+ return ctx->dst->create<Struct>(ctx->Clone(source()), ctx->Clone(members_),
ctx->Clone(decorations_));
}
diff --git a/src/ast/struct_block_decoration.cc b/src/ast/struct_block_decoration.cc
index 4dab8c1..c12902c 100644
--- a/src/ast/struct_block_decoration.cc
+++ b/src/ast/struct_block_decoration.cc
@@ -33,7 +33,7 @@
}
StructBlockDecoration* StructBlockDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<StructBlockDecoration>(ctx->Clone(source()));
+ return ctx->dst->create<StructBlockDecoration>(ctx->Clone(source()));
}
} // namespace ast
diff --git a/src/ast/struct_member.cc b/src/ast/struct_member.cc
index aa64980..28fbd3a 100644
--- a/src/ast/struct_member.cc
+++ b/src/ast/struct_member.cc
@@ -55,7 +55,7 @@
}
StructMember* StructMember::Clone(CloneContext* ctx) const {
- return ctx->mod->create<StructMember>(ctx->Clone(source()),
+ return ctx->dst->create<StructMember>(ctx->Clone(source()),
ctx->Clone(symbol_), ctx->Clone(type_),
ctx->Clone(decorations_));
}
diff --git a/src/ast/struct_member_offset_decoration.cc b/src/ast/struct_member_offset_decoration.cc
index 16608a7..380d480 100644
--- a/src/ast/struct_member_offset_decoration.cc
+++ b/src/ast/struct_member_offset_decoration.cc
@@ -36,7 +36,7 @@
StructMemberOffsetDecoration* StructMemberOffsetDecoration::Clone(
CloneContext* ctx) const {
- return ctx->mod->create<StructMemberOffsetDecoration>(ctx->Clone(source()),
+ return ctx->dst->create<StructMemberOffsetDecoration>(ctx->Clone(source()),
offset_);
}
diff --git a/src/ast/switch_statement.cc b/src/ast/switch_statement.cc
index a542548..cbd2018 100644
--- a/src/ast/switch_statement.cc
+++ b/src/ast/switch_statement.cc
@@ -33,7 +33,7 @@
SwitchStatement::~SwitchStatement() = default;
SwitchStatement* SwitchStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<SwitchStatement>(
+ return ctx->dst->create<SwitchStatement>(
ctx->Clone(source()), ctx->Clone(condition_), ctx->Clone(body_));
}
diff --git a/src/ast/type_constructor_expression.cc b/src/ast/type_constructor_expression.cc
index 75f336d..e8dbcc4 100644
--- a/src/ast/type_constructor_expression.cc
+++ b/src/ast/type_constructor_expression.cc
@@ -34,7 +34,7 @@
TypeConstructorExpression* TypeConstructorExpression::Clone(
CloneContext* ctx) const {
- return ctx->mod->create<TypeConstructorExpression>(
+ return ctx->dst->create<TypeConstructorExpression>(
ctx->Clone(source()), ctx->Clone(type_), ctx->Clone(values_));
}
diff --git a/src/ast/uint_literal.cc b/src/ast/uint_literal.cc
index 84d18de..be00e75 100644
--- a/src/ast/uint_literal.cc
+++ b/src/ast/uint_literal.cc
@@ -36,7 +36,7 @@
}
UintLiteral* UintLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<UintLiteral>(ctx->Clone(source()), ctx->Clone(type()),
+ return ctx->dst->create<UintLiteral>(ctx->Clone(source()), ctx->Clone(type()),
value_);
}
diff --git a/src/ast/unary_op_expression.cc b/src/ast/unary_op_expression.cc
index 79042ad..100a376 100644
--- a/src/ast/unary_op_expression.cc
+++ b/src/ast/unary_op_expression.cc
@@ -32,7 +32,7 @@
UnaryOpExpression::~UnaryOpExpression() = default;
UnaryOpExpression* UnaryOpExpression::Clone(CloneContext* ctx) const {
- return ctx->mod->create<UnaryOpExpression>(ctx->Clone(source()), op_,
+ return ctx->dst->create<UnaryOpExpression>(ctx->Clone(source()), op_,
ctx->Clone(expr_));
}
diff --git a/src/ast/variable.cc b/src/ast/variable.cc
index 0d5c3e5..1e579e1 100644
--- a/src/ast/variable.cc
+++ b/src/ast/variable.cc
@@ -91,7 +91,7 @@
}
Variable* Variable::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Variable>(ctx->Clone(source()), ctx->Clone(symbol_),
+ return ctx->dst->create<Variable>(ctx->Clone(source()), ctx->Clone(symbol_),
storage_class(), ctx->Clone(type()),
is_const_, ctx->Clone(constructor()),
ctx->Clone(decorations_));
diff --git a/src/ast/variable_decl_statement.cc b/src/ast/variable_decl_statement.cc
index b9d9986..d915dd0 100644
--- a/src/ast/variable_decl_statement.cc
+++ b/src/ast/variable_decl_statement.cc
@@ -31,7 +31,7 @@
VariableDeclStatement::~VariableDeclStatement() = default;
VariableDeclStatement* VariableDeclStatement::Clone(CloneContext* ctx) const {
- return ctx->mod->create<VariableDeclStatement>(ctx->Clone(source()),
+ return ctx->dst->create<VariableDeclStatement>(ctx->Clone(source()),
ctx->Clone(variable_));
}
diff --git a/src/ast/workgroup_decoration.cc b/src/ast/workgroup_decoration.cc
index 1c82475..b6e6702 100644
--- a/src/ast/workgroup_decoration.cc
+++ b/src/ast/workgroup_decoration.cc
@@ -45,7 +45,7 @@
}
WorkgroupDecoration* WorkgroupDecoration::Clone(CloneContext* ctx) const {
- return ctx->mod->create<WorkgroupDecoration>(ctx->Clone(source()), x_, y_,
+ return ctx->dst->create<WorkgroupDecoration>(ctx->Clone(source()), x_, y_,
z_);
}
diff --git a/src/clone_context.cc b/src/clone_context.cc
index 2244411..1eb8833 100644
--- a/src/clone_context.cc
+++ b/src/clone_context.cc
@@ -19,11 +19,11 @@
namespace tint {
CloneContext::CloneContext(ast::Module* to, ast::Module const* from)
- : mod(to), src(from) {}
+ : dst(to), src(from) {}
CloneContext::~CloneContext() = default;
Symbol CloneContext::Clone(const Symbol& s) const {
- return mod->RegisterSymbol(src->SymbolToName(s));
+ return dst->RegisterSymbol(src->SymbolToName(s));
}
void CloneContext::Clone() {
diff --git a/src/clone_context.h b/src/clone_context.h
index 103127c..9a0cd55 100644
--- a/src/clone_context.h
+++ b/src/clone_context.h
@@ -42,7 +42,7 @@
/// Destructor
~CloneContext();
- /// Clones the Node or type::Type `a` into the module #mod if `a` is not
+ /// Clones the Node or type::Type `a` into the module #dst if `a` is not
/// null. If `a` is null, then Clone() returns null. If `a` has been cloned
/// already by this CloneContext then the same cloned pointer is returned.
///
@@ -76,7 +76,7 @@
return static_cast<T*>(c);
}
- /// Clones the Source `s` into `mod`
+ /// Clones the Source `s` into `dst`
/// TODO(bclayton) - Currently this 'clone' is a shallow copy. If/when
/// `Source.File`s are owned by the `Module` this should make a copy of the
/// file.
@@ -84,7 +84,7 @@
/// @return the cloned source
Source Clone(const Source& s) const { return s; }
- /// Clones the Symbol `s` into `mod`
+ /// Clones the Symbol `s` into `dst`
///
/// The Symbol `s` must be owned by the module #src.
///
@@ -92,7 +92,7 @@
/// @return the cloned source
Symbol Clone(const Symbol& s) const;
- /// Clones each of the elements of the vector `v` into the module #mod->
+ /// Clones each of the elements of the vector `v` into the module #dst->
///
/// All the elements of the vector `v` must be owned by the module #src.
///
@@ -127,7 +127,7 @@
/// // Replace all ast::UintLiterals with the number 42
/// CloneCtx ctx(&out, in)
/// .ReplaceAll([&] (CloneContext* ctx, ast::UintLiteral* l) {
- /// return ctx->mod->create<ast::UintLiteral>(ctx->Clone(l->source()),
+ /// return ctx->dst->create<ast::UintLiteral>(ctx->Clone(l->source()),
/// ctx->Clone(l->type()),
/// 42);
/// }).Clone();
@@ -147,11 +147,11 @@
return *this;
}
- /// Clone performs the clone of the entire module #src to #mod.
+ /// Clone performs the clone of the entire module #src to #dst.
void Clone();
/// The target module to clone into.
- ast::Module* const mod;
+ ast::Module* const dst;
/// The source module to clone from.
ast::Module const* const src;
diff --git a/src/clone_context_test.cc b/src/clone_context_test.cc
index a3718a3..a0f378f 100644
--- a/src/clone_context_test.cc
+++ b/src/clone_context_test.cc
@@ -29,7 +29,7 @@
Cloneable* c = nullptr;
Cloneable* Clone(CloneContext* ctx) const override {
- auto* out = ctx->mod->create<Cloneable>();
+ auto* out = ctx->dst->create<Cloneable>();
out->a = ctx->Clone(a);
out->b = ctx->Clone(b);
out->c = ctx->Clone(c);
diff --git a/src/transform/bound_array_accessors.cc b/src/transform/bound_array_accessors.cc
index 0c2c290..f94a953 100644
--- a/src/transform/bound_array_accessors.cc
+++ b/src/transform/bound_array_accessors.cc
@@ -75,7 +75,7 @@
return nullptr;
}
- ast::Builder b(ctx->mod);
+ ast::Builder b(ctx->dst);
using u32 = ast::Builder::u32;
uint32_t size = 0;
diff --git a/src/transform/first_index_offset.cc b/src/transform/first_index_offset.cc
index 2d74c11..b2946f0 100644
--- a/src/transform/first_index_offset.cc
+++ b/src/transform/first_index_offset.cc
@@ -64,9 +64,9 @@
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 @@
// 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 @@
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);
diff --git a/src/transform/transform.cc b/src/transform/transform.cc
index 54766a7..29f346b 100644
--- a/src/transform/transform.cc
+++ b/src/transform/transform.cc
@@ -31,10 +31,10 @@
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()));
}
diff --git a/src/type/access_control_type.cc b/src/type/access_control_type.cc
index 9f8a074..d694d8b 100644
--- a/src/type/access_control_type.cc
+++ b/src/type/access_control_type.cc
@@ -59,7 +59,7 @@
}
AccessControl* AccessControl::Clone(CloneContext* ctx) const {
- return ctx->mod->create<AccessControl>(access_, ctx->Clone(subtype_));
+ return ctx->dst->create<AccessControl>(access_, ctx->Clone(subtype_));
}
} // namespace type
diff --git a/src/type/alias_type.cc b/src/type/alias_type.cc
index 0826e04..a7253dd 100644
--- a/src/type/alias_type.cc
+++ b/src/type/alias_type.cc
@@ -46,7 +46,7 @@
}
Alias* Alias::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Alias>(ctx->Clone(symbol()), ctx->Clone(subtype_));
+ return ctx->dst->create<Alias>(ctx->Clone(symbol()), ctx->Clone(subtype_));
}
} // namespace type
diff --git a/src/type/array_type.cc b/src/type/array_type.cc
index d5604a8..881b90b 100644
--- a/src/type/array_type.cc
+++ b/src/type/array_type.cc
@@ -96,7 +96,7 @@
}
Array* Array::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Array>(ctx->Clone(subtype_), size_,
+ return ctx->dst->create<Array>(ctx->Clone(subtype_), size_,
ctx->Clone(decorations()));
}
diff --git a/src/type/bool_type.cc b/src/type/bool_type.cc
index 1949064..5f4eb3b 100644
--- a/src/type/bool_type.cc
+++ b/src/type/bool_type.cc
@@ -33,7 +33,7 @@
}
Bool* Bool::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Bool>();
+ return ctx->dst->create<Bool>();
}
} // namespace type
diff --git a/src/type/depth_texture_type.cc b/src/type/depth_texture_type.cc
index 7b0eddf..a5b39e8 100644
--- a/src/type/depth_texture_type.cc
+++ b/src/type/depth_texture_type.cc
@@ -52,7 +52,7 @@
}
DepthTexture* DepthTexture::Clone(CloneContext* ctx) const {
- return ctx->mod->create<DepthTexture>(dim());
+ return ctx->dst->create<DepthTexture>(dim());
}
} // namespace type
diff --git a/src/type/f32_type.cc b/src/type/f32_type.cc
index 40820a3..ad6ff66 100644
--- a/src/type/f32_type.cc
+++ b/src/type/f32_type.cc
@@ -41,7 +41,7 @@
}
F32* F32::Clone(CloneContext* ctx) const {
- return ctx->mod->create<F32>();
+ return ctx->dst->create<F32>();
}
} // namespace type
diff --git a/src/type/i32_type.cc b/src/type/i32_type.cc
index 947fe3c..cac2b56 100644
--- a/src/type/i32_type.cc
+++ b/src/type/i32_type.cc
@@ -41,7 +41,7 @@
}
I32* I32::Clone(CloneContext* ctx) const {
- return ctx->mod->create<I32>();
+ return ctx->dst->create<I32>();
}
} // namespace type
diff --git a/src/type/matrix_type.cc b/src/type/matrix_type.cc
index 6726cc8..9f01810 100644
--- a/src/type/matrix_type.cc
+++ b/src/type/matrix_type.cc
@@ -56,7 +56,7 @@
}
Matrix* Matrix::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Matrix>(ctx->Clone(subtype_), rows_, columns_);
+ return ctx->dst->create<Matrix>(ctx->Clone(subtype_), rows_, columns_);
}
} // namespace type
diff --git a/src/type/multisampled_texture_type.cc b/src/type/multisampled_texture_type.cc
index cef1664..22b4fe3 100644
--- a/src/type/multisampled_texture_type.cc
+++ b/src/type/multisampled_texture_type.cc
@@ -41,7 +41,7 @@
}
MultisampledTexture* MultisampledTexture::Clone(CloneContext* ctx) const {
- return ctx->mod->create<MultisampledTexture>(dim(), ctx->Clone(type_));
+ return ctx->dst->create<MultisampledTexture>(dim(), ctx->Clone(type_));
}
} // namespace type
diff --git a/src/type/pointer_type.cc b/src/type/pointer_type.cc
index a012152..825bd02 100644
--- a/src/type/pointer_type.cc
+++ b/src/type/pointer_type.cc
@@ -36,7 +36,7 @@
Pointer::~Pointer() = default;
Pointer* Pointer::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Pointer>(ctx->Clone(subtype_), storage_class_);
+ return ctx->dst->create<Pointer>(ctx->Clone(subtype_), storage_class_);
}
} // namespace type
diff --git a/src/type/sampled_texture_type.cc b/src/type/sampled_texture_type.cc
index f0cdf90..1aab1ab 100644
--- a/src/type/sampled_texture_type.cc
+++ b/src/type/sampled_texture_type.cc
@@ -41,7 +41,7 @@
}
SampledTexture* SampledTexture::Clone(CloneContext* ctx) const {
- return ctx->mod->create<SampledTexture>(dim(), ctx->Clone(type_));
+ return ctx->dst->create<SampledTexture>(dim(), ctx->Clone(type_));
}
} // namespace type
diff --git a/src/type/sampler_type.cc b/src/type/sampler_type.cc
index 310e80e..139bea1 100644
--- a/src/type/sampler_type.cc
+++ b/src/type/sampler_type.cc
@@ -46,7 +46,7 @@
}
Sampler* Sampler::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Sampler>(kind_);
+ return ctx->dst->create<Sampler>(kind_);
}
} // namespace type
diff --git a/src/type/storage_texture_type.cc b/src/type/storage_texture_type.cc
index 7e55cad..9eb69f2 100644
--- a/src/type/storage_texture_type.cc
+++ b/src/type/storage_texture_type.cc
@@ -163,7 +163,7 @@
}
StorageTexture* StorageTexture::Clone(CloneContext* ctx) const {
- return ctx->mod->create<StorageTexture>(dim(), image_format_);
+ return ctx->dst->create<StorageTexture>(dim(), image_format_);
}
} // namespace type
diff --git a/src/type/struct_type.cc b/src/type/struct_type.cc
index d6d4d3e..99ddc87 100644
--- a/src/type/struct_type.cc
+++ b/src/type/struct_type.cc
@@ -83,7 +83,7 @@
}
Struct* Struct::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Struct>(ctx->Clone(symbol()), ctx->Clone(struct_));
+ return ctx->dst->create<Struct>(ctx->Clone(symbol()), ctx->Clone(struct_));
}
} // namespace type
diff --git a/src/type/u32_type.cc b/src/type/u32_type.cc
index e943505..be514fd 100644
--- a/src/type/u32_type.cc
+++ b/src/type/u32_type.cc
@@ -41,7 +41,7 @@
}
U32* U32::Clone(CloneContext* ctx) const {
- return ctx->mod->create<U32>();
+ return ctx->dst->create<U32>();
}
} // namespace type
diff --git a/src/type/vector_type.cc b/src/type/vector_type.cc
index 72c9f2a..624e81d 100644
--- a/src/type/vector_type.cc
+++ b/src/type/vector_type.cc
@@ -53,7 +53,7 @@
}
Vector* Vector::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Vector>(ctx->Clone(subtype_), size_);
+ return ctx->dst->create<Vector>(ctx->Clone(subtype_), size_);
}
} // namespace type
diff --git a/src/type/void_type.cc b/src/type/void_type.cc
index b6c4408..92a46dd 100644
--- a/src/type/void_type.cc
+++ b/src/type/void_type.cc
@@ -33,7 +33,7 @@
}
Void* Void::Clone(CloneContext* ctx) const {
- return ctx->mod->create<Void>();
+ return ctx->dst->create<Void>();
}
} // namespace type