ast: Remove StructMember constructor that doesn't take a Source

Parsers need fixing up.

Bug: tint:396
Bug: tint:390
Change-Id: Ie9f8f7428d2308c3b1a9a8d2137e2e3c6d1d13e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35162
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2020-12-12 12:18:04 +00:00 committed by Commit Bot service account
parent bbefff63a3
commit 4543d1a232
33 changed files with 275 additions and 259 deletions

View File

@ -23,11 +23,6 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::StructMember);
namespace tint {
namespace ast {
StructMember::StructMember(const std::string& name,
type::Type* type,
StructMemberDecorationList decorations)
: Base(), name_(name), type_(type), decorations_(std::move(decorations)) {}
StructMember::StructMember(const Source& source,
const std::string& name,
type::Type* type,

View File

@ -32,13 +32,6 @@ namespace ast {
class StructMember : public Castable<StructMember, Node> {
public:
/// Create a new struct member statement
/// @param name The struct member name
/// @param type The struct member type
/// @param decorations The struct member decorations
StructMember(const std::string& name,
type::Type* type,
StructMemberDecorationList decorations);
/// Create a new struct member statement
/// @param source The input source for the struct member statement
/// @param name The struct member name
/// @param type The struct member type

View File

@ -32,7 +32,7 @@ TEST_F(StructMemberTest, Creation) {
StructMemberDecorationList decorations;
decorations.emplace_back(create<StructMemberOffsetDecoration>(4, Source{}));
StructMember st{"a", &i32, decorations};
StructMember st{Source{}, "a", &i32, decorations};
EXPECT_EQ(st.name(), "a");
EXPECT_EQ(st.type(), &i32);
EXPECT_EQ(st.decorations().size(), 1u);
@ -59,18 +59,18 @@ TEST_F(StructMemberTest, CreationWithSource) {
TEST_F(StructMemberTest, IsValid) {
type::I32 i32;
StructMember st{"a", &i32, {}};
StructMember st{Source{}, "a", &i32, {}};
EXPECT_TRUE(st.IsValid());
}
TEST_F(StructMemberTest, IsValid_EmptyName) {
type::I32 i32;
StructMember st{"", &i32, {}};
StructMember st{Source{}, "", &i32, {}};
EXPECT_FALSE(st.IsValid());
}
TEST_F(StructMemberTest, IsValid_NullType) {
StructMember st{"a", nullptr, {}};
StructMember st{Source{}, "a", nullptr, {}};
EXPECT_FALSE(st.IsValid());
}
@ -80,7 +80,7 @@ TEST_F(StructMemberTest, IsValid_Null_Decoration) {
decorations.emplace_back(create<StructMemberOffsetDecoration>(4, Source{}));
decorations.push_back(nullptr);
StructMember st{"a", &i32, decorations};
StructMember st{Source{}, "a", &i32, decorations};
EXPECT_FALSE(st.IsValid());
}
@ -89,7 +89,7 @@ TEST_F(StructMemberTest, ToStr) {
StructMemberDecorationList decorations;
decorations.emplace_back(create<StructMemberOffsetDecoration>(4, Source{}));
StructMember st{"a", &i32, decorations};
StructMember st{Source{}, "a", &i32, decorations};
std::ostringstream out;
st.to_str(out, 2);
EXPECT_EQ(out.str(), " StructMember{[[ offset 4 ]] a: __i32}\n");
@ -97,7 +97,7 @@ TEST_F(StructMemberTest, ToStr) {
TEST_F(StructMemberTest, ToStrNoDecorations) {
type::I32 i32;
StructMember st{"a", &i32, {}};
StructMember st{Source{}, "a", &i32, {}};
std::ostringstream out;
st.to_str(out, 2);
EXPECT_EQ(out.str(), " StructMember{a: __i32}\n");

View File

@ -33,7 +33,7 @@ TEST_F(StructTest, Creation) {
type::I32 i32;
StructMemberList members;
members.push_back(
create<StructMember>("a", &i32, StructMemberDecorationList()));
create<StructMember>(Source{}, "a", &i32, StructMemberDecorationList()));
Struct s{members};
EXPECT_EQ(s.members().size(), 1u);
@ -49,7 +49,7 @@ TEST_F(StructTest, Creation_WithDecorations) {
StructMemberList members;
members.push_back(
create<StructMember>("a", &i32, StructMemberDecorationList()));
create<StructMember>(Source{}, "a", &i32, StructMemberDecorationList()));
StructDecorationList decos;
decos.push_back(create<StructBlockDecoration>(Source{}));
@ -69,7 +69,7 @@ TEST_F(StructTest, CreationWithSourceAndDecorations) {
StructMemberList members;
members.emplace_back(
create<StructMember>("a", &i32, StructMemberDecorationList()));
create<StructMember>(Source{}, "a", &i32, StructMemberDecorationList()));
StructDecorationList decos;
decos.push_back(create<StructBlockDecoration>(Source{}));
@ -96,7 +96,7 @@ TEST_F(StructTest, IsValid_Null_StructMember) {
StructMemberList members;
members.push_back(
create<StructMember>("a", &i32, StructMemberDecorationList()));
create<StructMember>(Source{}, "a", &i32, StructMemberDecorationList()));
members.push_back(nullptr);
Struct s{members};
@ -108,7 +108,7 @@ TEST_F(StructTest, IsValid_Invalid_StructMember) {
StructMemberList members;
members.push_back(
create<StructMember>("", &i32, StructMemberDecorationList()));
create<StructMember>(Source{}, "", &i32, StructMemberDecorationList()));
Struct s{members};
EXPECT_FALSE(s.IsValid());
@ -119,7 +119,7 @@ TEST_F(StructTest, ToStr) {
StructMemberList members;
members.emplace_back(
create<StructMember>("a", &i32, StructMemberDecorationList()));
create<StructMember>(Source{}, "a", &i32, StructMemberDecorationList()));
StructDecorationList decos;
decos.push_back(create<StructBlockDecoration>(Source{}));

View File

@ -126,11 +126,11 @@ TEST_F(AccessControlTest, MinBufferBindingSizeStruct) {
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
deco = StructMemberDecorationList();
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
StructDecorationList decos;
@ -170,12 +170,12 @@ TEST_F(AccessControlTest, BaseAlignmentStruct) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;

View File

@ -198,12 +198,12 @@ TEST_F(AliasTest, MinBufferBindingSizeStruct) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -247,12 +247,12 @@ TEST_F(AliasTest, BaseAlignmentStruct) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;

View File

@ -81,12 +81,12 @@ TEST_F(StructTest, MinBufferBindingSize) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -106,17 +106,17 @@ TEST_F(StructTest, MinBufferBindingSizeArray) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &arr, deco));
members.push_back(create<StructMember>(Source{}, "bar", &arr, deco));
}
StructDecorationList decos;
@ -137,17 +137,17 @@ TEST_F(StructTest, MinBufferBindingSizeRuntimeArray) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -165,7 +165,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec2) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec2, deco));
members.push_back(create<StructMember>(Source{}, "foo", &vec2, deco));
}
StructDecorationList decos;
@ -184,7 +184,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec3) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec3, deco));
members.push_back(create<StructMember>(Source{}, "foo", &vec3, deco));
}
StructDecorationList decos;
@ -204,7 +204,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec4) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec4, deco));
members.push_back(create<StructMember>(Source{}, "foo", &vec4, deco));
}
StructDecorationList decos;
@ -223,12 +223,12 @@ TEST_F(StructTest, BaseAlignment) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -247,17 +247,17 @@ TEST_F(StructTest, BaseAlignmentArray) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &arr, deco));
members.push_back(create<StructMember>(Source{}, "bar", &arr, deco));
}
StructDecorationList decos;
@ -276,17 +276,17 @@ TEST_F(StructTest, BaseAlignmentRuntimeArray) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &u32, deco));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -303,7 +303,7 @@ TEST_F(StructTest, BaseAlignmentVec2) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec2, deco));
members.push_back(create<StructMember>(Source{}, "foo", &vec2, deco));
}
StructDecorationList decos;
@ -321,7 +321,7 @@ TEST_F(StructTest, BaseAlignmentVec3) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec3, deco));
members.push_back(create<StructMember>(Source{}, "foo", &vec3, deco));
}
StructDecorationList decos;
@ -339,7 +339,7 @@ TEST_F(StructTest, BaseAlignmentVec4) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec4, deco));
members.push_back(create<StructMember>(Source{}, "foo", &vec4, deco));
}
StructDecorationList decos;

