mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-07 05:36:04 +00:00
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);
|
members.Add(member);
|
||||||
|
|
||||||
// Apply the PackedVec3::Attribute to the member
|
// Apply the PackedVec3::Attribute to the member
|
||||||
auto* member_decl = member->Declaration();
|
ctx.InsertFront(
|
||||||
auto name = ctx.Clone(member->Name());
|
member->Declaration()->attributes,
|
||||||
auto* type = ctx.Clone(member_decl->type);
|
b.ASTNodes().Create<Attribute>(b.ID(), b.AllocateNodeID()));
|
||||||
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)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user