mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Fix all tests that shared AST nodes
This is not valid. Will become an ICE. Bug: tint:469 Change-Id: I02c0eea16daf7d83f4d6c251e06d9cac0dfd7ce4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47777 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
0ecea57a8a
commit
a0cf62f415
@@ -69,11 +69,7 @@ ast::ArrayAccessorExpression* BoundArrayAccessors::Transform(
|
||||
|
||||
if (size == 0) {
|
||||
if (is_arr) {
|
||||
// Call Cloneable::Clone() instead of CloneContext::Clone() to ensure the
|
||||
// AST node is duplicated. CloneContext::Clone() will ensure that repeated
|
||||
// calls with the same pointer return the *same* cloned node - in this
|
||||
// case we actually want two copies.
|
||||
auto* arr = static_cast<ast::Expression*>(expr->array()->Clone(ctx));
|
||||
auto* arr = ctx->Clone(expr->array());
|
||||
auto* arr_len = b.Call("arrayLength", arr);
|
||||
auto* limit = b.Sub(arr_len, b.Expr(1u));
|
||||
new_idx = b.Call("min", b.Construct<u32>(ctx->Clone(old_idx)), limit);
|
||||
|
||||
@@ -222,7 +222,10 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap&) {
|
||||
for (auto* ret : sem_func->ReturnStatements()) {
|
||||
auto* ret_sem = ctx.src->Sem().Get(ret);
|
||||
// Reconstruct the return value using the newly created struct.
|
||||
auto* new_ret_value = ctx.Clone(ret->value());
|
||||
std::function<ast::Expression*()> new_ret_value = [&ctx, ret] {
|
||||
return ctx.Clone(ret->value());
|
||||
};
|
||||
|
||||
ast::ExpressionList ret_values;
|
||||
if (ret_type->Is<type::Struct>()) {
|
||||
if (!ret->value()->Is<ast::IdentifierExpression>()) {
|
||||
@@ -230,17 +233,17 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap&) {
|
||||
// re-evaluating it multiple times.
|
||||
auto temp = ctx.dst->Symbols().New();
|
||||
auto* temp_var = ctx.dst->Decl(
|
||||
ctx.dst->Const(temp, ctx.Clone(ret_type), new_ret_value));
|
||||
ctx.dst->Const(temp, ctx.Clone(ret_type), new_ret_value()));
|
||||
ctx.InsertBefore(ret_sem->Block()->statements(), ret, temp_var);
|
||||
new_ret_value = ctx.dst->Expr(temp);
|
||||
new_ret_value = [&ctx, temp] { return ctx.dst->Expr(temp); };
|
||||
}
|
||||
|
||||
for (auto* member : new_struct_members) {
|
||||
ret_values.push_back(
|
||||
ctx.dst->MemberAccessor(new_ret_value, member->symbol()));
|
||||
ctx.dst->MemberAccessor(new_ret_value(), member->symbol()));
|
||||
}
|
||||
} else {
|
||||
ret_values.push_back(new_ret_value);
|
||||
ret_values.push_back(new_ret_value());
|
||||
}
|
||||
|
||||
auto* new_ret = ctx.dst->create<ast::ReturnStatement>(
|
||||
|
||||
Reference in New Issue
Block a user