View File

@ -300,7 +300,7 @@ class InspectorHelper {
create<ast::StructMemberOffsetDecoration>(offset, Source{}));
members.push_back(create<ast::StructMember>(
StructMemberName(members.size(), type), type, deco));
Source{}, StructMemberName(members.size(), type), type, deco));
}
ast::StructDecorationList decos;
@ -1449,7 +1449,8 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) {
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>(
StructMemberName(members.size(), i32_type()), i32_type(), deco));
Source{}, StructMemberName(members.size(), i32_type()), i32_type(),
deco));
ast::StructDecorationList decos;

View File

@ -940,8 +940,9 @@ ast::type::Type* ParserImpl::ConvertType(
++num_non_writable_members;
}
const auto member_name = namer_.GetMemberName(type_id, member_index);
auto* ast_struct_member = create<ast::StructMember>(
member_name, ast_member_ty, std::move(ast_member_decorations));
auto* ast_struct_member =
create<ast::StructMember>(Source{}, member_name, ast_member_ty,
std::move(ast_member_decorations));
ast_members.push_back(ast_struct_member);
}

View File

@ -85,7 +85,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_InvalidType) {
TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_Read) {
ast::type::I32 i32;
ast::StructMember mem("a", &i32, ast::StructMemberDecorationList{});
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
ast::StructMemberList members;
members.push_back(&mem);
@ -111,7 +111,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_Read) {
TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_ReadWrite) {
ast::type::I32 i32;
ast::StructMember mem("a", &i32, ast::StructMemberDecorationList{});
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
ast::StructMemberList members;
members.push_back(&mem);
@ -137,7 +137,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_ReadWrite) {
TEST_F(ParserImplTest, VariableIdentDecl_MultipleAccessDecoFail) {
ast::type::I32 i32;
ast::StructMember mem("a", &i32, ast::StructMemberDecorationList{});
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
ast::StructMemberList members;
members.push_back(&mem);
@ -160,7 +160,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_MultipleAccessDecoFail) {
TEST_F(ParserImplTest, VariableIdentDecl_MultipleAccessDeco_MultiBlock_Fail) {
ast::type::I32 i32;
ast::StructMember mem("a", &i32, ast::StructMemberDecorationList{});
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
ast::StructMemberList members;
members.push_back(&mem);
@ -199,7 +199,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_AccessDecoIllegalValue) {
TEST_F(ParserImplTest, VariableIdentDecl_NonAccessDecoFail) {
ast::type::I32 i32;
ast::StructMember mem("a", &i32, ast::StructMemberDecorationList{});
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
ast::StructMemberList members;
members.push_back(&mem);

View File

@ -204,8 +204,8 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
ast::StructMemberDecorationList member_dec;
member_dec.push_back(
mod->create<ast::StructMemberOffsetDecoration>(offset, Source{}));
members.push_back(mod->create<ast::StructMember>(kFirstVertexName, u32_type,
std::move(member_dec)));
members.push_back(mod->create<ast::StructMember>(
Source{}, kFirstVertexName, u32_type, std::move(member_dec)));
vertex_index_offset_ = offset;
offset += 4;
}
@ -215,7 +215,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
member_dec.push_back(
mod->create<ast::StructMemberOffsetDecoration>(offset, Source{}));
members.push_back(mod->create<ast::StructMember>(
kFirstInstanceName, u32_type, std::move(member_dec)));
Source{}, kFirstInstanceName, u32_type, std::move(member_dec)));
instance_index_offset_ = offset;
offset += 4;
}

