Use 'final' specifier on leaf classes

Tint makes heavy use of RTTI via virtual methods. Give the compiler the
opportunity to optimize away some of these virtuals.

Bug: tint:1383
Change-Id: I28edfaa0a05bb1a9c506c61c0084542c0aeb37f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82745
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-03-07 18:37:46 +00:00 committed by Tint LUCI CQ
parent dc0e31cfaa
commit 41f8d2ad52
119 changed files with 174 additions and 159 deletions

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A type alias type. Holds a name and pointer to another type.
class Alias : public Castable<Alias, TypeDecl> {
class Alias final : public Castable<Alias, TypeDecl> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -27,7 +27,7 @@ namespace ast {
class Expression;
/// An array type. If size is zero then it is a runtime array.
class Array : public Castable<Array, Type> {
class Array final : public Castable<Array, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -22,7 +22,8 @@ namespace tint {
namespace ast {
/// An assignment statement
class AssignmentStatement : public Castable<AssignmentStatement, Statement> {
class AssignmentStatement final
: public Castable<AssignmentStatement, Statement> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// An atomic type.
class Atomic : public Castable<Atomic, Type> {
class Atomic final : public Castable<Atomic, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -44,7 +44,7 @@ enum class BinaryOp {
};
/// An binary expression
class BinaryExpression : public Castable<BinaryExpression, Expression> {
class BinaryExpression final : public Castable<BinaryExpression, Expression> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A binding attribute
class BindingAttribute : public Castable<BindingAttribute, Attribute> {
class BindingAttribute final : public Castable<BindingAttribute, Attribute> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -24,7 +24,7 @@ namespace ast {
class Type;
/// A bitcast expression
class BitcastExpression : public Castable<BitcastExpression, Expression> {
class BitcastExpression final : public Castable<BitcastExpression, Expression> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A block statement
class BlockStatement : public Castable<BlockStatement, Statement> {
class BlockStatement final : public Castable<BlockStatement, Statement> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -29,7 +29,7 @@ namespace tint {
namespace ast {
/// A boolean type
class Bool : public Castable<Bool, Type> {
class Bool final : public Castable<Bool, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A boolean literal
class BoolLiteralExpression
class BoolLiteralExpression final
: public Castable<BoolLiteralExpression, LiteralExpression> {
public:
/// Constructor

View File

@ -21,7 +21,7 @@ namespace tint {
namespace ast {
/// An break statement
class BreakStatement : public Castable<BreakStatement, Statement> {
class BreakStatement final : public Castable<BreakStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -24,7 +24,7 @@ namespace tint {
namespace ast {
/// A builtin attribute
class BuiltinAttribute : public Castable<BuiltinAttribute, Attribute> {
class BuiltinAttribute final : public Castable<BuiltinAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node

View File

@ -29,7 +29,7 @@ class IdentifierExpression;
/// * sem::Builtin
/// * sem::TypeConstructor
/// * sem::TypeConversion
class CallExpression : public Castable<CallExpression, Expression> {
class CallExpression final : public Castable<CallExpression, Expression> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -22,7 +22,7 @@ namespace tint {
namespace ast {
/// A call expression
class CallStatement : public Castable<CallStatement, Statement> {
class CallStatement final : public Castable<CallStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -27,7 +27,7 @@ namespace ast {
using CaseSelectorList = std::vector<const IntLiteralExpression*>;
/// A case statement
class CaseStatement : public Castable<CaseStatement, Statement> {
class CaseStatement final : public Castable<CaseStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -21,7 +21,7 @@ namespace tint {
namespace ast {
/// An continue statement
class ContinueStatement : public Castable<ContinueStatement, Statement> {
class ContinueStatement final : public Castable<ContinueStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A multisampled depth texture type.
class DepthMultisampledTexture
class DepthMultisampledTexture final
: public Castable<DepthMultisampledTexture, Texture> {
public:
/// Constructor

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A depth texture type.
class DepthTexture : public Castable<DepthTexture, Texture> {
class DepthTexture final : public Castable<DepthTexture, Texture> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -52,7 +52,7 @@ enum class DisabledValidation {
/// An internal attribute used to tell the validator to ignore specific
/// violations. Typically generated by transforms that need to produce ASTs that
/// would otherwise cause validation errors.
class DisableValidationAttribute
class DisableValidationAttribute final
: public Castable<DisableValidationAttribute, InternalAttribute> {
public:
/// Constructor

View File

@ -21,7 +21,7 @@ namespace tint {
namespace ast {
/// A discard statement
class DiscardStatement : public Castable<DiscardStatement, Statement> {
class DiscardStatement final : public Castable<DiscardStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -24,7 +24,7 @@ namespace tint {
namespace ast {
/// An else statement
class ElseStatement : public Castable<ElseStatement, Statement> {
class ElseStatement final : public Castable<ElseStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// An external texture type
class ExternalTexture : public Castable<ExternalTexture, Texture> {
class ExternalTexture final : public Castable<ExternalTexture, Texture> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A float 32 type
class F32 : public Castable<F32, Type> {
class F32 final : public Castable<F32, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -21,7 +21,8 @@ namespace tint {
namespace ast {
/// An fallthrough statement
class FallthroughStatement : public Castable<FallthroughStatement, Statement> {
class FallthroughStatement final
: public Castable<FallthroughStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A float literal
class FloatLiteralExpression
class FloatLiteralExpression final
: public Castable<FloatLiteralExpression, LiteralExpression> {
public:
/// Constructor

View File

@ -23,7 +23,7 @@ namespace ast {
class Expression;
/// A for loop statement
class ForLoopStatement : public Castable<ForLoopStatement, Statement> {
class ForLoopStatement final : public Castable<ForLoopStatement, Statement> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -33,7 +33,7 @@ namespace tint {
namespace ast {
/// A Function statement.
class Function : public Castable<Function, Node> {
class Function final : public Castable<Function, Node> {
public:
/// Create a function
/// @param program_id the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A group attribute
class GroupAttribute : public Castable<GroupAttribute, Attribute> {
class GroupAttribute final : public Castable<GroupAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A signed int 32 type.
class I32 : public Castable<I32, Type> {
class I32 final : public Castable<I32, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// An id attribute for pipeline-overridable constants
class IdAttribute : public Castable<IdAttribute, Attribute> {
class IdAttribute final : public Castable<IdAttribute, Attribute> {
public:
/// Create an id attribute.
/// @param pid the identifier of the program that owns this node

View File

@ -21,7 +21,8 @@ namespace tint {
namespace ast {
/// An identifier expression
class IdentifierExpression : public Castable<IdentifierExpression, Expression> {
class IdentifierExpression final
: public Castable<IdentifierExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// An if statement
class IfStatement : public Castable<IfStatement, Statement> {
class IfStatement final : public Castable<IfStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -21,7 +21,7 @@ namespace tint {
namespace ast {
/// An index accessor expression
class IndexAccessorExpression
class IndexAccessorExpression final
: public Castable<IndexAccessorExpression, Expression> {
public:
/// Constructor

View File

@ -30,7 +30,8 @@ enum class InterpolationType { kPerspective, kLinear, kFlat };
enum class InterpolationSampling { kNone = -1, kCenter, kCentroid, kSample };
/// An interpolate attribute
class InterpolateAttribute : public Castable<InterpolateAttribute, Attribute> {
class InterpolateAttribute final
: public Castable<InterpolateAttribute, Attribute> {
public:
/// Create an interpolate attribute.
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,8 @@ namespace tint {
namespace ast {
/// The invariant attribute
class InvariantAttribute : public Castable<InvariantAttribute, Attribute> {
class InvariantAttribute final
: public Castable<InvariantAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A location attribute
class LocationAttribute : public Castable<LocationAttribute, Attribute> {
class LocationAttribute final : public Castable<LocationAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node

View File

@ -21,7 +21,7 @@ namespace tint {
namespace ast {
/// A loop statement
class LoopStatement : public Castable<LoopStatement, Statement> {
class LoopStatement final : public Castable<LoopStatement, Statement> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A matrix type
class Matrix : public Castable<Matrix, Type> {
class Matrix final : public Castable<Matrix, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -21,7 +21,7 @@ namespace tint {
namespace ast {
/// A member accessor expression
class MemberAccessorExpression
class MemberAccessorExpression final
: public Castable<MemberAccessorExpression, Expression> {
public:
/// Constructor

View File

@ -28,7 +28,7 @@ class TypeDecl;
/// Module holds the top-level AST types, functions and global variables used by
/// a Program.
class Module : public Castable<Module, Node> {
class Module final : public Castable<Module, Node> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,8 @@ namespace tint {
namespace ast {
/// A multisampled texture type.
class MultisampledTexture : public Castable<MultisampledTexture, Texture> {
class MultisampledTexture final
: public Castable<MultisampledTexture, Texture> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -22,7 +22,7 @@ namespace ast {
/// Represents the `_` of a phony assignment `_ = <expr>`
/// @see https://www.w3.org/TR/WGSL/#phony-assignment-section
class PhonyExpression : public Castable<PhonyExpression, Expression> {
class PhonyExpression final : public Castable<PhonyExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -25,7 +25,7 @@ namespace tint {
namespace ast {
/// A pointer type.
class Pointer : public Castable<Pointer, Type> {
class Pointer final : public Castable<Pointer, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -22,7 +22,7 @@ namespace tint {
namespace ast {
/// A return statement
class ReturnStatement : public Castable<ReturnStatement, Statement> {
class ReturnStatement final : public Castable<ReturnStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A sampled texture type.
class SampledTexture : public Castable<SampledTexture, Texture> {
class SampledTexture final : public Castable<SampledTexture, Texture> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -36,7 +36,7 @@ enum class SamplerKind {
std::ostream& operator<<(std::ostream& out, SamplerKind kind);
/// A sampler type.
class Sampler : public Castable<Sampler, Type> {
class Sampler final : public Castable<Sampler, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A signed int literal
class SintLiteralExpression
class SintLiteralExpression final
: public Castable<SintLiteralExpression, IntLiteralExpression> {
public:
/// Constructor

View File

@ -24,7 +24,7 @@ namespace tint {
namespace ast {
/// A workgroup attribute
class StageAttribute : public Castable<StageAttribute, Attribute> {
class StageAttribute final : public Castable<StageAttribute, Attribute> {
public:
/// constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -50,7 +50,7 @@ enum class TexelFormat {
std::ostream& operator<<(std::ostream& out, TexelFormat format);
/// A storage texture type.
class StorageTexture : public Castable<StorageTexture, Texture> {
class StorageTexture final : public Castable<StorageTexture, Texture> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A stride attribute
class StrideAttribute : public Castable<StrideAttribute, Attribute> {
class StrideAttribute final : public Castable<StrideAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node

View File

@ -26,7 +26,7 @@ namespace tint {
namespace ast {
/// A struct statement.
class Struct : public Castable<Struct, TypeDecl> {
class Struct final : public Castable<Struct, TypeDecl> {
public:
/// Create a new struct statement
/// @param pid the identifier of the program that owns this node

View File

@ -24,7 +24,8 @@ namespace tint {
namespace ast {
/// The struct block attribute
class StructBlockAttribute : public Castable<StructBlockAttribute, Attribute> {
class StructBlockAttribute final
: public Castable<StructBlockAttribute, Attribute> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -27,7 +27,7 @@ namespace ast {
class Type;
/// A struct member statement.
class StructMember : public Castable<StructMember, Node> {
class StructMember final : public Castable<StructMember, Node> {
public:
/// Create a new struct member statement
/// @param pid the identifier of the program that owns this node

View File

@ -24,7 +24,7 @@ namespace tint {
namespace ast {
/// A struct member align attribute
class StructMemberAlignAttribute
class StructMemberAlignAttribute final
: public Castable<StructMemberAlignAttribute, Attribute> {
public:
/// constructor

View File

@ -32,7 +32,7 @@ namespace ast {
/// trivial for the Resolver to handle `@offset(n)` or `@size(n)` /
/// `@align(n)` attributes, so this is what we do, keeping all the layout
/// logic in one place.
class StructMemberOffsetAttribute
class StructMemberOffsetAttribute final
: public Castable<StructMemberOffsetAttribute, Attribute> {
public:
/// constructor

View File

@ -24,7 +24,7 @@ namespace tint {
namespace ast {
/// A struct member size attribute
class StructMemberSizeAttribute
class StructMemberSizeAttribute final
: public Castable<StructMemberSizeAttribute, Attribute> {
public:
/// constructor

View File

@ -22,7 +22,7 @@ namespace tint {
namespace ast {
/// A switch statement
class SwitchStatement : public Castable<SwitchStatement, Statement> {
class SwitchStatement final : public Castable<SwitchStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A named type (i.e. struct or alias)
class TypeName : public Castable<TypeName, Type> {
class TypeName final : public Castable<TypeName, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A unsigned int 32 type.
class U32 : public Castable<U32, Type> {
class U32 final : public Castable<U32, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A uint literal
class UintLiteralExpression
class UintLiteralExpression final
: public Castable<UintLiteralExpression, IntLiteralExpression> {
public:
/// Constructor

View File

@ -22,7 +22,7 @@ namespace tint {
namespace ast {
/// A unary op expression
class UnaryOpExpression : public Castable<UnaryOpExpression, Expression> {
class UnaryOpExpression final : public Castable<UnaryOpExpression, Expression> {
public:
/// Constructor
/// @param program_id the identifier of the program that owns this node

View File

@ -113,7 +113,7 @@ struct VariableBindingPoint {
/// defaulting syntax for a "var" declared inside a function.
/// - "let" is always StorageClass::kNone.
/// - formal parameter is always StorageClass::kNone.
class Variable : public Castable<Variable, Node> {
class Variable final : public Castable<Variable, Node> {
public:
/// Create a variable
/// @param program_id the identifier of the program that owns this node

View File

@ -22,7 +22,7 @@ namespace tint {
namespace ast {
/// A variable declaration statement
class VariableDeclStatement
class VariableDeclStatement final
: public Castable<VariableDeclStatement, Statement> {
public:
/// Constructor

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A vector type.
class Vector : public Castable<Vector, Type> {
class Vector final : public Castable<Vector, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace ast {
/// A void type
class Void : public Castable<Void, Type> {
class Void final : public Castable<Void, Type> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node

View File

@ -27,7 +27,8 @@ namespace ast {
class Expression;
/// A workgroup attribute
class WorkgroupAttribute : public Castable<WorkgroupAttribute, Attribute> {
class WorkgroupAttribute final
: public Castable<WorkgroupAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node

View File

@ -43,7 +43,7 @@ class NumberMatcher;
class TypeMatcher;
/// A special type that matches all TypeMatchers
class Any : public Castable<Any, sem::Type> {
class Any final : public Castable<Any, sem::Type> {
public:
Any() = default;
~Any() override = default;

View File

@ -647,7 +647,7 @@ class StructuredTraverser {
/// A StatementBuilder for ast::SwitchStatement
/// @see StatementBuilder
struct SwitchStatementBuilder
struct SwitchStatementBuilder final
: public Castable<SwitchStatementBuilder, StatementBuilder> {
/// Constructor
/// @param cond the switch statement condition
@ -674,7 +674,7 @@ struct SwitchStatementBuilder
/// A StatementBuilder for ast::IfStatement
/// @see StatementBuilder
struct IfStatementBuilder
struct IfStatementBuilder final
: public Castable<IfStatementBuilder, StatementBuilder> {
/// Constructor
/// @param c the if-statement condition
@ -696,7 +696,7 @@ struct IfStatementBuilder
/// A StatementBuilder for ast::LoopStatement
/// @see StatementBuilder
struct LoopStatementBuilder
struct LoopStatementBuilder final
: public Castable<LoopStatementBuilder, StatementBuilder> {
/// @param builder the program builder
/// @returns the built ast::LoopStatement

View File

@ -92,7 +92,7 @@ class Type : public Castable<Type> {
using TypeList = std::vector<const Type*>;
/// `void` type
struct Void : public Castable<Void, Type> {
struct Void final : public Castable<Void, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
const ast::Type* Build(ProgramBuilder& b) const override;
@ -104,7 +104,7 @@ struct Void : public Castable<Void, Type> {
};
/// `bool` type
struct Bool : public Castable<Bool, Type> {
struct Bool final : public Castable<Bool, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
const ast::Type* Build(ProgramBuilder& b) const override;
@ -116,7 +116,7 @@ struct Bool : public Castable<Bool, Type> {
};
/// `u32` type
struct U32 : public Castable<U32, Type> {
struct U32 final : public Castable<U32, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
const ast::Type* Build(ProgramBuilder& b) const override;
@ -128,7 +128,7 @@ struct U32 : public Castable<U32, Type> {
};
/// `f32` type
struct F32 : public Castable<F32, Type> {
struct F32 final : public Castable<F32, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
const ast::Type* Build(ProgramBuilder& b) const override;
@ -140,7 +140,7 @@ struct F32 : public Castable<F32, Type> {
};
/// `i32` type
struct I32 : public Castable<I32, Type> {
struct I32 final : public Castable<I32, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
const ast::Type* Build(ProgramBuilder& b) const override;
@ -152,7 +152,7 @@ struct I32 : public Castable<I32, Type> {
};
/// `ptr<SC, T>` type
struct Pointer : public Castable<Pointer, Type> {
struct Pointer final : public Castable<Pointer, Type> {
/// Constructor
/// @param ty the store type
/// @param sc the pointer storage class
@ -180,7 +180,7 @@ struct Pointer : public Castable<Pointer, Type> {
/// `ref<SC, T>` type
/// Note this has no AST representation, but is used for type tracking in the
/// reader.
struct Reference : public Castable<Reference, Type> {
struct Reference final : public Castable<Reference, Type> {
/// Constructor
/// @param ty the referenced type
/// @param sc the reference storage class
@ -206,7 +206,7 @@ struct Reference : public Castable<Reference, Type> {
};
/// `vecN<T>` type
struct Vector : public Castable<Vector, Type> {
struct Vector final : public Castable<Vector, Type> {
/// Constructor
/// @param ty the element type
/// @param sz the number of elements in the vector
@ -232,7 +232,7 @@ struct Vector : public Castable<Vector, Type> {
};
/// `matNxM<T>` type
struct Matrix : public Castable<Matrix, Type> {
struct Matrix final : public Castable<Matrix, Type> {
/// Constructor
/// @param ty the matrix element type
/// @param c the number of columns in the matrix
@ -261,7 +261,7 @@ struct Matrix : public Castable<Matrix, Type> {
};
/// `array<T, N>` type
struct Array : public Castable<Array, Type> {
struct Array final : public Castable<Array, Type> {
/// Constructor
/// @param el the element type
/// @param sz the number of elements in the array. 0 represents runtime-sized
@ -291,7 +291,7 @@ struct Array : public Castable<Array, Type> {
};
/// `sampler` type
struct Sampler : public Castable<Sampler, Type> {
struct Sampler final : public Castable<Sampler, Type> {
/// Constructor
/// @param k the sampler kind
explicit Sampler(ast::SamplerKind k);
@ -328,7 +328,7 @@ struct Texture : public Castable<Texture, Type> {
};
/// `texture_depth_D` type
struct DepthTexture : public Castable<DepthTexture, Texture> {
struct DepthTexture final : public Castable<DepthTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
explicit DepthTexture(ast::TextureDimension d);
@ -348,7 +348,7 @@ struct DepthTexture : public Castable<DepthTexture, Texture> {
};
/// `texture_depth_multisampled_D` type
struct DepthMultisampledTexture
struct DepthMultisampledTexture final
: public Castable<DepthMultisampledTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
@ -369,7 +369,8 @@ struct DepthMultisampledTexture
};
/// `texture_multisampled_D<T>` type
struct MultisampledTexture : public Castable<MultisampledTexture, Texture> {
struct MultisampledTexture final
: public Castable<MultisampledTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
/// @param t the multisampled texture type
@ -393,7 +394,7 @@ struct MultisampledTexture : public Castable<MultisampledTexture, Texture> {
};
/// `texture_D<T>` type
struct SampledTexture : public Castable<SampledTexture, Texture> {
struct SampledTexture final : public Castable<SampledTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
/// @param t the sampled texture type
@ -417,7 +418,7 @@ struct SampledTexture : public Castable<SampledTexture, Texture> {
};
/// `texture_storage_D<F>` type
struct StorageTexture : public Castable<StorageTexture, Texture> {
struct StorageTexture final : public Castable<StorageTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
/// @param f the storage image format
@ -467,7 +468,7 @@ struct Named : public Castable<Named, Type> {
};
/// `type T = N` type
struct Alias : public Castable<Alias, Named> {
struct Alias final : public Castable<Alias, Named> {
/// Constructor
/// @param n the alias name
/// @param t the aliased type
@ -486,7 +487,7 @@ struct Alias : public Castable<Alias, Named> {
};
/// `struct N { ... };` type
struct Struct : public Castable<Struct, Named> {
struct Struct final : public Castable<Struct, Named> {
/// Constructor
/// @param n the struct name
/// @param m the member types

View File

@ -47,13 +47,13 @@ namespace {
using ResolverValidationTest = ResolverTest;
class FakeStmt : public Castable<FakeStmt, ast::Statement> {
class FakeStmt final : public Castable<FakeStmt, ast::Statement> {
public:
FakeStmt(ProgramID pid, Source src) : Base(pid, src) {}
FakeStmt* Clone(CloneContext*) const override { return nullptr; }
};
class FakeExpr : public Castable<FakeExpr, ast::Expression> {
class FakeExpr final : public Castable<FakeExpr, ast::Expression> {
public:
FakeExpr(ProgramID pid, Source src) : Base(pid, src) {}
FakeExpr* Clone(CloneContext*) const override { return nullptr; }

View File

@ -32,7 +32,7 @@ namespace tint {
namespace sem {
/// Array holds the semantic information for Array nodes.
class Array : public Castable<Array, Type> {
class Array final : public Castable<Array, Type> {
public:
/// Constructor
/// @param element the array element type

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// A atomic type.
class Atomic : public Castable<Atomic, Type> {
class Atomic final : public Castable<Atomic, Type> {
public:
/// Constructor
/// @param subtype the atomic type

View File

@ -64,7 +64,7 @@ class BlockStatement : public Castable<BlockStatement, CompoundStatement> {
};
/// The root block statement for a function
class FunctionBlockStatement
class FunctionBlockStatement final
: public Castable<FunctionBlockStatement, BlockStatement> {
public:
/// Constructor
@ -76,7 +76,8 @@ class FunctionBlockStatement
};
/// Holds semantic information about a loop body block or for-loop body block
class LoopBlockStatement : public Castable<LoopBlockStatement, BlockStatement> {
class LoopBlockStatement final
: public Castable<LoopBlockStatement, BlockStatement> {
public:
/// Constructor
/// @param declaration the AST node for this block statement

View File

@ -29,7 +29,7 @@ namespace tint {
namespace sem {
/// A boolean type
class Bool : public Castable<Bool, Type> {
class Bool final : public Castable<Bool, Type> {
public:
/// Constructor
Bool();

View File

@ -72,7 +72,7 @@ bool IsBarrierBuiltin(BuiltinType i);
bool IsAtomicBuiltin(BuiltinType i);
/// Builtin holds the semantic information for a builtin function.
class Builtin : public Castable<Builtin, CallTarget> {
class Builtin final : public Castable<Builtin, CallTarget> {
public:
/// Constructor
/// @param type the builtin type

View File

@ -25,7 +25,7 @@ namespace sem {
/// Call is the base class for semantic nodes that hold semantic information for
/// ast::CallExpression nodes.
class Call : public Castable<Call, Expression> {
class Call final : public Castable<Call, Expression> {
public:
/// Constructor
/// @param declaration the AST node

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// A multisampled depth texture type.
class DepthMultisampledTexture
class DepthMultisampledTexture final
: public Castable<DepthMultisampledTexture, Texture> {
public:
/// Constructor

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// A depth texture type.
class DepthTexture : public Castable<DepthTexture, Texture> {
class DepthTexture final : public Castable<DepthTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// An external texture type
class ExternalTexture : public Castable<ExternalTexture, Texture> {
class ExternalTexture final : public Castable<ExternalTexture, Texture> {
public:
/// Constructor
ExternalTexture();

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// A float 32 type
class F32 : public Castable<F32, Type> {
class F32 final : public Castable<F32, Type> {
public:
/// Constructor
F32();

View File

@ -30,7 +30,8 @@ namespace tint {
namespace sem {
/// Holds semantic information about a for-loop statement
class ForLoopStatement : public Castable<ForLoopStatement, CompoundStatement> {
class ForLoopStatement final
: public Castable<ForLoopStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this for-loop statement

View File

@ -52,7 +52,7 @@ struct WorkgroupDimension {
using WorkgroupSize = std::array<WorkgroupDimension, 3>;
/// Function holds the semantic information for function nodes.
class Function : public Castable<Function, CallTarget> {
class Function final : public Castable<Function, CallTarget> {
public:
/// A vector of [Variable*, ast::VariableBindingPoint] pairs
using VariableBindings =

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// A signed int 32 type.
class I32 : public Castable<I32, Type> {
class I32 final : public Castable<I32, Type> {
public:
/// Constructor
I32();

View File

@ -32,7 +32,7 @@ namespace tint {
namespace sem {
/// Holds semantic information about an if statement
class IfStatement : public Castable<IfStatement, CompoundStatement> {
class IfStatement final : public Castable<IfStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this if statement
@ -60,7 +60,7 @@ class IfStatement : public Castable<IfStatement, CompoundStatement> {
};
/// Holds semantic information about an else statement
class ElseStatement : public Castable<ElseStatement, CompoundStatement> {
class ElseStatement final : public Castable<ElseStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this else statement

View File

@ -28,7 +28,7 @@ namespace tint {
namespace sem {
/// Holds semantic information about a loop statement
class LoopStatement : public Castable<LoopStatement, CompoundStatement> {
class LoopStatement final : public Castable<LoopStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this loop statement
@ -43,7 +43,7 @@ class LoopStatement : public Castable<LoopStatement, CompoundStatement> {
};
/// Holds semantic information about a loop continuing block
class LoopContinuingBlockStatement
class LoopContinuingBlockStatement final
: public Castable<LoopContinuingBlockStatement, BlockStatement> {
public:
/// Constructor

View File

@ -26,7 +26,7 @@ namespace sem {
class Vector;
/// A matrix type
class Matrix : public Castable<Matrix, Type> {
class Matrix final : public Castable<Matrix, Type> {
public:
/// Constructor
/// @param column_type the type of a column of the matrix

View File

@ -54,7 +54,7 @@ class MemberAccessorExpression
/// StructMemberAccess holds the semantic information for a
/// ast::MemberAccessorExpression node that represents an access to a structure
/// member.
class StructMemberAccess
class StructMemberAccess final
: public Castable<StructMemberAccess, MemberAccessorExpression> {
public:
/// Constructor
@ -81,7 +81,7 @@ class StructMemberAccess
/// Swizzle holds the semantic information for a ast::MemberAccessorExpression
/// node that represents a vector swizzle.
class Swizzle : public Castable<Swizzle, MemberAccessorExpression> {
class Swizzle final : public Castable<Swizzle, MemberAccessorExpression> {
public:
/// Constructor
/// @param declaration the AST node

View File

@ -29,7 +29,7 @@ namespace tint::sem {
/// Module holds the top-level semantic types, functions and global variables
/// used by a Program.
class Module : public Castable<Module, Node> {
class Module final : public Castable<Module, Node> {
public:
/// Constructor
/// @param dep_ordered_decls the dependency-ordered module-scope declarations

View File

@ -23,7 +23,8 @@ namespace tint {
namespace sem {
/// A multisampled texture type.
class MultisampledTexture : public Castable<MultisampledTexture, Texture> {
class MultisampledTexture final
: public Castable<MultisampledTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture

View File

@ -25,7 +25,7 @@ namespace tint {
namespace sem {
/// A pointer type.
class Pointer : public Castable<Pointer, Type> {
class Pointer final : public Castable<Pointer, Type> {
public:
/// Constructor
/// @param subtype the pointee type

View File

@ -25,7 +25,7 @@ namespace tint {
namespace sem {
/// A reference type.
class Reference : public Castable<Reference, Type> {
class Reference final : public Castable<Reference, Type> {
public:
/// Constructor
/// @param subtype the pointee type

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// A sampled texture type.
class SampledTexture : public Castable<SampledTexture, Texture> {
class SampledTexture final : public Castable<SampledTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture

View File

@ -24,7 +24,7 @@ namespace tint {
namespace sem {
/// A sampler type.
class Sampler : public Castable<Sampler, Type> {
class Sampler final : public Castable<Sampler, Type> {
public:
/// Constructor
/// @param kind the kind of sampler

View File

@ -27,7 +27,7 @@ namespace sem {
class Manager;
/// A storage texture type.
class StorageTexture : public Castable<StorageTexture, Texture> {
class StorageTexture final : public Castable<StorageTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture

View File

@ -54,7 +54,7 @@ enum class PipelineStageUsage {
};
/// Struct holds the semantic information for structures.
class Struct : public Castable<Struct, Type> {
class Struct final : public Castable<Struct, Type> {
public:
/// Constructor
/// @param declaration the AST structure declaration

View File

@ -29,7 +29,8 @@ namespace tint {
namespace sem {
/// Holds semantic information about an switch statement
class SwitchStatement : public Castable<SwitchStatement, CompoundStatement> {
class SwitchStatement final
: public Castable<SwitchStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this switch statement
@ -47,7 +48,7 @@ class SwitchStatement : public Castable<SwitchStatement, CompoundStatement> {
};
/// Holds semantic information about a switch case statement
class CaseStatement : public Castable<CaseStatement, CompoundStatement> {
class CaseStatement final : public Castable<CaseStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this case statement

View File

@ -21,7 +21,7 @@ namespace tint {
namespace sem {
/// TypeConstructor is the CallTarget for a type constructor.
class TypeConstructor : public Castable<TypeConstructor, CallTarget> {
class TypeConstructor final : public Castable<TypeConstructor, CallTarget> {
public:
/// Constructor
/// @param type the type that's being constructed

View File

@ -21,7 +21,7 @@ namespace tint {
namespace sem {
/// TypeConversion is the CallTarget for a type conversion (cast).
class TypeConversion : public Castable<TypeConversion, CallTarget> {
class TypeConversion final : public Castable<TypeConversion, CallTarget> {
public:
/// Constructor
/// @param type the target type of the cast

View File

@ -25,7 +25,7 @@
namespace tint::sem {
/// The type manager holds all the pointers to the known types.
class Manager : public utils::UniqueAllocator<Type> {
class Manager final : public utils::UniqueAllocator<Type> {
public:
/// Iterator is the type returned by begin() and end()
using Iterator = utils::BlockAllocator<Type>::ConstIterator;

View File

@ -23,7 +23,7 @@ namespace tint {
namespace sem {
/// A unsigned int 32 type.
class U32 : public Castable<U32, Type> {
class U32 final : public Castable<U32, Type> {
public:
/// Constructor
U32();

Some files were not shown because too many files have changed in this diff Show More