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>
This commit is contained in:
James Price 2021-12-09 15:45:03 +00:00
parent c7c80c053d
commit 7c0693d9fe
5 changed files with 1 additions and 17 deletions

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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) {

View File

@ -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;