View File

@ -258,7 +258,7 @@ void VertexPulling::State::AddVertexStorageBuffers() {
mod->create<ast::StructMemberOffsetDecoration>(0u, Source{}));
members.push_back(mod->create<ast::StructMember>(
kStructBufferName, internal_array_type, std::move(member_dec)));
Source{}, kStructBufferName, internal_array_type, std::move(member_dec)));
ast::StructDecorationList decos;
decos.push_back(mod->create<ast::StructBlockDecoration>(Source{}));

View File

@ -1210,8 +1210,10 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("first_member", &i32, decos));
members.push_back(create<ast::StructMember>("second_member", &f32, decos));
members.push_back(
create<ast::StructMember>(Source{}, "first_member", &i32, decos));
members.push_back(
create<ast::StructMember>(Source{}, "second_member", &f32, decos));
auto* strct = create<ast::Struct>(members);
@ -1251,8 +1253,10 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct_Alias) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("first_member", &i32, decos));
members.push_back(create<ast::StructMember>("second_member", &f32, decos));
members.push_back(
create<ast::StructMember>(Source{}, "first_member", &i32, decos));
members.push_back(
create<ast::StructMember>(Source{}, "second_member", &f32, decos));
auto* strct = create<ast::Struct>(members);
@ -1381,7 +1385,7 @@ TEST_F(TypeDeterminerTest, Expr_Accessor_MultiLevel) {
ast::StructMemberDecorationList decos;
ast::StructMemberList b_members;
b_members.push_back(create<ast::StructMember>("foo", &vec4, decos));
b_members.push_back(create<ast::StructMember>(Source{}, "foo", &vec4, decos));
auto* strctB = create<ast::Struct>(b_members);
ast::type::Struct stB("B", strctB);
@ -1389,7 +1393,7 @@ TEST_F(TypeDeterminerTest, Expr_Accessor_MultiLevel) {
ast::type::Vector vecB(&stB, 3);
ast::StructMemberList a_members;
a_members.push_back(create<ast::StructMember>("mem", &vecB, decos));
a_members.push_back(create<ast::StructMember>(Source{}, "mem", &vecB, decos));
auto* strctA = create<ast::Struct>(a_members);

View File

@ -47,7 +47,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayIsLast_Pass) {
ast::StructMemberList members;
{
ast::StructMemberDecorationList deco;
members.push_back(create<ast::StructMember>("vf", &f32, deco));
members.push_back(create<ast::StructMember>(Source{}, "vf", &f32, deco));
}
{
ast::StructMemberDecorationList deco;
@ -74,7 +74,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayIsLastNoBlock_Fail) {
ast::StructMemberList members;
{
ast::StructMemberDecorationList deco;
members.push_back(create<ast::StructMember>("vf", &f32, deco));
members.push_back(create<ast::StructMember>(Source{}, "vf", &f32, deco));
}
{
ast::StructMemberDecorationList deco;
@ -109,7 +109,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayIsNotLast_Fail) {
}
{
ast::StructMemberDecorationList deco;
members.push_back(create<ast::StructMember>("vf", &f32, deco));
members.push_back(create<ast::StructMember>(Source{}, "vf", &f32, deco));
}
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));
@ -143,7 +143,7 @@ TEST_F(ValidatorTypeTest, AliasRuntimeArrayIsNotLast_Fail) {
}
{
ast::StructMemberDecorationList deco;
members.push_back(create<ast::StructMember>("a", &u32, deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &u32, deco));
}
ast::StructDecorationList decos;
@ -172,7 +172,7 @@ TEST_F(ValidatorTypeTest, AliasRuntimeArrayIsLast_Pass) {
ast::StructMemberList members;
{
ast::StructMemberDecorationList deco;
members.push_back(create<ast::StructMember>("a", &u32, deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &u32, deco));
}
{
ast::StructMemberDecorationList deco;

View File

@ -51,9 +51,10 @@ TEST_F(HlslGeneratorImplTest_Alias, EmitAlias_Struct) {
ast::type::F32 f32;
auto* str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}),
create<ast::StructMember>(Source{}, "a", &f32,
ast::StructMemberDecorationList{}),
create<ast::StructMember>(
"b", &i32,
Source{}, "b", &i32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
});

View File

@ -353,7 +353,7 @@ TEST_F(HlslGeneratorImplTest_Function,
ast::StructMemberList members;
members.push_back(create<ast::StructMember>(
"coord", &vec4, ast::StructMemberDecorationList{}));
Source{}, "coord", &vec4, ast::StructMemberDecorationList{}));
auto* str = create<ast::Struct>(members);
@ -433,11 +433,11 @@ TEST_F(HlslGeneratorImplTest_Function,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -508,11 +508,11 @@ TEST_F(HlslGeneratorImplTest_Function,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -583,11 +583,11 @@ TEST_F(HlslGeneratorImplTest_Function,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -1360,7 +1360,7 @@ TEST_F(HlslGeneratorImplTest_Function,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("d", &f32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));

View File

@ -51,7 +51,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) {
ast::StructMemberList members;
ast::StructMemberDecorationList deco;
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("mem", &f32, deco));
members.push_back(create<ast::StructMember>(Source{}, "mem", &f32, deco));
auto* strct = create<ast::Struct>(members);
@ -98,11 +98,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -151,11 +151,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -206,11 +206,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"z", &i32,
Source{}, "z", &i32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMember>(
"a", &mat,
Source{}, "a", &mat,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
});
@ -283,11 +283,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("z", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("a", &mat, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
auto* str = create<ast::Struct>(members);
@ -347,11 +347,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("z", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("a", &mat, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
auto* str = create<ast::Struct>(members);
@ -407,11 +407,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("z", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("a", &mat, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
auto* str = create<ast::Struct>(members);
@ -463,7 +463,7 @@ TEST_F(
ast::StructMemberList members;
ast::StructMemberDecorationList deco;
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &mat, deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, deco));
auto* str = create<ast::Struct>(members);
@ -515,11 +515,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("z", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
members.push_back(create<ast::StructMember>("a", &mat, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
auto* str = create<ast::Struct>(members);
@ -579,7 +579,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &ary, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &ary, a_deco));
auto* str = create<ast::Struct>(members);
@ -635,7 +635,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &ary, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &ary, a_deco));
auto* str = create<ast::Struct>(members);
@ -697,11 +697,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -758,7 +758,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &ary, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &ary, a_deco));
auto* str = create<ast::Struct>(members);
@ -816,11 +816,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -876,11 +876,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &ivec3, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &ivec3, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
members.push_back(create<ast::StructMember>("b", &fvec3, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec3, b_deco));
auto* str = create<ast::Struct>(members);
@ -932,11 +932,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &ivec3, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &ivec3, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
members.push_back(create<ast::StructMember>("b", &fvec3, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec3, b_deco));
auto* str = create<ast::Struct>(members);
@ -1004,11 +1004,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* data_str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"a", &ivec3,
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMember>(
"b", &fvec3,
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
});
@ -1022,7 +1022,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* pre_str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"c", &ary,
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
});
@ -1089,11 +1089,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* data_str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"a", &ivec3,
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMember>(
"b", &fvec3,
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
});
@ -1106,7 +1106,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* pre_str =
create<ast::Struct>(ast::StructMemberList{create<ast::StructMember>(
"c", &ary,
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})});
@ -1174,11 +1174,11 @@ TEST_F(
auto* data_str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"a", &ivec3,
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMember>(
"b", &fvec3,
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
});
@ -1192,7 +1192,7 @@ TEST_F(
auto* pre_str =
create<ast::Struct>(ast::StructMemberList{create<ast::StructMember>(
"c", &ary,
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})});
@ -1259,11 +1259,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* data_str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"a", &ivec3,
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMember>(
"b", &fvec3,
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
});
@ -1277,7 +1277,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* pre_str =
create<ast::Struct>(ast::StructMemberList{create<ast::StructMember>(
"c", &ary,
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})});
@ -1344,11 +1344,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* data_str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"a", &ivec3,
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMember>(
"b", &fvec3,
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
});
@ -1362,7 +1362,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* pre_str =
create<ast::Struct>(ast::StructMemberList{create<ast::StructMember>(
"c", &ary,
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})});
@ -1439,11 +1439,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* data_str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"a", &ivec3,
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMember>(
"b", &fvec3,
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
});
@ -1457,7 +1457,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
auto* pre_str =
create<ast::Struct>(ast::StructMemberList{create<ast::StructMember>(
"c", &ary,
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})});

