From 41f8d2ad52ff05f4885a7e2646a9504f1717eb76 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Mon, 7 Mar 2022 18:37:46 +0000 Subject: [PATCH] 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 Reviewed-by: David Neto Kokoro: Kokoro Commit-Queue: Ben Clayton --- src/tint/ast/alias.h | 2 +- src/tint/ast/array.h | 2 +- src/tint/ast/assignment_statement.h | 3 +- src/tint/ast/atomic.h | 2 +- src/tint/ast/binary_expression.h | 2 +- src/tint/ast/binding_attribute.h | 2 +- src/tint/ast/bitcast_expression.h | 2 +- src/tint/ast/block_statement.h | 2 +- src/tint/ast/bool.h | 2 +- src/tint/ast/bool_literal_expression.h | 2 +- src/tint/ast/break_statement.h | 2 +- src/tint/ast/builtin_attribute.h | 2 +- src/tint/ast/call_expression.h | 2 +- src/tint/ast/call_statement.h | 2 +- src/tint/ast/case_statement.h | 2 +- src/tint/ast/continue_statement.h | 2 +- src/tint/ast/depth_multisampled_texture.h | 2 +- src/tint/ast/depth_texture.h | 2 +- src/tint/ast/disable_validation_attribute.h | 2 +- src/tint/ast/discard_statement.h | 2 +- src/tint/ast/else_statement.h | 2 +- src/tint/ast/external_texture.h | 2 +- src/tint/ast/f32.h | 2 +- src/tint/ast/fallthrough_statement.h | 3 +- src/tint/ast/float_literal_expression.h | 2 +- src/tint/ast/for_loop_statement.h | 2 +- src/tint/ast/function.h | 2 +- src/tint/ast/group_attribute.h | 2 +- src/tint/ast/i32.h | 2 +- src/tint/ast/id_attribute.h | 2 +- src/tint/ast/identifier_expression.h | 3 +- src/tint/ast/if_statement.h | 2 +- src/tint/ast/index_accessor_expression.h | 2 +- src/tint/ast/interpolate_attribute.h | 3 +- src/tint/ast/invariant_attribute.h | 3 +- src/tint/ast/location_attribute.h | 2 +- src/tint/ast/loop_statement.h | 2 +- src/tint/ast/matrix.h | 2 +- src/tint/ast/member_accessor_expression.h | 2 +- src/tint/ast/module.h | 2 +- src/tint/ast/multisampled_texture.h | 3 +- src/tint/ast/phony_expression.h | 2 +- src/tint/ast/pointer.h | 2 +- src/tint/ast/return_statement.h | 2 +- src/tint/ast/sampled_texture.h | 2 +- src/tint/ast/sampler.h | 2 +- src/tint/ast/sint_literal_expression.h | 2 +- src/tint/ast/stage_attribute.h | 2 +- src/tint/ast/storage_texture.h | 2 +- src/tint/ast/stride_attribute.h | 2 +- src/tint/ast/struct.h | 2 +- src/tint/ast/struct_block_attribute.h | 3 +- src/tint/ast/struct_member.h | 2 +- src/tint/ast/struct_member_align_attribute.h | 2 +- src/tint/ast/struct_member_offset_attribute.h | 2 +- src/tint/ast/struct_member_size_attribute.h | 2 +- src/tint/ast/switch_statement.h | 2 +- src/tint/ast/type_name.h | 2 +- src/tint/ast/u32.h | 2 +- src/tint/ast/uint_literal_expression.h | 2 +- src/tint/ast/unary_op_expression.h | 2 +- src/tint/ast/variable.h | 2 +- src/tint/ast/variable_decl_statement.h | 2 +- src/tint/ast/vector.h | 2 +- src/tint/ast/void.h | 2 +- src/tint/ast/workgroup_attribute.h | 3 +- src/tint/builtin_table.cc | 2 +- src/tint/reader/spirv/function.cc | 6 +-- src/tint/reader/spirv/parser_type.h | 37 ++++++++++--------- src/tint/resolver/validation_test.cc | 4 +- src/tint/sem/array.h | 2 +- src/tint/sem/atomic_type.h | 2 +- src/tint/sem/block_statement.h | 5 ++- src/tint/sem/bool_type.h | 2 +- src/tint/sem/builtin.h | 2 +- src/tint/sem/call.h | 2 +- .../sem/depth_multisampled_texture_type.h | 2 +- src/tint/sem/depth_texture_type.h | 2 +- src/tint/sem/external_texture_type.h | 2 +- src/tint/sem/f32_type.h | 2 +- src/tint/sem/for_loop_statement.h | 3 +- src/tint/sem/function.h | 2 +- src/tint/sem/i32_type.h | 2 +- src/tint/sem/if_statement.h | 4 +- src/tint/sem/loop_statement.h | 4 +- src/tint/sem/matrix_type.h | 2 +- src/tint/sem/member_accessor_expression.h | 4 +- src/tint/sem/module.h | 2 +- src/tint/sem/multisampled_texture_type.h | 3 +- src/tint/sem/pointer_type.h | 2 +- src/tint/sem/reference_type.h | 2 +- src/tint/sem/sampled_texture_type.h | 2 +- src/tint/sem/sampler_type.h | 2 +- src/tint/sem/storage_texture_type.h | 2 +- src/tint/sem/struct.h | 2 +- src/tint/sem/switch_statement.h | 5 ++- src/tint/sem/type_constructor.h | 2 +- src/tint/sem/type_conversion.h | 2 +- src/tint/sem/type_manager.h | 2 +- src/tint/sem/u32_type.h | 2 +- src/tint/sem/variable.h | 8 ++-- src/tint/sem/vector_type.h | 2 +- src/tint/sem/void_type.h | 2 +- src/tint/transform/add_empty_entry_point.h | 3 +- .../transform/add_spirv_block_attribute.h | 4 +- .../transform/array_length_from_uniform.h | 6 +-- src/tint/transform/binding_remapper.h | 4 +- src/tint/transform/builtin_polyfill.h | 4 +- src/tint/transform/calculate_array_length.h | 5 ++- .../transform/canonicalize_entry_point_io.h | 4 +- src/tint/transform/combine_samplers.h | 4 +- src/tint/transform/decompose_memory_access.h | 4 +- src/tint/transform/decompose_strided_array.h | 2 +- src/tint/transform/decompose_strided_matrix.h | 2 +- src/tint/transform/first_index_offset.h | 6 +-- src/tint/transform/fold_constants.h | 2 +- .../transform/fold_trivial_single_use_lets.h | 2 +- src/tint/transform/for_loop_to_loop.h | 2 +- src/tint/transform/glsl.h | 4 +- 119 files changed, 174 insertions(+), 159 deletions(-) diff --git a/src/tint/ast/alias.h b/src/tint/ast/alias.h index b308fa5020..c21b3e2d63 100644 --- a/src/tint/ast/alias.h +++ b/src/tint/ast/alias.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A type alias type. Holds a name and pointer to another type. -class Alias : public Castable { +class Alias final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/array.h b/src/tint/ast/array.h index b4429f37e5..413e4d3ac5 100644 --- a/src/tint/ast/array.h +++ b/src/tint/ast/array.h @@ -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 { +class Array final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/assignment_statement.h b/src/tint/ast/assignment_statement.h index 0b9c06bc21..55e07b8cc6 100644 --- a/src/tint/ast/assignment_statement.h +++ b/src/tint/ast/assignment_statement.h @@ -22,7 +22,8 @@ namespace tint { namespace ast { /// An assignment statement -class AssignmentStatement : public Castable { +class AssignmentStatement final + : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/atomic.h b/src/tint/ast/atomic.h index cdf33749b4..d5e1b9b3eb 100644 --- a/src/tint/ast/atomic.h +++ b/src/tint/ast/atomic.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// An atomic type. -class Atomic : public Castable { +class Atomic final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/binary_expression.h b/src/tint/ast/binary_expression.h index 73b2909370..bf3112ac43 100644 --- a/src/tint/ast/binary_expression.h +++ b/src/tint/ast/binary_expression.h @@ -44,7 +44,7 @@ enum class BinaryOp { }; /// An binary expression -class BinaryExpression : public Castable { +class BinaryExpression final : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/binding_attribute.h b/src/tint/ast/binding_attribute.h index 5e669ec835..8f3214d90a 100644 --- a/src/tint/ast/binding_attribute.h +++ b/src/tint/ast/binding_attribute.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A binding attribute -class BindingAttribute : public Castable { +class BindingAttribute final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/bitcast_expression.h b/src/tint/ast/bitcast_expression.h index db98d87de9..e16ae22a0b 100644 --- a/src/tint/ast/bitcast_expression.h +++ b/src/tint/ast/bitcast_expression.h @@ -24,7 +24,7 @@ namespace ast { class Type; /// A bitcast expression -class BitcastExpression : public Castable { +class BitcastExpression final : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/block_statement.h b/src/tint/ast/block_statement.h index fe0eeb5a33..31b2ef1c13 100644 --- a/src/tint/ast/block_statement.h +++ b/src/tint/ast/block_statement.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A block statement -class BlockStatement : public Castable { +class BlockStatement final : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/bool.h b/src/tint/ast/bool.h index 77ec0643dd..fa326da5ec 100644 --- a/src/tint/ast/bool.h +++ b/src/tint/ast/bool.h @@ -29,7 +29,7 @@ namespace tint { namespace ast { /// A boolean type -class Bool : public Castable { +class Bool final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/bool_literal_expression.h b/src/tint/ast/bool_literal_expression.h index 819c892507..421453ea77 100644 --- a/src/tint/ast/bool_literal_expression.h +++ b/src/tint/ast/bool_literal_expression.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A boolean literal -class BoolLiteralExpression +class BoolLiteralExpression final : public Castable { public: /// Constructor diff --git a/src/tint/ast/break_statement.h b/src/tint/ast/break_statement.h index c329f181c1..cf50c74990 100644 --- a/src/tint/ast/break_statement.h +++ b/src/tint/ast/break_statement.h @@ -21,7 +21,7 @@ namespace tint { namespace ast { /// An break statement -class BreakStatement : public Castable { +class BreakStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/builtin_attribute.h b/src/tint/ast/builtin_attribute.h index e4f3f3618f..436673966c 100644 --- a/src/tint/ast/builtin_attribute.h +++ b/src/tint/ast/builtin_attribute.h @@ -24,7 +24,7 @@ namespace tint { namespace ast { /// A builtin attribute -class BuiltinAttribute : public Castable { +class BuiltinAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/call_expression.h b/src/tint/ast/call_expression.h index 21b1c4c13d..efb1841abe 100644 --- a/src/tint/ast/call_expression.h +++ b/src/tint/ast/call_expression.h @@ -29,7 +29,7 @@ class IdentifierExpression; /// * sem::Builtin /// * sem::TypeConstructor /// * sem::TypeConversion -class CallExpression : public Castable { +class CallExpression final : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/call_statement.h b/src/tint/ast/call_statement.h index 644581935f..b9e0c4ce00 100644 --- a/src/tint/ast/call_statement.h +++ b/src/tint/ast/call_statement.h @@ -22,7 +22,7 @@ namespace tint { namespace ast { /// A call expression -class CallStatement : public Castable { +class CallStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/case_statement.h b/src/tint/ast/case_statement.h index d557728581..99fd81d5f4 100644 --- a/src/tint/ast/case_statement.h +++ b/src/tint/ast/case_statement.h @@ -27,7 +27,7 @@ namespace ast { using CaseSelectorList = std::vector; /// A case statement -class CaseStatement : public Castable { +class CaseStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/continue_statement.h b/src/tint/ast/continue_statement.h index 707ae5bf54..ab0b12eb94 100644 --- a/src/tint/ast/continue_statement.h +++ b/src/tint/ast/continue_statement.h @@ -21,7 +21,7 @@ namespace tint { namespace ast { /// An continue statement -class ContinueStatement : public Castable { +class ContinueStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/depth_multisampled_texture.h b/src/tint/ast/depth_multisampled_texture.h index a22b52d243..95051a4785 100644 --- a/src/tint/ast/depth_multisampled_texture.h +++ b/src/tint/ast/depth_multisampled_texture.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A multisampled depth texture type. -class DepthMultisampledTexture +class DepthMultisampledTexture final : public Castable { public: /// Constructor diff --git a/src/tint/ast/depth_texture.h b/src/tint/ast/depth_texture.h index 8efc5ed17e..62cd09df01 100644 --- a/src/tint/ast/depth_texture.h +++ b/src/tint/ast/depth_texture.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A depth texture type. -class DepthTexture : public Castable { +class DepthTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/disable_validation_attribute.h b/src/tint/ast/disable_validation_attribute.h index ef75c62a87..d46edb8dab 100644 --- a/src/tint/ast/disable_validation_attribute.h +++ b/src/tint/ast/disable_validation_attribute.h @@ -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 { public: /// Constructor diff --git a/src/tint/ast/discard_statement.h b/src/tint/ast/discard_statement.h index a884594883..7e4fcf1d0a 100644 --- a/src/tint/ast/discard_statement.h +++ b/src/tint/ast/discard_statement.h @@ -21,7 +21,7 @@ namespace tint { namespace ast { /// A discard statement -class DiscardStatement : public Castable { +class DiscardStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/else_statement.h b/src/tint/ast/else_statement.h index 979b3b9a71..6f641c78f9 100644 --- a/src/tint/ast/else_statement.h +++ b/src/tint/ast/else_statement.h @@ -24,7 +24,7 @@ namespace tint { namespace ast { /// An else statement -class ElseStatement : public Castable { +class ElseStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/external_texture.h b/src/tint/ast/external_texture.h index 6fc638dbed..cf9f60da90 100644 --- a/src/tint/ast/external_texture.h +++ b/src/tint/ast/external_texture.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// An external texture type -class ExternalTexture : public Castable { +class ExternalTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/f32.h b/src/tint/ast/f32.h index 92c7f514a1..58019c9627 100644 --- a/src/tint/ast/f32.h +++ b/src/tint/ast/f32.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A float 32 type -class F32 : public Castable { +class F32 final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/fallthrough_statement.h b/src/tint/ast/fallthrough_statement.h index d9501ddd6e..f1cc716218 100644 --- a/src/tint/ast/fallthrough_statement.h +++ b/src/tint/ast/fallthrough_statement.h @@ -21,7 +21,8 @@ namespace tint { namespace ast { /// An fallthrough statement -class FallthroughStatement : public Castable { +class FallthroughStatement final + : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/float_literal_expression.h b/src/tint/ast/float_literal_expression.h index e3673899f8..ffa3c2f3b3 100644 --- a/src/tint/ast/float_literal_expression.h +++ b/src/tint/ast/float_literal_expression.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A float literal -class FloatLiteralExpression +class FloatLiteralExpression final : public Castable { public: /// Constructor diff --git a/src/tint/ast/for_loop_statement.h b/src/tint/ast/for_loop_statement.h index 8d15d6c625..040ba52eb3 100644 --- a/src/tint/ast/for_loop_statement.h +++ b/src/tint/ast/for_loop_statement.h @@ -23,7 +23,7 @@ namespace ast { class Expression; /// A for loop statement -class ForLoopStatement : public Castable { +class ForLoopStatement final : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/function.h b/src/tint/ast/function.h index fd48e3f8b5..10ad7a69ea 100644 --- a/src/tint/ast/function.h +++ b/src/tint/ast/function.h @@ -33,7 +33,7 @@ namespace tint { namespace ast { /// A Function statement. -class Function : public Castable { +class Function final : public Castable { public: /// Create a function /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/group_attribute.h b/src/tint/ast/group_attribute.h index 31d5007965..be5c61e785 100644 --- a/src/tint/ast/group_attribute.h +++ b/src/tint/ast/group_attribute.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A group attribute -class GroupAttribute : public Castable { +class GroupAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/i32.h b/src/tint/ast/i32.h index 22c7e1b1d0..335bc98fed 100644 --- a/src/tint/ast/i32.h +++ b/src/tint/ast/i32.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A signed int 32 type. -class I32 : public Castable { +class I32 final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/id_attribute.h b/src/tint/ast/id_attribute.h index d4ede06f34..7fbac0edeb 100644 --- a/src/tint/ast/id_attribute.h +++ b/src/tint/ast/id_attribute.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// An id attribute for pipeline-overridable constants -class IdAttribute : public Castable { +class IdAttribute final : public Castable { public: /// Create an id attribute. /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/identifier_expression.h b/src/tint/ast/identifier_expression.h index 58d0140288..6c3c8b3b98 100644 --- a/src/tint/ast/identifier_expression.h +++ b/src/tint/ast/identifier_expression.h @@ -21,7 +21,8 @@ namespace tint { namespace ast { /// An identifier expression -class IdentifierExpression : public Castable { +class IdentifierExpression final + : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/if_statement.h b/src/tint/ast/if_statement.h index 3afe172891..dae9fd7716 100644 --- a/src/tint/ast/if_statement.h +++ b/src/tint/ast/if_statement.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// An if statement -class IfStatement : public Castable { +class IfStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/index_accessor_expression.h b/src/tint/ast/index_accessor_expression.h index 41dbcecda7..6fabadafa3 100644 --- a/src/tint/ast/index_accessor_expression.h +++ b/src/tint/ast/index_accessor_expression.h @@ -21,7 +21,7 @@ namespace tint { namespace ast { /// An index accessor expression -class IndexAccessorExpression +class IndexAccessorExpression final : public Castable { public: /// Constructor diff --git a/src/tint/ast/interpolate_attribute.h b/src/tint/ast/interpolate_attribute.h index d198ee7326..ac3b49d650 100644 --- a/src/tint/ast/interpolate_attribute.h +++ b/src/tint/ast/interpolate_attribute.h @@ -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 { +class InterpolateAttribute final + : public Castable { public: /// Create an interpolate attribute. /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/invariant_attribute.h b/src/tint/ast/invariant_attribute.h index c427147615..08a58e87fb 100644 --- a/src/tint/ast/invariant_attribute.h +++ b/src/tint/ast/invariant_attribute.h @@ -23,7 +23,8 @@ namespace tint { namespace ast { /// The invariant attribute -class InvariantAttribute : public Castable { +class InvariantAttribute final + : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/location_attribute.h b/src/tint/ast/location_attribute.h index 74a01cfdf8..3c8078d5f5 100644 --- a/src/tint/ast/location_attribute.h +++ b/src/tint/ast/location_attribute.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A location attribute -class LocationAttribute : public Castable { +class LocationAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/loop_statement.h b/src/tint/ast/loop_statement.h index 13484ed292..be29fc0459 100644 --- a/src/tint/ast/loop_statement.h +++ b/src/tint/ast/loop_statement.h @@ -21,7 +21,7 @@ namespace tint { namespace ast { /// A loop statement -class LoopStatement : public Castable { +class LoopStatement final : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/matrix.h b/src/tint/ast/matrix.h index 6f96d4b46f..0ba418c4f5 100644 --- a/src/tint/ast/matrix.h +++ b/src/tint/ast/matrix.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A matrix type -class Matrix : public Castable { +class Matrix final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/member_accessor_expression.h b/src/tint/ast/member_accessor_expression.h index 9aa3e3a658..8a82ba1915 100644 --- a/src/tint/ast/member_accessor_expression.h +++ b/src/tint/ast/member_accessor_expression.h @@ -21,7 +21,7 @@ namespace tint { namespace ast { /// A member accessor expression -class MemberAccessorExpression +class MemberAccessorExpression final : public Castable { public: /// Constructor diff --git a/src/tint/ast/module.h b/src/tint/ast/module.h index f7b3fafe0f..b98013da1b 100644 --- a/src/tint/ast/module.h +++ b/src/tint/ast/module.h @@ -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 { +class Module final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/multisampled_texture.h b/src/tint/ast/multisampled_texture.h index ea91011912..fbc3db05e4 100644 --- a/src/tint/ast/multisampled_texture.h +++ b/src/tint/ast/multisampled_texture.h @@ -23,7 +23,8 @@ namespace tint { namespace ast { /// A multisampled texture type. -class MultisampledTexture : public Castable { +class MultisampledTexture final + : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/phony_expression.h b/src/tint/ast/phony_expression.h index 28f31ca183..e021846d81 100644 --- a/src/tint/ast/phony_expression.h +++ b/src/tint/ast/phony_expression.h @@ -22,7 +22,7 @@ namespace ast { /// Represents the `_` of a phony assignment `_ = ` /// @see https://www.w3.org/TR/WGSL/#phony-assignment-section -class PhonyExpression : public Castable { +class PhonyExpression final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/pointer.h b/src/tint/ast/pointer.h index 38e2ef9c17..c73eb40933 100644 --- a/src/tint/ast/pointer.h +++ b/src/tint/ast/pointer.h @@ -25,7 +25,7 @@ namespace tint { namespace ast { /// A pointer type. -class Pointer : public Castable { +class Pointer final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/return_statement.h b/src/tint/ast/return_statement.h index f6be1486b7..5a20ff4f24 100644 --- a/src/tint/ast/return_statement.h +++ b/src/tint/ast/return_statement.h @@ -22,7 +22,7 @@ namespace tint { namespace ast { /// A return statement -class ReturnStatement : public Castable { +class ReturnStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/sampled_texture.h b/src/tint/ast/sampled_texture.h index af2cab36d6..6d0820ce6e 100644 --- a/src/tint/ast/sampled_texture.h +++ b/src/tint/ast/sampled_texture.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A sampled texture type. -class SampledTexture : public Castable { +class SampledTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/sampler.h b/src/tint/ast/sampler.h index 7552e22d42..8724384534 100644 --- a/src/tint/ast/sampler.h +++ b/src/tint/ast/sampler.h @@ -36,7 +36,7 @@ enum class SamplerKind { std::ostream& operator<<(std::ostream& out, SamplerKind kind); /// A sampler type. -class Sampler : public Castable { +class Sampler final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/sint_literal_expression.h b/src/tint/ast/sint_literal_expression.h index bc0f60b567..1431dd233e 100644 --- a/src/tint/ast/sint_literal_expression.h +++ b/src/tint/ast/sint_literal_expression.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A signed int literal -class SintLiteralExpression +class SintLiteralExpression final : public Castable { public: /// Constructor diff --git a/src/tint/ast/stage_attribute.h b/src/tint/ast/stage_attribute.h index b523538395..7bf918c1f9 100644 --- a/src/tint/ast/stage_attribute.h +++ b/src/tint/ast/stage_attribute.h @@ -24,7 +24,7 @@ namespace tint { namespace ast { /// A workgroup attribute -class StageAttribute : public Castable { +class StageAttribute final : public Castable { public: /// constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/storage_texture.h b/src/tint/ast/storage_texture.h index e1f74d930c..9af93af249 100644 --- a/src/tint/ast/storage_texture.h +++ b/src/tint/ast/storage_texture.h @@ -50,7 +50,7 @@ enum class TexelFormat { std::ostream& operator<<(std::ostream& out, TexelFormat format); /// A storage texture type. -class StorageTexture : public Castable { +class StorageTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/stride_attribute.h b/src/tint/ast/stride_attribute.h index f2067cbf8b..4edc54c02e 100644 --- a/src/tint/ast/stride_attribute.h +++ b/src/tint/ast/stride_attribute.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A stride attribute -class StrideAttribute : public Castable { +class StrideAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/struct.h b/src/tint/ast/struct.h index 95bc376da3..076c46d346 100644 --- a/src/tint/ast/struct.h +++ b/src/tint/ast/struct.h @@ -26,7 +26,7 @@ namespace tint { namespace ast { /// A struct statement. -class Struct : public Castable { +class Struct final : public Castable { public: /// Create a new struct statement /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/struct_block_attribute.h b/src/tint/ast/struct_block_attribute.h index df929f81a5..ba5c38f41e 100644 --- a/src/tint/ast/struct_block_attribute.h +++ b/src/tint/ast/struct_block_attribute.h @@ -24,7 +24,8 @@ namespace tint { namespace ast { /// The struct block attribute -class StructBlockAttribute : public Castable { +class StructBlockAttribute final + : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/struct_member.h b/src/tint/ast/struct_member.h index cf2e47b897..4be9256837 100644 --- a/src/tint/ast/struct_member.h +++ b/src/tint/ast/struct_member.h @@ -27,7 +27,7 @@ namespace ast { class Type; /// A struct member statement. -class StructMember : public Castable { +class StructMember final : public Castable { public: /// Create a new struct member statement /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/struct_member_align_attribute.h b/src/tint/ast/struct_member_align_attribute.h index b90c71f9b9..a1b455bcba 100644 --- a/src/tint/ast/struct_member_align_attribute.h +++ b/src/tint/ast/struct_member_align_attribute.h @@ -24,7 +24,7 @@ namespace tint { namespace ast { /// A struct member align attribute -class StructMemberAlignAttribute +class StructMemberAlignAttribute final : public Castable { public: /// constructor diff --git a/src/tint/ast/struct_member_offset_attribute.h b/src/tint/ast/struct_member_offset_attribute.h index f599a7eafe..63db9595ca 100644 --- a/src/tint/ast/struct_member_offset_attribute.h +++ b/src/tint/ast/struct_member_offset_attribute.h @@ -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 { public: /// constructor diff --git a/src/tint/ast/struct_member_size_attribute.h b/src/tint/ast/struct_member_size_attribute.h index a6397ab1f4..c2a6e505a0 100644 --- a/src/tint/ast/struct_member_size_attribute.h +++ b/src/tint/ast/struct_member_size_attribute.h @@ -24,7 +24,7 @@ namespace tint { namespace ast { /// A struct member size attribute -class StructMemberSizeAttribute +class StructMemberSizeAttribute final : public Castable { public: /// constructor diff --git a/src/tint/ast/switch_statement.h b/src/tint/ast/switch_statement.h index 8fa2fb5aa0..aa0cc77e26 100644 --- a/src/tint/ast/switch_statement.h +++ b/src/tint/ast/switch_statement.h @@ -22,7 +22,7 @@ namespace tint { namespace ast { /// A switch statement -class SwitchStatement : public Castable { +class SwitchStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/type_name.h b/src/tint/ast/type_name.h index c8e85dae30..9bae5d0574 100644 --- a/src/tint/ast/type_name.h +++ b/src/tint/ast/type_name.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A named type (i.e. struct or alias) -class TypeName : public Castable { +class TypeName final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/u32.h b/src/tint/ast/u32.h index 156fbe2199..a31222b1f3 100644 --- a/src/tint/ast/u32.h +++ b/src/tint/ast/u32.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A unsigned int 32 type. -class U32 : public Castable { +class U32 final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/uint_literal_expression.h b/src/tint/ast/uint_literal_expression.h index edc79e1237..58fdb9607d 100644 --- a/src/tint/ast/uint_literal_expression.h +++ b/src/tint/ast/uint_literal_expression.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A uint literal -class UintLiteralExpression +class UintLiteralExpression final : public Castable { public: /// Constructor diff --git a/src/tint/ast/unary_op_expression.h b/src/tint/ast/unary_op_expression.h index 62bc881c71..9b19a77552 100644 --- a/src/tint/ast/unary_op_expression.h +++ b/src/tint/ast/unary_op_expression.h @@ -22,7 +22,7 @@ namespace tint { namespace ast { /// A unary op expression -class UnaryOpExpression : public Castable { +class UnaryOpExpression final : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/variable.h b/src/tint/ast/variable.h index 0afe376c8b..88b6ad28f3 100644 --- a/src/tint/ast/variable.h +++ b/src/tint/ast/variable.h @@ -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 { +class Variable final : public Castable { public: /// Create a variable /// @param program_id the identifier of the program that owns this node diff --git a/src/tint/ast/variable_decl_statement.h b/src/tint/ast/variable_decl_statement.h index 3419d376e8..47fb8ab36d 100644 --- a/src/tint/ast/variable_decl_statement.h +++ b/src/tint/ast/variable_decl_statement.h @@ -22,7 +22,7 @@ namespace tint { namespace ast { /// A variable declaration statement -class VariableDeclStatement +class VariableDeclStatement final : public Castable { public: /// Constructor diff --git a/src/tint/ast/vector.h b/src/tint/ast/vector.h index 4087817bf6..bfc4908376 100644 --- a/src/tint/ast/vector.h +++ b/src/tint/ast/vector.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A vector type. -class Vector : public Castable { +class Vector final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/void.h b/src/tint/ast/void.h index 69d15716f6..94d382fbfb 100644 --- a/src/tint/ast/void.h +++ b/src/tint/ast/void.h @@ -23,7 +23,7 @@ namespace tint { namespace ast { /// A void type -class Void : public Castable { +class Void final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/ast/workgroup_attribute.h b/src/tint/ast/workgroup_attribute.h index 815420a4dd..5ffc7c644e 100644 --- a/src/tint/ast/workgroup_attribute.h +++ b/src/tint/ast/workgroup_attribute.h @@ -27,7 +27,8 @@ namespace ast { class Expression; /// A workgroup attribute -class WorkgroupAttribute : public Castable { +class WorkgroupAttribute final + : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node diff --git a/src/tint/builtin_table.cc b/src/tint/builtin_table.cc index c7443fddaa..13e7c5feb7 100644 --- a/src/tint/builtin_table.cc +++ b/src/tint/builtin_table.cc @@ -43,7 +43,7 @@ class NumberMatcher; class TypeMatcher; /// A special type that matches all TypeMatchers -class Any : public Castable { +class Any final : public Castable { public: Any() = default; ~Any() override = default; diff --git a/src/tint/reader/spirv/function.cc b/src/tint/reader/spirv/function.cc index 9c16094482..c130e85383 100644 --- a/src/tint/reader/spirv/function.cc +++ b/src/tint/reader/spirv/function.cc @@ -647,7 +647,7 @@ class StructuredTraverser { /// A StatementBuilder for ast::SwitchStatement /// @see StatementBuilder -struct SwitchStatementBuilder +struct SwitchStatementBuilder final : public Castable { /// 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 { /// 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 { /// @param builder the program builder /// @returns the built ast::LoopStatement diff --git a/src/tint/reader/spirv/parser_type.h b/src/tint/reader/spirv/parser_type.h index c550ad0309..2313e9ecfa 100644 --- a/src/tint/reader/spirv/parser_type.h +++ b/src/tint/reader/spirv/parser_type.h @@ -92,7 +92,7 @@ class Type : public Castable { using TypeList = std::vector; /// `void` type -struct Void : public Castable { +struct Void final : public Castable { /// @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 { }; /// `bool` type -struct Bool : public Castable { +struct Bool final : public Castable { /// @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 { }; /// `u32` type -struct U32 : public Castable { +struct U32 final : public Castable { /// @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 { }; /// `f32` type -struct F32 : public Castable { +struct F32 final : public Castable { /// @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 { }; /// `i32` type -struct I32 : public Castable { +struct I32 final : public Castable { /// @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 { }; /// `ptr` type -struct Pointer : public Castable { +struct Pointer final : public Castable { /// Constructor /// @param ty the store type /// @param sc the pointer storage class @@ -180,7 +180,7 @@ struct Pointer : public Castable { /// `ref` type /// Note this has no AST representation, but is used for type tracking in the /// reader. -struct Reference : public Castable { +struct Reference final : public Castable { /// Constructor /// @param ty the referenced type /// @param sc the reference storage class @@ -206,7 +206,7 @@ struct Reference : public Castable { }; /// `vecN` type -struct Vector : public Castable { +struct Vector final : public Castable { /// Constructor /// @param ty the element type /// @param sz the number of elements in the vector @@ -232,7 +232,7 @@ struct Vector : public Castable { }; /// `matNxM` type -struct Matrix : public Castable { +struct Matrix final : public Castable { /// Constructor /// @param ty the matrix element type /// @param c the number of columns in the matrix @@ -261,7 +261,7 @@ struct Matrix : public Castable { }; /// `array` type -struct Array : public Castable { +struct Array final : public Castable { /// 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 { }; /// `sampler` type -struct Sampler : public Castable { +struct Sampler final : public Castable { /// Constructor /// @param k the sampler kind explicit Sampler(ast::SamplerKind k); @@ -328,7 +328,7 @@ struct Texture : public Castable { }; /// `texture_depth_D` type -struct DepthTexture : public Castable { +struct DepthTexture final : public Castable { /// Constructor /// @param d the texture dimensions explicit DepthTexture(ast::TextureDimension d); @@ -348,7 +348,7 @@ struct DepthTexture : public Castable { }; /// `texture_depth_multisampled_D` type -struct DepthMultisampledTexture +struct DepthMultisampledTexture final : public Castable { /// Constructor /// @param d the texture dimensions @@ -369,7 +369,8 @@ struct DepthMultisampledTexture }; /// `texture_multisampled_D` type -struct MultisampledTexture : public Castable { +struct MultisampledTexture final + : public Castable { /// Constructor /// @param d the texture dimensions /// @param t the multisampled texture type @@ -393,7 +394,7 @@ struct MultisampledTexture : public Castable { }; /// `texture_D` type -struct SampledTexture : public Castable { +struct SampledTexture final : public Castable { /// Constructor /// @param d the texture dimensions /// @param t the sampled texture type @@ -417,7 +418,7 @@ struct SampledTexture : public Castable { }; /// `texture_storage_D` type -struct StorageTexture : public Castable { +struct StorageTexture final : public Castable { /// Constructor /// @param d the texture dimensions /// @param f the storage image format @@ -467,7 +468,7 @@ struct Named : public Castable { }; /// `type T = N` type -struct Alias : public Castable { +struct Alias final : public Castable { /// Constructor /// @param n the alias name /// @param t the aliased type @@ -486,7 +487,7 @@ struct Alias : public Castable { }; /// `struct N { ... };` type -struct Struct : public Castable { +struct Struct final : public Castable { /// Constructor /// @param n the struct name /// @param m the member types diff --git a/src/tint/resolver/validation_test.cc b/src/tint/resolver/validation_test.cc index 9198487a81..dbf8115cac 100644 --- a/src/tint/resolver/validation_test.cc +++ b/src/tint/resolver/validation_test.cc @@ -47,13 +47,13 @@ namespace { using ResolverValidationTest = ResolverTest; -class FakeStmt : public Castable { +class FakeStmt final : public Castable { public: FakeStmt(ProgramID pid, Source src) : Base(pid, src) {} FakeStmt* Clone(CloneContext*) const override { return nullptr; } }; -class FakeExpr : public Castable { +class FakeExpr final : public Castable { public: FakeExpr(ProgramID pid, Source src) : Base(pid, src) {} FakeExpr* Clone(CloneContext*) const override { return nullptr; } diff --git a/src/tint/sem/array.h b/src/tint/sem/array.h index 573e0048fc..b6639fe805 100644 --- a/src/tint/sem/array.h +++ b/src/tint/sem/array.h @@ -32,7 +32,7 @@ namespace tint { namespace sem { /// Array holds the semantic information for Array nodes. -class Array : public Castable { +class Array final : public Castable { public: /// Constructor /// @param element the array element type diff --git a/src/tint/sem/atomic_type.h b/src/tint/sem/atomic_type.h index e8c7a4d6dc..20035ec1a8 100644 --- a/src/tint/sem/atomic_type.h +++ b/src/tint/sem/atomic_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A atomic type. -class Atomic : public Castable { +class Atomic final : public Castable { public: /// Constructor /// @param subtype the atomic type diff --git a/src/tint/sem/block_statement.h b/src/tint/sem/block_statement.h index 2b54447ba8..c6e537f9de 100644 --- a/src/tint/sem/block_statement.h +++ b/src/tint/sem/block_statement.h @@ -64,7 +64,7 @@ class BlockStatement : public Castable { }; /// The root block statement for a function -class FunctionBlockStatement +class FunctionBlockStatement final : public Castable { 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 { +class LoopBlockStatement final + : public Castable { public: /// Constructor /// @param declaration the AST node for this block statement diff --git a/src/tint/sem/bool_type.h b/src/tint/sem/bool_type.h index 404fadcb97..7e53e88338 100644 --- a/src/tint/sem/bool_type.h +++ b/src/tint/sem/bool_type.h @@ -29,7 +29,7 @@ namespace tint { namespace sem { /// A boolean type -class Bool : public Castable { +class Bool final : public Castable { public: /// Constructor Bool(); diff --git a/src/tint/sem/builtin.h b/src/tint/sem/builtin.h index 533a30bd4c..bb216ac4f8 100644 --- a/src/tint/sem/builtin.h +++ b/src/tint/sem/builtin.h @@ -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 { +class Builtin final : public Castable { public: /// Constructor /// @param type the builtin type diff --git a/src/tint/sem/call.h b/src/tint/sem/call.h index c9674453e9..fad6db3b0e 100644 --- a/src/tint/sem/call.h +++ b/src/tint/sem/call.h @@ -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 { +class Call final : public Castable { public: /// Constructor /// @param declaration the AST node diff --git a/src/tint/sem/depth_multisampled_texture_type.h b/src/tint/sem/depth_multisampled_texture_type.h index 539fe0e17f..f2eff66ddf 100644 --- a/src/tint/sem/depth_multisampled_texture_type.h +++ b/src/tint/sem/depth_multisampled_texture_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A multisampled depth texture type. -class DepthMultisampledTexture +class DepthMultisampledTexture final : public Castable { public: /// Constructor diff --git a/src/tint/sem/depth_texture_type.h b/src/tint/sem/depth_texture_type.h index 45ca46f4f4..657c4b6440 100644 --- a/src/tint/sem/depth_texture_type.h +++ b/src/tint/sem/depth_texture_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A depth texture type. -class DepthTexture : public Castable { +class DepthTexture final : public Castable { public: /// Constructor /// @param dim the dimensionality of the texture diff --git a/src/tint/sem/external_texture_type.h b/src/tint/sem/external_texture_type.h index 197cbedc8d..2406c08052 100644 --- a/src/tint/sem/external_texture_type.h +++ b/src/tint/sem/external_texture_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// An external texture type -class ExternalTexture : public Castable { +class ExternalTexture final : public Castable { public: /// Constructor ExternalTexture(); diff --git a/src/tint/sem/f32_type.h b/src/tint/sem/f32_type.h index ff5872bae5..c239c16888 100644 --- a/src/tint/sem/f32_type.h +++ b/src/tint/sem/f32_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A float 32 type -class F32 : public Castable { +class F32 final : public Castable { public: /// Constructor F32(); diff --git a/src/tint/sem/for_loop_statement.h b/src/tint/sem/for_loop_statement.h index 8681089900..7f8321b1af 100644 --- a/src/tint/sem/for_loop_statement.h +++ b/src/tint/sem/for_loop_statement.h @@ -30,7 +30,8 @@ namespace tint { namespace sem { /// Holds semantic information about a for-loop statement -class ForLoopStatement : public Castable { +class ForLoopStatement final + : public Castable { public: /// Constructor /// @param declaration the AST node for this for-loop statement diff --git a/src/tint/sem/function.h b/src/tint/sem/function.h index 90657e7e69..6e34356c9a 100644 --- a/src/tint/sem/function.h +++ b/src/tint/sem/function.h @@ -52,7 +52,7 @@ struct WorkgroupDimension { using WorkgroupSize = std::array; /// Function holds the semantic information for function nodes. -class Function : public Castable { +class Function final : public Castable { public: /// A vector of [Variable*, ast::VariableBindingPoint] pairs using VariableBindings = diff --git a/src/tint/sem/i32_type.h b/src/tint/sem/i32_type.h index 47036ef1fb..6a28f8fe87 100644 --- a/src/tint/sem/i32_type.h +++ b/src/tint/sem/i32_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A signed int 32 type. -class I32 : public Castable { +class I32 final : public Castable { public: /// Constructor I32(); diff --git a/src/tint/sem/if_statement.h b/src/tint/sem/if_statement.h index eb6b6a4986..7dc2a1182b 100644 --- a/src/tint/sem/if_statement.h +++ b/src/tint/sem/if_statement.h @@ -32,7 +32,7 @@ namespace tint { namespace sem { /// Holds semantic information about an if statement -class IfStatement : public Castable { +class IfStatement final : public Castable { public: /// Constructor /// @param declaration the AST node for this if statement @@ -60,7 +60,7 @@ class IfStatement : public Castable { }; /// Holds semantic information about an else statement -class ElseStatement : public Castable { +class ElseStatement final : public Castable { public: /// Constructor /// @param declaration the AST node for this else statement diff --git a/src/tint/sem/loop_statement.h b/src/tint/sem/loop_statement.h index 7168c31b7b..23ca4d384a 100644 --- a/src/tint/sem/loop_statement.h +++ b/src/tint/sem/loop_statement.h @@ -28,7 +28,7 @@ namespace tint { namespace sem { /// Holds semantic information about a loop statement -class LoopStatement : public Castable { +class LoopStatement final : public Castable { public: /// Constructor /// @param declaration the AST node for this loop statement @@ -43,7 +43,7 @@ class LoopStatement : public Castable { }; /// Holds semantic information about a loop continuing block -class LoopContinuingBlockStatement +class LoopContinuingBlockStatement final : public Castable { public: /// Constructor diff --git a/src/tint/sem/matrix_type.h b/src/tint/sem/matrix_type.h index 67f8fe835a..888a7af8fd 100644 --- a/src/tint/sem/matrix_type.h +++ b/src/tint/sem/matrix_type.h @@ -26,7 +26,7 @@ namespace sem { class Vector; /// A matrix type -class Matrix : public Castable { +class Matrix final : public Castable { public: /// Constructor /// @param column_type the type of a column of the matrix diff --git a/src/tint/sem/member_accessor_expression.h b/src/tint/sem/member_accessor_expression.h index 7a1a2a31cb..df4950401a 100644 --- a/src/tint/sem/member_accessor_expression.h +++ b/src/tint/sem/member_accessor_expression.h @@ -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 { 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 { +class Swizzle final : public Castable { public: /// Constructor /// @param declaration the AST node diff --git a/src/tint/sem/module.h b/src/tint/sem/module.h index a21579e344..1077b7e967 100644 --- a/src/tint/sem/module.h +++ b/src/tint/sem/module.h @@ -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 { +class Module final : public Castable { public: /// Constructor /// @param dep_ordered_decls the dependency-ordered module-scope declarations diff --git a/src/tint/sem/multisampled_texture_type.h b/src/tint/sem/multisampled_texture_type.h index 4272e712ae..1e1ee050d5 100644 --- a/src/tint/sem/multisampled_texture_type.h +++ b/src/tint/sem/multisampled_texture_type.h @@ -23,7 +23,8 @@ namespace tint { namespace sem { /// A multisampled texture type. -class MultisampledTexture : public Castable { +class MultisampledTexture final + : public Castable { public: /// Constructor /// @param dim the dimensionality of the texture diff --git a/src/tint/sem/pointer_type.h b/src/tint/sem/pointer_type.h index d652cea3cd..7e2e48cc4c 100644 --- a/src/tint/sem/pointer_type.h +++ b/src/tint/sem/pointer_type.h @@ -25,7 +25,7 @@ namespace tint { namespace sem { /// A pointer type. -class Pointer : public Castable { +class Pointer final : public Castable { public: /// Constructor /// @param subtype the pointee type diff --git a/src/tint/sem/reference_type.h b/src/tint/sem/reference_type.h index 4628b1c40f..cc2921b574 100644 --- a/src/tint/sem/reference_type.h +++ b/src/tint/sem/reference_type.h @@ -25,7 +25,7 @@ namespace tint { namespace sem { /// A reference type. -class Reference : public Castable { +class Reference final : public Castable { public: /// Constructor /// @param subtype the pointee type diff --git a/src/tint/sem/sampled_texture_type.h b/src/tint/sem/sampled_texture_type.h index 79c39ae342..4cfa15ca58 100644 --- a/src/tint/sem/sampled_texture_type.h +++ b/src/tint/sem/sampled_texture_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A sampled texture type. -class SampledTexture : public Castable { +class SampledTexture final : public Castable { public: /// Constructor /// @param dim the dimensionality of the texture diff --git a/src/tint/sem/sampler_type.h b/src/tint/sem/sampler_type.h index f565e77b15..fd11fb5df8 100644 --- a/src/tint/sem/sampler_type.h +++ b/src/tint/sem/sampler_type.h @@ -24,7 +24,7 @@ namespace tint { namespace sem { /// A sampler type. -class Sampler : public Castable { +class Sampler final : public Castable { public: /// Constructor /// @param kind the kind of sampler diff --git a/src/tint/sem/storage_texture_type.h b/src/tint/sem/storage_texture_type.h index 4785680117..f3d545987c 100644 --- a/src/tint/sem/storage_texture_type.h +++ b/src/tint/sem/storage_texture_type.h @@ -27,7 +27,7 @@ namespace sem { class Manager; /// A storage texture type. -class StorageTexture : public Castable { +class StorageTexture final : public Castable { public: /// Constructor /// @param dim the dimensionality of the texture diff --git a/src/tint/sem/struct.h b/src/tint/sem/struct.h index 7748ee2048..dc33dc2943 100644 --- a/src/tint/sem/struct.h +++ b/src/tint/sem/struct.h @@ -54,7 +54,7 @@ enum class PipelineStageUsage { }; /// Struct holds the semantic information for structures. -class Struct : public Castable { +class Struct final : public Castable { public: /// Constructor /// @param declaration the AST structure declaration diff --git a/src/tint/sem/switch_statement.h b/src/tint/sem/switch_statement.h index ab9e4ebe01..ff17f58608 100644 --- a/src/tint/sem/switch_statement.h +++ b/src/tint/sem/switch_statement.h @@ -29,7 +29,8 @@ namespace tint { namespace sem { /// Holds semantic information about an switch statement -class SwitchStatement : public Castable { +class SwitchStatement final + : public Castable { public: /// Constructor /// @param declaration the AST node for this switch statement @@ -47,7 +48,7 @@ class SwitchStatement : public Castable { }; /// Holds semantic information about a switch case statement -class CaseStatement : public Castable { +class CaseStatement final : public Castable { public: /// Constructor /// @param declaration the AST node for this case statement diff --git a/src/tint/sem/type_constructor.h b/src/tint/sem/type_constructor.h index 61269492f2..ca6bf818d0 100644 --- a/src/tint/sem/type_constructor.h +++ b/src/tint/sem/type_constructor.h @@ -21,7 +21,7 @@ namespace tint { namespace sem { /// TypeConstructor is the CallTarget for a type constructor. -class TypeConstructor : public Castable { +class TypeConstructor final : public Castable { public: /// Constructor /// @param type the type that's being constructed diff --git a/src/tint/sem/type_conversion.h b/src/tint/sem/type_conversion.h index ae677114ec..fcea914d08 100644 --- a/src/tint/sem/type_conversion.h +++ b/src/tint/sem/type_conversion.h @@ -21,7 +21,7 @@ namespace tint { namespace sem { /// TypeConversion is the CallTarget for a type conversion (cast). -class TypeConversion : public Castable { +class TypeConversion final : public Castable { public: /// Constructor /// @param type the target type of the cast diff --git a/src/tint/sem/type_manager.h b/src/tint/sem/type_manager.h index 50f5f2d993..6d68af0d6b 100644 --- a/src/tint/sem/type_manager.h +++ b/src/tint/sem/type_manager.h @@ -25,7 +25,7 @@ namespace tint::sem { /// The type manager holds all the pointers to the known types. -class Manager : public utils::UniqueAllocator { +class Manager final : public utils::UniqueAllocator { public: /// Iterator is the type returned by begin() and end() using Iterator = utils::BlockAllocator::ConstIterator; diff --git a/src/tint/sem/u32_type.h b/src/tint/sem/u32_type.h index 83a36f5249..5fa5c12a37 100644 --- a/src/tint/sem/u32_type.h +++ b/src/tint/sem/u32_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A unsigned int 32 type. -class U32 : public Castable { +class U32 final : public Castable { public: /// Constructor U32(); diff --git a/src/tint/sem/variable.h b/src/tint/sem/variable.h index b2f29ddbf9..0f196d0f71 100644 --- a/src/tint/sem/variable.h +++ b/src/tint/sem/variable.h @@ -100,7 +100,7 @@ class Variable : public Castable { }; /// LocalVariable is a function-scope variable -class LocalVariable : public Castable { +class LocalVariable final : public Castable { public: /// Constructor /// @param declaration the AST declaration node @@ -135,7 +135,7 @@ class LocalVariable : public Castable { }; /// GlobalVariable is a module-scope variable -class GlobalVariable : public Castable { +class GlobalVariable final : public Castable { public: /// Constructor /// @param declaration the AST declaration node @@ -182,7 +182,7 @@ class GlobalVariable : public Castable { }; /// Parameter is a function parameter -class Parameter : public Castable { +class Parameter final : public Castable { public: /// Constructor for function parameters /// @param declaration the AST declaration node @@ -232,7 +232,7 @@ using ParameterList = std::vector; /// VariableUser holds the semantic information for an identifier expression /// node that resolves to a variable. -class VariableUser : public Castable { +class VariableUser final : public Castable { public: /// Constructor /// @param declaration the AST identifier node diff --git a/src/tint/sem/vector_type.h b/src/tint/sem/vector_type.h index 38c2a8d5c0..48ee1c55f8 100644 --- a/src/tint/sem/vector_type.h +++ b/src/tint/sem/vector_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A vector type. -class Vector : public Castable { +class Vector final : public Castable { public: /// Constructor /// @param subtype the vector element type diff --git a/src/tint/sem/void_type.h b/src/tint/sem/void_type.h index d6cabfb45e..0411de02ee 100644 --- a/src/tint/sem/void_type.h +++ b/src/tint/sem/void_type.h @@ -23,7 +23,7 @@ namespace tint { namespace sem { /// A void type -class Void : public Castable { +class Void final : public Castable { public: /// Constructor Void(); diff --git a/src/tint/transform/add_empty_entry_point.h b/src/tint/transform/add_empty_entry_point.h index 36e250ea23..33c3a26fef 100644 --- a/src/tint/transform/add_empty_entry_point.h +++ b/src/tint/transform/add_empty_entry_point.h @@ -21,7 +21,8 @@ namespace tint { namespace transform { /// Add an empty entry point to the module, if no other entry points exist. -class AddEmptyEntryPoint : public Castable { +class AddEmptyEntryPoint final + : public Castable { public: /// Constructor AddEmptyEntryPoint(); diff --git a/src/tint/transform/add_spirv_block_attribute.h b/src/tint/transform/add_spirv_block_attribute.h index dc8258d1ab..5e68dad774 100644 --- a/src/tint/transform/add_spirv_block_attribute.h +++ b/src/tint/transform/add_spirv_block_attribute.h @@ -28,12 +28,12 @@ namespace transform { /// store type of a buffer. If that structure is nested inside another structure /// or an array, then it is wrapped inside another structure which gets the /// `@internal(spirv_block)` attribute instead. -class AddSpirvBlockAttribute +class AddSpirvBlockAttribute final : public Castable { public: /// SpirvBlockAttribute is an InternalAttribute that is used to decorate a // structure that needs a SPIR-V block attribute. - class SpirvBlockAttribute + class SpirvBlockAttribute final : public Castable { public: /// Constructor diff --git a/src/tint/transform/array_length_from_uniform.h b/src/tint/transform/array_length_from_uniform.h index 109db8e45a..2505f17157 100644 --- a/src/tint/transform/array_length_from_uniform.h +++ b/src/tint/transform/array_length_from_uniform.h @@ -52,7 +52,7 @@ namespace transform { /// /// @note Depends on the following transforms to have been run first: /// * SimplifyPointers -class ArrayLengthFromUniform +class ArrayLengthFromUniform final : public Castable { public: /// Constructor @@ -61,7 +61,7 @@ class ArrayLengthFromUniform ~ArrayLengthFromUniform() override; /// Configuration options for the ArrayLengthFromUniform transform. - struct Config : public Castable { + struct Config final : public Castable { /// Constructor /// @param ubo_bp the binding point to use for the generated uniform buffer. explicit Config(sem::BindingPoint ubo_bp); @@ -86,7 +86,7 @@ class ArrayLengthFromUniform /// Information produced about what the transform did. /// If there were no calls to the arrayLength() builtin, then no Result will /// be emitted. - struct Result : public Castable { + struct Result final : public Castable { /// Constructor /// @param used_size_indices Indices into the UBO that are statically used. explicit Result(std::unordered_set used_size_indices); diff --git a/src/tint/transform/binding_remapper.h b/src/tint/transform/binding_remapper.h index 5cfa3ec825..f87f995e37 100644 --- a/src/tint/transform/binding_remapper.h +++ b/src/tint/transform/binding_remapper.h @@ -29,7 +29,7 @@ using BindingPoint = sem::BindingPoint; /// BindingRemapper is a transform used to remap resource binding points and /// access controls. -class BindingRemapper : public Castable { +class BindingRemapper final : public Castable { public: /// BindingPoints is a map of old binding point to new binding point using BindingPoints = std::unordered_map; @@ -39,7 +39,7 @@ class BindingRemapper : public Castable { /// Remappings is consumed by the BindingRemapper transform. /// Data holds information about shader usage and constant buffer offsets. - struct Remappings : public Castable { + struct Remappings final : public Castable { /// Constructor /// @param bp a map of new binding points /// @param ac a map of new access controls diff --git a/src/tint/transform/builtin_polyfill.h b/src/tint/transform/builtin_polyfill.h index 131e08ac47..dec716ef59 100644 --- a/src/tint/transform/builtin_polyfill.h +++ b/src/tint/transform/builtin_polyfill.h @@ -21,7 +21,7 @@ namespace tint { namespace transform { /// Implements builtins for backends that do not have a native implementation. -class BuiltinPolyfill : public Castable { +class BuiltinPolyfill final : public Castable { public: /// Constructor BuiltinPolyfill(); @@ -56,7 +56,7 @@ class BuiltinPolyfill : public Castable { /// Config is consumed by the BuiltinPolyfill transform. /// Config specifies the builtins that should be polyfilled. - struct Config : public Castable { + struct Config final : public Castable { /// Constructor /// @param b the list of builtins to polyfill explicit Config(const Builtins& b); diff --git a/src/tint/transform/calculate_array_length.h b/src/tint/transform/calculate_array_length.h index cc18faaff3..dfc1508ced 100644 --- a/src/tint/transform/calculate_array_length.h +++ b/src/tint/transform/calculate_array_length.h @@ -32,11 +32,12 @@ namespace transform { /// /// @note Depends on the following transforms to have been run first: /// * SimplifyPointers -class CalculateArrayLength : public Castable { +class CalculateArrayLength final + : public Castable { public: /// BufferSizeIntrinsic is an InternalAttribute that's applied to intrinsic /// functions used to obtain the runtime size of a storage buffer. - class BufferSizeIntrinsic + class BufferSizeIntrinsic final : public Castable { public: /// Constructor diff --git a/src/tint/transform/canonicalize_entry_point_io.h b/src/tint/transform/canonicalize_entry_point_io.h index 1d65e41876..48b7f40555 100644 --- a/src/tint/transform/canonicalize_entry_point_io.h +++ b/src/tint/transform/canonicalize_entry_point_io.h @@ -83,7 +83,7 @@ namespace transform { /// /// @note Depends on the following transforms to have been run first: /// * Unshadow -class CanonicalizeEntryPointIO +class CanonicalizeEntryPointIO final : public Castable { public: /// ShaderStyle is an enumerator of different ways to emit shader IO. @@ -99,7 +99,7 @@ class CanonicalizeEntryPointIO }; /// Configuration options for the transform. - struct Config : public Castable { + struct Config final : public Castable { /// Constructor /// @param style the approach to use for emitting shader IO. /// @param sample_mask an optional sample mask to combine with shader masks diff --git a/src/tint/transform/combine_samplers.h b/src/tint/transform/combine_samplers.h index e5457864c1..f55c275e9e 100644 --- a/src/tint/transform/combine_samplers.h +++ b/src/tint/transform/combine_samplers.h @@ -53,7 +53,7 @@ namespace transform { /// information needed to represent a combined sampler in GLSL /// (dimensionality, component type, etc). The GLSL writer outputs such /// (Tint) Textures as (GLSL) Samplers. -class CombineSamplers : public Castable { +class CombineSamplers final : public Castable { public: /// A pair of binding points. using SamplerTexturePair = sem::SamplerTexturePair; @@ -63,7 +63,7 @@ class CombineSamplers : public Castable { /// The client-provided mapping from separate texture and sampler binding /// points to combined sampler binding point. - struct BindingInfo : public Castable { + struct BindingInfo final : public Castable { /// Constructor /// @param map the map of all (texture, sampler) -> (combined) pairs /// @param placeholder the binding point to use for placeholder samplers. diff --git a/src/tint/transform/decompose_memory_access.h b/src/tint/transform/decompose_memory_access.h index 11b4450aa6..d1c2ce1390 100644 --- a/src/tint/transform/decompose_memory_access.h +++ b/src/tint/transform/decompose_memory_access.h @@ -30,14 +30,14 @@ namespace transform { /// DecomposeMemoryAccess is a transform used to replace storage and uniform /// buffer accesses with a combination of load, store or atomic functions on /// primitive types. -class DecomposeMemoryAccess +class DecomposeMemoryAccess final : public Castable { public: /// Intrinsic is an InternalAttribute that's used to decorate a stub function /// so that the HLSL transforms this into calls to /// `[RW]ByteAddressBuffer.Load[N]()` or `[RW]ByteAddressBuffer.Store[N]()`, /// with a possible cast. - class Intrinsic : public Castable { + class Intrinsic final : public Castable { public: /// Intrinsic op enum class Op { diff --git a/src/tint/transform/decompose_strided_array.h b/src/tint/transform/decompose_strided_array.h index 07d3353bbf..ccf869190f 100644 --- a/src/tint/transform/decompose_strided_array.h +++ b/src/tint/transform/decompose_strided_array.h @@ -28,7 +28,7 @@ namespace transform { /// /// @note Depends on the following transforms to have been run first: /// * SimplifyPointers -class DecomposeStridedArray +class DecomposeStridedArray final : public Castable { public: /// Constructor diff --git a/src/tint/transform/decompose_strided_matrix.h b/src/tint/transform/decompose_strided_matrix.h index eb908fffd8..f223178479 100644 --- a/src/tint/transform/decompose_strided_matrix.h +++ b/src/tint/transform/decompose_strided_matrix.h @@ -28,7 +28,7 @@ namespace transform { /// /// @note Depends on the following transforms to have been run first: /// * SimplifyPointers -class DecomposeStridedMatrix +class DecomposeStridedMatrix final : public Castable { public: /// Constructor diff --git a/src/tint/transform/first_index_offset.h b/src/tint/transform/first_index_offset.h index ce3135e8a8..21636f3e03 100644 --- a/src/tint/transform/first_index_offset.h +++ b/src/tint/transform/first_index_offset.h @@ -58,12 +58,12 @@ namespace transform { /// } /// ``` /// -class FirstIndexOffset : public Castable { +class FirstIndexOffset final : public Castable { public: /// BindingPoint is consumed by the FirstIndexOffset transform. /// BindingPoint specifies the binding point of the first index uniform /// buffer. - struct BindingPoint : public Castable { + struct BindingPoint final : public Castable { /// Constructor BindingPoint(); @@ -83,7 +83,7 @@ class FirstIndexOffset : public Castable { /// Data is outputted by the FirstIndexOffset transform. /// Data holds information about shader usage and constant buffer offsets. - struct Data : public Castable { + struct Data final : public Castable { /// Constructor /// @param has_vtx_index True if the shader uses vertex_index /// @param has_inst_index True if the shader uses instance_index diff --git a/src/tint/transform/fold_constants.h b/src/tint/transform/fold_constants.h index 564ade00d8..7f964d1655 100644 --- a/src/tint/transform/fold_constants.h +++ b/src/tint/transform/fold_constants.h @@ -21,7 +21,7 @@ namespace tint { namespace transform { /// FoldConstants transforms the AST by folding constant expressions -class FoldConstants : public Castable { +class FoldConstants final : public Castable { public: /// Constructor FoldConstants(); diff --git a/src/tint/transform/fold_trivial_single_use_lets.h b/src/tint/transform/fold_trivial_single_use_lets.h index 780fceebd8..858f6da009 100644 --- a/src/tint/transform/fold_trivial_single_use_lets.h +++ b/src/tint/transform/fold_trivial_single_use_lets.h @@ -34,7 +34,7 @@ namespace transform { /// single usage. /// These rules prevent any hoisting of the let that may affect execution /// behaviour. -class FoldTrivialSingleUseLets +class FoldTrivialSingleUseLets final : public Castable { public: /// Constructor diff --git a/src/tint/transform/for_loop_to_loop.h b/src/tint/transform/for_loop_to_loop.h index c4004482df..94b046091c 100644 --- a/src/tint/transform/for_loop_to_loop.h +++ b/src/tint/transform/for_loop_to_loop.h @@ -22,7 +22,7 @@ namespace transform { /// ForLoopToLoop is a Transform that converts a for-loop statement into a loop /// statement. This is required by the SPIR-V writer. -class ForLoopToLoop : public Castable { +class ForLoopToLoop final : public Castable { public: /// Constructor ForLoopToLoop(); diff --git a/src/tint/transform/glsl.h b/src/tint/transform/glsl.h index b637056716..baec29a5fc 100644 --- a/src/tint/transform/glsl.h +++ b/src/tint/transform/glsl.h @@ -29,10 +29,10 @@ namespace transform { /// Glsl is a transform used to sanitize a Program for use with the Glsl writer. /// Passing a non-sanitized Program to the Glsl writer will result in undefined /// behavior. -class Glsl : public Castable { +class Glsl final : public Castable { public: /// Configuration options for the Glsl sanitizer transform. - struct Config : public Castable { + struct Config final : public Castable { /// Constructor /// @param entry_point the root entry point function to generate /// @param disable_workgroup_init `true` to disable workgroup memory zero