resolver: Fix build. Enum member was renamed.

Change-Id: Iecbdd554ad60160df04be4bf3581387cb5639e6c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57420
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-07-08 15:12:36 +00:00
parent 70a3fa1ee9
commit 08b0ab9b92
1 changed files with 92 additions and 93 deletions

View File

@ -1197,9 +1197,10 @@ bool Resolver::ValidateFunction(const ast::Function* func,
(IsValidationEnabled( (IsValidationEnabled(
info->declaration->decorations(), info->declaration->decorations(),
ast::DisabledValidation::kEntryPointParameter) && ast::DisabledValidation::kEntryPointParameter) &&
IsValidationEnabled(info->declaration->decorations(), IsValidationEnabled(
info->declaration->decorations(),
ast::DisabledValidation:: ast::DisabledValidation::
kIgnoreAtomicFunctionParameter))) { kIgnoreConstructibleFunctionParameter))) {
AddError("decoration is not valid for entry point return types", AddError("decoration is not valid for entry point return types",
deco->source()); deco->source());
return false; return false;
@ -1231,9 +1232,12 @@ bool Resolver::ValidateEntryPoint(const ast::Function* func,
}; };
// Inner lambda that is applied to a type and all of its members. // Inner lambda that is applied to a type and all of its members.
auto validate_entry_point_decorations_inner = auto validate_entry_point_decorations_inner = [&](const ast::DecorationList&
[&](const ast::DecorationList& decos, sem::Type* ty, Source source, decos,
ParamOrRetType param_or_ret, bool is_struct_member) { sem::Type* ty,
Source source,
ParamOrRetType param_or_ret,
bool is_struct_member) {
// Scan decorations for pipeline IO attributes. // Scan decorations for pipeline IO attributes.
// Check for overlap with attributes that have been seen previously. // Check for overlap with attributes that have been seen previously.
ast::Decoration* pipeline_io_attribute = nullptr; ast::Decoration* pipeline_io_attribute = nullptr;
@ -1241,16 +1245,14 @@ bool Resolver::ValidateEntryPoint(const ast::Function* func,
if (auto* builtin = deco->As<ast::BuiltinDecoration>()) { if (auto* builtin = deco->As<ast::BuiltinDecoration>()) {
if (pipeline_io_attribute) { if (pipeline_io_attribute) {
AddError("multiple entry point IO attributes", deco->source()); AddError("multiple entry point IO attributes", deco->source());
AddNote( AddNote("previously consumed " + deco_to_str(pipeline_io_attribute),
"previously consumed " + deco_to_str(pipeline_io_attribute),
pipeline_io_attribute->source()); pipeline_io_attribute->source());
return false; return false;
} }
pipeline_io_attribute = deco; pipeline_io_attribute = deco;
if (builtins.count(builtin->value())) { if (builtins.count(builtin->value())) {
AddError( AddError(deco_to_str(builtin) +
deco_to_str(builtin) +
" attribute appears multiple times as pipeline " + " attribute appears multiple times as pipeline " +
(param_or_ret == ParamOrRetType::kParameter ? "input" (param_or_ret == ParamOrRetType::kParameter ? "input"
: "output"), : "output"),
@ -1259,25 +1261,23 @@ bool Resolver::ValidateEntryPoint(const ast::Function* func,
} }
builtins.emplace(builtin->value()); builtins.emplace(builtin->value());
if (!ValidateBuiltinDecoration(builtin, ty, if (!ValidateBuiltinDecoration(
/* is_input */ param_or_ret == builtin, ty,
ParamOrRetType::kParameter)) { /* is_input */ param_or_ret == ParamOrRetType::kParameter)) {
return false; return false;
} }
} else if (auto* location = deco->As<ast::LocationDecoration>()) { } else if (auto* location = deco->As<ast::LocationDecoration>()) {
if (pipeline_io_attribute) { if (pipeline_io_attribute) {
AddError("multiple entry point IO attributes", deco->source()); AddError("multiple entry point IO attributes", deco->source());
AddNote( AddNote("previously consumed " + deco_to_str(pipeline_io_attribute),
"previously consumed " + deco_to_str(pipeline_io_attribute),
pipeline_io_attribute->source()); pipeline_io_attribute->source());
return false; return false;
} }
pipeline_io_attribute = deco; pipeline_io_attribute = deco;
if (locations.count(location->value())) { if (locations.count(location->value())) {
AddError( AddError(deco_to_str(location) +
deco_to_str(location) +
" attribute appears multiple times as pipeline " + " attribute appears multiple times as pipeline " +
(param_or_ret == ParamOrRetType::kParameter ? "input" (param_or_ret == ParamOrRetType::kParameter ? "input"
: "output"), : "output"),
@ -1291,8 +1291,7 @@ bool Resolver::ValidateEntryPoint(const ast::Function* func,
// Check that we saw a pipeline IO attribute iff we need one. // Check that we saw a pipeline IO attribute iff we need one.
if (ty->Is<sem::Struct>()) { if (ty->Is<sem::Struct>()) {
if (pipeline_io_attribute) { if (pipeline_io_attribute) {
AddError( AddError("entry point IO attributes must not be used on structure " +
"entry point IO attributes must not be used on structure " +
std::string(param_or_ret == ParamOrRetType::kParameter std::string(param_or_ret == ParamOrRetType::kParameter
? "parameters" ? "parameters"
: "return types"), : "return types"),
@ -1304,8 +1303,8 @@ bool Resolver::ValidateEntryPoint(const ast::Function* func,
if (!pipeline_io_attribute) { if (!pipeline_io_attribute) {
std::string err = "missing entry point IO attribute"; std::string err = "missing entry point IO attribute";
if (!is_struct_member) { if (!is_struct_member) {
err += (param_or_ret == ParamOrRetType::kParameter err +=
? " on parameter" (param_or_ret == ParamOrRetType::kParameter ? " on parameter"
: " on return type"); : " on return type");
} }
AddError(err, source); AddError(err, source);