From 7c0693d9fe92244b3ae440c326d5c823ea71cb7e Mon Sep 17 00:00:00 2001 From: James Price <jrprice@google.com> Date: Thu, 9 Dec 2021 15:45:03 +0000 Subject: [PATCH] Remove {ast,sem}::Struct::IsBlockDecorated() No code should rely on the presence of the block attribute, which will soon be deprecated and removed. Bug: tint:1324 Change-Id: I868d5e795e66a93bdf99b94389c07dec98cb0ec2 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72084 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> --- src/ast/struct.cc | 4 ---- src/ast/struct.h | 3 --- src/inspector/inspector.cc | 6 +----- src/reader/wgsl/parser_impl_global_decl_test.cc | 2 -- src/sem/struct.h | 3 --- 5 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/ast/struct.cc b/src/ast/struct.cc index 7868caa487..a5f166f1af 100644 --- a/src/ast/struct.cc +++ b/src/ast/struct.cc @@ -44,10 +44,6 @@ Struct::Struct(Struct&&) = default; Struct::~Struct() = default; -bool Struct::IsBlockDecorated() const { - return HasDecoration<StructBlockDecoration>(decorations); -} - const Struct* Struct::Clone(CloneContext* ctx) const { // Clone arguments outside of create() call to have deterministic ordering auto src = ctx->Clone(source); diff --git a/src/ast/struct.h b/src/ast/struct.h index f3a08c9307..dd3ffa2360 100644 --- a/src/ast/struct.h +++ b/src/ast/struct.h @@ -44,9 +44,6 @@ class Struct : public Castable<Struct, TypeDecl> { ~Struct() override; - /// @returns true if the struct is block decorated - bool IsBlockDecorated() const; - /// Clones this node and all transitive child nodes using the `CloneContext` /// `ctx`. /// @param ctx the clone context diff --git a/src/inspector/inspector.cc b/src/inspector/inspector.cc index 5fead48540..c011a8e5c4 100644 --- a/src/inspector/inspector.cc +++ b/src/inspector/inspector.cc @@ -318,7 +318,7 @@ uint32_t Inspector::GetStorageSize(const std::string& entry_point) { auto* func_sem = program_->Sem().Get(func); for (auto& ruv : func_sem->TransitivelyReferencedUniformVariables()) { const sem::Struct* s = ruv.first->Type()->UnwrapRef()->As<sem::Struct>(); - if (s && s->IsBlockDecorated()) { + if (s) { size += s->Size(); } } @@ -382,10 +382,6 @@ std::vector<ResourceBinding> Inspector::GetUniformBufferResourceBindings( continue; } - if (!str->IsBlockDecorated()) { - continue; - } - ResourceBinding entry; entry.resource_type = ResourceBinding::ResourceType::kUniformBuffer; entry.bind_group = binding_info.group->value; diff --git a/src/reader/wgsl/parser_impl_global_decl_test.cc b/src/reader/wgsl/parser_impl_global_decl_test.cc index 97ec4878db..ff21c57df2 100644 --- a/src/reader/wgsl/parser_impl_global_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_decl_test.cc @@ -182,7 +182,6 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) { auto* str = t->As<ast::Struct>(); EXPECT_EQ(str->name, program.Symbols().Get("A")); EXPECT_EQ(str->members.size(), 1u); - EXPECT_FALSE(str->IsBlockDecorated()); const auto* ty = str->members[0]->type; ASSERT_TRUE(ty->Is<ast::Array>()); @@ -209,7 +208,6 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) { auto* str = t->As<ast::Struct>(); EXPECT_EQ(str->name, program.Symbols().Get("A")); EXPECT_EQ(str->members.size(), 1u); - EXPECT_TRUE(str->IsBlockDecorated()); } TEST_F(ParserImplTest, GlobalDecl_Struct_Invalid) { diff --git a/src/sem/struct.h b/src/sem/struct.h index 3e3b62d502..d7eab4bd2e 100644 --- a/src/sem/struct.h +++ b/src/sem/struct.h @@ -142,9 +142,6 @@ class Struct : public Castable<Struct, Type> { return pipeline_stage_uses_; } - /// @returns true if the struct has a block decoration - bool IsBlockDecorated() const { return declaration_->IsBlockDecorated(); } - /// @returns the name for the type std::string type_name() const override;