tint/transform: Use InsertFront to add attribute
This is simpler than reconstructing the attribute list and manually cloning the struct member. Change-Id: I3d0bd4039030b47e53ce618d9de7ee572b9698f1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113422 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
48802bb9ea
commit
04f792de9f
|
@ -56,16 +56,9 @@ struct PackedVec3::State {
|
|||
members.Add(member);
|
||||
|
||||
// Apply the PackedVec3::Attribute to the member
|
||||
auto* member_decl = member->Declaration();
|
||||
auto name = ctx.Clone(member->Name());
|
||||
auto* type = ctx.Clone(member_decl->type);
|
||||
utils::Vector<const ast::Attribute*, 4> attrs{
|
||||
b.ASTNodes().Create<Attribute>(b.ID(), b.AllocateNodeID()),
|
||||
};
|
||||
for (auto* attr : member_decl->attributes) {
|
||||
attrs.Push(ctx.Clone(attr));
|
||||
}
|
||||
ctx.Replace(member_decl, b.Member(name, type, std::move(attrs)));
|
||||
ctx.InsertFront(
|
||||
member->Declaration()->attributes,
|
||||
b.ASTNodes().Create<Attribute>(b.ID(), b.AllocateNodeID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue