From b6adc5bd42d0d3f566a54b18b722f922e2bf5a0d Mon Sep 17 00:00:00 2001 From: David Neto Date: Tue, 8 Sep 2020 19:16:05 +0000 Subject: [PATCH] Simplify getting entry point function The get-by-name method on the function stack already tells us if the name exists. We don't have to check, and then get it later. Change-Id: I26a1d395a9986df48f598055c3bc2864d94c87a8 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28260 Commit-Queue: David Neto Reviewed-by: Sarah Mashayekhi --- src/validator_impl.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/validator_impl.cc b/src/validator_impl.cc index 006ac7a597..88a1950661 100644 --- a/src/validator_impl.cc +++ b/src/validator_impl.cc @@ -84,16 +84,14 @@ bool ValidatorImpl::ValidateEntryPoints(const ast::EntryPointList& eps) { entry_point_map.push_scope(); for (const auto& ep : eps) { auto* ep_ptr = ep.get(); - if (!function_stack_.has(ep_ptr->function_name())) { + ast::Function* func = nullptr; + if (!function_stack_.get(ep_ptr->function_name(), &func)) { set_error(ep_ptr->source(), "v-0019: Function used in entry point does not exist: '" + ep_ptr->function_name() + "'"); return false; } - ast::Function* func = nullptr; - function_stack_.get(ep_ptr->function_name(), &func); - if (!func->return_type()->IsVoid()) { set_error(ep_ptr->source(), "v-0024: Entry point function must return void: '" +