From 98705d417ee3f7829493b6089633547d301e14d9 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 8 Dec 2022 22:21:24 +0000 Subject: [PATCH] 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 Reviewed-by: Ben Clayton Kokoro: Kokoro --- src/tint/type/abstract_float.cc | 2 +- src/tint/type/abstract_int.cc | 2 +- src/tint/type/abstract_numeric.cc | 2 +- src/tint/type/abstract_numeric.h | 2 +- src/tint/type/array.cc | 20 +- src/tint/type/array.h | 18 +- src/tint/type/array_test.cc | 131 +++++-------- src/tint/type/atomic.cc | 4 +- src/tint/type/atomic.h | 4 +- src/tint/type/atomic_test.cc | 24 +-- src/tint/type/bool.cc | 2 +- src/tint/type/bool.h | 2 +- src/tint/type/depth_multisampled_texture.cc | 2 +- .../type/depth_multisampled_texture_test.cc | 2 +- src/tint/type/depth_texture.cc | 2 +- src/tint/type/depth_texture_test.cc | 2 +- src/tint/type/external_texture.cc | 2 +- src/tint/type/external_texture_test.cc | 6 +- src/tint/type/f16.cc | 2 +- src/tint/type/f16.h | 2 +- src/tint/type/f32.cc | 2 +- src/tint/type/f32.h | 2 +- src/tint/type/i32.cc | 2 +- src/tint/type/i32.h | 2 +- src/tint/type/matrix.cc | 2 +- src/tint/type/matrix.h | 6 +- src/tint/type/matrix_test.cc | 36 ++-- src/tint/type/multisampled_texture.cc | 4 +- src/tint/type/multisampled_texture.h | 6 +- src/tint/type/multisampled_texture_test.cc | 34 ++-- src/tint/type/pointer.cc | 6 +- src/tint/type/pointer.h | 6 +- src/tint/type/pointer_test.cc | 51 ++--- src/tint/type/reference.cc | 6 +- src/tint/type/reference.h | 6 +- src/tint/type/reference_test.cc | 66 ++++--- src/tint/type/sampled_texture.cc | 4 +- src/tint/type/sampled_texture.h | 6 +- src/tint/type/sampled_texture_test.cc | 36 ++-- src/tint/type/sampler.cc | 4 +- src/tint/type/sampler.h | 2 +- src/tint/type/sampler_test.cc | 2 +- src/tint/type/storage_texture.cc | 12 +- src/tint/type/storage_texture.h | 10 +- src/tint/type/storage_texture_test.cc | 28 ++- src/tint/type/struct.cc | 22 +-- src/tint/type/struct.h | 10 +- src/tint/type/struct_test.cc | 26 +-- src/tint/type/texture.cc | 2 +- src/tint/type/texture.h | 2 +- src/tint/type/texture_test.cc | 2 +- src/tint/type/type.cc | 112 ++++++----- src/tint/type/type.h | 2 +- src/tint/type/type_manager.h | 14 +- src/tint/type/type_manager_test.cc | 28 +-- src/tint/type/type_test.cc | 174 +++++++++--------- src/tint/type/u32.cc | 2 +- src/tint/type/u32.h | 2 +- src/tint/type/vector.cc | 2 +- src/tint/type/vector.h | 4 +- src/tint/type/vector_test.cc | 30 +-- src/tint/type/void.cc | 2 +- src/tint/type/void.h | 2 +- 63 files changed, 479 insertions(+), 533 deletions(-) diff --git a/src/tint/type/abstract_float.cc b/src/tint/type/abstract_float.cc index 5e17f0a8f2..7f472dc86b 100644 --- a/src/tint/type/abstract_float.cc +++ b/src/tint/type/abstract_float.cc @@ -29,7 +29,7 @@ size_t AbstractFloat::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode); } -bool AbstractFloat::Equals(const type::Type& other) const { +bool AbstractFloat::Equals(const Type& other) const { return other.Is(); } diff --git a/src/tint/type/abstract_int.cc b/src/tint/type/abstract_int.cc index 1506e6f845..dffaab03a2 100644 --- a/src/tint/type/abstract_int.cc +++ b/src/tint/type/abstract_int.cc @@ -29,7 +29,7 @@ size_t AbstractInt::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode); } -bool AbstractInt::Equals(const type::Type& other) const { +bool AbstractInt::Equals(const Type& other) const { return other.Is(); } diff --git a/src/tint/type/abstract_numeric.cc b/src/tint/type/abstract_numeric.cc index f5fdee85db..b689153285 100644 --- a/src/tint/type/abstract_numeric.cc +++ b/src/tint/type/abstract_numeric.cc @@ -19,7 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::AbstractNumeric); 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 bc49c2d360..33cdac8f82 100644 --- a/src/tint/type/abstract_numeric.h +++ b/src/tint/type/abstract_numeric.h @@ -23,7 +23,7 @@ namespace tint::type { /// 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 { +class AbstractNumeric : public Castable { public: /// Constructor AbstractNumeric(); diff --git a/src/tint/type/array.cc b/src/tint/type/array.cc index 1d1fed5e56..f8b2e0fc5c 100644 --- a/src/tint/type/array.cc +++ b/src/tint/type/array.cc @@ -27,20 +27,20 @@ namespace tint::type { 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()) { + if (count->Is()) { 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()) { + if (!count->Is()) { if (element->HasFixedFootprint()) { - flags.Add(type::TypeFlag::kFixedFootprint); + flags.Add(TypeFlag::kFixedFootprint); } } return flags; @@ -52,8 +52,8 @@ const char* const Array::kErrExpectedConstantCount = "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 @@ size_t Array::Hash() const { return utils::Hash(TypeInfo::Of().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()) { // 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 d6defdd979..52fb8a81db 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 { +class Array final : public Castable { 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 @@ class Array final : public Castable { /// @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 @@ class Array final : public Castable { /// @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 ConstantCount() const { - if (auto* count = count_->As()) { + if (auto* count = count_->As()) { return count->value; } return std::nullopt; @@ -102,8 +102,8 @@ class Array final : public Castable { 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 f2b3ee748c..367aa4ba7a 100644 --- a/src/tint/type/array_test.cc +++ b/src/tint/type/array_test.cc @@ -22,29 +22,22 @@ namespace { using ArrayTest = TestHelper; TEST_F(ArrayTest, CreateSizedArray) { - auto* a = - create(create(), create(2u), 4u, 8u, 32u, 16u); - auto* b = - create(create(), create(2u), 4u, 8u, 32u, 16u); - auto* c = - create(create(), create(3u), 4u, 8u, 32u, 16u); - auto* d = - create(create(), create(2u), 5u, 8u, 32u, 16u); - auto* e = - create(create(), create(2u), 4u, 9u, 32u, 16u); - auto* f = - create(create(), create(2u), 4u, 8u, 33u, 16u); - auto* g = - create(create(), create(2u), 4u, 8u, 33u, 17u); + auto* a = create(create(), create(2u), 4u, 8u, 32u, 16u); + auto* b = create(create(), create(2u), 4u, 8u, 32u, 16u); + auto* c = create(create(), create(3u), 4u, 8u, 32u, 16u); + auto* d = create(create(), create(2u), 5u, 8u, 32u, 16u); + auto* e = create(create(), create(2u), 4u, 9u, 32u, 16u); + auto* f = create(create(), create(2u), 4u, 8u, 33u, 16u); + auto* g = create(create(), create(2u), 4u, 8u, 33u, 17u); - EXPECT_EQ(a->ElemType(), create()); - EXPECT_EQ(a->Count(), create(2u)); + EXPECT_EQ(a->ElemType(), create()); + EXPECT_EQ(a->Count(), create(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()); + EXPECT_FALSE(a->Count()->Is()); EXPECT_EQ(a, b); EXPECT_NE(a, c); @@ -55,27 +48,21 @@ TEST_F(ArrayTest, CreateSizedArray) { } TEST_F(ArrayTest, CreateRuntimeArray) { - auto* a = - create(create(), create(), 4u, 8u, 32u, 32u); - auto* b = - create(create(), create(), 4u, 8u, 32u, 32u); - auto* c = - create(create(), create(), 5u, 8u, 32u, 32u); - auto* d = - create(create(), create(), 4u, 9u, 32u, 32u); - auto* e = - create(create(), create(), 4u, 8u, 33u, 32u); - auto* f = - create(create(), create(), 4u, 8u, 33u, 17u); + auto* a = create(create(), create(), 4u, 8u, 32u, 32u); + auto* b = create(create(), create(), 4u, 8u, 32u, 32u); + auto* c = create(create(), create(), 5u, 8u, 32u, 32u); + auto* d = create(create(), create(), 4u, 9u, 32u, 32u); + auto* e = create(create(), create(), 4u, 8u, 33u, 32u); + auto* f = create(create(), create(), 4u, 8u, 33u, 17u); - EXPECT_EQ(a->ElemType(), create()); - EXPECT_EQ(a->Count(), create()); + EXPECT_EQ(a->ElemType(), create()); + EXPECT_EQ(a->Count(), create()); 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()); + EXPECT_TRUE(a->Count()->Is()); EXPECT_EQ(a, b); EXPECT_NE(a, c); @@ -85,20 +72,13 @@ TEST_F(ArrayTest, CreateRuntimeArray) { } TEST_F(ArrayTest, Hash) { - auto* a = - create(create(), create(2u), 4u, 8u, 32u, 16u); - auto* b = - create(create(), create(2u), 4u, 8u, 32u, 16u); - auto* c = - create(create(), create(3u), 4u, 8u, 32u, 16u); - auto* d = - create(create(), create(2u), 5u, 8u, 32u, 16u); - auto* e = - create(create(), create(2u), 4u, 9u, 32u, 16u); - auto* f = - create(create(), create(2u), 4u, 8u, 33u, 16u); - auto* g = - create(create(), create(2u), 4u, 8u, 33u, 17u); + auto* a = create(create(), create(2u), 4u, 8u, 32u, 16u); + auto* b = create(create(), create(2u), 4u, 8u, 32u, 16u); + auto* c = create(create(), create(3u), 4u, 8u, 32u, 16u); + auto* d = create(create(), create(2u), 5u, 8u, 32u, 16u); + auto* e = create(create(), create(2u), 4u, 9u, 32u, 16u); + auto* f = create(create(), create(2u), 4u, 8u, 33u, 16u); + auto* g = create(create(), create(2u), 4u, 8u, 33u, 17u); EXPECT_EQ(a->Hash(), b->Hash()); EXPECT_NE(a->Hash(), c->Hash()); @@ -109,20 +89,13 @@ TEST_F(ArrayTest, Hash) { } TEST_F(ArrayTest, Equals) { - auto* a = - create(create(), create(2u), 4u, 8u, 32u, 16u); - auto* b = - create(create(), create(2u), 4u, 8u, 32u, 16u); - auto* c = - create(create(), create(3u), 4u, 8u, 32u, 16u); - auto* d = - create(create(), create(2u), 5u, 8u, 32u, 16u); - auto* e = - create(create(), create(2u), 4u, 9u, 32u, 16u); - auto* f = - create(create(), create(2u), 4u, 8u, 33u, 16u); - auto* g = - create(create(), create(2u), 4u, 8u, 33u, 17u); + auto* a = create(create(), create(2u), 4u, 8u, 32u, 16u); + auto* b = create(create(), create(2u), 4u, 8u, 32u, 16u); + auto* c = create(create(), create(3u), 4u, 8u, 32u, 16u); + auto* d = create(create(), create(2u), 5u, 8u, 32u, 16u); + auto* e = create(create(), create(2u), 4u, 9u, 32u, 16u); + auto* f = create(create(), create(2u), 4u, 8u, 33u, 16u); + auto* g = create(create(), create(2u), 4u, 8u, 33u, 17u); EXPECT_TRUE(a->Equals(*b)); EXPECT_FALSE(a->Equals(*c)); @@ -130,42 +103,38 @@ TEST_F(ArrayTest, Equals) { 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(create(), create(), 0u, 4u, 4u, 4u); + auto* arr = create(create(), create(), 0u, 4u, 4u, 4u); EXPECT_EQ(arr->FriendlyName(Symbols()), "array"); } TEST_F(ArrayTest, FriendlyNameStaticSized) { - auto* arr = - create(create(), create(5u), 4u, 20u, 4u, 4u); + auto* arr = create(create(), create(5u), 4u, 20u, 4u, 4u); EXPECT_EQ(arr->FriendlyName(Symbols()), "array"); } TEST_F(ArrayTest, FriendlyNameRuntimeSizedNonImplicitStride) { - auto* arr = - create(create(), create(), 0u, 4u, 8u, 4u); + auto* arr = create(create(), create(), 0u, 4u, 8u, 4u); EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array"); } TEST_F(ArrayTest, FriendlyNameStaticSizedNonImplicitStride) { - auto* arr = - create(create(), create(5u), 4u, 20u, 8u, 4u); + auto* arr = create(create(), create(5u), 4u, 20u, 8u, 4u); EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array"); } TEST_F(ArrayTest, IsConstructable) { auto* fixed_sized = - create(create(), create(2u), 4u, 8u, 32u, 16u); + create(create(), create(2u), 4u, 8u, 32u, 16u); auto* named_override_sized = create( - create(), create(nullptr), 4u, 8u, 32u, 16u); + create(), create(nullptr), 4u, 8u, 32u, 16u); auto* unnamed_override_sized = create( - create(), create(nullptr), 4u, 8u, 32u, 16u); + create(), create(nullptr), 4u, 8u, 32u, 16u); auto* runtime_sized = - create(create(), create(), 4u, 8u, 32u, 16u); + create(create(), create(), 4u, 8u, 32u, 16u); EXPECT_TRUE(fixed_sized->IsConstructible()); EXPECT_FALSE(named_override_sized->IsConstructible()); @@ -175,13 +144,13 @@ TEST_F(ArrayTest, IsConstructable) { TEST_F(ArrayTest, HasCreationFixedFootprint) { auto* fixed_sized = - create(create(), create(2u), 4u, 8u, 32u, 16u); + create(create(), create(2u), 4u, 8u, 32u, 16u); auto* named_override_sized = create( - create(), create(nullptr), 4u, 8u, 32u, 16u); + create(), create(nullptr), 4u, 8u, 32u, 16u); auto* unnamed_override_sized = create( - create(), create(nullptr), 4u, 8u, 32u, 16u); + create(), create(nullptr), 4u, 8u, 32u, 16u); auto* runtime_sized = - create(create(), create(), 4u, 8u, 32u, 16u); + create(create(), create(), 4u, 8u, 32u, 16u); EXPECT_TRUE(fixed_sized->HasCreationFixedFootprint()); EXPECT_FALSE(named_override_sized->HasCreationFixedFootprint()); @@ -191,13 +160,13 @@ TEST_F(ArrayTest, HasCreationFixedFootprint) { TEST_F(ArrayTest, HasFixedFootprint) { auto* fixed_sized = - create(create(), create(2u), 4u, 8u, 32u, 16u); + create(create(), create(2u), 4u, 8u, 32u, 16u); auto* named_override_sized = create( - create(), create(nullptr), 4u, 8u, 32u, 16u); + create(), create(nullptr), 4u, 8u, 32u, 16u); auto* unnamed_override_sized = create( - create(), create(nullptr), 4u, 8u, 32u, 16u); + create(), create(nullptr), 4u, 8u, 32u, 16u); auto* runtime_sized = - create(create(), create(), 4u, 8u, 32u, 16u); + create(create(), create(), 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 ee6c98bfc4..749959c0ea 100644 --- a/src/tint/type/atomic.cc +++ b/src/tint/type/atomic.cc @@ -23,12 +23,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Atomic); 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()); + TINT_ASSERT(AST, !subtype->Is()); } size_t Atomic::Hash() const { diff --git a/src/tint/type/atomic.h b/src/tint/type/atomic.h index df05a0aed3..c05227407f 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 { +class Atomic final : public Castable { public: /// Constructor /// @param subtype the atomic type @@ -37,7 +37,7 @@ class Atomic final : public Castable { /// @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 065cf52a7f..b67e118e6d 100644 --- a/src/tint/type/atomic_test.cc +++ b/src/tint/type/atomic_test.cc @@ -22,33 +22,33 @@ namespace { using AtomicTest = TestHelper; TEST_F(AtomicTest, Creation) { - auto* a = create(create()); - auto* b = create(create()); - auto* c = create(create()); - EXPECT_TRUE(a->Type()->Is()); + auto* a = create(create()); + auto* b = create(create()); + auto* c = create(create()); + EXPECT_TRUE(a->Type()->Is()); EXPECT_EQ(a, b); EXPECT_NE(a, c); } TEST_F(AtomicTest, Hash) { - auto* a = create(create()); - auto* b = create(create()); - auto* c = create(create()); + auto* a = create(create()); + auto* b = create(create()); + auto* c = create(create()); EXPECT_EQ(a->Hash(), b->Hash()); EXPECT_NE(a->Hash(), c->Hash()); } TEST_F(AtomicTest, Equals) { - auto* a = create(create()); - auto* b = create(create()); - auto* c = create(create()); + auto* a = create(create()); + auto* b = create(create()); + auto* c = create(create()); 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(create()); + auto* a = create(create()); EXPECT_EQ(a->FriendlyName(Symbols()), "atomic"); } diff --git a/src/tint/type/bool.cc b/src/tint/type/bool.cc index 4c3ab15f5a..7cde72cb0b 100644 --- a/src/tint/type/bool.cc +++ b/src/tint/type/bool.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Bool); 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 900630d8aa..19ad8c1bd2 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 { +class Bool final : public Castable { public: /// Constructor Bool(); diff --git a/src/tint/type/depth_multisampled_texture.cc b/src/tint/type/depth_multisampled_texture.cc index 339839a865..b6a8704957 100644 --- a/src/tint/type/depth_multisampled_texture.cc +++ b/src/tint/type/depth_multisampled_texture.cc @@ -40,7 +40,7 @@ size_t DepthMultisampledTexture::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode, dim()); } -bool DepthMultisampledTexture::Equals(const type::Type& other) const { +bool DepthMultisampledTexture::Equals(const Type& other) const { if (auto* o = other.As()) { 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 d0257b98b7..1a01e543ab 100644 --- a/src/tint/type/depth_multisampled_texture_test.cc +++ b/src/tint/type/depth_multisampled_texture_test.cc @@ -44,7 +44,7 @@ TEST_F(DepthMultisampledTextureTest, Equals) { 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 ef80dcd3ba..34edde1b9d 100644 --- a/src/tint/type/depth_texture.cc +++ b/src/tint/type/depth_texture.cc @@ -41,7 +41,7 @@ size_t DepthTexture::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode, dim()); } -bool DepthTexture::Equals(const type::Type& other) const { +bool DepthTexture::Equals(const Type& other) const { if (auto* o = other.As()) { return o->dim() == dim(); } diff --git a/src/tint/type/depth_texture_test.cc b/src/tint/type/depth_texture_test.cc index e885fa63b6..b729dc8a4b 100644 --- a/src/tint/type/depth_texture_test.cc +++ b/src/tint/type/depth_texture_test.cc @@ -49,7 +49,7 @@ TEST_F(DepthTextureTest, Equals) { 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 8480de89a4..ac7e676ba6 100644 --- a/src/tint/type/external_texture.cc +++ b/src/tint/type/external_texture.cc @@ -30,7 +30,7 @@ size_t ExternalTexture::Hash() const { return static_cast(TypeInfo::Of().full_hashcode); } -bool ExternalTexture::Equals(const type::Type& other) const { +bool ExternalTexture::Equals(const Type& other) const { return other.Is(); } diff --git a/src/tint/type/external_texture_test.cc b/src/tint/type/external_texture_test.cc index bbafebc93c..5f54015f1d 100644 --- a/src/tint/type/external_texture_test.cc +++ b/src/tint/type/external_texture_test.cc @@ -41,11 +41,11 @@ TEST_F(ExternalTextureTest, Equals) { auto* a = create(); auto* b = create(); 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()); @@ -56,7 +56,7 @@ TEST_F(ExternalTextureTest, IsTexture) { } 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 5cb3cfdca8..aecefa413b 100644 --- a/src/tint/type/f16.cc +++ b/src/tint/type/f16.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::F16); 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 a10597bed5..c4c3d1fa2b 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 { +class F16 final : public Castable { public: /// Constructor F16(); diff --git a/src/tint/type/f32.cc b/src/tint/type/f32.cc index 92bc4d459e..f9ff7ee386 100644 --- a/src/tint/type/f32.cc +++ b/src/tint/type/f32.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::F32); 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 0991c3d357..57aa560f8e 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 { +class F32 final : public Castable { public: /// Constructor F32(); diff --git a/src/tint/type/i32.cc b/src/tint/type/i32.cc index f657e244da..5a242e4986 100644 --- a/src/tint/type/i32.cc +++ b/src/tint/type/i32.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::I32); 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 3057cdabc7..9073daa13a 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 { +class I32 final : public Castable { public: /// Constructor I32(); diff --git a/src/tint/type/matrix.cc b/src/tint/type/matrix.cc index ecc22506a6..d73d190272 100644 --- a/src/tint/type/matrix.cc +++ b/src/tint/type/matrix.cc @@ -23,7 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Matrix); 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 52025c66b1..3191f95677 100644 --- a/src/tint/type/matrix.h +++ b/src/tint/type/matrix.h @@ -27,7 +27,7 @@ class Vector; namespace tint::type { /// A matrix type -class Matrix final : public Castable { +class Matrix final : public Castable { public: /// Constructor /// @param column_type the type of a column of the matrix @@ -45,7 +45,7 @@ class Matrix final : public Castable { 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 @@ class Matrix final : public Castable { 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 7cd06c353f..aff69249a6 100644 --- a/src/tint/type/matrix_test.cc +++ b/src/tint/type/matrix_test.cc @@ -21,13 +21,13 @@ namespace { using MatrixTest = TestHelper; TEST_F(MatrixTest, Creation) { - auto* a = create(create(create(), 3u), 4u); - auto* b = create(create(create(), 3u), 4u); - auto* c = create(create(create(), 3u), 4u); - auto* d = create(create(create(), 2u), 4u); - auto* e = create(create(create(), 3u), 2u); + auto* a = create(create(create(), 3u), 4u); + auto* b = create(create(create(), 3u), 4u); + auto* c = create(create(create(), 3u), 4u); + auto* d = create(create(create(), 2u), 4u); + auto* e = create(create(create(), 3u), 2u); - EXPECT_EQ(a->type(), create()); + EXPECT_EQ(a->type(), create()); EXPECT_EQ(a->rows(), 3u); EXPECT_EQ(a->columns(), 4u); @@ -38,11 +38,11 @@ TEST_F(MatrixTest, Creation) { } TEST_F(MatrixTest, Hash) { - auto* a = create(create(create(), 3u), 4u); - auto* b = create(create(create(), 3u), 4u); - auto* c = create(create(create(), 3u), 4u); - auto* d = create(create(create(), 2u), 4u); - auto* e = create(create(create(), 3u), 2u); + auto* a = create(create(create(), 3u), 4u); + auto* b = create(create(create(), 3u), 4u); + auto* c = create(create(create(), 3u), 4u); + auto* d = create(create(create(), 2u), 4u); + auto* e = create(create(create(), 3u), 2u); EXPECT_EQ(a->Hash(), b->Hash()); EXPECT_NE(a->Hash(), c->Hash()); @@ -51,21 +51,21 @@ TEST_F(MatrixTest, Hash) { } TEST_F(MatrixTest, Equals) { - auto* a = create(create(create(), 3u), 4u); - auto* b = create(create(create(), 3u), 4u); - auto* c = create(create(create(), 3u), 4u); - auto* d = create(create(create(), 2u), 4u); - auto* e = create(create(create(), 3u), 2u); + auto* a = create(create(create(), 3u), 4u); + auto* b = create(create(create(), 3u), 4u); + auto* c = create(create(create(), 3u), 4u); + auto* d = create(create(create(), 2u), 4u); + auto* e = create(create(create(), 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"); diff --git a/src/tint/type/multisampled_texture.cc b/src/tint/type/multisampled_texture.cc index 0bb2989e5d..e1d2ed795a 100644 --- a/src/tint/type/multisampled_texture.cc +++ b/src/tint/type/multisampled_texture.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::MultisampledTexture); 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 @@ size_t MultisampledTexture::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode, dim(), type_); } -bool MultisampledTexture::Equals(const type::Type& other) const { +bool MultisampledTexture::Equals(const Type& other) const { if (auto* o = other.As()) { return o->dim() == dim() && o->type_ == type_; } diff --git a/src/tint/type/multisampled_texture.h b/src/tint/type/multisampled_texture.h index d3d4a27111..421b2946ab 100644 --- a/src/tint/type/multisampled_texture.h +++ b/src/tint/type/multisampled_texture.h @@ -27,7 +27,7 @@ class MultisampledTexture final : public Castable /// 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 @@ class MultisampledTexture final : public Castable 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 @@ class MultisampledTexture final : public Castable 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 72cf496e48..cf3d28afe2 100644 --- a/src/tint/type/multisampled_texture_test.cc +++ b/src/tint/type/multisampled_texture_test.cc @@ -26,38 +26,38 @@ namespace { using MultisampledTextureTest = TestHelper; TEST_F(MultisampledTextureTest, Creation) { - auto* a = create(ast::TextureDimension::k2d, create()); - auto* b = create(ast::TextureDimension::k2d, create()); - auto* c = create(ast::TextureDimension::k3d, create()); - auto* d = create(ast::TextureDimension::k2d, create()); + auto* a = create(ast::TextureDimension::k2d, create()); + auto* b = create(ast::TextureDimension::k2d, create()); + auto* c = create(ast::TextureDimension::k3d, create()); + auto* d = create(ast::TextureDimension::k2d, create()); EXPECT_EQ(a, b); EXPECT_NE(a, c); EXPECT_NE(a, d); } TEST_F(MultisampledTextureTest, Hash) { - auto* a = create(ast::TextureDimension::k2d, create()); - auto* b = create(ast::TextureDimension::k2d, create()); - auto* c = create(ast::TextureDimension::k3d, create()); - auto* d = create(ast::TextureDimension::k2d, create()); + auto* a = create(ast::TextureDimension::k2d, create()); + auto* b = create(ast::TextureDimension::k2d, create()); + auto* c = create(ast::TextureDimension::k3d, create()); + auto* d = create(ast::TextureDimension::k2d, create()); 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(ast::TextureDimension::k2d, create()); - auto* b = create(ast::TextureDimension::k2d, create()); - auto* c = create(ast::TextureDimension::k3d, create()); - auto* d = create(ast::TextureDimension::k2d, create()); + auto* a = create(ast::TextureDimension::k2d, create()); + auto* b = create(ast::TextureDimension::k2d, create()); + auto* c = create(ast::TextureDimension::k3d, create()); + auto* d = create(ast::TextureDimension::k2d, create()); 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()); @@ -68,19 +68,19 @@ TEST_F(MultisampledTextureTest, IsTexture) { } 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"); } diff --git a/src/tint/type/pointer.cc b/src/tint/type/pointer.cc index 37dbf69612..286e90cb06 100644 --- a/src/tint/type/pointer.cc +++ b/src/tint/type/pointer.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Pointer); 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()); TINT_ASSERT(Type, access != ast::Access::kUndefined); } @@ -32,7 +32,7 @@ size_t Pointer::Hash() const { return utils::Hash(TypeInfo::Of().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()) { 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 08280466eb..a7703e458e 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 { +class Pointer final : public Castable { 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 @@ class Pointer final : public Castable { 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 ebfb895b55..4f8033f046 100644 --- a/src/tint/type/pointer_test.cc +++ b/src/tint/type/pointer_test.cc @@ -21,17 +21,13 @@ namespace { using PointerTest = TestHelper; TEST_F(PointerTest, Creation) { - auto* a = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* b = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* c = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* d = - create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); - auto* e = create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); + auto* a = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* b = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* c = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* d = create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); + auto* e = create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); - EXPECT_TRUE(a->StoreType()->Is()); + EXPECT_TRUE(a->StoreType()->Is()); EXPECT_EQ(a->AddressSpace(), ast::AddressSpace::kStorage); EXPECT_EQ(a->Access(), ast::Access::kReadWrite); @@ -42,15 +38,11 @@ TEST_F(PointerTest, Creation) { } TEST_F(PointerTest, Hash) { - auto* a = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* b = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* c = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* d = - create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); - auto* e = create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); + auto* a = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* b = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* c = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* d = create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); + auto* e = create(create(), 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, Hash) { } TEST_F(PointerTest, Equals) { - auto* a = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* b = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* c = - create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); - auto* d = - create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); - auto* e = create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); + auto* a = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* b = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* c = create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* d = create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); + auto* e = create(create(), 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(create(), ast::AddressSpace::kNone, ast::Access::kRead); + auto* r = create(create(), ast::AddressSpace::kNone, ast::Access::kRead); EXPECT_EQ(r->FriendlyName(Symbols()), "ptr"); } TEST_F(PointerTest, FriendlyNameWithAddressSpace) { - auto* r = - create(create(), ast::AddressSpace::kWorkgroup, ast::Access::kRead); + auto* r = create(create(), ast::AddressSpace::kWorkgroup, ast::Access::kRead); EXPECT_EQ(r->FriendlyName(Symbols()), "ptr"); } diff --git a/src/tint/type/reference.cc b/src/tint/type/reference.cc index 475c80e45d..93cb7f2352 100644 --- a/src/tint/type/reference.cc +++ b/src/tint/type/reference.cc @@ -21,8 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Reference); 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()); TINT_ASSERT(Type, access != ast::Access::kUndefined); } @@ -31,7 +31,7 @@ size_t Reference::Hash() const { return utils::Hash(TypeInfo::Of().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()) { 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 94db9c4557..ebf307cc43 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 { +class Reference final : public Castable { 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 @@ class Reference final : public Castable { 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 b5f06b4aa8..3d50997bbb 100644 --- a/src/tint/type/reference_test.cc +++ b/src/tint/type/reference_test.cc @@ -21,18 +21,17 @@ namespace { using ReferenceTest = TestHelper; TEST_F(ReferenceTest, Creation) { - auto* a = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* b = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* c = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* d = create(create(), ast::AddressSpace::kPrivate, - ast::Access::kReadWrite); - auto* e = - create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); + auto* a = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* b = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* c = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* d = + create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); + auto* e = create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); - EXPECT_TRUE(a->StoreType()->Is()); + EXPECT_TRUE(a->StoreType()->Is()); EXPECT_EQ(a->AddressSpace(), ast::AddressSpace::kStorage); EXPECT_EQ(a->Access(), ast::Access::kReadWrite); @@ -43,16 +42,15 @@ TEST_F(ReferenceTest, Creation) { } TEST_F(ReferenceTest, Hash) { - auto* a = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* b = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* c = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* d = create(create(), ast::AddressSpace::kPrivate, - ast::Access::kReadWrite); - auto* e = - create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); + auto* a = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* b = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* c = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* d = + create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); + auto* e = create(create(), 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, Hash) { } TEST_F(ReferenceTest, Equals) { - auto* a = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* b = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* c = create(create(), ast::AddressSpace::kStorage, - ast::Access::kReadWrite); - auto* d = create(create(), ast::AddressSpace::kPrivate, - ast::Access::kReadWrite); - auto* e = - create(create(), ast::AddressSpace::kStorage, ast::Access::kRead); + auto* a = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* b = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* c = + create(create(), ast::AddressSpace::kStorage, ast::Access::kReadWrite); + auto* d = + create(create(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite); + auto* e = create(create(), 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(create(), ast::AddressSpace::kNone, ast::Access::kRead); + auto* r = create(create(), ast::AddressSpace::kNone, ast::Access::kRead); EXPECT_EQ(r->FriendlyName(Symbols()), "ref"); } TEST_F(ReferenceTest, FriendlyNameWithAddressSpace) { - auto* r = - create(create(), ast::AddressSpace::kWorkgroup, ast::Access::kRead); + auto* r = create(create(), ast::AddressSpace::kWorkgroup, ast::Access::kRead); EXPECT_EQ(r->FriendlyName(Symbols()), "ref"); } diff --git a/src/tint/type/sampled_texture.cc b/src/tint/type/sampled_texture.cc index bea18e6710..2a708e544e 100644 --- a/src/tint/type/sampled_texture.cc +++ b/src/tint/type/sampled_texture.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::SampledTexture); 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 @@ size_t SampledTexture::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode, dim(), type_); } -bool SampledTexture::Equals(const type::Type& other) const { +bool SampledTexture::Equals(const Type& other) const { if (auto* o = other.As()) { return o->dim() == dim() && o->type_ == type_; } diff --git a/src/tint/type/sampled_texture.h b/src/tint/type/sampled_texture.h index 7b5f6f8460..2e82f28f21 100644 --- a/src/tint/type/sampled_texture.h +++ b/src/tint/type/sampled_texture.h @@ -27,7 +27,7 @@ class SampledTexture final : public Castable { /// 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 @@ class SampledTexture final : public Castable { bool Equals(const Type& other) const override; /// @returns the subtype of the sampled texture - type::Type* type() const { return const_cast(type_); } + Type* type() const { return const_cast(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 @@ class SampledTexture final : public Castable { 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 4f327ea50e..ab0c74d421 100644 --- a/src/tint/type/sampled_texture_test.cc +++ b/src/tint/type/sampled_texture_test.cc @@ -25,12 +25,12 @@ namespace { using SampledTextureTest = TestHelper; TEST_F(SampledTextureTest, Creation) { - auto* a = create(ast::TextureDimension::kCube, create()); - auto* b = create(ast::TextureDimension::kCube, create()); - auto* c = create(ast::TextureDimension::k2d, create()); - auto* d = create(ast::TextureDimension::kCube, create()); + auto* a = create(ast::TextureDimension::kCube, create()); + auto* b = create(ast::TextureDimension::kCube, create()); + auto* c = create(ast::TextureDimension::k2d, create()); + auto* d = create(ast::TextureDimension::kCube, create()); - EXPECT_TRUE(a->type()->Is()); + EXPECT_TRUE(a->type()->Is()); EXPECT_EQ(a->dim(), ast::TextureDimension::kCube); EXPECT_EQ(a, b); @@ -39,10 +39,10 @@ TEST_F(SampledTextureTest, Creation) { } TEST_F(SampledTextureTest, Hash) { - auto* a = create(ast::TextureDimension::kCube, create()); - auto* b = create(ast::TextureDimension::kCube, create()); - auto* c = create(ast::TextureDimension::k2d, create()); - auto* d = create(ast::TextureDimension::kCube, create()); + auto* a = create(ast::TextureDimension::kCube, create()); + auto* b = create(ast::TextureDimension::kCube, create()); + auto* c = create(ast::TextureDimension::k2d, create()); + auto* d = create(ast::TextureDimension::kCube, create()); EXPECT_EQ(a->Hash(), b->Hash()); EXPECT_NE(a->Hash(), c->Hash()); @@ -50,19 +50,19 @@ TEST_F(SampledTextureTest, Hash) { } TEST_F(SampledTextureTest, Equals) { - auto* a = create(ast::TextureDimension::kCube, create()); - auto* b = create(ast::TextureDimension::kCube, create()); - auto* c = create(ast::TextureDimension::k2d, create()); - auto* d = create(ast::TextureDimension::kCube, create()); + auto* a = create(ast::TextureDimension::kCube, create()); + auto* b = create(ast::TextureDimension::kCube, create()); + auto* c = create(ast::TextureDimension::k2d, create()); + auto* d = create(ast::TextureDimension::kCube, create()); 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()); @@ -72,19 +72,19 @@ TEST_F(SampledTextureTest, IsTexture) { } 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"); } diff --git a/src/tint/type/sampler.cc b/src/tint/type/sampler.cc index c6d197567b..f49d525b75 100644 --- a/src/tint/type/sampler.cc +++ b/src/tint/type/sampler.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Sampler); 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 @@ size_t Sampler::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode, kind_); } -bool Sampler::Equals(const type::Type& other) const { +bool Sampler::Equals(const Type& other) const { if (auto* o = other.As()) { return o->kind_ == kind_; } diff --git a/src/tint/type/sampler.h b/src/tint/type/sampler.h index 5c205a3e57..c8ff9d6b34 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 { +class Sampler final : public Castable { 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 038efb59ac..65a23707f5 100644 --- a/src/tint/type/sampler_test.cc +++ b/src/tint/type/sampler_test.cc @@ -52,7 +52,7 @@ TEST_F(SamplerTest, Equals) { 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 03d340e4e3..8e8ed3d90c 100644 --- a/src/tint/type/storage_texture.cc +++ b/src/tint/type/storage_texture.cc @@ -24,7 +24,7 @@ namespace tint::type { 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 @@ size_t StorageTexture::Hash() const { return utils::Hash(TypeInfo::Of().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()) { return o->dim() == dim() && o->texel_format_ == texel_format_ && o->access_ == access_; } @@ -48,14 +48,14 @@ std::string StorageTexture::FriendlyName(const SymbolTable&) const { 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(); + return type_mgr.Get(); } case ast::TexelFormat::kR32Sint: @@ -63,7 +63,7 @@ type::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, type::TypeManage case ast::TexelFormat::kRg32Sint: case ast::TexelFormat::kRgba16Sint: case ast::TexelFormat::kRgba32Sint: { - return type_mgr.Get(); + return type_mgr.Get(); } case ast::TexelFormat::kRgba8Unorm: @@ -72,7 +72,7 @@ type::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, type::TypeManage case ast::TexelFormat::kRg32Float: case ast::TexelFormat::kRgba16Float: case ast::TexelFormat::kRgba32Float: { - return type_mgr.Get(); + return type_mgr.Get(); } case ast::TexelFormat::kUndefined: diff --git a/src/tint/type/storage_texture.h b/src/tint/type/storage_texture.h index a540560a17..4189ebe239 100644 --- a/src/tint/type/storage_texture.h +++ b/src/tint/type/storage_texture.h @@ -39,7 +39,7 @@ class StorageTexture final : public Castable { StorageTexture(ast::TextureDimension dim, ast::TexelFormat format, ast::Access access, - type::Type* subtype); + Type* subtype); /// Move constructor StorageTexture(StorageTexture&&); @@ -53,7 +53,7 @@ class StorageTexture final : public Castable { 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 @@ class StorageTexture final : public Castable { 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 a237d716f2..b375207799 100644 --- a/src/tint/type/storage_texture_test.cc +++ b/src/tint/type/storage_texture_test.cc @@ -41,7 +41,7 @@ TEST_F(StorageTextureTest, Creation) { auto* e = Create(ast::TextureDimension::kCube, ast::TexelFormat::kRgba32Float, ast::Access::kRead); - EXPECT_TRUE(a->type()->Is()); + EXPECT_TRUE(a->type()->Is()); EXPECT_EQ(a->dim(), ast::TextureDimension::kCube); EXPECT_EQ(a, b); @@ -84,7 +84,7 @@ TEST_F(StorageTextureTest, Equals) { 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, FriendlyName) { } 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()); ASSERT_TRUE(s->Is()); - EXPECT_TRUE(s->As()->type()->Is()); + EXPECT_TRUE(s->As()->type()->Is()); } TEST_F(StorageTextureTest, U32) { - auto* subtype = type::StorageTexture::SubtypeFor(ast::TexelFormat::kRg32Uint, Types()); - type::Type* s = - create(ast::TextureDimension::k2dArray, ast::TexelFormat::kRg32Uint, - ast::Access::kReadWrite, subtype); + auto* subtype = StorageTexture::SubtypeFor(ast::TexelFormat::kRg32Uint, Types()); + Type* s = create(ast::TextureDimension::k2dArray, ast::TexelFormat::kRg32Uint, + ast::Access::kReadWrite, subtype); auto program = Build(); ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); ASSERT_TRUE(s->Is()); ASSERT_TRUE(s->Is()); - EXPECT_TRUE(s->As()->type()->Is()); + EXPECT_TRUE(s->As()->type()->Is()); } TEST_F(StorageTextureTest, I32) { - auto* subtype = type::StorageTexture::SubtypeFor(ast::TexelFormat::kRgba32Sint, Types()); - type::Type* s = - create(ast::TextureDimension::k2dArray, ast::TexelFormat::kRgba32Sint, - ast::Access::kReadWrite, subtype); + auto* subtype = StorageTexture::SubtypeFor(ast::TexelFormat::kRgba32Sint, Types()); + Type* s = create(ast::TextureDimension::k2dArray, ast::TexelFormat::kRgba32Sint, + ast::Access::kReadWrite, subtype); auto program = Build(); ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); ASSERT_TRUE(s->Is()); ASSERT_TRUE(s->Is()); - EXPECT_TRUE(s->As()->type()->Is()); + EXPECT_TRUE(s->As()->type()->Is()); } } // namespace diff --git a/src/tint/type/struct.cc b/src/tint/type/struct.cc index bf52c373af..a72aa0f4c7 100644 --- a/src/tint/type/struct.cc +++ b/src/tint/type/struct.cc @@ -28,21 +28,21 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::StructMemberBase); namespace tint::type { namespace { -type::TypeFlags FlagsFrom(utils::VectorRef members) { - type::TypeFlags flags{ - type::TypeFlag::kConstructable, - type::TypeFlag::kCreationFixedFootprint, - type::TypeFlag::kFixedFootprint, +TypeFlags FlagsFrom(utils::VectorRef 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 @@ size_t StructBase::Hash() const { return utils::Hash(TypeInfo::Of().full_hashcode, name_); } -bool StructBase::Equals(const type::Type& other) const { +bool StructBase::Equals(const Type& other) const { if (auto* o = other.As()) { return o->name_ == name_; } @@ -101,9 +101,7 @@ std::string StructBase::FriendlyName(const SymbolTable& symbols) const { 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 e6e2bbd1f7..b9daec9a0c 100644 --- a/src/tint/type/struct.h +++ b/src/tint/type/struct.h @@ -45,7 +45,7 @@ enum class PipelineStageUsage { }; /// StructBase holds the Type information for structures. -class StructBase : public Castable { +class StructBase : public Castable { public: /// Constructor /// @param source the source of the structure @@ -167,7 +167,7 @@ class StructBase : public Castable { }; /// StructMemberBase holds the type information for structure members. -class StructMemberBase : public Castable { +class StructMemberBase : public Castable { public: /// Constructor /// @param source the source of the struct member @@ -198,10 +198,10 @@ class StructMemberBase : public Castable { /// 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 @@ class StructMemberBase : public Castable { 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 e8992819c4..55e1517c1a 100644 --- a/src/tint/type/struct_test.cc +++ b/src/tint/type/struct_test.cc @@ -24,37 +24,37 @@ using TypeStructTest = TestHelper; TEST_F(TypeStructTest, Creation) { auto name = Sym("S"); - auto* s = create(Source{}, name, utils::Empty, 4u /* align */, 8u /* size */, - 16u /* size_no_padding */); + auto* s = create(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(Source{}, Sym("a"), utils::Empty, 4u /* align */, - 4u /* size */, 4u /* size_no_padding */); - auto* b = create(Source{}, Sym("b"), utils::Empty, 4u /* align */, - 4u /* size */, 4u /* size_no_padding */); + auto* a = create(Source{}, Sym("a"), utils::Empty, 4u /* align */, 4u /* size */, + 4u /* size_no_padding */); + auto* b = create(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(Source{}, Sym("a"), utils::Empty, 4u /* align */, - 4u /* size */, 4u /* size_no_padding */); - auto* b = create(Source{}, Sym("b"), utils::Empty, 4u /* align */, - 4u /* size */, 4u /* size_no_padding */); + auto* a = create(Source{}, Sym("a"), utils::Empty, 4u /* align */, 4u /* size */, + 4u /* size_no_padding */); + auto* b = create(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(Source{}, name, utils::Empty, 4u /* align */, 4u /* size */, - 4u /* size_no_padding */); + auto* s = create(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 76d6df5c6f..eedd273504 100644 --- a/src/tint/type/texture.cc +++ b/src/tint/type/texture.cc @@ -18,7 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Texture); 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 dc566fea12..4ce0120e0f 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 { +class Texture : public Castable { 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 c7da4f5212..ae223a121c 100644 --- a/src/tint/type/texture_test.cc +++ b/src/tint/type/texture_test.cc @@ -24,7 +24,7 @@ using TextureTypeDimTest = TestParamHelper; 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 ca328180b9..1eead356f5 100644 --- a/src/tint/type/type.cc +++ b/src/tint/type/type.cc @@ -46,7 +46,7 @@ Type::~Type() = default; const Type* Type::UnwrapPtr() const { auto* type = this; - while (auto* ptr = type->As()) { + while (auto* ptr = type->As()) { type = ptr->StoreType(); } return type; @@ -54,7 +54,7 @@ const Type* Type::UnwrapPtr() const { const Type* Type::UnwrapRef() const { auto* type = this; - if (auto* ref = type->As()) { + if (auto* ref = type->As()) { type = ref->StoreType(); } return type; @@ -69,29 +69,28 @@ uint32_t Type::Align() const { } bool Type::is_scalar() const { - return IsAnyOf(); + return IsAnyOf(); } bool Type::is_numeric_scalar() const { - return IsAnyOf(); + return IsAnyOf(); } bool Type::is_float_scalar() const { - return IsAnyOf(); + return IsAnyOf(); } 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_float_scalar_or_vector_or_matrix() const { } bool Type::is_integer_scalar() const { - return IsAnyOf(); + return IsAnyOf(); } bool Type::is_signed_integer_scalar() const { - return IsAnyOf(); + return IsAnyOf(); } bool Type::is_unsigned_integer_scalar() const { - return Is(); + return Is(); } bool Type::is_signed_integer_vector() const { - return Is( - [](const type::Vector* v) { return v->type()->IsAnyOf(); }); + return Is([](const Vector* v) { return v->type()->IsAnyOf(); }); } bool Type::is_unsigned_integer_vector() const { - return Is([](const type::Vector* v) { return v->type()->Is(); }); + return Is([](const Vector* v) { return v->type()->Is(); }); } bool Type::is_unsigned_integer_scalar_or_vector() const { - return Is() || is_unsigned_integer_vector(); + return Is() || is_unsigned_integer_vector(); } bool Type::is_signed_integer_scalar_or_vector() const { - return IsAnyOf() || is_signed_integer_vector(); + return IsAnyOf() || is_signed_integer_vector(); } bool Type::is_integer_scalar_or_vector() const { @@ -136,35 +134,35 @@ bool Type::is_integer_scalar_or_vector() const { } bool Type::is_abstract_integer_vector() const { - return Is([](const type::Vector* v) { return v->type()->Is(); }); + return Is([](const Vector* v) { return v->type()->Is(); }); } bool Type::is_abstract_float_vector() const { - return Is([](const type::Vector* v) { return v->type()->Is(); }); + return Is([](const Vector* v) { return v->type()->Is(); }); } bool Type::is_abstract_integer_scalar_or_vector() const { - return Is() || is_abstract_integer_vector(); + return Is() || is_abstract_integer_vector(); } bool Type::is_abstract_float_scalar_or_vector() const { - return Is() || is_abstract_float_vector(); + return Is() || is_abstract_float_vector(); } bool Type::is_bool_vector() const { - return Is([](const type::Vector* v) { return v->type()->Is(); }); + return Is([](const Vector* v) { return v->type()->Is(); }); } bool Type::is_bool_scalar_or_vector() const { - return Is() || is_bool_vector(); + return Is() || 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_numeric_scalar_or_vector() const { } bool Type::is_handle() const { - return IsAnyOf(); + return IsAnyOf(); } 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 @@ uint32_t Type::ConversionRank(const Type* from, const Type* to) { } 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()) { + [&](const Vector* from_vec) { + if (auto* to_vec = to->As()) { 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()) { + [&](const Matrix* from_mat) { + if (auto* to_mat = to->As()) { 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 @@ uint32_t Type::ConversionRank(const Type* from, const Type* to) { } return kNoConversion; }, - [&](const type::Array* from_arr) { - if (auto* to_arr = to->As()) { + [&](const Array* from_arr) { + if (auto* to_arr = to->As()) { 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 @@ const Type* Type::ElementOf(const Type* ty, uint32_t* count /* = nullptr */) { } 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()) { + if (auto* const_count = a->Count()->As()) { *count = const_count->value; } } @@ -303,7 +301,7 @@ const Type* Type::DeepestElementOf(const Type* ty, uint32_t* count /* = nullptr return el_ty; } -const type::Type* Type::Common(utils::VectorRef types) { +const Type* Type::Common(utils::VectorRef types) { const auto count = types.Length(); if (count == 0) { return nullptr; @@ -314,10 +312,10 @@ const type::Type* Type::Common(utils::VectorRef types) { 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 ed8b6e7189..187b5669b8 100644 --- a/src/tint/type/type.h +++ b/src/tint/type/type.h @@ -192,7 +192,7 @@ class Type : public Castable { /// @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 types); + static const Type* Common(utils::VectorRef types); protected: /// Constructor diff --git a/src/tint/type/type_manager.h b/src/tint/type/type_manager.h index 31c4c22b71..4c643d3b4e 100644 --- a/src/tint/type/type_manager.h +++ b/src/tint/type/type_manager.h @@ -32,7 +32,7 @@ namespace tint::type { class TypeManager final { public: /// Iterator is the type returned by begin() and end() - using TypeIterator = utils::BlockAllocator::ConstIterator; + using TypeIterator = utils::BlockAllocator::ConstIterator; /// Constructor TypeManager(); @@ -69,7 +69,7 @@ class TypeManager final { /// If an existing instance of `T` has been constructed, then the same /// pointer is returned. template >, + typename _ = std::enable_if>, typename... ARGS> TYPE* Get(ARGS&&... args) { return types_.Get(std::forward(args)...); @@ -79,7 +79,7 @@ class TypeManager final { /// @return a pointer to an instance of `T` with the provided arguments, or nullptr if the item /// was not found. template >, + typename _ = std::enable_if>, typename... ARGS> TYPE* Find(ARGS&&... args) const { return types_.Find(std::forward(args)...); @@ -90,8 +90,8 @@ class TypeManager final { /// If an existing instance of `T` has been constructed, then the same /// pointer is returned. template || - traits::IsTypeOrDerived>, + typename _ = std::enable_if || + traits::IsTypeOrDerived>, typename... ARGS> TYPE* GetNode(ARGS&&... args) { return nodes_.Get(std::forward(args)...); @@ -103,8 +103,8 @@ class TypeManager final { TypeIterator end() const { return types_.end(); } private: - utils::UniqueAllocator types_; - utils::UniqueAllocator nodes_; + utils::UniqueAllocator types_; + utils::UniqueAllocator nodes_; }; } // namespace tint::type diff --git a/src/tint/type/type_manager_test.cc b/src/tint/type/type_manager_test.cc index 11c3645f71..90d7fdc865 100644 --- a/src/tint/type/type_manager_test.cc +++ b/src/tint/type/type_manager_test.cc @@ -35,51 +35,51 @@ using TypeManagerTest = testing::Test; TEST_F(TypeManagerTest, GetUnregistered) { TypeManager tm; - auto* t = tm.Get(); + auto* t = tm.Get(); ASSERT_NE(t, nullptr); - EXPECT_TRUE(t->Is()); + EXPECT_TRUE(t->Is()); } TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) { TypeManager tm; - auto* t = tm.Get(); + auto* t = tm.Get(); ASSERT_NE(t, nullptr); - EXPECT_TRUE(t->Is()); + EXPECT_TRUE(t->Is()); - auto* t2 = tm.Get(); + auto* t2 = tm.Get(); EXPECT_EQ(t, t2); } TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) { TypeManager tm; - type::Type* t = tm.Get(); + Type* t = tm.Get(); ASSERT_NE(t, nullptr); - EXPECT_TRUE(t->Is()); + EXPECT_TRUE(t->Is()); - type::Type* t2 = tm.Get(); + Type* t2 = tm.Get(); ASSERT_NE(t2, nullptr); EXPECT_NE(t, t2); - EXPECT_TRUE(t2->Is()); + EXPECT_TRUE(t2->Is()); } TEST_F(TypeManagerTest, Find) { TypeManager tm; - auto* created = tm.Get(); + auto* created = tm.Get(); - EXPECT_EQ(tm.Find(), nullptr); - EXPECT_EQ(tm.Find(), created); + EXPECT_EQ(tm.Find(), nullptr); + EXPECT_EQ(tm.Find(), created); } TEST_F(TypeManagerTest, WrapDoesntAffectInner) { TypeManager inner; TypeManager outer = TypeManager::Wrap(inner); - inner.Get(); + inner.Get(); EXPECT_EQ(count(inner), 1u); EXPECT_EQ(count(outer), 0u); - outer.Get(); + outer.Get(); 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 a363d7eb44..133f52129f 100644 --- a/src/tint/type/type_test.cc +++ b/src/tint/type/type_test.cc @@ -23,135 +23,135 @@ namespace tint::type { namespace { struct TypeTest : public TestHelper { - const type::AbstractFloat* af = create(); - const type::AbstractInt* ai = create(); - const type::F32* f32 = create(); - const type::F16* f16 = create(); - const type::I32* i32 = create(); - const type::U32* u32 = create(); - const type::Vector* vec2_f32 = create(f32, 2u); - const type::Vector* vec3_f32 = create(f32, 3u); - const type::Vector* vec3_f16 = create(f16, 3u); - const type::Vector* vec4_f32 = create(f32, 4u); - const type::Vector* vec3_u32 = create(u32, 3u); - const type::Vector* vec3_i32 = create(i32, 3u); - const type::Vector* vec3_af = create(af, 3u); - const type::Vector* vec3_ai = create(ai, 3u); - const type::Matrix* mat2x4_f32 = create(vec4_f32, 2u); - const type::Matrix* mat3x4_f32 = create(vec4_f32, 3u); - const type::Matrix* mat4x2_f32 = create(vec2_f32, 4u); - const type::Matrix* mat4x3_f32 = create(vec3_f32, 4u); - const type::Matrix* mat4x3_f16 = create(vec3_f16, 4u); - const type::Matrix* mat4x3_af = create(vec3_af, 4u); - const type::Reference* ref_u32 = - create(u32, ast::AddressSpace::kPrivate, ast::Access::kReadWrite); - const type::StructBase* str_f32 = create(Source{}, - Sym("str_f32"), - utils::Vector{ - create( - /* 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(Source{}, - Sym("str_f16"), - utils::Vector{ - create( - /* 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(Source{}, - Sym("str_af"), - utils::Vector{ - create( - /* 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( + const AbstractFloat* af = create(); + const AbstractInt* ai = create(); + const F32* f32 = create(); + const F16* f16 = create(); + const I32* i32 = create(); + const U32* u32 = create(); + const Vector* vec2_f32 = create(f32, 2u); + const Vector* vec3_f32 = create(f32, 3u); + const Vector* vec3_f16 = create(f16, 3u); + const Vector* vec4_f32 = create(f32, 4u); + const Vector* vec3_u32 = create(u32, 3u); + const Vector* vec3_i32 = create(i32, 3u); + const Vector* vec3_af = create(af, 3u); + const Vector* vec3_ai = create(ai, 3u); + const Matrix* mat2x4_f32 = create(vec4_f32, 2u); + const Matrix* mat3x4_f32 = create(vec4_f32, 3u); + const Matrix* mat4x2_f32 = create(vec2_f32, 4u); + const Matrix* mat4x3_f32 = create(vec3_f32, 4u); + const Matrix* mat4x3_f16 = create(vec3_f16, 4u); + const Matrix* mat4x3_af = create(vec3_af, 4u); + const Reference* ref_u32 = + create(u32, ast::AddressSpace::kPrivate, ast::Access::kReadWrite); + const StructBase* str_f32 = create(Source{}, + Sym("str_f32"), + utils::Vector{ + create( + /* 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(Source{}, + Sym("str_f16"), + utils::Vector{ + create( + /* 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(Source{}, + Sym("str_af"), + utils::Vector{ + create( + /* 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( /* element */ i32, - /* count */ create(5u), + /* count */ create(5u), /* align */ 4u, /* size */ 5u * 4u, /* stride */ 5u * 4u, /* implicit_stride */ 5u * 4u); - const type::Array* arr_ai = create( + const Array* arr_ai = create( /* element */ ai, - /* count */ create(5u), + /* count */ create(5u), /* align */ 4u, /* size */ 5u * 4u, /* stride */ 5u * 4u, /* implicit_stride */ 5u * 4u); - const type::Array* arr_vec3_i32 = create( + const Array* arr_vec3_i32 = create( /* element */ vec3_i32, /* count */ create(5u), /* align */ 16u, /* size */ 5u * 16u, /* stride */ 5u * 16u, /* implicit_stride */ 5u * 16u); - const type::Array* arr_vec3_ai = create( + const Array* arr_vec3_ai = create( /* element */ vec3_ai, - /* count */ create(5u), + /* count */ create(5u), /* align */ 16u, /* size */ 5u * 16u, /* stride */ 5u * 16u, /* implicit_stride */ 5u * 16u); - const type::Array* arr_mat4x3_f16 = create( + const Array* arr_mat4x3_f16 = create( /* element */ mat4x3_f16, - /* count */ create(5u), + /* count */ create(5u), /* align */ 32u, /* size */ 5u * 32u, /* stride */ 5u * 32u, /* implicit_stride */ 5u * 32u); - const type::Array* arr_mat4x3_f32 = create( + const Array* arr_mat4x3_f32 = create( /* element */ mat4x3_f32, - /* count */ create(5u), + /* count */ create(5u), /* align */ 64u, /* size */ 5u * 64u, /* stride */ 5u * 64u, /* implicit_stride */ 5u * 64u); - const type::Array* arr_mat4x3_af = create( + const Array* arr_mat4x3_af = create( /* element */ mat4x3_af, - /* count */ create(5u), + /* count */ create(5u), /* align */ 64u, /* size */ 5u * 64u, /* stride */ 5u * 64u, /* implicit_stride */ 5u * 64u); - const type::Array* arr_str_f16 = create( + const Array* arr_str_f16 = create( /* element */ str_f16, - /* count */ create(5u), + /* count */ create(5u), /* align */ 4u, /* size */ 5u * 4u, /* stride */ 5u * 4u, /* implicit_stride */ 5u * 4u); - const type::Array* arr_str_af = create( + const Array* arr_str_af = create( /* element */ str_af, - /* count */ create(5u), + /* count */ create(5u), /* align */ 4u, /* size */ 5u * 4u, /* stride */ 5u * 4u, diff --git a/src/tint/type/u32.cc b/src/tint/type/u32.cc index 54b487e10c..b787c96e10 100644 --- a/src/tint/type/u32.cc +++ b/src/tint/type/u32.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::U32); 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 bbbc33fb09..6e2c4cc65e 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 { +class U32 final : public Castable { public: /// Constructor U32(); diff --git a/src/tint/type/vector.cc b/src/tint/type/vector.cc index a044613ad2..a2b57a45d2 100644 --- a/src/tint/type/vector.cc +++ b/src/tint/type/vector.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Vector); 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 ba84c821f0..fb5834dcdb 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 { +class Vector final : public Castable { public: /// Constructor /// @param subtype the vector element type @@ -40,7 +40,7 @@ class Vector final : public Castable { 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 b83ab510dd..aed294ab3d 100644 --- a/src/tint/type/vector_test.cc +++ b/src/tint/type/vector_test.cc @@ -21,12 +21,12 @@ namespace { using VectorTest = TestHelper; TEST_F(VectorTest, Creation) { - auto* a = create(create(), 2u); - auto* b = create(create(), 2u); - auto* c = create(create(), 2u); - auto* d = create(create(), 3u); + auto* a = create(create(), 2u); + auto* b = create(create(), 2u); + auto* c = create(create(), 2u); + auto* d = create(create(), 3u); - EXPECT_EQ(a->type(), create()); + EXPECT_EQ(a->type(), create()); EXPECT_EQ(a->Width(), 2u); EXPECT_EQ(a, b); @@ -35,10 +35,10 @@ TEST_F(VectorTest, Creation) { } TEST_F(VectorTest, Hash) { - auto* a = create(create(), 2u); - auto* b = create(create(), 2u); - auto* c = create(create(), 2u); - auto* d = create(create(), 3u); + auto* a = create(create(), 2u); + auto* b = create(create(), 2u); + auto* c = create(create(), 2u); + auto* d = create(create(), 3u); EXPECT_EQ(a->Hash(), b->Hash()); EXPECT_NE(a->Hash(), c->Hash()); @@ -46,19 +46,19 @@ TEST_F(VectorTest, Hash) { } TEST_F(VectorTest, Equals) { - auto* a = create(create(), 2u); - auto* b = create(create(), 2u); - auto* c = create(create(), 2u); - auto* d = create(create(), 3u); + auto* a = create(create(), 2u); + auto* b = create(create(), 2u); + auto* c = create(create(), 2u); + auto* d = create(create(), 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(); + auto* f32 = create(); auto* v = create(f32, 3u); EXPECT_EQ(v->FriendlyName(Symbols()), "vec3"); } diff --git a/src/tint/type/void.cc b/src/tint/type/void.cc index 2b8bb17312..aaeca9104c 100644 --- a/src/tint/type/void.cc +++ b/src/tint/type/void.cc @@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Void); 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 e533c86970..2106aea12e 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 { +class Void final : public Castable { public: /// Constructor Void();