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:
parent
f927bcb5a6
commit
f6d95d3244
|
@ -57,7 +57,7 @@ constexpr static const size_t kNumFixedCandidates = 8;
|
||||||
/// A special type that matches all TypeMatchers
|
/// A special type that matches all TypeMatchers
|
||||||
class Any final : public Castable<Any, type::Type> {
|
class Any final : public Castable<Any, type::Type> {
|
||||||
public:
|
public:
|
||||||
Any() : Base(type::TypeFlags{}) {}
|
Any() : Base(type::Flags{}) {}
|
||||||
~Any() override = default;
|
~Any() override = default;
|
||||||
|
|
||||||
// Stub implementations for type::Type conformance.
|
// Stub implementations for type::Type conformance.
|
||||||
|
|
|
@ -19,7 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::AbstractNumeric);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
AbstractNumeric::AbstractNumeric()
|
AbstractNumeric::AbstractNumeric()
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -27,20 +27,20 @@ namespace tint::type {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TypeFlags FlagsFrom(const Type* element, const ArrayCount* count) {
|
type::Flags FlagsFrom(const Type* element, const ArrayCount* count) {
|
||||||
TypeFlags flags;
|
type::Flags flags;
|
||||||
// Only constant-expression sized arrays are constructible
|
// Only constant-expression sized arrays are constructible
|
||||||
if (count->Is<ConstantArrayCount>()) {
|
if (count->Is<ConstantArrayCount>()) {
|
||||||
if (element->IsConstructible()) {
|
if (element->IsConstructible()) {
|
||||||
flags.Add(TypeFlag::kConstructable);
|
flags.Add(Flag::kConstructable);
|
||||||
}
|
}
|
||||||
if (element->HasCreationFixedFootprint()) {
|
if (element->HasCreationFixedFootprint()) {
|
||||||
flags.Add(TypeFlag::kCreationFixedFootprint);
|
flags.Add(Flag::kCreationFixedFootprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!count->Is<RuntimeArrayCount>()) {
|
if (!count->Is<RuntimeArrayCount>()) {
|
||||||
if (element->HasFixedFootprint()) {
|
if (element->HasFixedFootprint()) {
|
||||||
flags.Add(TypeFlag::kFixedFootprint);
|
flags.Add(Flag::kFixedFootprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return flags;
|
return flags;
|
||||||
|
|
|
@ -23,7 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Atomic);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Atomic::Atomic(const type::Type* subtype)
|
Atomic::Atomic(const type::Type* subtype)
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Bool);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Bool::Bool()
|
Bool::Bool()
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::F16);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
F16::F16()
|
F16::F16()
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::F32);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
F32::F32()
|
F32::F32()
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::I32);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
I32::I32()
|
I32::I32()
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -23,7 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Matrix);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Matrix::Matrix(const Vector* column_type, uint32_t columns)
|
Matrix::Matrix(const Vector* column_type, uint32_t columns)
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -23,7 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Pointer);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Pointer::Pointer(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
|
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, !subtype->Is<Reference>());
|
||||||
TINT_ASSERT(Type, access != ast::Access::kUndefined);
|
TINT_ASSERT(Type, access != ast::Access::kUndefined);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Reference);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Reference::Reference(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
|
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, !subtype->Is<Reference>());
|
||||||
TINT_ASSERT(Type, access != ast::Access::kUndefined);
|
TINT_ASSERT(Type, access != ast::Access::kUndefined);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Sampler);
|
||||||
|
|
||||||
namespace tint::type {
|
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;
|
Sampler::Sampler(Sampler&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -28,21 +28,21 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::StructMember);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TypeFlags FlagsFrom(utils::VectorRef<const StructMember*> members) {
|
type::Flags FlagsFrom(utils::VectorRef<const StructMember*> members) {
|
||||||
TypeFlags flags{
|
type::Flags flags{
|
||||||
TypeFlag::kConstructable,
|
Flag::kConstructable,
|
||||||
TypeFlag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
TypeFlag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
};
|
};
|
||||||
for (auto* member : members) {
|
for (auto* member : members) {
|
||||||
if (!member->Type()->IsConstructible()) {
|
if (!member->Type()->IsConstructible()) {
|
||||||
flags.Remove(TypeFlag::kConstructable);
|
flags.Remove(Flag::kConstructable);
|
||||||
}
|
}
|
||||||
if (!member->Type()->HasFixedFootprint()) {
|
if (!member->Type()->HasFixedFootprint()) {
|
||||||
flags.Remove(TypeFlag::kFixedFootprint);
|
flags.Remove(Flag::kFixedFootprint);
|
||||||
}
|
}
|
||||||
if (!member->Type()->HasCreationFixedFootprint()) {
|
if (!member->Type()->HasCreationFixedFootprint()) {
|
||||||
flags.Remove(TypeFlag::kCreationFixedFootprint);
|
flags.Remove(Flag::kCreationFixedFootprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return flags;
|
return flags;
|
||||||
|
|
|
@ -18,7 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Texture);
|
||||||
|
|
||||||
namespace tint::type {
|
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;
|
Texture::Texture(Texture&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Type);
|
||||||
|
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Type::Type(TypeFlags flags) : flags_(flags) {
|
Type::Type(type::Flags flags) : flags_(flags) {
|
||||||
if (IsConstructible()) {
|
if (IsConstructible()) {
|
||||||
TINT_ASSERT(Type, HasCreationFixedFootprint());
|
TINT_ASSERT(Type, HasCreationFixedFootprint());
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class SymbolTable;
|
||||||
|
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
enum TypeFlag {
|
enum Flag {
|
||||||
/// Type is constructable.
|
/// Type is constructable.
|
||||||
/// @see https://gpuweb.github.io/gpuweb/wgsl/#constructible-types
|
/// @see https://gpuweb.github.io/gpuweb/wgsl/#constructible-types
|
||||||
kConstructable,
|
kConstructable,
|
||||||
|
@ -42,15 +42,12 @@ enum TypeFlag {
|
||||||
kFixedFootprint,
|
kFixedFootprint,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An alias to utils::EnumSet<TypeFlag>
|
/// An alias to utils::EnumSet<Flag>
|
||||||
using TypeFlags = utils::EnumSet<TypeFlag>;
|
using Flags = utils::EnumSet<Flag>;
|
||||||
|
|
||||||
/// Base class for a type in the system
|
/// Base class for a type in the system
|
||||||
class Type : public Castable<Type, Node> {
|
class Type : public Castable<Type, Node> {
|
||||||
public:
|
public:
|
||||||
/// Alias to TypeFlag
|
|
||||||
using Flag = TypeFlag;
|
|
||||||
|
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
Type(Type&&);
|
Type(Type&&);
|
||||||
~Type() override;
|
~Type() override;
|
||||||
|
@ -83,7 +80,7 @@ class Type : public Castable<Type, Node> {
|
||||||
virtual uint32_t Align() const;
|
virtual uint32_t Align() const;
|
||||||
|
|
||||||
/// @returns the flags on the type
|
/// @returns the flags on the type
|
||||||
TypeFlags Flags() { return flags_; }
|
type::Flags Flags() { return flags_; }
|
||||||
|
|
||||||
/// @returns true if type is constructable
|
/// @returns true if type is constructable
|
||||||
/// https://gpuweb.github.io/gpuweb/wgsl/#constructible-types
|
/// https://gpuweb.github.io/gpuweb/wgsl/#constructible-types
|
||||||
|
@ -197,10 +194,10 @@ class Type : public Castable<Type, Node> {
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param flags the flags of this type
|
/// @param flags the flags of this type
|
||||||
explicit Type(TypeFlags flags);
|
explicit Type(type::Flags flags);
|
||||||
|
|
||||||
/// The flags of this type.
|
/// The flags of this type.
|
||||||
const TypeFlags flags_;
|
const type::Flags flags_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::type
|
} // namespace tint::type
|
||||||
|
|
|
@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::U32);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
U32::U32()
|
U32::U32()
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Vector);
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Vector::Vector(Type const* subtype, uint32_t width)
|
Vector::Vector(Type const* subtype, uint32_t width)
|
||||||
: Base(TypeFlags{
|
: Base(type::Flags{
|
||||||
Flag::kConstructable,
|
Flag::kConstructable,
|
||||||
Flag::kCreationFixedFootprint,
|
Flag::kCreationFixedFootprint,
|
||||||
Flag::kFixedFootprint,
|
Flag::kFixedFootprint,
|
||||||
|
|
|
@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Void);
|
||||||
|
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
|
||||||
Void::Void() : Base(TypeFlags{}) {}
|
Void::Void() : Base(type::Flags{}) {}
|
||||||
|
|
||||||
Void::Void(Void&&) = default;
|
Void::Void(Void&&) = default;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue