[validation] Validate if entry point functions accept parameters
Bug: tint: 6
Change-Id: I7e9f50759e65ed6ef3dc25a6c004bec3dfbd4648
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27122
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/validator_function_test.cc b/src/validator_function_test.cc
index 70684d1..e8e4eee 100644
--- a/src/validator_function_test.cc
+++ b/src/validator_function_test.cc
@@ -312,7 +312,7 @@
"12:34: v-0024: Entry point function must return void: 'vtx_main'");
}
-TEST_F(ValidateFunctionTest, DISABLED_EntryPointFunctionWithParams_Fail) {
+TEST_F(ValidateFunctionTest, EntryPointFunctionWithParams_Fail) {
// entry_point vertex as "func" = vtx_func
// fn vtx_func(a : i32) -> void { return; }
ast::type::I32Type i32;
diff --git a/src/validator_impl.cc b/src/validator_impl.cc
index 9f36feb..48fd7d2 100644
--- a/src/validator_impl.cc
+++ b/src/validator_impl.cc
@@ -76,6 +76,12 @@
ep_ptr->function_name() + "'");
return false;
}
+ if (func->params().size() != 0) {
+ set_error(ep_ptr->source(),
+ "v-0023: Entry point function must accept no parameters: '" +
+ ep_ptr->function_name() + "'");
+ return false;
+ }
}
return true;
}