View File

@ -174,12 +174,12 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -198,12 +198,12 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -221,13 +221,13 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_InjectPadding) {
decos.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(128, Source{}));
members.push_back(create<ast::StructMember>("c", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
auto* str = create<ast::Struct>(members);
@ -250,10 +250,10 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) {
ast::StructMemberList members;
members.push_back(create<ast::StructMember>(
"double", &i32, ast::StructMemberDecorationList{}));
Source{}, "double", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
members.push_back(create<ast::StructMember>("float", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "float", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -273,12 +273,12 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_WithDecoration) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));

View File

@ -54,12 +54,12 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_Struct) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &i32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
auto* str = create<ast::Struct>(members);
@ -78,12 +78,12 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_AliasStructIdent) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &i32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
auto* str = create<ast::Struct>(members);

View File

@ -365,11 +365,11 @@ TEST_F(MslGeneratorImplTest,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -449,11 +449,11 @@ TEST_F(MslGeneratorImplTest,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -962,11 +962,11 @@ TEST_F(MslGeneratorImplTest,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -1076,11 +1076,11 @@ TEST_F(MslGeneratorImplTest,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("a", &i32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -1336,7 +1336,7 @@ TEST_F(MslGeneratorImplTest,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("d", &f32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));

View File

@ -163,13 +163,13 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct) {
decos.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(128, Source{}));
members.push_back(create<ast::StructMember>("c", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
auto* str = create<ast::Struct>(members);
@ -187,26 +187,26 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct_of_struct) {
decos.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
members.push_back(create<ast::StructMember>("b", &fvec, decos));
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
members.push_back(create<ast::StructMember>("c", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
auto* inner_str = create<ast::Struct>(members);
ast::type::Struct inner_s("Inner", inner_str);
decos.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("d", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
members.push_back(create<ast::StructMember>("e", &inner_s, decos));
members.push_back(create<ast::StructMember>(Source{}, "e", &inner_s, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(64, Source{}));
members.push_back(create<ast::StructMember>("f", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "f", &f32, decos));
auto* outer_str = create<ast::Struct>(members);

View File

@ -175,12 +175,12 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -195,12 +195,12 @@ TEST_F(MslGeneratorImplTest, EmitType_StructDecl) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -220,15 +220,15 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_InjectPadding) {
auto* str = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(
"a", &i32,
Source{}, "a", &i32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
create<ast::StructMember>(
"b", &f32,
Source{}, "b", &f32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(32, Source{})}),
create<ast::StructMember>(
"c", &f32,
Source{}, "c", &f32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(128, Source{})}),
});
@ -253,10 +253,10 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_NameCollision) {
ast::StructMemberList members;
members.push_back(create<ast::StructMember>(
"main", &i32, ast::StructMemberDecorationList{}));
Source{}, "main", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
members.push_back(create<ast::StructMember>("float", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "float", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -276,12 +276,12 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithDecoration) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));

View File

@ -103,12 +103,12 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);

View File

@ -301,8 +301,8 @@ TEST_F(BuilderTest, MemberAccessor) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &f32, decos));
members.push_back(create<ast::StructMember>("b", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("my_struct", s);
@ -355,14 +355,16 @@ TEST_F(BuilderTest, MemberAccessor_Nested) {
// ident.inner.a
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "a", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "b", &f32, decos));
ast::type::Struct inner_struct("Inner", create<ast::Struct>(inner_members));
ast::StructMemberList outer_members;
outer_members.push_back(
create<ast::StructMember>("inner", &inner_struct, decos));
create<ast::StructMember>(Source{}, "inner", &inner_struct, decos));
ast::type::Struct s_type("my_struct", create<ast::Struct>(outer_members));
@ -420,15 +422,18 @@ TEST_F(BuilderTest, MemberAccessor_Nested_WithAlias) {
// ident.inner.a
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "a", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "b", &f32, decos));
ast::type::Struct inner_struct("Inner", create<ast::Struct>(inner_members));
ast::type::Alias alias(mod->RegisterSymbol("Inner"), "Inner", &inner_struct);
ast::StructMemberList outer_members;
outer_members.push_back(create<ast::StructMember>("inner", &alias, decos));
outer_members.push_back(
create<ast::StructMember>(Source{}, "inner", &alias, decos));
ast::type::Struct s_type("Outer", create<ast::Struct>(outer_members));
@ -486,14 +491,16 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_LHS) {
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "a", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "b", &f32, decos));
ast::type::Struct inner_struct("Inner", create<ast::Struct>(inner_members));
ast::StructMemberList outer_members;
outer_members.push_back(
create<ast::StructMember>("inner", &inner_struct, decos));
create<ast::StructMember>(Source{}, "inner", &inner_struct, decos));
ast::type::Struct s_type("my_struct", create<ast::Struct>(outer_members));
@ -558,14 +565,16 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_RHS) {
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "a", &f32, decos));
inner_members.push_back(
create<ast::StructMember>(Source{}, "b", &f32, decos));
ast::type::Struct inner_struct("Inner", create<ast::Struct>(inner_members));
ast::StructMemberList outer_members;
outer_members.push_back(
create<ast::StructMember>("inner", &inner_struct, decos));
create<ast::StructMember>(Source{}, "inner", &inner_struct, decos));
ast::type::Struct s_type("my_struct", create<ast::Struct>(outer_members));
@ -852,18 +861,18 @@ TEST_F(BuilderTest, Accessor_Mixed_ArrayAndMember) {
ast::StructMemberDecorationList decos;
auto* s = create<ast::Struct>(
ast::StructMemberList{create<ast::StructMember>("baz", &vec3, decos)});
auto* s = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(Source{}, "baz", &vec3, decos)});
ast::type::Struct c_type("C", s);
s = create<ast::Struct>(
ast::StructMemberList{create<ast::StructMember>("bar", &c_type, decos)});
s = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>(Source{}, "bar", &c_type, decos)});
ast::type::Struct b_type("B", s);
ast::type::Array b_ary_type(&b_type, 3, ast::ArrayDecorationList{});
s = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>("foo", &b_ary_type, decos)});
create<ast::StructMember>(Source{}, "foo", &b_ary_type, decos)});
ast::type::Struct a_type("A", s);
ast::type::Array a_ary_type(&a_type, 2, ast::ArrayDecorationList{});

