Remove sem::UnwrapAccess()
Bug: tint:802
Change-Id: I8bc769e4e7c2a27a8793e2851d12f75ec20c97e9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51142
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/resolver/resolver.cc b/src/resolver/resolver.cc
index a5e3379..a80472b 100644
--- a/src/resolver/resolver.cc
+++ b/src/resolver/resolver.cc
@@ -183,7 +183,6 @@
// 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<sem::Vector>() || type->Is<sem::Matrix>()) {
return true;
}
@@ -203,7 +202,6 @@
// https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable-types
bool Resolver::IsHostShareable(const sem::Type* type) {
- type = type->UnwrapAccess();
if (type->IsAnyOf<sem::I32, sem::U32, sem::F32>()) {
return true;
}
@@ -555,7 +553,7 @@
}
// 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 @@
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 00f9e10..4d44dfe 100644
--- a/src/sem/type.cc
+++ b/src/sem/type.cc
@@ -52,12 +52,6 @@
return type;
}
-const Type* Type::UnwrapAccess() const {
- // TODO(amaiorano): Delete this function
- auto* type = this;
- return type;
-}
-
bool Type::is_scalar() const {
return IsAnyOf<F32, U32, I32, Bool>();
}
diff --git a/src/sem/type.h b/src/sem/type.h
index 11dd080..d3ee2ac 100644
--- a/src/sem/type.h
+++ b/src/sem/type.h
@@ -52,9 +52,6 @@
/// @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;