[tint] Remove current_function from ValidateEntryPoint.

The ValidateEntryPoint only needs the current functions pipeline stage.
Pass that in instead of using current_function_.

Bug: tint:1313
Change-Id: I7b08997f6c4940a614a75fc905ba923c0686bfc4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87142
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-19 01:59:54 +00:00 committed by Dawn LUCI CQ
parent 98b19374b4
commit 3dbeb8b7a5
2 changed files with 7 additions and 6 deletions

View File

@ -257,7 +257,7 @@ class Resolver {
bool ValidateContinueStatement(const sem::Statement* stmt);
bool ValidateDiscardStatement(const sem::Statement* stmt);
bool ValidateElseStatement(const sem::ElseStatement* stmt);
bool ValidateEntryPoint(const sem::Function* func);
bool ValidateEntryPoint(const sem::Function* func, ast::PipelineStage stage);
bool ValidateForLoopStatement(const sem::ForLoopStatement* stmt);
bool ValidateFallthroughStatement(const sem::Statement* stmt);
bool ValidateFunction(const sem::Function* func);

View File

@ -917,7 +917,10 @@ bool Resolver::ValidateFunction(const sem::Function* func) {
}
if (decl->IsEntryPoint()) {
if (!ValidateEntryPoint(func)) {
auto stage = current_function_
? current_function_->Declaration()->PipelineStage()
: ast::PipelineStage::kNone;
if (!ValidateEntryPoint(func, stage)) {
return false;
}
}
@ -937,7 +940,8 @@ bool Resolver::ValidateFunction(const sem::Function* func) {
return true;
}
bool Resolver::ValidateEntryPoint(const sem::Function* func) {
bool Resolver::ValidateEntryPoint(const sem::Function* func,
ast::PipelineStage stage) {
auto* decl = func->Declaration();
// Use a lambda to validate the entry point attributes for a type.
@ -959,9 +963,6 @@ bool Resolver::ValidateEntryPoint(const sem::Function* func) {
Source source,
ParamOrRetType param_or_ret,
bool is_struct_member) {
auto stage = current_function_
? current_function_->Declaration()->PipelineStage()
: ast::PipelineStage::kNone;
// Scan attributes for pipeline IO attributes.
// Check for overlap with attributes that have been seen previously.
const ast::Attribute* pipeline_io_attribute = nullptr;