mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 14:46:08 +00:00
Validate attributes on function parameters
Entry point function parameter can only have builtin and location attributes (unless a disable validation attribute is present). Other functions cannot have any decorations on their parameters. Fix parameter creation in the CanonicalizeEntryPointIO transform for a case where it was not stripping attributes that are not valid for function parameters. Change-Id: I000908aa2dc007c52d100c5f65bca051a49bec9a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55863 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Auto-Submit: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
14c0b8acbf
commit
c3f19081f8
@@ -151,6 +151,13 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap& data) {
|
||||
<< "nested pipeline IO struct";
|
||||
}
|
||||
|
||||
ast::DecorationList new_decorations = RemoveDecorations(
|
||||
&ctx, member->Declaration()->decorations(),
|
||||
[](const ast::Decoration* deco) {
|
||||
return !deco->IsAnyOf<ast::BuiltinDecoration,
|
||||
ast::LocationDecoration>();
|
||||
});
|
||||
|
||||
if (cfg->builtin_style == BuiltinStyle::kParameter &&
|
||||
ast::HasDecoration<ast::BuiltinDecoration>(
|
||||
member->Declaration()->decorations())) {
|
||||
@@ -158,19 +165,12 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap& data) {
|
||||
// parameters, then move it to the parameter list.
|
||||
auto* member_ty = CreateASTTypeFor(&ctx, member->Type());
|
||||
auto new_param_name = ctx.dst->Sym();
|
||||
new_parameters.push_back(ctx.dst->Param(
|
||||
new_param_name, member_ty,
|
||||
ctx.Clone(member->Declaration()->decorations())));
|
||||
new_parameters.push_back(
|
||||
ctx.dst->Param(new_param_name, member_ty, new_decorations));
|
||||
init_values.push_back(ctx.dst->Expr(new_param_name));
|
||||
continue;
|
||||
}
|
||||
|
||||
ast::DecorationList new_decorations = RemoveDecorations(
|
||||
&ctx, member->Declaration()->decorations(),
|
||||
[](const ast::Decoration* deco) {
|
||||
return !deco->IsAnyOf<ast::BuiltinDecoration,
|
||||
ast::LocationDecoration>();
|
||||
});
|
||||
auto member_name = ctx.Clone(member->Declaration()->symbol());
|
||||
auto* member_type = ctx.Clone(member->Declaration()->type());
|
||||
new_struct_members.push_back(
|
||||
|
||||
Reference in New Issue
Block a user