resolver: Fix for ICE: node not reached by the resolver More of a workaround. Will be properly fixed by tint:724 . Fixed: tint:728 Change-Id: If4887a781106010d12209365f36f27b493a9f173 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48422 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/resolver/resolver.cc b/src/resolver/resolver.cc index ff7f50c..947dfef 100644 --- a/src/resolver/resolver.cc +++ b/src/resolver/resolver.cc
@@ -207,10 +207,14 @@ for (auto* node : builder_->ASTNodes().Objects()) { if (marked_.count(node) == 0) { - if (node->Is<ast::AccessDecoration>()) { - // These are generated by the WGSL parser, used to build - // sem::AccessControls and then leaked. - // Once we introduce AST types, this should be fixed. + if (node->IsAnyOf<ast::AccessDecoration, ast::StrideDecoration>()) { + // TODO(crbug.com/tint/724) - Remove once tint:724 is complete. + // ast::AccessDecorations are generated by the WGSL parser, used to + // build sem::AccessControls and then leaked. + // ast::StrideDecoration are used to build a sem::ArrayTypes, but + // multiple arrays of the same stride, size and element type are + // currently de-duplicated by the type manager, and we leak these + // decorations. continue; } TINT_ICE(diagnostics_) << "AST node '" << node->TypeInfo().name
diff --git a/src/resolver/resolver_test.cc b/src/resolver/resolver_test.cc index 028d51a..b00a199 100644 --- a/src/resolver/resolver_test.cc +++ b/src/resolver/resolver_test.cc
@@ -1626,6 +1626,13 @@ ASSERT_TRUE(r()->Resolve()) << r()->error(); } +// Test for crbug.com/tint/728 +TEST_F(ResolverTest, ASTNodesAreReached) { + Structure("A", {Member("x", ty.array<f32, 4>(4))}); + Structure("B", {Member("x", ty.array<f32, 4>(4))}); + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + TEST_F(ResolverTest, ASTNodeNotReached) { EXPECT_FATAL_FAILURE( {