View File

@ -231,8 +231,8 @@ TEST_F(BuilderTest, Assign_StructMember) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &f32, decos));
members.push_back(create<ast::StructMember>("b", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("my_struct", s);

View File

@ -943,8 +943,8 @@ TEST_F(SpvBuilderConstructorTest, Type_Array_2_Vec3) {
TEST_F(SpvBuilderConstructorTest, Type_Struct) {
ast::StructMemberDecorationList decos;
auto* s = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>("a", ty.f32, decos),
create<ast::StructMember>("b", ty.vec3<f32>(), decos),
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
create<ast::StructMember>(Source{}, "b", ty.vec3<f32>(), decos),
});
ast::type::Struct s_type("my_struct", s);
@ -1080,7 +1080,7 @@ TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Array) {
TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Struct) {
ast::StructMemberDecorationList decos;
auto* s = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>("a", ty.f32, decos),
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
});
ast::type::Struct s_type("my_struct", s);
@ -1492,8 +1492,8 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_BitCastScalars) {
TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct) {
ast::StructMemberDecorationList decos;
auto* s = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>("a", ty.f32, decos),
create<ast::StructMember>("b", ty.vec3<f32>(), decos),
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
create<ast::StructMember>(Source{}, "b", ty.vec3<f32>(), decos),
});
ast::type::Struct s_type("my_struct", s);
@ -1509,8 +1509,8 @@ TEST_F(SpvBuilderConstructorTest,
IsConstructorConst_Struct_WithIdentSubExpression) {
ast::StructMemberDecorationList decos;
auto* s = create<ast::Struct>(ast::StructMemberList{
create<ast::StructMember>("a", ty.f32, decos),
create<ast::StructMember>("b", ty.vec3<f32>(), decos),
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
create<ast::StructMember>(Source{}, "b", ty.vec3<f32>(), decos),
});
ast::type::Struct s_type("my_struct", s);

View File

@ -264,7 +264,7 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("d", &f32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));

