Add Source to sem::Struct

This CL adds a Source to the sem::Struct. The uses of
struct->Declaration()->source now use the source stored directly on the
struct.

Bug: tint:1718
Change-Id: I860c67764f85d98b3f655247e18f93fa0fef9436
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112447
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair
2022-12-01 16:25:25 +00:00
committed by Dawn LUCI CQ
parent 8954189545
commit f745e4e2bf
9 changed files with 34 additions and 25 deletions

View File

@@ -122,8 +122,8 @@ TEST_F(CreateASTTypeForTest, AliasedArrayWithComplexOverrideLength) {
TEST_F(CreateASTTypeForTest, Struct) {
auto* str = create([](ProgramBuilder& b) {
auto* decl = b.Structure("S", {});
return b.create<sem::Struct>(decl, decl->name, sem::StructMemberList{}, 4u /* align */,
4u /* size */, 4u /* size_no_padding */);
return b.create<sem::Struct>(decl, decl->source, decl->name, sem::StructMemberList{},
4u /* align */, 4u /* size */, 4u /* size_no_padding */);
});
ASSERT_TRUE(str->Is<ast::TypeName>());
EXPECT_EQ(ast_type_builder.Symbols().NameFor(str->As<ast::TypeName>()->name), "S");