From f6d95d32448dec268d24b4529e5c49cc44ce9c2c Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 12 Dec 2022 21:26:23 +0000 Subject: [PATCH] Rename TypeFlags and TypeFlag. This CL updates TypeFlags and TypeFlag to drop the Type prefix. Bug: tint:1718 Change-Id: Ia197c867e39102582ba3314b7b3f24d8bec89712 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113801 Reviewed-by: Ben Clayton Kokoro: Kokoro Commit-Queue: Dan Sinclair --- src/tint/resolver/intrinsic_table.cc | 2 +- src/tint/type/abstract_numeric.cc | 2 +- src/tint/type/array.cc | 10 +++++----- src/tint/type/atomic.cc | 2 +- src/tint/type/bool.cc | 2 +- src/tint/type/f16.cc | 2 +- src/tint/type/f32.cc | 2 +- src/tint/type/i32.cc | 2 +- src/tint/type/matrix.cc | 2 +- src/tint/type/pointer.cc | 2 +- src/tint/type/reference.cc | 2 +- src/tint/type/sampler.cc | 2 +- src/tint/type/struct.cc | 16 ++++++++-------- src/tint/type/texture.cc | 2 +- src/tint/type/type.cc | 2 +- src/tint/type/type.h | 15 ++++++--------- src/tint/type/u32.cc | 2 +- src/tint/type/vector.cc | 2 +- src/tint/type/void.cc | 2 +- 19 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/tint/resolver/intrinsic_table.cc b/src/tint/resolver/intrinsic_table.cc index f6b87f3eb7..e6fd3df988 100644 --- a/src/tint/resolver/intrinsic_table.cc +++ b/src/tint/resolver/intrinsic_table.cc @@ -57,7 +57,7 @@ constexpr static const size_t kNumFixedCandidates = 8; /// A special type that matches all TypeMatchers class Any final : public Castable { public: - Any() : Base(type::TypeFlags{}) {} + Any() : Base(type::Flags{}) {} ~Any() override = default; // Stub implementations for type::Type conformance. diff --git a/src/tint/type/abstract_numeric.cc b/src/tint/type/abstract_numeric.cc index b689153285..390488e252 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/array.cc b/src/tint/type/array.cc index f8b2e0fc5c..ad903fa014 100644 --- a/src/tint/type/array.cc +++ b/src/tint/type/array.cc @@ -27,20 +27,20 @@ namespace tint::type { namespace { -TypeFlags FlagsFrom(const Type* element, const ArrayCount* count) { - TypeFlags flags; +type::Flags FlagsFrom(const Type* element, const ArrayCount* count) { + type::Flags flags; // Only constant-expression sized arrays are constructible if (count->Is()) { if (element->IsConstructible()) { - flags.Add(TypeFlag::kConstructable); + flags.Add(Flag::kConstructable); } if (element->HasCreationFixedFootprint()) { - flags.Add(TypeFlag::kCreationFixedFootprint); + flags.Add(Flag::kCreationFixedFootprint); } } if (!count->Is()) { if (element->HasFixedFootprint()) { - flags.Add(TypeFlag::kFixedFootprint); + flags.Add(Flag::kFixedFootprint); } } return flags; diff --git a/src/tint/type/atomic.cc b/src/tint/type/atomic.cc index 749959c0ea..e8508743b2 100644 --- a/src/tint/type/atomic.cc +++ b/src/tint/type/atomic.cc @@ -23,7 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Atomic); namespace tint::type { Atomic::Atomic(const type::Type* subtype) - : Base(TypeFlags{ + : Base(type::Flags{ Flag::kCreationFixedFootprint, Flag::kFixedFootprint, }), diff --git a/src/tint/type/bool.cc b/src/tint/type/bool.cc index 7cde72cb0b..a76228dc92 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/f16.cc b/src/tint/type/f16.cc index aecefa413b..4243cb8942 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/f32.cc b/src/tint/type/f32.cc index f9ff7ee386..ea86008b9f 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/i32.cc b/src/tint/type/i32.cc index 5a242e4986..fb3d258b4a 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/matrix.cc b/src/tint/type/matrix.cc index d73d190272..063ac88a61 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/pointer.cc b/src/tint/type/pointer.cc index 286e90cb06..c59170cf55 100644 --- a/src/tint/type/pointer.cc +++ b/src/tint/type/pointer.cc @@ -23,7 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Pointer); namespace tint::type { Pointer::Pointer(const Type* subtype, ast::AddressSpace address_space, ast::Access access) - : Base(TypeFlags{}), subtype_(subtype), address_space_(address_space), access_(access) { + : Base(type::Flags{}), subtype_(subtype), address_space_(address_space), access_(access) { TINT_ASSERT(Type, !subtype->Is()); TINT_ASSERT(Type, access != ast::Access::kUndefined); } diff --git a/src/tint/type/reference.cc b/src/tint/type/reference.cc index 93cb7f2352..0541f84fc2 100644 --- a/src/tint/type/reference.cc +++ b/src/tint/type/reference.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Reference); namespace tint::type { Reference::Reference(const Type* subtype, ast::AddressSpace address_space, ast::Access access) - : Base(TypeFlags{}), subtype_(subtype), address_space_(address_space), access_(access) { + : Base(type::Flags{}), subtype_(subtype), address_space_(address_space), access_(access) { TINT_ASSERT(Type, !subtype->Is()); TINT_ASSERT(Type, access != ast::Access::kUndefined); } diff --git a/src/tint/type/sampler.cc b/src/tint/type/sampler.cc index f49d525b75..c49a8efae8 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(TypeFlags{}), kind_(kind) {} +Sampler::Sampler(ast::SamplerKind kind) : Base(type::Flags{}), kind_(kind) {} Sampler::Sampler(Sampler&&) = default; diff --git a/src/tint/type/struct.cc b/src/tint/type/struct.cc index e7b220d523..778a600c51 100644 --- a/src/tint/type/struct.cc +++ b/src/tint/type/struct.cc @@ -28,21 +28,21 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::StructMember); namespace tint::type { namespace { -TypeFlags FlagsFrom(utils::VectorRef members) { - TypeFlags flags{ - TypeFlag::kConstructable, - TypeFlag::kCreationFixedFootprint, - TypeFlag::kFixedFootprint, +type::Flags FlagsFrom(utils::VectorRef members) { + type::Flags flags{ + Flag::kConstructable, + Flag::kCreationFixedFootprint, + Flag::kFixedFootprint, }; for (auto* member : members) { if (!member->Type()->IsConstructible()) { - flags.Remove(TypeFlag::kConstructable); + flags.Remove(Flag::kConstructable); } if (!member->Type()->HasFixedFootprint()) { - flags.Remove(TypeFlag::kFixedFootprint); + flags.Remove(Flag::kFixedFootprint); } if (!member->Type()->HasCreationFixedFootprint()) { - flags.Remove(TypeFlag::kCreationFixedFootprint); + flags.Remove(Flag::kCreationFixedFootprint); } } return flags; diff --git a/src/tint/type/texture.cc b/src/tint/type/texture.cc index eedd273504..0aa8549eee 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(TypeFlags{}), dim_(dim) {} +Texture::Texture(ast::TextureDimension dim) : Base(type::Flags{}), dim_(dim) {} Texture::Texture(Texture&&) = default; diff --git a/src/tint/type/type.cc b/src/tint/type/type.cc index 7241782493..d7bccc0105 100644 --- a/src/tint/type/type.cc +++ b/src/tint/type/type.cc @@ -34,7 +34,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Type); namespace tint::type { -Type::Type(TypeFlags flags) : flags_(flags) { +Type::Type(type::Flags flags) : flags_(flags) { if (IsConstructible()) { TINT_ASSERT(Type, HasCreationFixedFootprint()); } diff --git a/src/tint/type/type.h b/src/tint/type/type.h index 187b5669b8..00e1752c4a 100644 --- a/src/tint/type/type.h +++ b/src/tint/type/type.h @@ -30,7 +30,7 @@ class SymbolTable; namespace tint::type { -enum TypeFlag { +enum Flag { /// Type is constructable. /// @see https://gpuweb.github.io/gpuweb/wgsl/#constructible-types kConstructable, @@ -42,15 +42,12 @@ enum TypeFlag { kFixedFootprint, }; -/// An alias to utils::EnumSet -using TypeFlags = utils::EnumSet; +/// An alias to utils::EnumSet +using Flags = utils::EnumSet; /// Base class for a type in the system class Type : public Castable { public: - /// Alias to TypeFlag - using Flag = TypeFlag; - /// Move constructor Type(Type&&); ~Type() override; @@ -83,7 +80,7 @@ class Type : public Castable { virtual uint32_t Align() const; /// @returns the flags on the type - TypeFlags Flags() { return flags_; } + type::Flags Flags() { return flags_; } /// @returns true if type is constructable /// https://gpuweb.github.io/gpuweb/wgsl/#constructible-types @@ -197,10 +194,10 @@ class Type : public Castable { protected: /// Constructor /// @param flags the flags of this type - explicit Type(TypeFlags flags); + explicit Type(type::Flags flags); /// The flags of this type. - const TypeFlags flags_; + const type::Flags flags_; }; } // namespace tint::type diff --git a/src/tint/type/u32.cc b/src/tint/type/u32.cc index b787c96e10..fd38cb900f 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/vector.cc b/src/tint/type/vector.cc index a2b57a45d2..70b33bc428 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(TypeFlags{ + : Base(type::Flags{ Flag::kConstructable, Flag::kCreationFixedFootprint, Flag::kFixedFootprint, diff --git a/src/tint/type/void.cc b/src/tint/type/void.cc index aaeca9104c..b993dfe40e 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(TypeFlags{}) {} +Void::Void() : Base(type::Flags{}) {} Void::Void(Void&&) = default;