View File

@ -530,8 +530,8 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &i32, decos));
members.push_back(create<ast::StructMember>("b", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, decos));
ast::type::Struct A("A", create<ast::Struct>(members));
ast::type::AccessControl ac{ast::AccessControl::kReadOnly, &A};
@ -567,7 +567,7 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
ast::type::Struct A("A", create<ast::Struct>(members));
ast::type::Alias B(mod->RegisterSymbol("B"), "B", &A);
@ -602,7 +602,7 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
ast::type::Struct A("A", create<ast::Struct>(members));
ast::type::AccessControl ac{ast::AccessControl::kReadOnly, &A};
@ -637,7 +637,7 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &i32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
ast::type::Struct A("A", create<ast::Struct>(members));
ast::type::AccessControl read{ast::AccessControl::kReadOnly, &A};

View File

@ -1308,7 +1308,8 @@ OpFunctionEnd
TEST_F(IntrinsicBuilderTest, Call_ArrayLength) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", ty.array<f32>(), decos));
members.push_back(
create<ast::StructMember>(Source{}, "a", ty.array<f32>(), decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("my_struct", s);
@ -1348,8 +1349,9 @@ TEST_F(IntrinsicBuilderTest, Call_ArrayLength) {
TEST_F(IntrinsicBuilderTest, Call_ArrayLength_OtherMembersInStruct) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("z", ty.f32, decos));
members.push_back(create<ast::StructMember>("a", ty.array<f32>(), decos));
members.push_back(create<ast::StructMember>(Source{}, "z", ty.f32, decos));
members.push_back(
create<ast::StructMember>(Source{}, "a", ty.array<f32>(), decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("my_struct", s);
@ -1391,8 +1393,9 @@ TEST_F(IntrinsicBuilderTest, DISABLED_Call_ArrayLength_Ptr) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("z", ty.f32, decos));
members.push_back(create<ast::StructMember>("a", ty.array<f32>(), decos));
members.push_back(create<ast::StructMember>(Source{}, "z", ty.f32, decos));
members.push_back(
create<ast::StructMember>(Source{}, "a", ty.array<f32>(), decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("my_struct", s);

View File

@ -297,7 +297,7 @@ TEST_F(BuilderTest_Type, GenerateStruct) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("my_struct", s);
@ -319,7 +319,7 @@ TEST_F(BuilderTest_Type, GenerateStruct_Decorated) {
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &f32, decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, decos));
ast::StructDecorationList struct_decos;
struct_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
@ -350,8 +350,8 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) {
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(8, Source{}));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &f32, a_decos));
members.push_back(create<ast::StructMember>("b", &f32, b_decos));
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, a_decos));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("S", s);
@ -383,9 +383,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_NonLayout_Matrix) {
ast::StructMemberDecorationList empty_b;
ast::StructMemberDecorationList empty_c;
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &glsl_mat2x2, empty_a));
members.push_back(create<ast::StructMember>("b", &glsl_mat2x3, empty_b));
members.push_back(create<ast::StructMember>("c", &glsl_mat4x4, empty_c));
members.push_back(
create<ast::StructMember>(Source{}, "a", &glsl_mat2x2, empty_a));
members.push_back(
create<ast::StructMember>(Source{}, "b", &glsl_mat2x3, empty_b));
members.push_back(
create<ast::StructMember>(Source{}, "c", &glsl_mat4x4, empty_c));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("S", s);
@ -426,9 +429,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutMatrix) {
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(48, Source{}));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &glsl_mat2x2, a_decos));
members.push_back(create<ast::StructMember>("b", &glsl_mat2x3, b_decos));
members.push_back(create<ast::StructMember>("c", &glsl_mat4x4, c_decos));
members.push_back(
create<ast::StructMember>(Source{}, "a", &glsl_mat2x2, a_decos));
members.push_back(
create<ast::StructMember>(Source{}, "b", &glsl_mat2x3, b_decos));
members.push_back(
create<ast::StructMember>(Source{}, "c", &glsl_mat4x4, c_decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("S", s);
@ -490,9 +496,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutArraysOfMatrix) {
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(48, Source{}));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>("a", &glsl_mat2x2, a_decos));
members.push_back(create<ast::StructMember>("b", &glsl_mat2x3, b_decos));
members.push_back(create<ast::StructMember>("c", &glsl_mat4x4, c_decos));
members.push_back(
create<ast::StructMember>(Source{}, "a", &glsl_mat2x2, a_decos));
members.push_back(
create<ast::StructMember>(Source{}, "b", &glsl_mat2x3, b_decos));
members.push_back(
create<ast::StructMember>(Source{}, "c", &glsl_mat4x4, c_decos));
auto* s = create<ast::Struct>(members);
ast::type::Struct s_type("S", s);

