Use StorageClass::kNone for ast local var decls

To declare a local variable, we write `var name : type`, not `var<function> name : type`.
This change fixes all the places where we were feeding StorageClass::kFunction into variable declarations.

Note that the resolved, semantic variable correctly infers the `kFunction` StorageClass.

Change-Id: I6221fabae1de0435044f29b9a91808421d5cace6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50821
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2021-05-12 21:08:22 +00:00
committed by Commit Bot service account
parent 884a4e2172
commit f6c84e4d45
54 changed files with 380 additions and 410 deletions

View File

@@ -291,8 +291,7 @@ class InspectorHelper : public ProgramBuilder {
std::tie(member_idx, member_type) = member;
std::string member_name = StructMemberName(member_idx, member_type);
stmts.emplace_back(Decl(
Var("local" + member_name, member_type, ast::StorageClass::kNone)));
stmts.emplace_back(Decl(Var("local" + member_name, member_type)));
}
for (auto member : members) {
@@ -414,8 +413,7 @@ class InspectorHelper : public ProgramBuilder {
std::string result_name = "sampler_result";
ast::StatementList stmts;
stmts.emplace_back(Decl(Var("sampler_result", ty.vec(base_type, 4),
ast::StorageClass::kFunction)));
stmts.emplace_back(Decl(Var("sampler_result", ty.vec(base_type, 4))));
stmts.emplace_back(
Assign("sampler_result",
@@ -446,8 +444,7 @@ class InspectorHelper : public ProgramBuilder {
ast::StatementList stmts;
stmts.emplace_back(Decl(Var("sampler_result", ty.vec(base_type, 4),
ast::StorageClass::kFunction)));
stmts.emplace_back(Decl(Var("sampler_result", ty.vec(base_type, 4))));
stmts.emplace_back(
Assign("sampler_result", Call("textureSample", texture_name,
@@ -479,8 +476,7 @@ class InspectorHelper : public ProgramBuilder {
ast::StatementList stmts;
stmts.emplace_back(
Decl(Var("sampler_result", base_type, ast::StorageClass::kFunction)));
stmts.emplace_back(Decl(Var("sampler_result", base_type)));
stmts.emplace_back(
Assign("sampler_result", Call("textureSampleCompare", texture_name,
sampler_name, coords_name, depth_name)));
@@ -581,8 +577,7 @@ class InspectorHelper : public ProgramBuilder {
ast::DecorationList decorations) {
ast::StatementList stmts;
stmts.emplace_back(
Decl(Var("dim", dim_type, ast::StorageClass::kFunction)));
stmts.emplace_back(Decl(Var("dim", dim_type)));
stmts.emplace_back(Assign("dim", Call("textureDimensions", st_name)));
stmts.emplace_back(Return());