Remove type:: prefix in type/ folder.
Remove type:: namespaces added during the file moves.
Bug: tint:1718
Change-Id: I9862296cf93aad92e6c2b2e54d06d1c53d3a9b09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113428
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/type/abstract_float.cc b/src/tint/type/abstract_float.cc
index 5e17f0a..7f472dc 100644
--- a/src/tint/type/abstract_float.cc
+++ b/src/tint/type/abstract_float.cc
@@ -29,7 +29,7 @@
return utils::Hash(TypeInfo::Of<AbstractFloat>().full_hashcode);
}
-bool AbstractFloat::Equals(const type::Type& other) const {
+bool AbstractFloat::Equals(const Type& other) const {
return other.Is<AbstractFloat>();
}
diff --git a/src/tint/type/abstract_int.cc b/src/tint/type/abstract_int.cc
index 1506e6f..dffaab0 100644
--- a/src/tint/type/abstract_int.cc
+++ b/src/tint/type/abstract_int.cc
@@ -29,7 +29,7 @@
return utils::Hash(TypeInfo::Of<AbstractInt>().full_hashcode);
}
-bool AbstractInt::Equals(const type::Type& other) const {
+bool AbstractInt::Equals(const Type& other) const {
return other.Is<AbstractInt>();
}
diff --git a/src/tint/type/abstract_numeric.cc b/src/tint/type/abstract_numeric.cc
index f5fdee8..b689153 100644
--- a/src/tint/type/abstract_numeric.cc
+++ b/src/tint/type/abstract_numeric.cc
@@ -19,7 +19,7 @@
namespace tint::type {
AbstractNumeric::AbstractNumeric()
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/abstract_numeric.h b/src/tint/type/abstract_numeric.h
index bc49c2d..33cdac8 100644
--- a/src/tint/type/abstract_numeric.h
+++ b/src/tint/type/abstract_numeric.h
@@ -23,7 +23,7 @@
/// The base class for abstract-int and abstract-float types.
/// @see https://www.w3.org/TR/WGSL/#types-for-creation-time-constants
-class AbstractNumeric : public Castable<AbstractNumeric, type::Type> {
+class AbstractNumeric : public Castable<AbstractNumeric, Type> {
public:
/// Constructor
AbstractNumeric();
diff --git a/src/tint/type/array.cc b/src/tint/type/array.cc
index 1d1fed5..f8b2e0f 100644
--- a/src/tint/type/array.cc
+++ b/src/tint/type/array.cc
@@ -27,20 +27,20 @@
namespace {
-type::TypeFlags FlagsFrom(const type::Type* element, const type::ArrayCount* count) {
- type::TypeFlags flags;
+TypeFlags FlagsFrom(const Type* element, const ArrayCount* count) {
+ TypeFlags flags;
// Only constant-expression sized arrays are constructible
- if (count->Is<type::ConstantArrayCount>()) {
+ if (count->Is<ConstantArrayCount>()) {
if (element->IsConstructible()) {
- flags.Add(type::TypeFlag::kConstructable);
+ flags.Add(TypeFlag::kConstructable);
}
if (element->HasCreationFixedFootprint()) {
- flags.Add(type::TypeFlag::kCreationFixedFootprint);
+ flags.Add(TypeFlag::kCreationFixedFootprint);
}
}
- if (!count->Is<type::RuntimeArrayCount>()) {
+ if (!count->Is<RuntimeArrayCount>()) {
if (element->HasFixedFootprint()) {
- flags.Add(type::TypeFlag::kFixedFootprint);
+ flags.Add(TypeFlag::kFixedFootprint);
}
}
return flags;
@@ -52,8 +52,8 @@
"array size is an override-expression, when expected a constant-expression.\n"
"Was the SubstituteOverride transform run?";
-Array::Array(const type::Type* element,
- const type::ArrayCount* count,
+Array::Array(const Type* element,
+ const ArrayCount* count,
uint32_t align,
uint32_t size,
uint32_t stride,
@@ -72,7 +72,7 @@
return utils::Hash(TypeInfo::Of<Array>().full_hashcode, count_, align_, size_, stride_);
}
-bool Array::Equals(const type::Type& other) const {
+bool Array::Equals(const Type& other) const {
if (auto* o = other.As<Array>()) {
// Note: implicit_stride is not part of the type_name string as this is
// derived from the element type
diff --git a/src/tint/type/array.h b/src/tint/type/array.h
index d6defdd..52fb8a8 100644
--- a/src/tint/type/array.h
+++ b/src/tint/type/array.h
@@ -28,7 +28,7 @@
namespace tint::type {
/// Array holds the type information for Array nodes.
-class Array final : public Castable<Array, type::Type> {
+class Array final : public Castable<Array, Type> {
public:
/// An error message string stating that the array count was expected to be a constant
/// expression. Used by multiple writers and transforms.
@@ -45,8 +45,8 @@
/// @param implicit_stride the number of bytes from the start of one element
/// of the array to the start of the next element, if there was no `@stride`
/// attribute applied.
- Array(type::Type const* element,
- const type::ArrayCount* count,
+ Array(Type const* element,
+ const ArrayCount* count,
uint32_t align,
uint32_t size,
uint32_t stride,
@@ -57,17 +57,17 @@
/// @param other the other type to compare against
/// @returns true if the this type is equal to the given type
- bool Equals(const type::Type& other) const override;
+ bool Equals(const Type& other) const override;
/// @return the array element type
- type::Type const* ElemType() const { return element_; }
+ Type const* ElemType() const { return element_; }
/// @returns the number of elements in the array.
- const type::ArrayCount* Count() const { return count_; }
+ const ArrayCount* Count() const { return count_; }
/// @returns the array count if the count is a const-expression, otherwise returns nullopt.
inline std::optional<uint32_t> ConstantCount() const {
- if (auto* count = count_->As<type::ConstantArrayCount>()) {
+ if (auto* count = count_->As<ConstantArrayCount>()) {
return count->value;
}
return std::nullopt;
@@ -102,8 +102,8 @@
std::string FriendlyName(const SymbolTable& symbols) const override;
private:
- type::Type const* const element_;
- const type::ArrayCount* count_;
+ Type const* const element_;
+ const ArrayCount* count_;
const uint32_t align_;
const uint32_t size_;
const uint32_t stride_;
diff --git a/src/tint/type/array_test.cc b/src/tint/type/array_test.cc
index f2b3ee7..367aa4b 100644
--- a/src/tint/type/array_test.cc
+++ b/src/tint/type/array_test.cc
@@ -22,29 +22,22 @@
using ArrayTest = TestHelper;
TEST_F(ArrayTest, CreateSizedArray) {
- auto* a =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
- auto* b =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
- auto* c =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(3u), 4u, 8u, 32u, 16u);
- auto* d =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 5u, 8u, 32u, 16u);
- auto* e =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 9u, 32u, 16u);
- auto* f =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 33u, 16u);
- auto* g =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 33u, 17u);
+ auto* a = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ auto* b = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ auto* c = create<Array>(create<U32>(), create<ConstantArrayCount>(3u), 4u, 8u, 32u, 16u);
+ auto* d = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 5u, 8u, 32u, 16u);
+ auto* e = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 9u, 32u, 16u);
+ auto* f = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 33u, 16u);
+ auto* g = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 33u, 17u);
- EXPECT_EQ(a->ElemType(), create<type::U32>());
- EXPECT_EQ(a->Count(), create<type::ConstantArrayCount>(2u));
+ EXPECT_EQ(a->ElemType(), create<U32>());
+ EXPECT_EQ(a->Count(), create<ConstantArrayCount>(2u));
EXPECT_EQ(a->Align(), 4u);
EXPECT_EQ(a->Size(), 8u);
EXPECT_EQ(a->Stride(), 32u);
EXPECT_EQ(a->ImplicitStride(), 16u);
EXPECT_FALSE(a->IsStrideImplicit());
- EXPECT_FALSE(a->Count()->Is<type::RuntimeArrayCount>());
+ EXPECT_FALSE(a->Count()->Is<RuntimeArrayCount>());
EXPECT_EQ(a, b);
EXPECT_NE(a, c);
@@ -55,27 +48,21 @@
}
TEST_F(ArrayTest, CreateRuntimeArray) {
- auto* a =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 8u, 32u, 32u);
- auto* b =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 8u, 32u, 32u);
- auto* c =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 5u, 8u, 32u, 32u);
- auto* d =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 9u, 32u, 32u);
- auto* e =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 8u, 33u, 32u);
- auto* f =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 8u, 33u, 17u);
+ auto* a = create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 32u, 32u);
+ auto* b = create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 32u, 32u);
+ auto* c = create<Array>(create<U32>(), create<RuntimeArrayCount>(), 5u, 8u, 32u, 32u);
+ auto* d = create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 9u, 32u, 32u);
+ auto* e = create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 33u, 32u);
+ auto* f = create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 33u, 17u);
- EXPECT_EQ(a->ElemType(), create<type::U32>());
- EXPECT_EQ(a->Count(), create<type::RuntimeArrayCount>());
+ EXPECT_EQ(a->ElemType(), create<U32>());
+ EXPECT_EQ(a->Count(), create<RuntimeArrayCount>());
EXPECT_EQ(a->Align(), 4u);
EXPECT_EQ(a->Size(), 8u);
EXPECT_EQ(a->Stride(), 32u);
EXPECT_EQ(a->ImplicitStride(), 32u);
EXPECT_TRUE(a->IsStrideImplicit());
- EXPECT_TRUE(a->Count()->Is<type::RuntimeArrayCount>());
+ EXPECT_TRUE(a->Count()->Is<RuntimeArrayCount>());
EXPECT_EQ(a, b);
EXPECT_NE(a, c);
@@ -85,20 +72,13 @@
}
TEST_F(ArrayTest, Hash) {
- auto* a =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
- auto* b =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
- auto* c =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(3u), 4u, 8u, 32u, 16u);
- auto* d =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 5u, 8u, 32u, 16u);
- auto* e =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 9u, 32u, 16u);
- auto* f =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 33u, 16u);
- auto* g =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 33u, 17u);
+ auto* a = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ auto* b = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ auto* c = create<Array>(create<U32>(), create<ConstantArrayCount>(3u), 4u, 8u, 32u, 16u);
+ auto* d = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 5u, 8u, 32u, 16u);
+ auto* e = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 9u, 32u, 16u);
+ auto* f = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 33u, 16u);
+ auto* g = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 33u, 17u);
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
@@ -109,20 +89,13 @@
}
TEST_F(ArrayTest, Equals) {
- auto* a =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
- auto* b =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
- auto* c =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(3u), 4u, 8u, 32u, 16u);
- auto* d =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 5u, 8u, 32u, 16u);
- auto* e =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 9u, 32u, 16u);
- auto* f =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 33u, 16u);
- auto* g =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 33u, 17u);
+ auto* a = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ auto* b = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ auto* c = create<Array>(create<U32>(), create<ConstantArrayCount>(3u), 4u, 8u, 32u, 16u);
+ auto* d = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 5u, 8u, 32u, 16u);
+ auto* e = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 9u, 32u, 16u);
+ auto* f = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 33u, 16u);
+ auto* g = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 33u, 17u);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
@@ -130,42 +103,38 @@
EXPECT_FALSE(a->Equals(*e));
EXPECT_FALSE(a->Equals(*f));
EXPECT_FALSE(a->Equals(*g));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(ArrayTest, FriendlyNameRuntimeSized) {
- auto* arr =
- create<Array>(create<type::I32>(), create<type::RuntimeArrayCount>(), 0u, 4u, 4u, 4u);
+ auto* arr = create<Array>(create<I32>(), create<RuntimeArrayCount>(), 0u, 4u, 4u, 4u);
EXPECT_EQ(arr->FriendlyName(Symbols()), "array<i32>");
}
TEST_F(ArrayTest, FriendlyNameStaticSized) {
- auto* arr =
- create<Array>(create<type::I32>(), create<type::ConstantArrayCount>(5u), 4u, 20u, 4u, 4u);
+ auto* arr = create<Array>(create<I32>(), create<ConstantArrayCount>(5u), 4u, 20u, 4u, 4u);
EXPECT_EQ(arr->FriendlyName(Symbols()), "array<i32, 5>");
}
TEST_F(ArrayTest, FriendlyNameRuntimeSizedNonImplicitStride) {
- auto* arr =
- create<Array>(create<type::I32>(), create<type::RuntimeArrayCount>(), 0u, 4u, 8u, 4u);
+ auto* arr = create<Array>(create<I32>(), create<RuntimeArrayCount>(), 0u, 4u, 8u, 4u);
EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array<i32>");
}
TEST_F(ArrayTest, FriendlyNameStaticSizedNonImplicitStride) {
- auto* arr =
- create<Array>(create<type::I32>(), create<type::ConstantArrayCount>(5u), 4u, 20u, 8u, 4u);
+ auto* arr = create<Array>(create<I32>(), create<ConstantArrayCount>(5u), 4u, 20u, 8u, 4u);
EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array<i32, 5>");
}
TEST_F(ArrayTest, IsConstructable) {
auto* fixed_sized =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
auto* named_override_sized = create<Array>(
- create<type::U32>(), create<sem::NamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
+ create<U32>(), create<sem::NamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
auto* unnamed_override_sized = create<Array>(
- create<type::U32>(), create<sem::UnnamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
+ create<U32>(), create<sem::UnnamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
auto* runtime_sized =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 8u, 32u, 16u);
+ create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 32u, 16u);
EXPECT_TRUE(fixed_sized->IsConstructible());
EXPECT_FALSE(named_override_sized->IsConstructible());
@@ -175,13 +144,13 @@
TEST_F(ArrayTest, HasCreationFixedFootprint) {
auto* fixed_sized =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
auto* named_override_sized = create<Array>(
- create<type::U32>(), create<sem::NamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
+ create<U32>(), create<sem::NamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
auto* unnamed_override_sized = create<Array>(
- create<type::U32>(), create<sem::UnnamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
+ create<U32>(), create<sem::UnnamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
auto* runtime_sized =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 8u, 32u, 16u);
+ create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 32u, 16u);
EXPECT_TRUE(fixed_sized->HasCreationFixedFootprint());
EXPECT_FALSE(named_override_sized->HasCreationFixedFootprint());
@@ -191,13 +160,13 @@
TEST_F(ArrayTest, HasFixedFootprint) {
auto* fixed_sized =
- create<Array>(create<type::U32>(), create<type::ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
+ create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
auto* named_override_sized = create<Array>(
- create<type::U32>(), create<sem::NamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
+ create<U32>(), create<sem::NamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
auto* unnamed_override_sized = create<Array>(
- create<type::U32>(), create<sem::UnnamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
+ create<U32>(), create<sem::UnnamedOverrideArrayCount>(nullptr), 4u, 8u, 32u, 16u);
auto* runtime_sized =
- create<Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 8u, 32u, 16u);
+ create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 32u, 16u);
EXPECT_TRUE(fixed_sized->HasFixedFootprint());
EXPECT_TRUE(named_override_sized->HasFixedFootprint());
diff --git a/src/tint/type/atomic.cc b/src/tint/type/atomic.cc
index ee6c98b..749959c 100644
--- a/src/tint/type/atomic.cc
+++ b/src/tint/type/atomic.cc
@@ -23,12 +23,12 @@
namespace tint::type {
Atomic::Atomic(const type::Type* subtype)
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
}),
subtype_(subtype) {
- TINT_ASSERT(AST, !subtype->Is<type::Reference>());
+ TINT_ASSERT(AST, !subtype->Is<Reference>());
}
size_t Atomic::Hash() const {
diff --git a/src/tint/type/atomic.h b/src/tint/type/atomic.h
index df05a0a..c052274 100644
--- a/src/tint/type/atomic.h
+++ b/src/tint/type/atomic.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A atomic type.
-class Atomic final : public Castable<Atomic, type::Type> {
+class Atomic final : public Castable<Atomic, Type> {
public:
/// Constructor
/// @param subtype the atomic type
@@ -37,7 +37,7 @@
/// @param other the other type to compare against
/// @returns true if the this type is equal to the given type
- bool Equals(const Type& other) const override;
+ bool Equals(const type::Type& other) const override;
/// @returns the atomic type
const type::Type* Type() const { return subtype_; }
diff --git a/src/tint/type/atomic_test.cc b/src/tint/type/atomic_test.cc
index 065cf52..b67e118 100644
--- a/src/tint/type/atomic_test.cc
+++ b/src/tint/type/atomic_test.cc
@@ -22,33 +22,33 @@
using AtomicTest = TestHelper;
TEST_F(AtomicTest, Creation) {
- auto* a = create<Atomic>(create<type::I32>());
- auto* b = create<Atomic>(create<type::I32>());
- auto* c = create<Atomic>(create<type::U32>());
- EXPECT_TRUE(a->Type()->Is<type::I32>());
+ auto* a = create<Atomic>(create<I32>());
+ auto* b = create<Atomic>(create<I32>());
+ auto* c = create<Atomic>(create<U32>());
+ EXPECT_TRUE(a->Type()->Is<I32>());
EXPECT_EQ(a, b);
EXPECT_NE(a, c);
}
TEST_F(AtomicTest, Hash) {
- auto* a = create<Atomic>(create<type::I32>());
- auto* b = create<Atomic>(create<type::I32>());
- auto* c = create<Atomic>(create<type::U32>());
+ auto* a = create<Atomic>(create<I32>());
+ auto* b = create<Atomic>(create<I32>());
+ auto* c = create<Atomic>(create<U32>());
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
}
TEST_F(AtomicTest, Equals) {
- auto* a = create<Atomic>(create<type::I32>());
- auto* b = create<Atomic>(create<type::I32>());
- auto* c = create<Atomic>(create<type::U32>());
+ auto* a = create<Atomic>(create<I32>());
+ auto* b = create<Atomic>(create<I32>());
+ auto* c = create<Atomic>(create<U32>());
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(AtomicTest, FriendlyName) {
- auto* a = create<Atomic>(create<type::I32>());
+ auto* a = create<Atomic>(create<I32>());
EXPECT_EQ(a->FriendlyName(Symbols()), "atomic<i32>");
}
diff --git a/src/tint/type/bool.cc b/src/tint/type/bool.cc
index 4c3ab15..7cde72c 100644
--- a/src/tint/type/bool.cc
+++ b/src/tint/type/bool.cc
@@ -21,7 +21,7 @@
namespace tint::type {
Bool::Bool()
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/bool.h b/src/tint/type/bool.h
index 900630d..19ad8c1 100644
--- a/src/tint/type/bool.h
+++ b/src/tint/type/bool.h
@@ -28,7 +28,7 @@
namespace tint::type {
/// A boolean type
-class Bool final : public Castable<Bool, type::Type> {
+class Bool final : public Castable<Bool, Type> {
public:
/// Constructor
Bool();
diff --git a/src/tint/type/depth_multisampled_texture.cc b/src/tint/type/depth_multisampled_texture.cc
index 339839a..b6a8704 100644
--- a/src/tint/type/depth_multisampled_texture.cc
+++ b/src/tint/type/depth_multisampled_texture.cc
@@ -40,7 +40,7 @@
return utils::Hash(TypeInfo::Of<DepthMultisampledTexture>().full_hashcode, dim());
}
-bool DepthMultisampledTexture::Equals(const type::Type& other) const {
+bool DepthMultisampledTexture::Equals(const Type& other) const {
if (auto* o = other.As<DepthMultisampledTexture>()) {
return o->dim() == dim();
}
diff --git a/src/tint/type/depth_multisampled_texture_test.cc b/src/tint/type/depth_multisampled_texture_test.cc
index d0257b9..1a01e54 100644
--- a/src/tint/type/depth_multisampled_texture_test.cc
+++ b/src/tint/type/depth_multisampled_texture_test.cc
@@ -44,7 +44,7 @@
EXPECT_TRUE(a->Equals(*a));
EXPECT_TRUE(a->Equals(*b));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(DepthMultisampledTextureTest, Dim) {
diff --git a/src/tint/type/depth_texture.cc b/src/tint/type/depth_texture.cc
index ef80dcd..34edde1 100644
--- a/src/tint/type/depth_texture.cc
+++ b/src/tint/type/depth_texture.cc
@@ -41,7 +41,7 @@
return utils::Hash(TypeInfo::Of<DepthTexture>().full_hashcode, dim());
}
-bool DepthTexture::Equals(const type::Type& other) const {
+bool DepthTexture::Equals(const Type& other) const {
if (auto* o = other.As<DepthTexture>()) {
return o->dim() == dim();
}
diff --git a/src/tint/type/depth_texture_test.cc b/src/tint/type/depth_texture_test.cc
index e885fa6..b729dc8 100644
--- a/src/tint/type/depth_texture_test.cc
+++ b/src/tint/type/depth_texture_test.cc
@@ -49,7 +49,7 @@
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(DepthTextureTest, IsTexture) {
diff --git a/src/tint/type/external_texture.cc b/src/tint/type/external_texture.cc
index 8480de8..ac7e676 100644
--- a/src/tint/type/external_texture.cc
+++ b/src/tint/type/external_texture.cc
@@ -30,7 +30,7 @@
return static_cast<size_t>(TypeInfo::Of<ExternalTexture>().full_hashcode);
}
-bool ExternalTexture::Equals(const type::Type& other) const {
+bool ExternalTexture::Equals(const Type& other) const {
return other.Is<ExternalTexture>();
}
diff --git a/src/tint/type/external_texture_test.cc b/src/tint/type/external_texture_test.cc
index bbafebc..5f54015 100644
--- a/src/tint/type/external_texture_test.cc
+++ b/src/tint/type/external_texture_test.cc
@@ -41,11 +41,11 @@
auto* a = create<ExternalTexture>();
auto* b = create<ExternalTexture>();
EXPECT_TRUE(a->Equals(*b));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(ExternalTextureTest, IsTexture) {
- type::F32 f32;
+ F32 f32;
ExternalTexture s;
Texture* ty = &s;
EXPECT_FALSE(ty->Is<DepthTexture>());
@@ -56,7 +56,7 @@
}
TEST_F(ExternalTextureTest, Dim) {
- type::F32 f32;
+ F32 f32;
ExternalTexture s;
EXPECT_EQ(s.dim(), ast::TextureDimension::k2d);
}
diff --git a/src/tint/type/f16.cc b/src/tint/type/f16.cc
index 5cb3cfd..aecefa4 100644
--- a/src/tint/type/f16.cc
+++ b/src/tint/type/f16.cc
@@ -21,7 +21,7 @@
namespace tint::type {
F16::F16()
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/f16.h b/src/tint/type/f16.h
index a10597b..c4c3d1f 100644
--- a/src/tint/type/f16.h
+++ b/src/tint/type/f16.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A float 16 type
-class F16 final : public Castable<F16, type::Type> {
+class F16 final : public Castable<F16, Type> {
public:
/// Constructor
F16();
diff --git a/src/tint/type/f32.cc b/src/tint/type/f32.cc
index 92bc4d4..f9ff7ee 100644
--- a/src/tint/type/f32.cc
+++ b/src/tint/type/f32.cc
@@ -21,7 +21,7 @@
namespace tint::type {
F32::F32()
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/f32.h b/src/tint/type/f32.h
index 0991c3d..57aa560 100644
--- a/src/tint/type/f32.h
+++ b/src/tint/type/f32.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A float 32 type
-class F32 final : public Castable<F32, type::Type> {
+class F32 final : public Castable<F32, Type> {
public:
/// Constructor
F32();
diff --git a/src/tint/type/i32.cc b/src/tint/type/i32.cc
index f657e24..5a242e4 100644
--- a/src/tint/type/i32.cc
+++ b/src/tint/type/i32.cc
@@ -21,7 +21,7 @@
namespace tint::type {
I32::I32()
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/i32.h b/src/tint/type/i32.h
index 3057cda..9073daa 100644
--- a/src/tint/type/i32.h
+++ b/src/tint/type/i32.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A signed int 32 type.
-class I32 final : public Castable<I32, type::Type> {
+class I32 final : public Castable<I32, Type> {
public:
/// Constructor
I32();
diff --git a/src/tint/type/matrix.cc b/src/tint/type/matrix.cc
index ecc2250..d73d190 100644
--- a/src/tint/type/matrix.cc
+++ b/src/tint/type/matrix.cc
@@ -23,7 +23,7 @@
namespace tint::type {
Matrix::Matrix(const Vector* column_type, uint32_t columns)
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/matrix.h b/src/tint/type/matrix.h
index 52025c6..3191f95 100644
--- a/src/tint/type/matrix.h
+++ b/src/tint/type/matrix.h
@@ -27,7 +27,7 @@
namespace tint::type {
/// A matrix type
-class Matrix final : public Castable<Matrix, type::Type> {
+class Matrix final : public Castable<Matrix, Type> {
public:
/// Constructor
/// @param column_type the type of a column of the matrix
@@ -45,7 +45,7 @@
bool Equals(const Type& other) const override;
/// @returns the type of the matrix
- const type::Type* type() const { return subtype_; }
+ const Type* type() const { return subtype_; }
/// @returns the number of rows in the matrix
uint32_t rows() const { return rows_; }
/// @returns the number of columns in the matrix
@@ -70,7 +70,7 @@
uint32_t ColumnStride() const;
private:
- const type::Type* const subtype_;
+ const Type* const subtype_;
const Vector* const column_type_;
const uint32_t rows_;
const uint32_t columns_;
diff --git a/src/tint/type/matrix_test.cc b/src/tint/type/matrix_test.cc
index 7cd06c3..aff6924 100644
--- a/src/tint/type/matrix_test.cc
+++ b/src/tint/type/matrix_test.cc
@@ -21,13 +21,13 @@
using MatrixTest = TestHelper;
TEST_F(MatrixTest, Creation) {
- auto* a = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 4u);
- auto* b = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 4u);
- auto* c = create<Matrix>(create<Vector>(create<type::F32>(), 3u), 4u);
- auto* d = create<Matrix>(create<Vector>(create<type::I32>(), 2u), 4u);
- auto* e = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 2u);
+ auto* a = create<Matrix>(create<Vector>(create<I32>(), 3u), 4u);
+ auto* b = create<Matrix>(create<Vector>(create<I32>(), 3u), 4u);
+ auto* c = create<Matrix>(create<Vector>(create<F32>(), 3u), 4u);
+ auto* d = create<Matrix>(create<Vector>(create<I32>(), 2u), 4u);
+ auto* e = create<Matrix>(create<Vector>(create<I32>(), 3u), 2u);
- EXPECT_EQ(a->type(), create<type::I32>());
+ EXPECT_EQ(a->type(), create<I32>());
EXPECT_EQ(a->rows(), 3u);
EXPECT_EQ(a->columns(), 4u);
@@ -38,11 +38,11 @@
}
TEST_F(MatrixTest, Hash) {
- auto* a = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 4u);
- auto* b = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 4u);
- auto* c = create<Matrix>(create<Vector>(create<type::F32>(), 3u), 4u);
- auto* d = create<Matrix>(create<Vector>(create<type::I32>(), 2u), 4u);
- auto* e = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 2u);
+ auto* a = create<Matrix>(create<Vector>(create<I32>(), 3u), 4u);
+ auto* b = create<Matrix>(create<Vector>(create<I32>(), 3u), 4u);
+ auto* c = create<Matrix>(create<Vector>(create<F32>(), 3u), 4u);
+ auto* d = create<Matrix>(create<Vector>(create<I32>(), 2u), 4u);
+ auto* e = create<Matrix>(create<Vector>(create<I32>(), 3u), 2u);
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
@@ -51,21 +51,21 @@
}
TEST_F(MatrixTest, Equals) {
- auto* a = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 4u);
- auto* b = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 4u);
- auto* c = create<Matrix>(create<Vector>(create<type::F32>(), 3u), 4u);
- auto* d = create<Matrix>(create<Vector>(create<type::I32>(), 2u), 4u);
- auto* e = create<Matrix>(create<Vector>(create<type::I32>(), 3u), 2u);
+ auto* a = create<Matrix>(create<Vector>(create<I32>(), 3u), 4u);
+ auto* b = create<Matrix>(create<Vector>(create<I32>(), 3u), 4u);
+ auto* c = create<Matrix>(create<Vector>(create<F32>(), 3u), 4u);
+ auto* d = create<Matrix>(create<Vector>(create<I32>(), 2u), 4u);
+ auto* e = create<Matrix>(create<Vector>(create<I32>(), 3u), 2u);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
EXPECT_FALSE(a->Equals(*d));
EXPECT_FALSE(a->Equals(*e));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(MatrixTest, FriendlyName) {
- type::I32 i32;
+ I32 i32;
Vector c{&i32, 3};
Matrix m{&c, 2};
EXPECT_EQ(m.FriendlyName(Symbols()), "mat2x3<i32>");
diff --git a/src/tint/type/multisampled_texture.cc b/src/tint/type/multisampled_texture.cc
index 0bb2989..e1d2ed7 100644
--- a/src/tint/type/multisampled_texture.cc
+++ b/src/tint/type/multisampled_texture.cc
@@ -21,7 +21,7 @@
namespace tint::type {
-MultisampledTexture::MultisampledTexture(ast::TextureDimension dim, const type::Type* type)
+MultisampledTexture::MultisampledTexture(ast::TextureDimension dim, const Type* type)
: Base(dim), type_(type) {
TINT_ASSERT(Type, type_);
}
@@ -34,7 +34,7 @@
return utils::Hash(TypeInfo::Of<MultisampledTexture>().full_hashcode, dim(), type_);
}
-bool MultisampledTexture::Equals(const type::Type& other) const {
+bool MultisampledTexture::Equals(const Type& other) const {
if (auto* o = other.As<MultisampledTexture>()) {
return o->dim() == dim() && o->type_ == type_;
}
diff --git a/src/tint/type/multisampled_texture.h b/src/tint/type/multisampled_texture.h
index d3d4a27..421b294 100644
--- a/src/tint/type/multisampled_texture.h
+++ b/src/tint/type/multisampled_texture.h
@@ -27,7 +27,7 @@
/// Constructor
/// @param dim the dimensionality of the texture
/// @param type the data type of the multisampled texture
- MultisampledTexture(ast::TextureDimension dim, const type::Type* type);
+ MultisampledTexture(ast::TextureDimension dim, const Type* type);
/// Move constructor
MultisampledTexture(MultisampledTexture&&);
~MultisampledTexture() override;
@@ -40,7 +40,7 @@
bool Equals(const Type& other) const override;
/// @returns the subtype of the sampled texture
- const type::Type* type() const { return type_; }
+ const Type* type() const { return type_; }
/// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
@@ -48,7 +48,7 @@
std::string FriendlyName(const SymbolTable& symbols) const override;
private:
- const type::Type* const type_;
+ const Type* const type_;
};
} // namespace tint::type
diff --git a/src/tint/type/multisampled_texture_test.cc b/src/tint/type/multisampled_texture_test.cc
index 72cf496..cf3d28a 100644
--- a/src/tint/type/multisampled_texture_test.cc
+++ b/src/tint/type/multisampled_texture_test.cc
@@ -26,38 +26,38 @@
using MultisampledTextureTest = TestHelper;
TEST_F(MultisampledTextureTest, Creation) {
- auto* a = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* b = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* c = create<MultisampledTexture>(ast::TextureDimension::k3d, create<type::F32>());
- auto* d = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::I32>());
+ auto* a = create<MultisampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* b = create<MultisampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* c = create<MultisampledTexture>(ast::TextureDimension::k3d, create<F32>());
+ auto* d = create<MultisampledTexture>(ast::TextureDimension::k2d, create<I32>());
EXPECT_EQ(a, b);
EXPECT_NE(a, c);
EXPECT_NE(a, d);
}
TEST_F(MultisampledTextureTest, Hash) {
- auto* a = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* b = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* c = create<MultisampledTexture>(ast::TextureDimension::k3d, create<type::F32>());
- auto* d = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::I32>());
+ auto* a = create<MultisampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* b = create<MultisampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* c = create<MultisampledTexture>(ast::TextureDimension::k3d, create<F32>());
+ auto* d = create<MultisampledTexture>(ast::TextureDimension::k2d, create<I32>());
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
EXPECT_NE(a->Hash(), d->Hash());
}
TEST_F(MultisampledTextureTest, Equals) {
- auto* a = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* b = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* c = create<MultisampledTexture>(ast::TextureDimension::k3d, create<type::F32>());
- auto* d = create<MultisampledTexture>(ast::TextureDimension::k2d, create<type::I32>());
+ auto* a = create<MultisampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* b = create<MultisampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* c = create<MultisampledTexture>(ast::TextureDimension::k3d, create<F32>());
+ auto* d = create<MultisampledTexture>(ast::TextureDimension::k2d, create<I32>());
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
EXPECT_FALSE(a->Equals(*d));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(MultisampledTextureTest, IsTexture) {
- type::F32 f32;
+ F32 f32;
MultisampledTexture s(ast::TextureDimension::kCube, &f32);
Texture* ty = &s;
EXPECT_FALSE(ty->Is<DepthTexture>());
@@ -68,19 +68,19 @@
}
TEST_F(MultisampledTextureTest, Dim) {
- type::F32 f32;
+ F32 f32;
MultisampledTexture s(ast::TextureDimension::k3d, &f32);
EXPECT_EQ(s.dim(), ast::TextureDimension::k3d);
}
TEST_F(MultisampledTextureTest, Type) {
- type::F32 f32;
+ F32 f32;
MultisampledTexture s(ast::TextureDimension::k3d, &f32);
EXPECT_EQ(s.type(), &f32);
}
TEST_F(MultisampledTextureTest, FriendlyName) {
- type::F32 f32;
+ F32 f32;
MultisampledTexture s(ast::TextureDimension::k3d, &f32);
EXPECT_EQ(s.FriendlyName(Symbols()), "texture_multisampled_3d<f32>");
}
diff --git a/src/tint/type/pointer.cc b/src/tint/type/pointer.cc
index 37dbf69..286e90c 100644
--- a/src/tint/type/pointer.cc
+++ b/src/tint/type/pointer.cc
@@ -22,8 +22,8 @@
namespace tint::type {
-Pointer::Pointer(const type::Type* subtype, ast::AddressSpace address_space, ast::Access access)
- : Base(type::TypeFlags{}), subtype_(subtype), address_space_(address_space), access_(access) {
+Pointer::Pointer(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
+ : Base(TypeFlags{}), subtype_(subtype), address_space_(address_space), access_(access) {
TINT_ASSERT(Type, !subtype->Is<Reference>());
TINT_ASSERT(Type, access != ast::Access::kUndefined);
}
@@ -32,7 +32,7 @@
return utils::Hash(TypeInfo::Of<Pointer>().full_hashcode, address_space_, subtype_, access_);
}
-bool Pointer::Equals(const type::Type& other) const {
+bool Pointer::Equals(const Type& other) const {
if (auto* o = other.As<Pointer>()) {
return o->address_space_ == address_space_ && o->subtype_ == subtype_ &&
o->access_ == access_;
diff --git a/src/tint/type/pointer.h b/src/tint/type/pointer.h
index 0828046..a7703e4 100644
--- a/src/tint/type/pointer.h
+++ b/src/tint/type/pointer.h
@@ -24,13 +24,13 @@
namespace tint::type {
/// A pointer type.
-class Pointer final : public Castable<Pointer, type::Type> {
+class Pointer final : public Castable<Pointer, Type> {
public:
/// Constructor
/// @param subtype the pointee type
/// @param address_space the address space of the pointer
/// @param access the resolved access control of the reference
- Pointer(const type::Type* subtype, ast::AddressSpace address_space, ast::Access access);
+ Pointer(const Type* subtype, ast::AddressSpace address_space, ast::Access access);
/// Move constructor
Pointer(Pointer&&);
@@ -44,7 +44,7 @@
bool Equals(const Type& other) const override;
/// @returns the pointee type
- const type::Type* StoreType() const { return subtype_; }
+ const Type* StoreType() const { return subtype_; }
/// @returns the address space of the pointer
ast::AddressSpace AddressSpace() const { return address_space_; }
diff --git a/src/tint/type/pointer_test.cc b/src/tint/type/pointer_test.cc
index ebfb895..4f8033f 100644
--- a/src/tint/type/pointer_test.cc
+++ b/src/tint/type/pointer_test.cc
@@ -21,17 +21,13 @@
using PointerTest = TestHelper;
TEST_F(PointerTest, Creation) {
- auto* a =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* b =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* c =
- create<Pointer>(create<type::F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* d =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
- auto* e = create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
+ auto* a = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* b = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* c = create<Pointer>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* d = create<Pointer>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
+ auto* e = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
- EXPECT_TRUE(a->StoreType()->Is<type::I32>());
+ EXPECT_TRUE(a->StoreType()->Is<I32>());
EXPECT_EQ(a->AddressSpace(), ast::AddressSpace::kStorage);
EXPECT_EQ(a->Access(), ast::Access::kReadWrite);
@@ -42,15 +38,11 @@
}
TEST_F(PointerTest, Hash) {
- auto* a =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* b =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* c =
- create<Pointer>(create<type::F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* d =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
- auto* e = create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
+ auto* a = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* b = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* c = create<Pointer>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* d = create<Pointer>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
+ auto* e = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
@@ -59,31 +51,26 @@
}
TEST_F(PointerTest, Equals) {
- auto* a =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* b =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* c =
- create<Pointer>(create<type::F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
- auto* d =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
- auto* e = create<Pointer>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
+ auto* a = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* b = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* c = create<Pointer>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* d = create<Pointer>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
+ auto* e = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
EXPECT_FALSE(a->Equals(*d));
EXPECT_FALSE(a->Equals(*e));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(PointerTest, FriendlyName) {
- auto* r = create<Pointer>(create<type::I32>(), ast::AddressSpace::kNone, ast::Access::kRead);
+ auto* r = create<Pointer>(create<I32>(), ast::AddressSpace::kNone, ast::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<i32, read>");
}
TEST_F(PointerTest, FriendlyNameWithAddressSpace) {
- auto* r =
- create<Pointer>(create<type::I32>(), ast::AddressSpace::kWorkgroup, ast::Access::kRead);
+ auto* r = create<Pointer>(create<I32>(), ast::AddressSpace::kWorkgroup, ast::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<workgroup, i32, read>");
}
diff --git a/src/tint/type/reference.cc b/src/tint/type/reference.cc
index 475c80e..93cb7f2 100644
--- a/src/tint/type/reference.cc
+++ b/src/tint/type/reference.cc
@@ -21,8 +21,8 @@
namespace tint::type {
-Reference::Reference(const type::Type* subtype, ast::AddressSpace address_space, ast::Access access)
- : Base(type::TypeFlags{}), subtype_(subtype), address_space_(address_space), access_(access) {
+Reference::Reference(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
+ : Base(TypeFlags{}), subtype_(subtype), address_space_(address_space), access_(access) {
TINT_ASSERT(Type, !subtype->Is<Reference>());
TINT_ASSERT(Type, access != ast::Access::kUndefined);
}
@@ -31,7 +31,7 @@
return utils::Hash(TypeInfo::Of<Reference>().full_hashcode, address_space_, subtype_, access_);
}
-bool Reference::Equals(const type::Type& other) const {
+bool Reference::Equals(const Type& other) const {
if (auto* o = other.As<Reference>()) {
return o->address_space_ == address_space_ && o->subtype_ == subtype_ &&
o->access_ == access_;
diff --git a/src/tint/type/reference.h b/src/tint/type/reference.h
index 94db9c4..ebf307c 100644
--- a/src/tint/type/reference.h
+++ b/src/tint/type/reference.h
@@ -24,13 +24,13 @@
namespace tint::type {
/// A reference type.
-class Reference final : public Castable<Reference, type::Type> {
+class Reference final : public Castable<Reference, Type> {
public:
/// Constructor
/// @param subtype the pointee type
/// @param address_space the address space of the reference
/// @param access the resolved access control of the reference
- Reference(const type::Type* subtype, ast::AddressSpace address_space, ast::Access access);
+ Reference(const Type* subtype, ast::AddressSpace address_space, ast::Access access);
/// Move constructor
Reference(Reference&&);
@@ -44,7 +44,7 @@
bool Equals(const Type& other) const override;
/// @returns the pointee type
- const type::Type* StoreType() const { return subtype_; }
+ const Type* StoreType() const { return subtype_; }
/// @returns the address space of the reference
ast::AddressSpace AddressSpace() const { return address_space_; }
diff --git a/src/tint/type/reference_test.cc b/src/tint/type/reference_test.cc
index b5f06b4..3d50997 100644
--- a/src/tint/type/reference_test.cc
+++ b/src/tint/type/reference_test.cc
@@ -21,18 +21,17 @@
using ReferenceTest = TestHelper;
TEST_F(ReferenceTest, Creation) {
- auto* a = create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* b = create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* c = create<Reference>(create<type::F32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* d = create<Reference>(create<type::I32>(), ast::AddressSpace::kPrivate,
- ast::Access::kReadWrite);
- auto* e =
- create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
+ auto* a =
+ create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* b =
+ create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* c =
+ create<Reference>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* d =
+ create<Reference>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
+ auto* e = create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
- EXPECT_TRUE(a->StoreType()->Is<type::I32>());
+ EXPECT_TRUE(a->StoreType()->Is<I32>());
EXPECT_EQ(a->AddressSpace(), ast::AddressSpace::kStorage);
EXPECT_EQ(a->Access(), ast::Access::kReadWrite);
@@ -43,16 +42,15 @@
}
TEST_F(ReferenceTest, Hash) {
- auto* a = create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* b = create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* c = create<Reference>(create<type::F32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* d = create<Reference>(create<type::I32>(), ast::AddressSpace::kPrivate,
- ast::Access::kReadWrite);
- auto* e =
- create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
+ auto* a =
+ create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* b =
+ create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* c =
+ create<Reference>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* d =
+ create<Reference>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
+ auto* e = create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
@@ -61,32 +59,30 @@
}
TEST_F(ReferenceTest, Equals) {
- auto* a = create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* b = create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* c = create<Reference>(create<type::F32>(), ast::AddressSpace::kStorage,
- ast::Access::kReadWrite);
- auto* d = create<Reference>(create<type::I32>(), ast::AddressSpace::kPrivate,
- ast::Access::kReadWrite);
- auto* e =
- create<Reference>(create<type::I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
+ auto* a =
+ create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* b =
+ create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* c =
+ create<Reference>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
+ auto* d =
+ create<Reference>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
+ auto* e = create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
EXPECT_FALSE(a->Equals(*d));
EXPECT_FALSE(a->Equals(*e));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(ReferenceTest, FriendlyName) {
- auto* r = create<Reference>(create<type::I32>(), ast::AddressSpace::kNone, ast::Access::kRead);
+ auto* r = create<Reference>(create<I32>(), ast::AddressSpace::kNone, ast::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ref<i32, read>");
}
TEST_F(ReferenceTest, FriendlyNameWithAddressSpace) {
- auto* r =
- create<Reference>(create<type::I32>(), ast::AddressSpace::kWorkgroup, ast::Access::kRead);
+ auto* r = create<Reference>(create<I32>(), ast::AddressSpace::kWorkgroup, ast::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ref<workgroup, i32, read>");
}
diff --git a/src/tint/type/sampled_texture.cc b/src/tint/type/sampled_texture.cc
index bea18e6..2a708e5 100644
--- a/src/tint/type/sampled_texture.cc
+++ b/src/tint/type/sampled_texture.cc
@@ -21,7 +21,7 @@
namespace tint::type {
-SampledTexture::SampledTexture(ast::TextureDimension dim, const type::Type* type)
+SampledTexture::SampledTexture(ast::TextureDimension dim, const Type* type)
: Base(dim), type_(type) {
TINT_ASSERT(Type, type_);
}
@@ -34,7 +34,7 @@
return utils::Hash(TypeInfo::Of<SampledTexture>().full_hashcode, dim(), type_);
}
-bool SampledTexture::Equals(const type::Type& other) const {
+bool SampledTexture::Equals(const Type& other) const {
if (auto* o = other.As<SampledTexture>()) {
return o->dim() == dim() && o->type_ == type_;
}
diff --git a/src/tint/type/sampled_texture.h b/src/tint/type/sampled_texture.h
index 7b5f6f84..2e82f28 100644
--- a/src/tint/type/sampled_texture.h
+++ b/src/tint/type/sampled_texture.h
@@ -27,7 +27,7 @@
/// Constructor
/// @param dim the dimensionality of the texture
/// @param type the data type of the sampled texture
- SampledTexture(ast::TextureDimension dim, const type::Type* type);
+ SampledTexture(ast::TextureDimension dim, const Type* type);
/// Move constructor
SampledTexture(SampledTexture&&);
~SampledTexture() override;
@@ -40,7 +40,7 @@
bool Equals(const Type& other) const override;
/// @returns the subtype of the sampled texture
- type::Type* type() const { return const_cast<type::Type*>(type_); }
+ Type* type() const { return const_cast<Type*>(type_); }
/// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
@@ -48,7 +48,7 @@
std::string FriendlyName(const SymbolTable& symbols) const override;
private:
- const type::Type* const type_;
+ const Type* const type_;
};
} // namespace tint::type
diff --git a/src/tint/type/sampled_texture_test.cc b/src/tint/type/sampled_texture_test.cc
index 4f327ea..ab0c74d 100644
--- a/src/tint/type/sampled_texture_test.cc
+++ b/src/tint/type/sampled_texture_test.cc
@@ -25,12 +25,12 @@
using SampledTextureTest = TestHelper;
TEST_F(SampledTextureTest, Creation) {
- auto* a = create<SampledTexture>(ast::TextureDimension::kCube, create<type::F32>());
- auto* b = create<SampledTexture>(ast::TextureDimension::kCube, create<type::F32>());
- auto* c = create<SampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* d = create<SampledTexture>(ast::TextureDimension::kCube, create<type::I32>());
+ auto* a = create<SampledTexture>(ast::TextureDimension::kCube, create<F32>());
+ auto* b = create<SampledTexture>(ast::TextureDimension::kCube, create<F32>());
+ auto* c = create<SampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* d = create<SampledTexture>(ast::TextureDimension::kCube, create<I32>());
- EXPECT_TRUE(a->type()->Is<type::F32>());
+ EXPECT_TRUE(a->type()->Is<F32>());
EXPECT_EQ(a->dim(), ast::TextureDimension::kCube);
EXPECT_EQ(a, b);
@@ -39,10 +39,10 @@
}
TEST_F(SampledTextureTest, Hash) {
- auto* a = create<SampledTexture>(ast::TextureDimension::kCube, create<type::F32>());
- auto* b = create<SampledTexture>(ast::TextureDimension::kCube, create<type::F32>());
- auto* c = create<SampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* d = create<SampledTexture>(ast::TextureDimension::kCube, create<type::I32>());
+ auto* a = create<SampledTexture>(ast::TextureDimension::kCube, create<F32>());
+ auto* b = create<SampledTexture>(ast::TextureDimension::kCube, create<F32>());
+ auto* c = create<SampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* d = create<SampledTexture>(ast::TextureDimension::kCube, create<I32>());
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
@@ -50,19 +50,19 @@
}
TEST_F(SampledTextureTest, Equals) {
- auto* a = create<SampledTexture>(ast::TextureDimension::kCube, create<type::F32>());
- auto* b = create<SampledTexture>(ast::TextureDimension::kCube, create<type::F32>());
- auto* c = create<SampledTexture>(ast::TextureDimension::k2d, create<type::F32>());
- auto* d = create<SampledTexture>(ast::TextureDimension::kCube, create<type::I32>());
+ auto* a = create<SampledTexture>(ast::TextureDimension::kCube, create<F32>());
+ auto* b = create<SampledTexture>(ast::TextureDimension::kCube, create<F32>());
+ auto* c = create<SampledTexture>(ast::TextureDimension::k2d, create<F32>());
+ auto* d = create<SampledTexture>(ast::TextureDimension::kCube, create<I32>());
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
EXPECT_FALSE(a->Equals(*d));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(SampledTextureTest, IsTexture) {
- type::F32 f32;
+ F32 f32;
SampledTexture s(ast::TextureDimension::kCube, &f32);
Texture* ty = &s;
EXPECT_FALSE(ty->Is<DepthTexture>());
@@ -72,19 +72,19 @@
}
TEST_F(SampledTextureTest, Dim) {
- type::F32 f32;
+ F32 f32;
SampledTexture s(ast::TextureDimension::k3d, &f32);
EXPECT_EQ(s.dim(), ast::TextureDimension::k3d);
}
TEST_F(SampledTextureTest, Type) {
- type::F32 f32;
+ F32 f32;
SampledTexture s(ast::TextureDimension::k3d, &f32);
EXPECT_EQ(s.type(), &f32);
}
TEST_F(SampledTextureTest, FriendlyName) {
- type::F32 f32;
+ F32 f32;
SampledTexture s(ast::TextureDimension::k3d, &f32);
EXPECT_EQ(s.FriendlyName(Symbols()), "texture_3d<f32>");
}
diff --git a/src/tint/type/sampler.cc b/src/tint/type/sampler.cc
index c6d1975..f49d525 100644
--- a/src/tint/type/sampler.cc
+++ b/src/tint/type/sampler.cc
@@ -21,7 +21,7 @@
namespace tint::type {
-Sampler::Sampler(ast::SamplerKind kind) : Base(type::TypeFlags{}), kind_(kind) {}
+Sampler::Sampler(ast::SamplerKind kind) : Base(TypeFlags{}), kind_(kind) {}
Sampler::Sampler(Sampler&&) = default;
@@ -31,7 +31,7 @@
return utils::Hash(TypeInfo::Of<Sampler>().full_hashcode, kind_);
}
-bool Sampler::Equals(const type::Type& other) const {
+bool Sampler::Equals(const Type& other) const {
if (auto* o = other.As<Sampler>()) {
return o->kind_ == kind_;
}
diff --git a/src/tint/type/sampler.h b/src/tint/type/sampler.h
index 5c205a3..c8ff9d6 100644
--- a/src/tint/type/sampler.h
+++ b/src/tint/type/sampler.h
@@ -23,7 +23,7 @@
namespace tint::type {
/// A sampler type.
-class Sampler final : public Castable<Sampler, type::Type> {
+class Sampler final : public Castable<Sampler, Type> {
public:
/// Constructor
/// @param kind the kind of sampler
diff --git a/src/tint/type/sampler_test.cc b/src/tint/type/sampler_test.cc
index 038efb5..65a2370 100644
--- a/src/tint/type/sampler_test.cc
+++ b/src/tint/type/sampler_test.cc
@@ -52,7 +52,7 @@
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(SamplerTest, FriendlyNameSampler) {
diff --git a/src/tint/type/storage_texture.cc b/src/tint/type/storage_texture.cc
index 03d340e..8e8ed3d 100644
--- a/src/tint/type/storage_texture.cc
+++ b/src/tint/type/storage_texture.cc
@@ -24,7 +24,7 @@
StorageTexture::StorageTexture(ast::TextureDimension dim,
ast::TexelFormat format,
ast::Access access,
- type::Type* subtype)
+ Type* subtype)
: Base(dim), texel_format_(format), access_(access), subtype_(subtype) {}
StorageTexture::StorageTexture(StorageTexture&&) = default;
@@ -35,7 +35,7 @@
return utils::Hash(TypeInfo::Of<StorageTexture>().full_hashcode, dim(), texel_format_, access_);
}
-bool StorageTexture::Equals(const type::Type& other) const {
+bool StorageTexture::Equals(const Type& other) const {
if (auto* o = other.As<StorageTexture>()) {
return o->dim() == dim() && o->texel_format_ == texel_format_ && o->access_ == access_;
}
@@ -48,14 +48,14 @@
return out.str();
}
-type::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, type::TypeManager& type_mgr) {
+Type* StorageTexture::SubtypeFor(ast::TexelFormat format, TypeManager& type_mgr) {
switch (format) {
case ast::TexelFormat::kR32Uint:
case ast::TexelFormat::kRgba8Uint:
case ast::TexelFormat::kRg32Uint:
case ast::TexelFormat::kRgba16Uint:
case ast::TexelFormat::kRgba32Uint: {
- return type_mgr.Get<type::U32>();
+ return type_mgr.Get<U32>();
}
case ast::TexelFormat::kR32Sint:
@@ -63,7 +63,7 @@
case ast::TexelFormat::kRg32Sint:
case ast::TexelFormat::kRgba16Sint:
case ast::TexelFormat::kRgba32Sint: {
- return type_mgr.Get<type::I32>();
+ return type_mgr.Get<I32>();
}
case ast::TexelFormat::kRgba8Unorm:
@@ -72,7 +72,7 @@
case ast::TexelFormat::kRg32Float:
case ast::TexelFormat::kRgba16Float:
case ast::TexelFormat::kRgba32Float: {
- return type_mgr.Get<type::F32>();
+ return type_mgr.Get<F32>();
}
case ast::TexelFormat::kUndefined:
diff --git a/src/tint/type/storage_texture.h b/src/tint/type/storage_texture.h
index a540560..4189ebe 100644
--- a/src/tint/type/storage_texture.h
+++ b/src/tint/type/storage_texture.h
@@ -39,7 +39,7 @@
StorageTexture(ast::TextureDimension dim,
ast::TexelFormat format,
ast::Access access,
- type::Type* subtype);
+ Type* subtype);
/// Move constructor
StorageTexture(StorageTexture&&);
@@ -53,7 +53,7 @@
bool Equals(const Type& other) const override;
/// @returns the storage subtype
- type::Type* type() const { return subtype_; }
+ Type* type() const { return subtype_; }
/// @returns the texel format
ast::TexelFormat texel_format() const { return texel_format_; }
@@ -67,14 +67,14 @@
std::string FriendlyName(const SymbolTable& symbols) const override;
/// @param format the storage texture image format
- /// @param type_mgr the type::TypeManager used to build the returned type
+ /// @param type_mgr the TypeManager used to build the returned type
/// @returns the storage texture subtype for the given TexelFormat
- static type::Type* SubtypeFor(ast::TexelFormat format, type::TypeManager& type_mgr);
+ static Type* SubtypeFor(ast::TexelFormat format, TypeManager& type_mgr);
private:
ast::TexelFormat const texel_format_;
ast::Access const access_;
- type::Type* const subtype_;
+ Type* const subtype_;
};
} // namespace tint::type
diff --git a/src/tint/type/storage_texture_test.cc b/src/tint/type/storage_texture_test.cc
index a237d71..b375207 100644
--- a/src/tint/type/storage_texture_test.cc
+++ b/src/tint/type/storage_texture_test.cc
@@ -41,7 +41,7 @@
auto* e =
Create(ast::TextureDimension::kCube, ast::TexelFormat::kRgba32Float, ast::Access::kRead);
- EXPECT_TRUE(a->type()->Is<type::F32>());
+ EXPECT_TRUE(a->type()->Is<F32>());
EXPECT_EQ(a->dim(), ast::TextureDimension::kCube);
EXPECT_EQ(a, b);
@@ -84,7 +84,7 @@
EXPECT_FALSE(a->Equals(*c));
EXPECT_FALSE(a->Equals(*d));
EXPECT_FALSE(a->Equals(*e));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(StorageTextureTest, Dim) {
@@ -106,43 +106,41 @@
}
TEST_F(StorageTextureTest, F32) {
- type::Type* s = Create(ast::TextureDimension::k2dArray, ast::TexelFormat::kRgba32Float,
- ast::Access::kReadWrite);
+ Type* s = Create(ast::TextureDimension::k2dArray, ast::TexelFormat::kRgba32Float,
+ ast::Access::kReadWrite);
auto program = Build();
ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str();
ASSERT_TRUE(s->Is<Texture>());
ASSERT_TRUE(s->Is<StorageTexture>());
- EXPECT_TRUE(s->As<StorageTexture>()->type()->Is<type::F32>());
+ EXPECT_TRUE(s->As<StorageTexture>()->type()->Is<F32>());
}
TEST_F(StorageTextureTest, U32) {
- auto* subtype = type::StorageTexture::SubtypeFor(ast::TexelFormat::kRg32Uint, Types());
- type::Type* s =
- create<StorageTexture>(ast::TextureDimension::k2dArray, ast::TexelFormat::kRg32Uint,
- ast::Access::kReadWrite, subtype);
+ auto* subtype = StorageTexture::SubtypeFor(ast::TexelFormat::kRg32Uint, Types());
+ Type* s = create<StorageTexture>(ast::TextureDimension::k2dArray, ast::TexelFormat::kRg32Uint,
+ ast::Access::kReadWrite, subtype);
auto program = Build();
ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str();
ASSERT_TRUE(s->Is<Texture>());
ASSERT_TRUE(s->Is<StorageTexture>());
- EXPECT_TRUE(s->As<StorageTexture>()->type()->Is<type::U32>());
+ EXPECT_TRUE(s->As<StorageTexture>()->type()->Is<U32>());
}
TEST_F(StorageTextureTest, I32) {
- auto* subtype = type::StorageTexture::SubtypeFor(ast::TexelFormat::kRgba32Sint, Types());
- type::Type* s =
- create<StorageTexture>(ast::TextureDimension::k2dArray, ast::TexelFormat::kRgba32Sint,
- ast::Access::kReadWrite, subtype);
+ auto* subtype = StorageTexture::SubtypeFor(ast::TexelFormat::kRgba32Sint, Types());
+ Type* s = create<StorageTexture>(ast::TextureDimension::k2dArray, ast::TexelFormat::kRgba32Sint,
+ ast::Access::kReadWrite, subtype);
auto program = Build();
ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str();
ASSERT_TRUE(s->Is<Texture>());
ASSERT_TRUE(s->Is<StorageTexture>());
- EXPECT_TRUE(s->As<StorageTexture>()->type()->Is<type::I32>());
+ EXPECT_TRUE(s->As<StorageTexture>()->type()->Is<I32>());
}
} // namespace
diff --git a/src/tint/type/struct.cc b/src/tint/type/struct.cc
index bf52c37..a72aa0f 100644
--- a/src/tint/type/struct.cc
+++ b/src/tint/type/struct.cc
@@ -28,21 +28,21 @@
namespace tint::type {
namespace {
-type::TypeFlags FlagsFrom(utils::VectorRef<const StructMemberBase*> members) {
- type::TypeFlags flags{
- type::TypeFlag::kConstructable,
- type::TypeFlag::kCreationFixedFootprint,
- type::TypeFlag::kFixedFootprint,
+TypeFlags FlagsFrom(utils::VectorRef<const StructMemberBase*> members) {
+ TypeFlags flags{
+ TypeFlag::kConstructable,
+ TypeFlag::kCreationFixedFootprint,
+ TypeFlag::kFixedFootprint,
};
for (auto* member : members) {
if (!member->Type()->IsConstructible()) {
- flags.Remove(type::TypeFlag::kConstructable);
+ flags.Remove(TypeFlag::kConstructable);
}
if (!member->Type()->HasFixedFootprint()) {
- flags.Remove(type::TypeFlag::kFixedFootprint);
+ flags.Remove(TypeFlag::kFixedFootprint);
}
if (!member->Type()->HasCreationFixedFootprint()) {
- flags.Remove(type::TypeFlag::kCreationFixedFootprint);
+ flags.Remove(TypeFlag::kCreationFixedFootprint);
}
}
return flags;
@@ -70,7 +70,7 @@
return utils::Hash(TypeInfo::Of<StructBase>().full_hashcode, name_);
}
-bool StructBase::Equals(const type::Type& other) const {
+bool StructBase::Equals(const Type& other) const {
if (auto* o = other.As<StructBase>()) {
return o->name_ == name_;
}
@@ -101,9 +101,7 @@
std::string StructBase::Layout(const tint::SymbolTable& symbols) const {
std::stringstream ss;
- auto member_name_of = [&](const type::StructMemberBase* sm) {
- return symbols.NameFor(sm->Name());
- };
+ auto member_name_of = [&](const StructMemberBase* sm) { return symbols.NameFor(sm->Name()); };
if (Members().IsEmpty()) {
return {};
diff --git a/src/tint/type/struct.h b/src/tint/type/struct.h
index e6e2bbd..b9daec9 100644
--- a/src/tint/type/struct.h
+++ b/src/tint/type/struct.h
@@ -45,7 +45,7 @@
};
/// StructBase holds the Type information for structures.
-class StructBase : public Castable<StructBase, type::Type> {
+class StructBase : public Castable<StructBase, Type> {
public:
/// Constructor
/// @param source the source of the structure
@@ -167,7 +167,7 @@
};
/// StructMemberBase holds the type information for structure members.
-class StructMemberBase : public Castable<StructMemberBase, type::Node> {
+class StructMemberBase : public Castable<StructMemberBase, Node> {
public:
/// Constructor
/// @param source the source of the struct member
@@ -198,10 +198,10 @@
/// Sets the owning structure to `s`
/// @param s the new structure owner
- void SetStruct(const type::StructBase* s) { struct_ = s; }
+ void SetStruct(const StructBase* s) { struct_ = s; }
/// @returns the structure that owns this member
- const type::StructBase* Struct() const { return struct_; }
+ const StructBase* Struct() const { return struct_; }
/// @returns the type of the member
const type::Type* Type() const { return type_; }
@@ -224,7 +224,7 @@
private:
const tint::Source source_;
const Symbol name_;
- const type::StructBase* struct_;
+ const StructBase* struct_;
const type::Type* type_;
const uint32_t index_;
const uint32_t offset_;
diff --git a/src/tint/type/struct_test.cc b/src/tint/type/struct_test.cc
index e899281..55e1517 100644
--- a/src/tint/type/struct_test.cc
+++ b/src/tint/type/struct_test.cc
@@ -24,37 +24,37 @@
TEST_F(TypeStructTest, Creation) {
auto name = Sym("S");
- auto* s = create<type::StructBase>(Source{}, name, utils::Empty, 4u /* align */, 8u /* size */,
- 16u /* size_no_padding */);
+ auto* s = create<StructBase>(Source{}, name, utils::Empty, 4u /* align */, 8u /* size */,
+ 16u /* size_no_padding */);
EXPECT_EQ(s->Align(), 4u);
EXPECT_EQ(s->Size(), 8u);
EXPECT_EQ(s->SizeNoPadding(), 16u);
}
TEST_F(TypeStructTest, Hash) {
- auto* a = create<type::StructBase>(Source{}, Sym("a"), utils::Empty, 4u /* align */,
- 4u /* size */, 4u /* size_no_padding */);
- auto* b = create<type::StructBase>(Source{}, Sym("b"), utils::Empty, 4u /* align */,
- 4u /* size */, 4u /* size_no_padding */);
+ auto* a = create<StructBase>(Source{}, Sym("a"), utils::Empty, 4u /* align */, 4u /* size */,
+ 4u /* size_no_padding */);
+ auto* b = create<StructBase>(Source{}, Sym("b"), utils::Empty, 4u /* align */, 4u /* size */,
+ 4u /* size_no_padding */);
EXPECT_NE(a->Hash(), b->Hash());
}
TEST_F(TypeStructTest, Equals) {
- auto* a = create<type::StructBase>(Source{}, Sym("a"), utils::Empty, 4u /* align */,
- 4u /* size */, 4u /* size_no_padding */);
- auto* b = create<type::StructBase>(Source{}, Sym("b"), utils::Empty, 4u /* align */,
- 4u /* size */, 4u /* size_no_padding */);
+ auto* a = create<StructBase>(Source{}, Sym("a"), utils::Empty, 4u /* align */, 4u /* size */,
+ 4u /* size_no_padding */);
+ auto* b = create<StructBase>(Source{}, Sym("b"), utils::Empty, 4u /* align */, 4u /* size */,
+ 4u /* size_no_padding */);
EXPECT_TRUE(a->Equals(*a));
EXPECT_FALSE(a->Equals(*b));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(TypeStructTest, FriendlyName) {
auto name = Sym("my_struct");
- auto* s = create<type::StructBase>(Source{}, name, utils::Empty, 4u /* align */, 4u /* size */,
- 4u /* size_no_padding */);
+ auto* s = create<StructBase>(Source{}, name, utils::Empty, 4u /* align */, 4u /* size */,
+ 4u /* size_no_padding */);
EXPECT_EQ(s->FriendlyName(Symbols()), "my_struct");
}
diff --git a/src/tint/type/texture.cc b/src/tint/type/texture.cc
index 76d6df5..eedd273 100644
--- a/src/tint/type/texture.cc
+++ b/src/tint/type/texture.cc
@@ -18,7 +18,7 @@
namespace tint::type {
-Texture::Texture(ast::TextureDimension dim) : Base(type::TypeFlags{}), dim_(dim) {}
+Texture::Texture(ast::TextureDimension dim) : Base(TypeFlags{}), dim_(dim) {}
Texture::Texture(Texture&&) = default;
diff --git a/src/tint/type/texture.h b/src/tint/type/texture.h
index dc566fe..4ce0120 100644
--- a/src/tint/type/texture.h
+++ b/src/tint/type/texture.h
@@ -21,7 +21,7 @@
namespace tint::type {
/// A texture type.
-class Texture : public Castable<Texture, type::Type> {
+class Texture : public Castable<Texture, Type> {
public:
/// Constructor
/// @param dim the dimensionality of the texture
diff --git a/src/tint/type/texture_test.cc b/src/tint/type/texture_test.cc
index c7da4f5..ae223a1 100644
--- a/src/tint/type/texture_test.cc
+++ b/src/tint/type/texture_test.cc
@@ -24,7 +24,7 @@
TEST_P(TextureTypeDimTest, DimMustMatch) {
// Check that the dim() query returns the right dimensionality.
- type::F32 f32;
+ F32 f32;
// TextureType is an abstract class, so use concrete class
// SampledTexture in its stead.
SampledTexture st(GetParam(), &f32);
diff --git a/src/tint/type/type.cc b/src/tint/type/type.cc
index ca32818..1eead35 100644
--- a/src/tint/type/type.cc
+++ b/src/tint/type/type.cc
@@ -46,7 +46,7 @@
const Type* Type::UnwrapPtr() const {
auto* type = this;
- while (auto* ptr = type->As<type::Pointer>()) {
+ while (auto* ptr = type->As<Pointer>()) {
type = ptr->StoreType();
}
return type;
@@ -54,7 +54,7 @@
const Type* Type::UnwrapRef() const {
auto* type = this;
- if (auto* ref = type->As<type::Reference>()) {
+ if (auto* ref = type->As<Reference>()) {
type = ref->StoreType();
}
return type;
@@ -69,29 +69,28 @@
}
bool Type::is_scalar() const {
- return IsAnyOf<type::F16, type::F32, type::U32, type::I32, type::AbstractNumeric, type::Bool>();
+ return IsAnyOf<F16, F32, U32, I32, AbstractNumeric, Bool>();
}
bool Type::is_numeric_scalar() const {
- return IsAnyOf<type::F16, type::F32, type::U32, type::I32, type::AbstractNumeric>();
+ return IsAnyOf<F16, F32, U32, I32, AbstractNumeric>();
}
bool Type::is_float_scalar() const {
- return IsAnyOf<type::F16, type::F32, type::AbstractNumeric>();
+ return IsAnyOf<F16, F32, AbstractNumeric>();
}
bool Type::is_float_matrix() const {
- return Is([](const type::Matrix* m) { return m->type()->is_float_scalar(); });
+ return Is([](const Matrix* m) { return m->type()->is_float_scalar(); });
}
bool Type::is_square_float_matrix() const {
- return Is([](const type::Matrix* m) {
- return m->type()->is_float_scalar() && m->rows() == m->columns();
- });
+ return Is(
+ [](const Matrix* m) { return m->type()->is_float_scalar() && m->rows() == m->columns(); });
}
bool Type::is_float_vector() const {
- return Is([](const type::Vector* v) { return v->type()->is_float_scalar(); });
+ return Is([](const Vector* v) { return v->type()->is_float_scalar(); });
}
bool Type::is_float_scalar_or_vector() const {
@@ -103,32 +102,31 @@
}
bool Type::is_integer_scalar() const {
- return IsAnyOf<type::U32, type::I32>();
+ return IsAnyOf<U32, I32>();
}
bool Type::is_signed_integer_scalar() const {
- return IsAnyOf<type::I32, type::AbstractInt>();
+ return IsAnyOf<I32, AbstractInt>();
}
bool Type::is_unsigned_integer_scalar() const {
- return Is<type::U32>();
+ return Is<U32>();
}
bool Type::is_signed_integer_vector() const {
- return Is(
- [](const type::Vector* v) { return v->type()->IsAnyOf<type::I32, type::AbstractInt>(); });
+ return Is([](const Vector* v) { return v->type()->IsAnyOf<I32, AbstractInt>(); });
}
bool Type::is_unsigned_integer_vector() const {
- return Is([](const type::Vector* v) { return v->type()->Is<type::U32>(); });
+ return Is([](const Vector* v) { return v->type()->Is<U32>(); });
}
bool Type::is_unsigned_integer_scalar_or_vector() const {
- return Is<type::U32>() || is_unsigned_integer_vector();
+ return Is<U32>() || is_unsigned_integer_vector();
}
bool Type::is_signed_integer_scalar_or_vector() const {
- return IsAnyOf<type::I32, type::AbstractInt>() || is_signed_integer_vector();
+ return IsAnyOf<I32, AbstractInt>() || is_signed_integer_vector();
}
bool Type::is_integer_scalar_or_vector() const {
@@ -136,35 +134,35 @@
}
bool Type::is_abstract_integer_vector() const {
- return Is([](const type::Vector* v) { return v->type()->Is<type::AbstractInt>(); });
+ return Is([](const Vector* v) { return v->type()->Is<AbstractInt>(); });
}
bool Type::is_abstract_float_vector() const {
- return Is([](const type::Vector* v) { return v->type()->Is<type::AbstractFloat>(); });
+ return Is([](const Vector* v) { return v->type()->Is<AbstractFloat>(); });
}
bool Type::is_abstract_integer_scalar_or_vector() const {
- return Is<type::AbstractInt>() || is_abstract_integer_vector();
+ return Is<AbstractInt>() || is_abstract_integer_vector();
}
bool Type::is_abstract_float_scalar_or_vector() const {
- return Is<type::AbstractFloat>() || is_abstract_float_vector();
+ return Is<AbstractFloat>() || is_abstract_float_vector();
}
bool Type::is_bool_vector() const {
- return Is([](const type::Vector* v) { return v->type()->Is<type::Bool>(); });
+ return Is([](const Vector* v) { return v->type()->Is<Bool>(); });
}
bool Type::is_bool_scalar_or_vector() const {
- return Is<type::Bool>() || is_bool_vector();
+ return Is<Bool>() || is_bool_vector();
}
bool Type::is_numeric_vector() const {
- return Is([](const type::Vector* v) { return v->type()->is_numeric_scalar(); });
+ return Is([](const Vector* v) { return v->type()->is_numeric_scalar(); });
}
bool Type::is_scalar_vector() const {
- return Is([](const type::Vector* v) { return v->type()->is_scalar(); });
+ return Is([](const Vector* v) { return v->type()->is_scalar(); });
}
bool Type::is_numeric_scalar_or_vector() const {
@@ -172,17 +170,17 @@
}
bool Type::is_handle() const {
- return IsAnyOf<type::Sampler, type::Texture>();
+ return IsAnyOf<Sampler, Texture>();
}
bool Type::HoldsAbstract() const {
return Switch(
this, //
- [&](const type::AbstractNumeric*) { return true; },
- [&](const type::Vector* v) { return v->type()->HoldsAbstract(); },
- [&](const type::Matrix* m) { return m->type()->HoldsAbstract(); },
- [&](const type::Array* a) { return a->ElemType()->HoldsAbstract(); },
- [&](const type::StructBase* s) {
+ [&](const AbstractNumeric*) { return true; },
+ [&](const Vector* v) { return v->type()->HoldsAbstract(); },
+ [&](const Matrix* m) { return m->type()->HoldsAbstract(); },
+ [&](const Array* a) { return a->ElemType()->HoldsAbstract(); },
+ [&](const StructBase* s) {
for (auto* m : s->Members()) {
if (m->Type()->HoldsAbstract()) {
return true;
@@ -198,33 +196,33 @@
}
return Switch(
from,
- [&](const type::AbstractFloat*) {
+ [&](const AbstractFloat*) {
return Switch(
- to, //
- [&](const type::F32*) { return 1; }, //
- [&](const type::F16*) { return 2; }, //
+ to, //
+ [&](const F32*) { return 1; }, //
+ [&](const F16*) { return 2; }, //
[&](Default) { return kNoConversion; });
},
- [&](const type::AbstractInt*) {
+ [&](const AbstractInt*) {
return Switch(
- to, //
- [&](const type::I32*) { return 3; }, //
- [&](const type::U32*) { return 4; }, //
- [&](const type::AbstractFloat*) { return 5; }, //
- [&](const type::F32*) { return 6; }, //
- [&](const type::F16*) { return 7; }, //
+ to, //
+ [&](const I32*) { return 3; }, //
+ [&](const U32*) { return 4; }, //
+ [&](const AbstractFloat*) { return 5; }, //
+ [&](const F32*) { return 6; }, //
+ [&](const F16*) { return 7; }, //
[&](Default) { return kNoConversion; });
},
- [&](const type::Vector* from_vec) {
- if (auto* to_vec = to->As<type::Vector>()) {
+ [&](const Vector* from_vec) {
+ if (auto* to_vec = to->As<Vector>()) {
if (from_vec->Width() == to_vec->Width()) {
return ConversionRank(from_vec->type(), to_vec->type());
}
}
return kNoConversion;
},
- [&](const type::Matrix* from_mat) {
- if (auto* to_mat = to->As<type::Matrix>()) {
+ [&](const Matrix* from_mat) {
+ if (auto* to_mat = to->As<Matrix>()) {
if (from_mat->columns() == to_mat->columns() &&
from_mat->rows() == to_mat->rows()) {
return ConversionRank(from_mat->type(), to_mat->type());
@@ -232,15 +230,15 @@
}
return kNoConversion;
},
- [&](const type::Array* from_arr) {
- if (auto* to_arr = to->As<type::Array>()) {
+ [&](const Array* from_arr) {
+ if (auto* to_arr = to->As<Array>()) {
if (from_arr->Count() == to_arr->Count()) {
return ConversionRank(from_arr->ElemType(), to_arr->ElemType());
}
}
return kNoConversion;
},
- [&](const type::StructBase* from_str) {
+ [&](const StructBase* from_str) {
auto concrete_tys = from_str->ConcreteTypes();
for (size_t i = 0; i < concrete_tys.Length(); i++) {
if (concrete_tys[i] == to) {
@@ -261,21 +259,21 @@
}
return Switch(
ty, //
- [&](const type::Vector* v) {
+ [&](const Vector* v) {
if (count) {
*count = v->Width();
}
return v->type();
},
- [&](const type::Matrix* m) {
+ [&](const Matrix* m) {
if (count) {
*count = m->columns();
}
return m->ColumnType();
},
- [&](const type::Array* a) {
+ [&](const Array* a) {
if (count) {
- if (auto* const_count = a->Count()->As<type::ConstantArrayCount>()) {
+ if (auto* const_count = a->Count()->As<ConstantArrayCount>()) {
*count = const_count->value;
}
}
@@ -303,7 +301,7 @@
return el_ty;
}
-const type::Type* Type::Common(utils::VectorRef<const Type*> types) {
+const Type* Type::Common(utils::VectorRef<const Type*> types) {
const auto count = types.Length();
if (count == 0) {
return nullptr;
@@ -314,10 +312,10 @@
if (ty == common) {
continue; // ty == common
}
- if (type::Type::ConversionRank(ty, common) != type::Type::kNoConversion) {
+ if (Type::ConversionRank(ty, common) != Type::kNoConversion) {
continue; // ty can be converted to common.
}
- if (type::Type::ConversionRank(common, ty) != type::Type::kNoConversion) {
+ if (Type::ConversionRank(common, ty) != Type::kNoConversion) {
common = ty; // common can be converted to ty.
continue;
}
diff --git a/src/tint/type/type.h b/src/tint/type/type.h
index ed8b6e7..187b566 100644
--- a/src/tint/type/type.h
+++ b/src/tint/type/type.h
@@ -192,7 +192,7 @@
/// @returns the lowest-ranking type that all types in `types` can be implicitly converted to,
/// or nullptr if there is no consistent common type across all types in `types`.
/// @see https://www.w3.org/TR/WGSL/#conversion-rank
- static const type::Type* Common(utils::VectorRef<const Type*> types);
+ static const Type* Common(utils::VectorRef<const Type*> types);
protected:
/// Constructor
diff --git a/src/tint/type/type_manager.h b/src/tint/type/type_manager.h
index 31c4c22..4c643d3 100644
--- a/src/tint/type/type_manager.h
+++ b/src/tint/type/type_manager.h
@@ -32,7 +32,7 @@
class TypeManager final {
public:
/// Iterator is the type returned by begin() and end()
- using TypeIterator = utils::BlockAllocator<type::Type>::ConstIterator;
+ using TypeIterator = utils::BlockAllocator<Type>::ConstIterator;
/// Constructor
TypeManager();
@@ -69,7 +69,7 @@
/// If an existing instance of `T` has been constructed, then the same
/// pointer is returned.
template <typename TYPE,
- typename _ = std::enable_if<traits::IsTypeOrDerived<TYPE, type::Type>>,
+ typename _ = std::enable_if<traits::IsTypeOrDerived<TYPE, Type>>,
typename... ARGS>
TYPE* Get(ARGS&&... args) {
return types_.Get<TYPE>(std::forward<ARGS>(args)...);
@@ -79,7 +79,7 @@
/// @return a pointer to an instance of `T` with the provided arguments, or nullptr if the item
/// was not found.
template <typename TYPE,
- typename _ = std::enable_if<traits::IsTypeOrDerived<TYPE, type::Type>>,
+ typename _ = std::enable_if<traits::IsTypeOrDerived<TYPE, Type>>,
typename... ARGS>
TYPE* Find(ARGS&&... args) const {
return types_.Find<TYPE>(std::forward<ARGS>(args)...);
@@ -90,8 +90,8 @@
/// If an existing instance of `T` has been constructed, then the same
/// pointer is returned.
template <typename TYPE,
- typename _ = std::enable_if<traits::IsTypeOrDerived<TYPE, type::ArrayCount> ||
- traits::IsTypeOrDerived<TYPE, type::StructMemberBase>>,
+ typename _ = std::enable_if<traits::IsTypeOrDerived<TYPE, ArrayCount> ||
+ traits::IsTypeOrDerived<TYPE, StructMemberBase>>,
typename... ARGS>
TYPE* GetNode(ARGS&&... args) {
return nodes_.Get<TYPE>(std::forward<ARGS>(args)...);
@@ -103,8 +103,8 @@
TypeIterator end() const { return types_.end(); }
private:
- utils::UniqueAllocator<type::Type> types_;
- utils::UniqueAllocator<type::Node> nodes_;
+ utils::UniqueAllocator<Type> types_;
+ utils::UniqueAllocator<Node> nodes_;
};
} // namespace tint::type
diff --git a/src/tint/type/type_manager_test.cc b/src/tint/type/type_manager_test.cc
index 11c3645..90d7fdc 100644
--- a/src/tint/type/type_manager_test.cc
+++ b/src/tint/type/type_manager_test.cc
@@ -35,51 +35,51 @@
TEST_F(TypeManagerTest, GetUnregistered) {
TypeManager tm;
- auto* t = tm.Get<type::I32>();
+ auto* t = tm.Get<I32>();
ASSERT_NE(t, nullptr);
- EXPECT_TRUE(t->Is<type::I32>());
+ EXPECT_TRUE(t->Is<I32>());
}
TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) {
TypeManager tm;
- auto* t = tm.Get<type::I32>();
+ auto* t = tm.Get<I32>();
ASSERT_NE(t, nullptr);
- EXPECT_TRUE(t->Is<type::I32>());
+ EXPECT_TRUE(t->Is<I32>());
- auto* t2 = tm.Get<type::I32>();
+ auto* t2 = tm.Get<I32>();
EXPECT_EQ(t, t2);
}
TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) {
TypeManager tm;
- type::Type* t = tm.Get<type::I32>();
+ Type* t = tm.Get<I32>();
ASSERT_NE(t, nullptr);
- EXPECT_TRUE(t->Is<type::I32>());
+ EXPECT_TRUE(t->Is<I32>());
- type::Type* t2 = tm.Get<type::U32>();
+ Type* t2 = tm.Get<U32>();
ASSERT_NE(t2, nullptr);
EXPECT_NE(t, t2);
- EXPECT_TRUE(t2->Is<type::U32>());
+ EXPECT_TRUE(t2->Is<U32>());
}
TEST_F(TypeManagerTest, Find) {
TypeManager tm;
- auto* created = tm.Get<type::I32>();
+ auto* created = tm.Get<I32>();
- EXPECT_EQ(tm.Find<type::U32>(), nullptr);
- EXPECT_EQ(tm.Find<type::I32>(), created);
+ EXPECT_EQ(tm.Find<U32>(), nullptr);
+ EXPECT_EQ(tm.Find<I32>(), created);
}
TEST_F(TypeManagerTest, WrapDoesntAffectInner) {
TypeManager inner;
TypeManager outer = TypeManager::Wrap(inner);
- inner.Get<type::I32>();
+ inner.Get<I32>();
EXPECT_EQ(count(inner), 1u);
EXPECT_EQ(count(outer), 0u);
- outer.Get<type::U32>();
+ outer.Get<U32>();
EXPECT_EQ(count(inner), 1u);
EXPECT_EQ(count(outer), 1u);
diff --git a/src/tint/type/type_test.cc b/src/tint/type/type_test.cc
index a363d7e..133f521 100644
--- a/src/tint/type/type_test.cc
+++ b/src/tint/type/type_test.cc
@@ -23,135 +23,135 @@
namespace {
struct TypeTest : public TestHelper {
- const type::AbstractFloat* af = create<type::AbstractFloat>();
- const type::AbstractInt* ai = create<type::AbstractInt>();
- const type::F32* f32 = create<type::F32>();
- const type::F16* f16 = create<type::F16>();
- const type::I32* i32 = create<type::I32>();
- const type::U32* u32 = create<type::U32>();
- const type::Vector* vec2_f32 = create<type::Vector>(f32, 2u);
- const type::Vector* vec3_f32 = create<type::Vector>(f32, 3u);
- const type::Vector* vec3_f16 = create<type::Vector>(f16, 3u);
- const type::Vector* vec4_f32 = create<type::Vector>(f32, 4u);
- const type::Vector* vec3_u32 = create<type::Vector>(u32, 3u);
- const type::Vector* vec3_i32 = create<type::Vector>(i32, 3u);
- const type::Vector* vec3_af = create<type::Vector>(af, 3u);
- const type::Vector* vec3_ai = create<type::Vector>(ai, 3u);
- const type::Matrix* mat2x4_f32 = create<type::Matrix>(vec4_f32, 2u);
- const type::Matrix* mat3x4_f32 = create<type::Matrix>(vec4_f32, 3u);
- const type::Matrix* mat4x2_f32 = create<type::Matrix>(vec2_f32, 4u);
- const type::Matrix* mat4x3_f32 = create<type::Matrix>(vec3_f32, 4u);
- const type::Matrix* mat4x3_f16 = create<type::Matrix>(vec3_f16, 4u);
- const type::Matrix* mat4x3_af = create<type::Matrix>(vec3_af, 4u);
- const type::Reference* ref_u32 =
- create<type::Reference>(u32, ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
- const type::StructBase* str_f32 = create<type::StructBase>(Source{},
- Sym("str_f32"),
- utils::Vector{
- create<type::StructMemberBase>(
- /* source */ Source{},
- /* name */ Sym("x"),
- /* type */ f32,
- /* index */ 0u,
- /* offset */ 0u,
- /* align */ 4u,
- /* size */ 4u,
- /* location */ std::nullopt),
- },
- /* align*/ 4u,
- /* size*/ 4u,
- /* size_no_padding*/ 4u);
- const type::StructBase* str_f16 = create<type::StructBase>(Source{},
- Sym("str_f16"),
- utils::Vector{
- create<type::StructMemberBase>(
- /* source */ Source{},
- /* name */ Sym("x"),
- /* type */ f16,
- /* index */ 0u,
- /* offset */ 0u,
- /* align */ 4u,
- /* size */ 4u,
- /* location */ std::nullopt),
- },
- /* align*/ 4u,
- /* size*/ 4u,
- /* size_no_padding*/ 4u);
- type::StructBase* str_af = create<type::StructBase>(Source{},
- Sym("str_af"),
- utils::Vector{
- create<type::StructMemberBase>(
- /* source */ Source{},
- /* name */ Sym("x"),
- /* type */ af,
- /* index */ 0u,
- /* offset */ 0u,
- /* align */ 4u,
- /* size */ 4u,
- /* location */ std::nullopt),
- },
- /* align*/ 4u,
- /* size*/ 4u,
- /* size_no_padding*/ 4u);
- const type::Array* arr_i32 = create<type::Array>(
+ const AbstractFloat* af = create<AbstractFloat>();
+ const AbstractInt* ai = create<AbstractInt>();
+ const F32* f32 = create<F32>();
+ const F16* f16 = create<F16>();
+ const I32* i32 = create<I32>();
+ const U32* u32 = create<U32>();
+ const Vector* vec2_f32 = create<Vector>(f32, 2u);
+ const Vector* vec3_f32 = create<Vector>(f32, 3u);
+ const Vector* vec3_f16 = create<Vector>(f16, 3u);
+ const Vector* vec4_f32 = create<Vector>(f32, 4u);
+ const Vector* vec3_u32 = create<Vector>(u32, 3u);
+ const Vector* vec3_i32 = create<Vector>(i32, 3u);
+ const Vector* vec3_af = create<Vector>(af, 3u);
+ const Vector* vec3_ai = create<Vector>(ai, 3u);
+ const Matrix* mat2x4_f32 = create<Matrix>(vec4_f32, 2u);
+ const Matrix* mat3x4_f32 = create<Matrix>(vec4_f32, 3u);
+ const Matrix* mat4x2_f32 = create<Matrix>(vec2_f32, 4u);
+ const Matrix* mat4x3_f32 = create<Matrix>(vec3_f32, 4u);
+ const Matrix* mat4x3_f16 = create<Matrix>(vec3_f16, 4u);
+ const Matrix* mat4x3_af = create<Matrix>(vec3_af, 4u);
+ const Reference* ref_u32 =
+ create<Reference>(u32, ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
+ const StructBase* str_f32 = create<StructBase>(Source{},
+ Sym("str_f32"),
+ utils::Vector{
+ create<StructMemberBase>(
+ /* source */ Source{},
+ /* name */ Sym("x"),
+ /* type */ f32,
+ /* index */ 0u,
+ /* offset */ 0u,
+ /* align */ 4u,
+ /* size */ 4u,
+ /* location */ std::nullopt),
+ },
+ /* align*/ 4u,
+ /* size*/ 4u,
+ /* size_no_padding*/ 4u);
+ const StructBase* str_f16 = create<StructBase>(Source{},
+ Sym("str_f16"),
+ utils::Vector{
+ create<StructMemberBase>(
+ /* source */ Source{},
+ /* name */ Sym("x"),
+ /* type */ f16,
+ /* index */ 0u,
+ /* offset */ 0u,
+ /* align */ 4u,
+ /* size */ 4u,
+ /* location */ std::nullopt),
+ },
+ /* align*/ 4u,
+ /* size*/ 4u,
+ /* size_no_padding*/ 4u);
+ StructBase* str_af = create<StructBase>(Source{},
+ Sym("str_af"),
+ utils::Vector{
+ create<StructMemberBase>(
+ /* source */ Source{},
+ /* name */ Sym("x"),
+ /* type */ af,
+ /* index */ 0u,
+ /* offset */ 0u,
+ /* align */ 4u,
+ /* size */ 4u,
+ /* location */ std::nullopt),
+ },
+ /* align*/ 4u,
+ /* size*/ 4u,
+ /* size_no_padding*/ 4u);
+ const Array* arr_i32 = create<Array>(
/* element */ i32,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 4u,
/* size */ 5u * 4u,
/* stride */ 5u * 4u,
/* implicit_stride */ 5u * 4u);
- const type::Array* arr_ai = create<type::Array>(
+ const Array* arr_ai = create<Array>(
/* element */ ai,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 4u,
/* size */ 5u * 4u,
/* stride */ 5u * 4u,
/* implicit_stride */ 5u * 4u);
- const type::Array* arr_vec3_i32 = create<type::Array>(
+ const Array* arr_vec3_i32 = create<Array>(
/* element */ vec3_i32,
/* count */ create<ConstantArrayCount>(5u),
/* align */ 16u,
/* size */ 5u * 16u,
/* stride */ 5u * 16u,
/* implicit_stride */ 5u * 16u);
- const type::Array* arr_vec3_ai = create<type::Array>(
+ const Array* arr_vec3_ai = create<Array>(
/* element */ vec3_ai,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 16u,
/* size */ 5u * 16u,
/* stride */ 5u * 16u,
/* implicit_stride */ 5u * 16u);
- const type::Array* arr_mat4x3_f16 = create<type::Array>(
+ const Array* arr_mat4x3_f16 = create<Array>(
/* element */ mat4x3_f16,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 32u,
/* size */ 5u * 32u,
/* stride */ 5u * 32u,
/* implicit_stride */ 5u * 32u);
- const type::Array* arr_mat4x3_f32 = create<type::Array>(
+ const Array* arr_mat4x3_f32 = create<Array>(
/* element */ mat4x3_f32,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 64u,
/* size */ 5u * 64u,
/* stride */ 5u * 64u,
/* implicit_stride */ 5u * 64u);
- const type::Array* arr_mat4x3_af = create<type::Array>(
+ const Array* arr_mat4x3_af = create<Array>(
/* element */ mat4x3_af,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 64u,
/* size */ 5u * 64u,
/* stride */ 5u * 64u,
/* implicit_stride */ 5u * 64u);
- const type::Array* arr_str_f16 = create<type::Array>(
+ const Array* arr_str_f16 = create<Array>(
/* element */ str_f16,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 4u,
/* size */ 5u * 4u,
/* stride */ 5u * 4u,
/* implicit_stride */ 5u * 4u);
- const type::Array* arr_str_af = create<type::Array>(
+ const Array* arr_str_af = create<Array>(
/* element */ str_af,
- /* count */ create<type::ConstantArrayCount>(5u),
+ /* count */ create<ConstantArrayCount>(5u),
/* align */ 4u,
/* size */ 5u * 4u,
/* stride */ 5u * 4u,
diff --git a/src/tint/type/u32.cc b/src/tint/type/u32.cc
index 54b487e..b787c96 100644
--- a/src/tint/type/u32.cc
+++ b/src/tint/type/u32.cc
@@ -21,7 +21,7 @@
namespace tint::type {
U32::U32()
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/u32.h b/src/tint/type/u32.h
index bbbc33f..6e2c4cc 100644
--- a/src/tint/type/u32.h
+++ b/src/tint/type/u32.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A unsigned int 32 type.
-class U32 final : public Castable<U32, type::Type> {
+class U32 final : public Castable<U32, Type> {
public:
/// Constructor
U32();
diff --git a/src/tint/type/vector.cc b/src/tint/type/vector.cc
index a044613..a2b57a4 100644
--- a/src/tint/type/vector.cc
+++ b/src/tint/type/vector.cc
@@ -22,7 +22,7 @@
namespace tint::type {
Vector::Vector(Type const* subtype, uint32_t width)
- : Base(type::TypeFlags{
+ : Base(TypeFlags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
diff --git a/src/tint/type/vector.h b/src/tint/type/vector.h
index ba84c82..fb5834d 100644
--- a/src/tint/type/vector.h
+++ b/src/tint/type/vector.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A vector type.
-class Vector final : public Castable<Vector, type::Type> {
+class Vector final : public Castable<Vector, Type> {
public:
/// Constructor
/// @param subtype the vector element type
@@ -40,7 +40,7 @@
bool Equals(const Type& other) const override;
/// @returns the type of the vector elements
- const type::Type* type() const { return subtype_; }
+ const Type* type() const { return subtype_; }
/// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
diff --git a/src/tint/type/vector_test.cc b/src/tint/type/vector_test.cc
index b83ab51..aed294a 100644
--- a/src/tint/type/vector_test.cc
+++ b/src/tint/type/vector_test.cc
@@ -21,12 +21,12 @@
using VectorTest = TestHelper;
TEST_F(VectorTest, Creation) {
- auto* a = create<Vector>(create<type::I32>(), 2u);
- auto* b = create<Vector>(create<type::I32>(), 2u);
- auto* c = create<Vector>(create<type::F32>(), 2u);
- auto* d = create<Vector>(create<type::F32>(), 3u);
+ auto* a = create<Vector>(create<I32>(), 2u);
+ auto* b = create<Vector>(create<I32>(), 2u);
+ auto* c = create<Vector>(create<F32>(), 2u);
+ auto* d = create<Vector>(create<F32>(), 3u);
- EXPECT_EQ(a->type(), create<type::I32>());
+ EXPECT_EQ(a->type(), create<I32>());
EXPECT_EQ(a->Width(), 2u);
EXPECT_EQ(a, b);
@@ -35,10 +35,10 @@
}
TEST_F(VectorTest, Hash) {
- auto* a = create<Vector>(create<type::I32>(), 2u);
- auto* b = create<Vector>(create<type::I32>(), 2u);
- auto* c = create<Vector>(create<type::F32>(), 2u);
- auto* d = create<Vector>(create<type::F32>(), 3u);
+ auto* a = create<Vector>(create<I32>(), 2u);
+ auto* b = create<Vector>(create<I32>(), 2u);
+ auto* c = create<Vector>(create<F32>(), 2u);
+ auto* d = create<Vector>(create<F32>(), 3u);
EXPECT_EQ(a->Hash(), b->Hash());
EXPECT_NE(a->Hash(), c->Hash());
@@ -46,19 +46,19 @@
}
TEST_F(VectorTest, Equals) {
- auto* a = create<Vector>(create<type::I32>(), 2u);
- auto* b = create<Vector>(create<type::I32>(), 2u);
- auto* c = create<Vector>(create<type::F32>(), 2u);
- auto* d = create<Vector>(create<type::F32>(), 3u);
+ auto* a = create<Vector>(create<I32>(), 2u);
+ auto* b = create<Vector>(create<I32>(), 2u);
+ auto* c = create<Vector>(create<F32>(), 2u);
+ auto* d = create<Vector>(create<F32>(), 3u);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
EXPECT_FALSE(a->Equals(*d));
- EXPECT_FALSE(a->Equals(type::Void{}));
+ EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(VectorTest, FriendlyName) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<F32>();
auto* v = create<Vector>(f32, 3u);
EXPECT_EQ(v->FriendlyName(Symbols()), "vec3<f32>");
}
diff --git a/src/tint/type/void.cc b/src/tint/type/void.cc
index 2b8bb17..aaeca91 100644
--- a/src/tint/type/void.cc
+++ b/src/tint/type/void.cc
@@ -20,7 +20,7 @@
namespace tint::type {
-Void::Void() : Base(type::TypeFlags{}) {}
+Void::Void() : Base(TypeFlags{}) {}
Void::Void(Void&&) = default;
diff --git a/src/tint/type/void.h b/src/tint/type/void.h
index e533c86..2106aea 100644
--- a/src/tint/type/void.h
+++ b/src/tint/type/void.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A void type
-class Void final : public Castable<Void, type::Type> {
+class Void final : public Castable<Void, Type> {
public:
/// Constructor
Void();