From be607c07a4d9aa31392ba912ae5f919949f89708 Mon Sep 17 00:00:00 2001 From: Antonio Maiorano Date: Tue, 18 May 2021 15:26:40 +0000 Subject: [PATCH] Remove sem::UnwrapAccess() Bug: tint:802 Change-Id: I8bc769e4e7c2a27a8793e2851d12f75ec20c97e9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51142 Commit-Queue: Antonio Maiorano Reviewed-by: Ben Clayton --- src/resolver/resolver.cc | 7 ++----- src/sem/type.cc | 6 ------ src/sem/type.h | 3 --- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/resolver/resolver.cc b/src/resolver/resolver.cc index a5e33799b2..a80472b180 100644 --- a/src/resolver/resolver.cc +++ b/src/resolver/resolver.cc @@ -183,7 +183,6 @@ bool Resolver::Resolve() { // https://gpuweb.github.io/gpuweb/wgsl.html#storable-types bool Resolver::IsStorable(const sem::Type* type) { - type = type->UnwrapAccess(); if (type->is_scalar() || type->Is() || type->Is()) { return true; } @@ -203,7 +202,6 @@ bool Resolver::IsStorable(const sem::Type* type) { // https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable-types bool Resolver::IsHostShareable(const sem::Type* type) { - type = type->UnwrapAccess(); if (type->IsAnyOf()) { return true; } @@ -555,7 +553,7 @@ bool Resolver::ValidateVariableConstructor(const ast::Variable* var, } // Value type has to match storage type - if (storage_type->UnwrapAccess() != value_type->UnwrapAccess()) { + if (storage_type != value_type) { std::string decl = var->is_const() ? "let" : "var"; diagnostics_.add_error("cannot initialize " + decl + " of type '" + type_name + "' with value of type '" + @@ -3018,13 +3016,12 @@ bool Resolver::ValidateAssignment(const ast::AssignmentStatement* a) { return false; } - auto* storage_type_with_access = lhs_ref->StoreType(); + auto* storage_type = lhs_ref->StoreType(); // TODO(crbug.com/tint/809): The originating variable of the left-hand side // must not have an access(read) access attribute. // https://gpuweb.github.io/gpuweb/wgsl/#assignment - auto* storage_type = storage_type_with_access->UnwrapAccess(); auto* value_type = rhs_type->UnwrapRef(); // Implicit load of RHS // RHS needs to be of a storable type diff --git a/src/sem/type.cc b/src/sem/type.cc index 00f9e10016..4d44dfe9cf 100644 --- a/src/sem/type.cc +++ b/src/sem/type.cc @@ -52,12 +52,6 @@ const Type* Type::UnwrapRef() const { return type; } -const Type* Type::UnwrapAccess() const { - // TODO(amaiorano): Delete this function - auto* type = this; - return type; -} - bool Type::is_scalar() const { return IsAnyOf(); } diff --git a/src/sem/type.h b/src/sem/type.h index 11dd0804b9..d3ee2ac64d 100644 --- a/src/sem/type.h +++ b/src/sem/type.h @@ -52,9 +52,6 @@ class Type : public Castable { /// @returns the inner type if this is a reference, `this` otherwise const Type* UnwrapRef() const; - /// @returns the inner most type if this is an access control, `this` - /// otherwise - const Type* UnwrapAccess() const; /// @returns true if this type is a scalar bool is_scalar() const;