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>
This commit is contained in:
Ben Clayton 2021-04-20 18:11:51 +00:00 committed by Commit Bot service account
parent 83116d298c
commit 5b3d88b748
2 changed files with 15 additions and 4 deletions

View File

@ -207,10 +207,14 @@ bool Resolver::ResolveInternal() {
for (auto* node : builder_->ASTNodes().Objects()) { for (auto* node : builder_->ASTNodes().Objects()) {
if (marked_.count(node) == 0) { if (marked_.count(node) == 0) {
if (node->Is<ast::AccessDecoration>()) { if (node->IsAnyOf<ast::AccessDecoration, ast::StrideDecoration>()) {
// These are generated by the WGSL parser, used to build // TODO(crbug.com/tint/724) - Remove once tint:724 is complete.
// sem::AccessControls and then leaked. // ast::AccessDecorations are generated by the WGSL parser, used to
// Once we introduce AST types, this should be fixed. // 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; continue;
} }
TINT_ICE(diagnostics_) << "AST node '" << node->TypeInfo().name TINT_ICE(diagnostics_) << "AST node '" << node->TypeInfo().name

View File

@ -1626,6 +1626,13 @@ TEST_F(ResolverTest, Function_EntryPoints_LinearTime) {
ASSERT_TRUE(r()->Resolve()) << r()->error(); 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) { TEST_F(ResolverTest, ASTNodeNotReached) {
EXPECT_FATAL_FAILURE( EXPECT_FATAL_FAILURE(
{ {