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 <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-12-12 21:26:23 +00:00 committed by Dawn LUCI CQ
parent f927bcb5a6
commit f6d95d3244
19 changed files with 35 additions and 38 deletions

View File

@ -57,7 +57,7 @@ constexpr static const size_t kNumFixedCandidates = 8;
/// A special type that matches all TypeMatchers
class Any final : public Castable<Any, type::Type> {
public:
Any() : Base(type::TypeFlags{}) {}
Any() : Base(type::Flags{}) {}
~Any() override = default;
// Stub implementations for type::Type conformance.

View File

@ -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,

View File

@ -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<ConstantArrayCount>()) {
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<RuntimeArrayCount>()) {
if (element->HasFixedFootprint()) {
flags.Add(TypeFlag::kFixedFootprint);
flags.Add(Flag::kFixedFootprint);
}
}
return flags;

View File

@ -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,
}),

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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<Reference>());
TINT_ASSERT(Type, access != ast::Access::kUndefined);
}

View File

@ -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<Reference>());
TINT_ASSERT(Type, access != ast::Access::kUndefined);
}

View File

@ -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;

View File

@ -28,21 +28,21 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::StructMember);
namespace tint::type {
namespace {
TypeFlags FlagsFrom(utils::VectorRef<const StructMember*> members) {
TypeFlags flags{
TypeFlag::kConstructable,
TypeFlag::kCreationFixedFootprint,
TypeFlag::kFixedFootprint,
type::Flags FlagsFrom(utils::VectorRef<const StructMember*> 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;

View File

@ -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;

View File

@ -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());
}

View File

@ -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<TypeFlag>
using TypeFlags = utils::EnumSet<TypeFlag>;
/// An alias to utils::EnumSet<Flag>
using Flags = utils::EnumSet<Flag>;
/// Base class for a type in the system
class Type : public Castable<Type, Node> {
public:
/// Alias to TypeFlag
using Flag = TypeFlag;
/// Move constructor
Type(Type&&);
~Type() override;
@ -83,7 +80,7 @@ class Type : public Castable<Type, Node> {
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<Type, Node> {
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

View File

@ -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,

View File

@ -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,

View File

@ -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;