Add helper for function creation.

This CL adds a Func helper to the ast builder class. The helper is then
used through the various files to simplify function creation.

Change-Id: Ie93777586e9311d82cff5932dfba2c4ca763ae08
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35823
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/writer/spirv/builder_function_decoration_test.cc b/src/writer/spirv/builder_function_decoration_test.cc
index 4f28dc5..33fd143 100644
--- a/src/writer/spirv/builder_function_decoration_test.cc
+++ b/src/writer/spirv/builder_function_decoration_test.cc
@@ -352,13 +352,12 @@
           });
   mod->AddGlobalVariable(fragdepth);
 
-  auto* body = create<ast::BlockStatement>(ast::StatementList{
-      create<ast::AssignmentStatement>(Expr("fragdepth"), Expr(1.f)),
-  });
-
-  auto* func = create<ast::Function>(
-      Source{}, mod->RegisterSymbol("main"), "main", ast::VariableList{},
-      create<ast::type::Void>(), body, ast::FunctionDecorationList{});
+  auto* func =
+      Func("main", ast::VariableList{}, create<ast::type::Void>(),
+           ast::StatementList{
+               create<ast::AssignmentStatement>(Expr("fragdepth"), Expr(1.f)),
+           },
+           ast::FunctionDecorationList{});
 
   func->add_referenced_module_variable(fragdepth);