View File

@ -44,12 +44,12 @@ TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &i32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
auto* str = create<ast::Struct>(members);
@ -72,12 +72,12 @@ TEST_F(WgslGeneratorImplTest, EmitAlias_ToStruct) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &i32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
auto* str = create<ast::Struct>(members);

View File

@ -193,7 +193,7 @@ TEST_F(WgslGeneratorImplTest,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<ast::StructMember>("d", &f32, a_deco));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));

View File

@ -66,7 +66,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array) {
TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_Read) {
ast::type::I32 i32;
ast::StructMember mem("a", &i32, ast::StructMemberDecorationList{});
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
ast::StructMemberList members;
members.push_back(&mem);
@ -86,7 +86,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_Read) {
TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_ReadWrite) {
ast::type::I32 i32;
ast::StructMember mem("a", &i32, ast::StructMemberDecorationList{});
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
ast::StructMemberList members;
members.push_back(&mem);
@ -176,12 +176,12 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -196,12 +196,12 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructDecl) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str = create<ast::Struct>(members);
@ -221,12 +221,12 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithDecoration) {
ast::type::F32 f32;
ast::StructMemberList members;
members.push_back(
create<ast::StructMember>("a", &i32, ast::StructMemberDecorationList{}));
members.push_back(create<ast::StructMember>(
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<ast::StructMember>("b", &f32, b_deco));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));