From b5599d35f96f4b6d5ab57ed2d2791ed7b9d7e971 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 7 Apr 2022 16:55:14 +0000 Subject: [PATCH] Condense namespaces in tint/transform. This PR condenses the namespaces in the tint/transform folder. Change-Id: Idf448870ccf90f892b9186f7aab7bb0ac9deda17 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86029 Auto-Submit: Dan Sinclair Reviewed-by: Ben Clayton Commit-Queue: Dan Sinclair --- src/tint/transform/add_empty_entry_point.cc | 6 ++---- src/tint/transform/add_empty_entry_point.h | 6 ++---- src/tint/transform/add_empty_entry_point_test.cc | 6 ++---- src/tint/transform/add_spirv_block_attribute.cc | 6 ++---- src/tint/transform/add_spirv_block_attribute.h | 6 ++---- src/tint/transform/add_spirv_block_attribute_test.cc | 6 ++---- src/tint/transform/array_length_from_uniform.cc | 6 ++---- src/tint/transform/array_length_from_uniform.h | 9 ++++----- src/tint/transform/array_length_from_uniform_test.cc | 6 ++---- src/tint/transform/binding_remapper.cc | 6 ++---- src/tint/transform/binding_remapper.h | 6 ++---- src/tint/transform/binding_remapper_test.cc | 6 ++---- src/tint/transform/builtin_polyfill.cc | 6 ++---- src/tint/transform/builtin_polyfill.h | 6 ++---- src/tint/transform/builtin_polyfill_test.cc | 6 ++---- src/tint/transform/calculate_array_length.cc | 6 ++---- src/tint/transform/calculate_array_length.h | 9 ++++----- src/tint/transform/calculate_array_length_test.cc | 6 ++---- src/tint/transform/canonicalize_entry_point_io.cc | 6 ++---- src/tint/transform/canonicalize_entry_point_io.h | 6 ++---- .../transform/canonicalize_entry_point_io_test.cc | 6 ++---- src/tint/transform/combine_samplers.cc | 6 ++---- src/tint/transform/combine_samplers.h | 6 ++---- src/tint/transform/combine_samplers_test.cc | 6 ++---- src/tint/transform/decompose_memory_access.cc | 6 ++---- src/tint/transform/decompose_memory_access.h | 9 ++++----- src/tint/transform/decompose_memory_access_test.cc | 6 ++---- src/tint/transform/decompose_strided_array.cc | 6 ++---- src/tint/transform/decompose_strided_array.h | 6 ++---- src/tint/transform/decompose_strided_array_test.cc | 6 ++---- src/tint/transform/decompose_strided_matrix.cc | 6 ++---- src/tint/transform/decompose_strided_matrix.h | 6 ++---- src/tint/transform/decompose_strided_matrix_test.cc | 6 ++---- src/tint/transform/expand_compound_assignment.cc | 6 ++---- src/tint/transform/expand_compound_assignment.h | 6 ++---- .../transform/expand_compound_assignment_test.cc | 6 ++---- src/tint/transform/first_index_offset.cc | 6 ++---- src/tint/transform/first_index_offset.h | 6 ++---- src/tint/transform/first_index_offset_test.cc | 6 ++---- src/tint/transform/fold_constants.cc | 6 ++---- src/tint/transform/fold_constants.h | 6 ++---- src/tint/transform/fold_constants_test.cc | 6 ++---- src/tint/transform/fold_trivial_single_use_lets.cc | 6 ++---- src/tint/transform/fold_trivial_single_use_lets.h | 6 ++---- .../transform/fold_trivial_single_use_lets_test.cc | 6 ++---- src/tint/transform/for_loop_to_loop.cc | 6 ++---- src/tint/transform/for_loop_to_loop.h | 6 ++---- src/tint/transform/for_loop_to_loop_test.cc | 6 ++---- src/tint/transform/glsl.cc | 6 ++---- src/tint/transform/glsl.h | 9 ++++----- src/tint/transform/glsl_test.cc | 6 ++---- .../transform/localize_struct_array_assignment.cc | 6 ++---- .../transform/localize_struct_array_assignment.h | 6 ++---- .../localize_struct_array_assignment_test.cc | 6 ++---- src/tint/transform/loop_to_for_loop.cc | 6 ++---- src/tint/transform/loop_to_for_loop.h | 6 ++---- src/tint/transform/loop_to_for_loop_test.cc | 6 ++---- src/tint/transform/manager.cc | 6 ++---- src/tint/transform/manager.h | 6 ++---- .../module_scope_var_to_entry_point_param.cc | 6 ++---- .../module_scope_var_to_entry_point_param.h | 6 ++---- .../module_scope_var_to_entry_point_param_test.cc | 6 ++---- src/tint/transform/multiplanar_external_texture.cc | 6 ++---- src/tint/transform/multiplanar_external_texture.h | 6 ++---- .../transform/multiplanar_external_texture_test.cc | 6 ++---- src/tint/transform/num_workgroups_from_uniform.cc | 6 ++---- src/tint/transform/num_workgroups_from_uniform.h | 9 ++++----- .../transform/num_workgroups_from_uniform_test.cc | 6 ++---- .../promote_initializers_to_const_var_test.cc | 6 ++---- .../transform/promote_side_effects_to_decl_test.cc | 6 ++---- src/tint/transform/remove_continue_in_switch_test.cc | 6 ++---- src/tint/transform/remove_phonies.cc | 6 ++---- src/tint/transform/remove_phonies.h | 6 ++---- src/tint/transform/remove_phonies_test.cc | 6 ++---- src/tint/transform/remove_unreachable_statements.cc | 6 ++---- src/tint/transform/remove_unreachable_statements.h | 6 ++---- .../transform/remove_unreachable_statements_test.cc | 6 ++---- src/tint/transform/renamer_test.cc | 6 ++---- src/tint/transform/robustness.cc | 6 ++---- src/tint/transform/robustness.h | 12 ++++-------- src/tint/transform/robustness_test.cc | 6 ++---- src/tint/transform/simplify_pointers.cc | 6 ++---- src/tint/transform/simplify_pointers.h | 6 ++---- src/tint/transform/simplify_pointers_test.cc | 6 ++---- src/tint/transform/single_entry_point.cc | 6 ++---- src/tint/transform/single_entry_point.h | 6 ++---- src/tint/transform/single_entry_point_test.cc | 6 ++---- src/tint/transform/test_helper.h | 6 ++---- src/tint/transform/transform.cc | 6 ++---- src/tint/transform/transform.h | 6 ++---- src/tint/transform/transform_test.cc | 6 ++---- src/tint/transform/unshadow.cc | 6 ++---- src/tint/transform/unshadow.h | 6 ++---- src/tint/transform/unshadow_test.cc | 6 ++---- src/tint/transform/unwind_discard_functions_test.cc | 6 ++---- src/tint/transform/var_for_dynamic_index_test.cc | 6 ++---- .../vectorize_scalar_matrix_constructors.cc | 6 ++---- .../transform/vectorize_scalar_matrix_constructors.h | 6 ++---- .../vectorize_scalar_matrix_constructors_test.cc | 6 ++---- src/tint/transform/vertex_pulling.cc | 6 ++---- src/tint/transform/vertex_pulling.h | 6 ++---- src/tint/transform/vertex_pulling_test.cc | 6 ++---- src/tint/transform/wrap_arrays_in_structs.cc | 6 ++---- src/tint/transform/wrap_arrays_in_structs.h | 12 ++++-------- src/tint/transform/wrap_arrays_in_structs_test.cc | 6 ++---- src/tint/transform/zero_init_workgroup_memory.cc | 6 ++---- src/tint/transform/zero_init_workgroup_memory.h | 6 ++---- .../transform/zero_init_workgroup_memory_test.cc | 6 ++---- 108 files changed, 230 insertions(+), 445 deletions(-) diff --git a/src/tint/transform/add_empty_entry_point.cc b/src/tint/transform/add_empty_entry_point.cc index 5e33ce8bc1..0710d2bba6 100644 --- a/src/tint/transform/add_empty_entry_point.cc +++ b/src/tint/transform/add_empty_entry_point.cc @@ -20,8 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::AddEmptyEntryPoint); -namespace tint { -namespace transform { +namespace tint::transform { AddEmptyEntryPoint::AddEmptyEntryPoint() = default; @@ -47,5 +46,4 @@ void AddEmptyEntryPoint::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/add_empty_entry_point.h b/src/tint/transform/add_empty_entry_point.h index 33c3a26fef..eb9dccd5a9 100644 --- a/src/tint/transform/add_empty_entry_point.h +++ b/src/tint/transform/add_empty_entry_point.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Add an empty entry point to the module, if no other entry points exist. class AddEmptyEntryPoint final @@ -47,7 +46,6 @@ class AddEmptyEntryPoint final DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_ADD_EMPTY_ENTRY_POINT_H_ diff --git a/src/tint/transform/add_empty_entry_point_test.cc b/src/tint/transform/add_empty_entry_point_test.cc index e8c1c72cc5..0854251e03 100644 --- a/src/tint/transform/add_empty_entry_point_test.cc +++ b/src/tint/transform/add_empty_entry_point_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using AddEmptyEntryPointTest = TransformTest; @@ -84,5 +83,4 @@ var unused_entry_point : f32; } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/add_spirv_block_attribute.cc b/src/tint/transform/add_spirv_block_attribute.cc index ffd389690a..91ab991d7b 100644 --- a/src/tint/transform/add_spirv_block_attribute.cc +++ b/src/tint/transform/add_spirv_block_attribute.cc @@ -26,8 +26,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::AddSpirvBlockAttribute); TINT_INSTANTIATE_TYPEINFO( tint::transform::AddSpirvBlockAttribute::SpirvBlockAttribute); -namespace tint { -namespace transform { +namespace tint::transform { AddSpirvBlockAttribute::AddSpirvBlockAttribute() = default; @@ -118,5 +117,4 @@ AddSpirvBlockAttribute::SpirvBlockAttribute::Clone(CloneContext* ctx) const { .Create(ctx->dst->ID()); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/add_spirv_block_attribute.h b/src/tint/transform/add_spirv_block_attribute.h index 5e68dad774..386a34118a 100644 --- a/src/tint/transform/add_spirv_block_attribute.h +++ b/src/tint/transform/add_spirv_block_attribute.h @@ -20,8 +20,7 @@ #include "src/tint/ast/internal_attribute.h" #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// AddSpirvBlockAttribute is a transform that adds an /// `@internal(spirv_block)` attribute to any structure that is used as the @@ -70,7 +69,6 @@ class AddSpirvBlockAttribute final DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_ADD_SPIRV_BLOCK_ATTRIBUTE_H_ diff --git a/src/tint/transform/add_spirv_block_attribute_test.cc b/src/tint/transform/add_spirv_block_attribute_test.cc index 046b9c1630..b68920c25e 100644 --- a/src/tint/transform/add_spirv_block_attribute_test.cc +++ b/src/tint/transform/add_spirv_block_attribute_test.cc @@ -19,8 +19,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using AddSpirvBlockAttributeTest = TransformTest; @@ -611,5 +610,4 @@ struct Inner { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/array_length_from_uniform.cc b/src/tint/transform/array_length_from_uniform.cc index ff733ff01e..52c68f2c84 100644 --- a/src/tint/transform/array_length_from_uniform.cc +++ b/src/tint/transform/array_length_from_uniform.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::ArrayLengthFromUniform); TINT_INSTANTIATE_TYPEINFO(tint::transform::ArrayLengthFromUniform::Config); TINT_INSTANTIATE_TYPEINFO(tint::transform::ArrayLengthFromUniform::Result); -namespace tint { -namespace transform { +namespace tint::transform { ArrayLengthFromUniform::ArrayLengthFromUniform() = default; ArrayLengthFromUniform::~ArrayLengthFromUniform() = default; @@ -229,5 +228,4 @@ ArrayLengthFromUniform::Result::Result( ArrayLengthFromUniform::Result::Result(const Result&) = default; ArrayLengthFromUniform::Result::~Result() = default; -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/array_length_from_uniform.h b/src/tint/transform/array_length_from_uniform.h index 2505f17157..9d5cea60a2 100644 --- a/src/tint/transform/array_length_from_uniform.h +++ b/src/tint/transform/array_length_from_uniform.h @@ -21,12 +21,12 @@ #include "src/tint/sem/binding_point.h" #include "src/tint/transform/transform.h" -namespace tint { - // Forward declarations +namespace tint { class CloneContext; +} -namespace transform { +namespace tint::transform { /// ArrayLengthFromUniform is a transform that implements calls to arrayLength() /// by calculating the length from the total size of the storage buffer, which @@ -119,7 +119,6 @@ class ArrayLengthFromUniform final DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_ARRAY_LENGTH_FROM_UNIFORM_H_ diff --git a/src/tint/transform/array_length_from_uniform_test.cc b/src/tint/transform/array_length_from_uniform_test.cc index 7cdcb5cdd2..42a334ce4e 100644 --- a/src/tint/transform/array_length_from_uniform_test.cc +++ b/src/tint/transform/array_length_from_uniform_test.cc @@ -20,8 +20,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/transform/unshadow.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using ArrayLengthFromUniformTest = TransformTest; @@ -497,5 +496,4 @@ struct SB { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/binding_remapper.cc b/src/tint/transform/binding_remapper.cc index 21155dfe57..3934b207d0 100644 --- a/src/tint/transform/binding_remapper.cc +++ b/src/tint/transform/binding_remapper.cc @@ -26,8 +26,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper); TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper::Remappings); -namespace tint { -namespace transform { +namespace tint::transform { BindingRemapper::Remappings::Remappings(BindingPoints bp, AccessControls ac, @@ -159,5 +158,4 @@ void BindingRemapper::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/binding_remapper.h b/src/tint/transform/binding_remapper.h index f87f995e37..3e9f613470 100644 --- a/src/tint/transform/binding_remapper.h +++ b/src/tint/transform/binding_remapper.h @@ -21,8 +21,7 @@ #include "src/tint/sem/binding_point.h" #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// BindingPoint is an alias to sem::BindingPoint using BindingPoint = sem::BindingPoint; @@ -86,7 +85,6 @@ class BindingRemapper final : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_BINDING_REMAPPER_H_ diff --git a/src/tint/transform/binding_remapper_test.cc b/src/tint/transform/binding_remapper_test.cc index 3fc0b19319..70c723216b 100644 --- a/src/tint/transform/binding_remapper_test.cc +++ b/src/tint/transform/binding_remapper_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using BindingRemapperTest = TransformTest; @@ -359,5 +358,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/builtin_polyfill.cc b/src/tint/transform/builtin_polyfill.cc index 9cd2c678ef..c33d40fe5a 100644 --- a/src/tint/transform/builtin_polyfill.cc +++ b/src/tint/transform/builtin_polyfill.cc @@ -24,8 +24,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::BuiltinPolyfill); TINT_INSTANTIATE_TYPEINFO(tint::transform::BuiltinPolyfill::Config); -namespace tint { -namespace transform { +namespace tint::transform { /// The PIMPL state for the BuiltinPolyfill transform struct BuiltinPolyfill::State { @@ -598,5 +597,4 @@ BuiltinPolyfill::Config::Config(const Builtins& b) : builtins(b) {} BuiltinPolyfill::Config::Config(const Config&) = default; BuiltinPolyfill::Config::~Config() = default; -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/builtin_polyfill.h b/src/tint/transform/builtin_polyfill.h index dec716ef59..ada10158e2 100644 --- a/src/tint/transform/builtin_polyfill.h +++ b/src/tint/transform/builtin_polyfill.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Implements builtins for backends that do not have a native implementation. class BuiltinPolyfill final : public Castable { @@ -91,7 +90,6 @@ class BuiltinPolyfill final : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_BUILTIN_POLYFILL_H_ diff --git a/src/tint/transform/builtin_polyfill_test.cc b/src/tint/transform/builtin_polyfill_test.cc index 49e0471259..c5cc2c5ff7 100644 --- a/src/tint/transform/builtin_polyfill_test.cc +++ b/src/tint/transform/builtin_polyfill_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using Level = BuiltinPolyfill::Level; @@ -1117,5 +1116,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/calculate_array_length.cc b/src/tint/transform/calculate_array_length.cc index 05fcb0f2f1..589d21e8df 100644 --- a/src/tint/transform/calculate_array_length.cc +++ b/src/tint/transform/calculate_array_length.cc @@ -34,8 +34,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::CalculateArrayLength); TINT_INSTANTIATE_TYPEINFO( tint::transform::CalculateArrayLength::BufferSizeIntrinsic); -namespace tint { -namespace transform { +namespace tint::transform { namespace { @@ -239,5 +238,4 @@ void CalculateArrayLength::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/calculate_array_length.h b/src/tint/transform/calculate_array_length.h index dfc1508ced..0ed7a5d42a 100644 --- a/src/tint/transform/calculate_array_length.h +++ b/src/tint/transform/calculate_array_length.h @@ -20,12 +20,12 @@ #include "src/tint/ast/internal_attribute.h" #include "src/tint/transform/transform.h" -namespace tint { - // Forward declarations +namespace tint { class CloneContext; +} -namespace transform { +namespace tint::transform { /// CalculateArrayLength is a transform used to replace calls to arrayLength() /// with a value calculated from the size of the storage buffer. @@ -78,7 +78,6 @@ class CalculateArrayLength final DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_CALCULATE_ARRAY_LENGTH_H_ diff --git a/src/tint/transform/calculate_array_length_test.cc b/src/tint/transform/calculate_array_length_test.cc index 17d28fdf45..dec1698de0 100644 --- a/src/tint/transform/calculate_array_length_test.cc +++ b/src/tint/transform/calculate_array_length_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/transform/unshadow.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using CalculateArrayLengthTest = TransformTest; @@ -549,5 +548,4 @@ struct SB2 { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/canonicalize_entry_point_io.cc b/src/tint/transform/canonicalize_entry_point_io.cc index 1eaa5dbe65..9d72887cdd 100644 --- a/src/tint/transform/canonicalize_entry_point_io.cc +++ b/src/tint/transform/canonicalize_entry_point_io.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::CanonicalizeEntryPointIO); TINT_INSTANTIATE_TYPEINFO(tint::transform::CanonicalizeEntryPointIO::Config); -namespace tint { -namespace transform { +namespace tint::transform { CanonicalizeEntryPointIO::CanonicalizeEntryPointIO() = default; CanonicalizeEntryPointIO::~CanonicalizeEntryPointIO() = default; @@ -775,5 +774,4 @@ CanonicalizeEntryPointIO::Config::Config(ShaderStyle style, CanonicalizeEntryPointIO::Config::Config(const Config&) = default; CanonicalizeEntryPointIO::Config::~Config() = default; -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/canonicalize_entry_point_io.h b/src/tint/transform/canonicalize_entry_point_io.h index 48b7f40555..eab4128819 100644 --- a/src/tint/transform/canonicalize_entry_point_io.h +++ b/src/tint/transform/canonicalize_entry_point_io.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// CanonicalizeEntryPointIO is a transform used to rewrite shader entry point /// interfaces into a form that the generators can handle. Each entry point @@ -143,7 +142,6 @@ class CanonicalizeEntryPointIO final struct State; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_CANONICALIZE_ENTRY_POINT_IO_H_ diff --git a/src/tint/transform/canonicalize_entry_point_io_test.cc b/src/tint/transform/canonicalize_entry_point_io_test.cc index 6147fe0613..bf4d699910 100644 --- a/src/tint/transform/canonicalize_entry_point_io_test.cc +++ b/src/tint/transform/canonicalize_entry_point_io_test.cc @@ -17,8 +17,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/transform/unshadow.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using CanonicalizeEntryPointIOTest = TransformTest; @@ -4037,5 +4036,4 @@ fn main() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/combine_samplers.cc b/src/tint/transform/combine_samplers.cc index ab0b90ded8..4b1e892a3e 100644 --- a/src/tint/transform/combine_samplers.cc +++ b/src/tint/transform/combine_samplers.cc @@ -36,8 +36,7 @@ bool IsGlobal(const tint::sem::VariablePair& pair) { } // namespace -namespace tint { -namespace transform { +namespace tint::transform { CombineSamplers::BindingInfo::BindingInfo(const BindingMap& map, const sem::BindingPoint& placeholder) @@ -351,5 +350,4 @@ void CombineSamplers::Run(CloneContext& ctx, State(ctx, binding_info).Run(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/combine_samplers.h b/src/tint/transform/combine_samplers.h index f55c275e9e..d15d2ab855 100644 --- a/src/tint/transform/combine_samplers.h +++ b/src/tint/transform/combine_samplers.h @@ -21,8 +21,7 @@ #include "src/tint/sem/sampler_texture_pair.h" #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// This transform converts all separate texture/sampler refences in a /// program into combined texture/samplers. This is required for GLSL, @@ -104,7 +103,6 @@ class CombineSamplers final : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_COMBINE_SAMPLERS_H_ diff --git a/src/tint/transform/combine_samplers_test.cc b/src/tint/transform/combine_samplers_test.cc index f223cb1e54..cb60103a32 100644 --- a/src/tint/transform/combine_samplers_test.cc +++ b/src/tint/transform/combine_samplers_test.cc @@ -19,8 +19,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using CombineSamplersTest = TransformTest; @@ -1008,5 +1007,4 @@ fn main() -> vec4 { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/decompose_memory_access.cc b/src/tint/transform/decompose_memory_access.cc index 50805518bc..699eeb4fbc 100644 --- a/src/tint/transform/decompose_memory_access.cc +++ b/src/tint/transform/decompose_memory_access.cc @@ -41,8 +41,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess); TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess::Intrinsic); -namespace tint { -namespace transform { +namespace tint::transform { namespace { @@ -991,8 +990,7 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform TINT_INSTANTIATE_TYPEINFO(tint::transform::Offset); TINT_INSTANTIATE_TYPEINFO(tint::transform::OffsetLiteral); diff --git a/src/tint/transform/decompose_memory_access.h b/src/tint/transform/decompose_memory_access.h index d1c2ce1390..efcd39b118 100644 --- a/src/tint/transform/decompose_memory_access.h +++ b/src/tint/transform/decompose_memory_access.h @@ -20,12 +20,12 @@ #include "src/tint/ast/internal_attribute.h" #include "src/tint/transform/transform.h" -namespace tint { - // Forward declarations +namespace tint { class CloneContext; +} -namespace transform { +namespace tint::transform { /// DecomposeMemoryAccess is a transform used to replace storage and uniform /// buffer accesses with a combination of load, store or atomic functions on @@ -125,7 +125,6 @@ class DecomposeMemoryAccess final struct State; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_DECOMPOSE_MEMORY_ACCESS_H_ diff --git a/src/tint/transform/decompose_memory_access_test.cc b/src/tint/transform/decompose_memory_access_test.cc index ec47d9a70f..dadb4226da 100644 --- a/src/tint/transform/decompose_memory_access_test.cc +++ b/src/tint/transform/decompose_memory_access_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using DecomposeMemoryAccessTest = TransformTest; @@ -2800,5 +2799,4 @@ struct S { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/decompose_strided_array.cc b/src/tint/transform/decompose_strided_array.cc index 0265704cff..74b6903b36 100644 --- a/src/tint/transform/decompose_strided_array.cc +++ b/src/tint/transform/decompose_strided_array.cc @@ -29,8 +29,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeStridedArray); -namespace tint { -namespace transform { +namespace tint::transform { namespace { using DecomposedArrays = std::unordered_map; @@ -158,5 +157,4 @@ void DecomposeStridedArray::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/decompose_strided_array.h b/src/tint/transform/decompose_strided_array.h index ccf869190f..505f5cbecd 100644 --- a/src/tint/transform/decompose_strided_array.h +++ b/src/tint/transform/decompose_strided_array.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// DecomposeStridedArray transforms replaces arrays with a non-default /// `@stride` attribute with an array of structure elements, where the @@ -55,7 +54,6 @@ class DecomposeStridedArray final DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_DECOMPOSE_STRIDED_ARRAY_H_ diff --git a/src/tint/transform/decompose_strided_array_test.cc b/src/tint/transform/decompose_strided_array_test.cc index 63c7823720..98ef2c42a9 100644 --- a/src/tint/transform/decompose_strided_array_test.cc +++ b/src/tint/transform/decompose_strided_array_test.cc @@ -23,8 +23,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/transform/unshadow.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using DecomposeStridedArrayTest = TransformTest; @@ -694,5 +693,4 @@ fn f() { EXPECT_EQ(expect, str(got)); } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/decompose_strided_matrix.cc b/src/tint/transform/decompose_strided_matrix.cc index 6f06c80a36..fd7194d2f1 100644 --- a/src/tint/transform/decompose_strided_matrix.cc +++ b/src/tint/transform/decompose_strided_matrix.cc @@ -27,8 +27,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeStridedMatrix); -namespace tint { -namespace transform { +namespace tint::transform { namespace { /// MatrixInfo describes a matrix member with a custom stride @@ -247,5 +246,4 @@ void DecomposeStridedMatrix::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/decompose_strided_matrix.h b/src/tint/transform/decompose_strided_matrix.h index 9a4c7b7694..bcde5aa5b7 100644 --- a/src/tint/transform/decompose_strided_matrix.h +++ b/src/tint/transform/decompose_strided_matrix.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// DecomposeStridedMatrix transforms replaces matrix members of storage or /// uniform buffer structures, that have a stride attribute, into an array @@ -55,7 +54,6 @@ class DecomposeStridedMatrix final DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_DECOMPOSE_STRIDED_MATRIX_H_ diff --git a/src/tint/transform/decompose_strided_matrix_test.cc b/src/tint/transform/decompose_strided_matrix_test.cc index 4fe08a01de..73389991d6 100644 --- a/src/tint/transform/decompose_strided_matrix_test.cc +++ b/src/tint/transform/decompose_strided_matrix_test.cc @@ -24,8 +24,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/transform/unshadow.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using DecomposeStridedMatrixTest = TransformTest; @@ -667,5 +666,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/expand_compound_assignment.cc b/src/tint/transform/expand_compound_assignment.cc index 3a986a2762..0473fae1f7 100644 --- a/src/tint/transform/expand_compound_assignment.cc +++ b/src/tint/transform/expand_compound_assignment.cc @@ -27,8 +27,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::ExpandCompoundAssignment); -namespace tint { -namespace transform { +namespace tint::transform { ExpandCompoundAssignment::ExpandCompoundAssignment() = default; @@ -192,5 +191,4 @@ void ExpandCompoundAssignment::Run(CloneContext& ctx, state.Finalize(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/expand_compound_assignment.h b/src/tint/transform/expand_compound_assignment.h index 644711770d..b461bed82e 100644 --- a/src/tint/transform/expand_compound_assignment.h +++ b/src/tint/transform/expand_compound_assignment.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Converts compound assignment statements to regular assignment statements, /// hoisting the LHS expression if necessary. @@ -65,7 +64,6 @@ class ExpandCompoundAssignment DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_EXPAND_COMPOUND_ASSIGNMENT_H_ diff --git a/src/tint/transform/expand_compound_assignment_test.cc b/src/tint/transform/expand_compound_assignment_test.cc index dc0992fce8..d3fa510003 100644 --- a/src/tint/transform/expand_compound_assignment_test.cc +++ b/src/tint/transform/expand_compound_assignment_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using ExpandCompoundAssignmentTest = TransformTest; @@ -742,5 +741,4 @@ fn main() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/first_index_offset.cc b/src/tint/transform/first_index_offset.cc index 0a21017555..46a2dcd245 100644 --- a/src/tint/transform/first_index_offset.cc +++ b/src/tint/transform/first_index_offset.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset); TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset::BindingPoint); TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset::Data); -namespace tint { -namespace transform { +namespace tint::transform { namespace { // Uniform buffer member names @@ -184,5 +183,4 @@ void FirstIndexOffset::Run(CloneContext& ctx, instance_index_offset); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/first_index_offset.h b/src/tint/transform/first_index_offset.h index 21636f3e03..43d003d4ed 100644 --- a/src/tint/transform/first_index_offset.h +++ b/src/tint/transform/first_index_offset.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Adds firstVertex/Instance (injected via root constants) to /// vertex/instance index builtins. @@ -137,7 +136,6 @@ class FirstIndexOffset final : public Castable { uint32_t group_ = 0; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_FIRST_INDEX_OFFSET_H_ diff --git a/src/tint/transform/first_index_offset_test.cc b/src/tint/transform/first_index_offset_test.cc index 00822ff63b..ee914390ce 100644 --- a/src/tint/transform/first_index_offset_test.cc +++ b/src/tint/transform/first_index_offset_test.cc @@ -20,8 +20,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using FirstIndexOffsetTest = TransformTest; @@ -646,5 +645,4 @@ fn func(i : u32) -> u32 { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/fold_constants.cc b/src/tint/transform/fold_constants.cc index 08995eb2dd..b814c5cdc8 100644 --- a/src/tint/transform/fold_constants.cc +++ b/src/tint/transform/fold_constants.cc @@ -26,8 +26,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::FoldConstants); -namespace tint { -namespace transform { +namespace tint::transform { FoldConstants::FoldConstants() = default; @@ -95,5 +94,4 @@ void FoldConstants::Run(CloneContext& ctx, const DataMap&, DataMap&) const { ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/fold_constants.h b/src/tint/transform/fold_constants.h index 7f964d1655..fbe7abd7b1 100644 --- a/src/tint/transform/fold_constants.h +++ b/src/tint/transform/fold_constants.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// FoldConstants transforms the AST by folding constant expressions class FoldConstants final : public Castable { @@ -41,7 +40,6 @@ class FoldConstants final : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_FOLD_CONSTANTS_H_ diff --git a/src/tint/transform/fold_constants_test.cc b/src/tint/transform/fold_constants_test.cc index fd57c929f0..d8121bc256 100644 --- a/src/tint/transform/fold_constants_test.cc +++ b/src/tint/transform/fold_constants_test.cc @@ -20,8 +20,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using FoldConstantsTest = TransformTest; @@ -423,5 +422,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/fold_trivial_single_use_lets.cc b/src/tint/transform/fold_trivial_single_use_lets.cc index 33dc55da07..a0f02a8f00 100644 --- a/src/tint/transform/fold_trivial_single_use_lets.cc +++ b/src/tint/transform/fold_trivial_single_use_lets.cc @@ -23,8 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::FoldTrivialSingleUseLets); -namespace tint { -namespace transform { +namespace tint::transform { namespace { const ast::VariableDeclStatement* AsTrivialLetDecl(const ast::Statement* stmt) { @@ -88,5 +87,4 @@ void FoldTrivialSingleUseLets::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/fold_trivial_single_use_lets.h b/src/tint/transform/fold_trivial_single_use_lets.h index 858f6da009..d343b76482 100644 --- a/src/tint/transform/fold_trivial_single_use_lets.h +++ b/src/tint/transform/fold_trivial_single_use_lets.h @@ -20,8 +20,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// FoldTrivialSingleUseLets is an optimizer for folding away trivial `let` /// statements into their single place of use. This transform is intended to @@ -55,7 +54,6 @@ class FoldTrivialSingleUseLets final DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_FOLD_TRIVIAL_SINGLE_USE_LETS_H_ diff --git a/src/tint/transform/fold_trivial_single_use_lets_test.cc b/src/tint/transform/fold_trivial_single_use_lets_test.cc index 09939e13d8..e08c19117f 100644 --- a/src/tint/transform/fold_trivial_single_use_lets_test.cc +++ b/src/tint/transform/fold_trivial_single_use_lets_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using FoldTrivialSingleUseLetsTest = TransformTest; @@ -184,5 +183,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/for_loop_to_loop.cc b/src/tint/transform/for_loop_to_loop.cc index f7fda57edd..14d5edbfec 100644 --- a/src/tint/transform/for_loop_to_loop.cc +++ b/src/tint/transform/for_loop_to_loop.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::ForLoopToLoop); -namespace tint { -namespace transform { +namespace tint::transform { ForLoopToLoop::ForLoopToLoop() = default; ForLoopToLoop::~ForLoopToLoop() = default; @@ -72,5 +71,4 @@ void ForLoopToLoop::Run(CloneContext& ctx, const DataMap&, DataMap&) const { ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/for_loop_to_loop.h b/src/tint/transform/for_loop_to_loop.h index 94b046091c..54286d4c28 100644 --- a/src/tint/transform/for_loop_to_loop.h +++ b/src/tint/transform/for_loop_to_loop.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// ForLoopToLoop is a Transform that converts a for-loop statement into a loop /// statement. This is required by the SPIR-V writer. @@ -48,7 +47,6 @@ class ForLoopToLoop final : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_FOR_LOOP_TO_LOOP_H_ diff --git a/src/tint/transform/for_loop_to_loop_test.cc b/src/tint/transform/for_loop_to_loop_test.cc index 07fe2a9e45..84ffa98461 100644 --- a/src/tint/transform/for_loop_to_loop_test.cc +++ b/src/tint/transform/for_loop_to_loop_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using ForLoopToLoopTest = TransformTest; @@ -370,5 +369,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/glsl.cc b/src/tint/transform/glsl.cc index df6b6b3b61..f0120e8fb8 100644 --- a/src/tint/transform/glsl.cc +++ b/src/tint/transform/glsl.cc @@ -42,8 +42,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::Glsl); TINT_INSTANTIATE_TYPEINFO(tint::transform::Glsl::Config); -namespace tint { -namespace transform { +namespace tint::transform { Glsl::Glsl() = default; Glsl::~Glsl() = default; @@ -143,5 +142,4 @@ Glsl::Config::Config(const std::string& entry_point_in, Glsl::Config::Config(const Config&) = default; Glsl::Config::~Config() = default; -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/glsl.h b/src/tint/transform/glsl.h index 414f871055..73bc76b801 100644 --- a/src/tint/transform/glsl.h +++ b/src/tint/transform/glsl.h @@ -19,12 +19,12 @@ #include "src/tint/transform/transform.h" -namespace tint { - // Forward declarations +namespace tint { class CloneContext; +} -namespace transform { +namespace tint::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 @@ -70,7 +70,6 @@ class Glsl final : public Castable { Output Run(const Program* program, const DataMap& data = {}) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_GLSL_H_ diff --git a/src/tint/transform/glsl_test.cc b/src/tint/transform/glsl_test.cc index 5a2d872de8..555701b59a 100644 --- a/src/tint/transform/glsl_test.cc +++ b/src/tint/transform/glsl_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using GlslTest = TransformTest; @@ -37,5 +36,4 @@ fn unused_entry_point() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/localize_struct_array_assignment.cc b/src/tint/transform/localize_struct_array_assignment.cc index ff2289bc1a..e888c017ad 100644 --- a/src/tint/transform/localize_struct_array_assignment.cc +++ b/src/tint/transform/localize_struct_array_assignment.cc @@ -30,8 +30,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::LocalizeStructArrayAssignment); -namespace tint { -namespace transform { +namespace tint::transform { /// Private implementation of LocalizeStructArrayAssignment transform class LocalizeStructArrayAssignment::State { @@ -220,5 +219,4 @@ void LocalizeStructArrayAssignment::Run(CloneContext& ctx, state.Run(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/localize_struct_array_assignment.h b/src/tint/transform/localize_struct_array_assignment.h index ec5faa6053..2c45203e1b 100644 --- a/src/tint/transform/localize_struct_array_assignment.h +++ b/src/tint/transform/localize_struct_array_assignment.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// This transforms replaces assignment to dynamically-indexed fixed-size arrays /// in structs on shader-local variables with code that copies the arrays to a @@ -52,7 +51,6 @@ class LocalizeStructArrayAssignment class State; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_LOCALIZE_STRUCT_ARRAY_ASSIGNMENT_H_ diff --git a/src/tint/transform/localize_struct_array_assignment_test.cc b/src/tint/transform/localize_struct_array_assignment_test.cc index 2c75f762ba..d202785130 100644 --- a/src/tint/transform/localize_struct_array_assignment_test.cc +++ b/src/tint/transform/localize_struct_array_assignment_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using LocalizeStructArrayAssignmentTest = TransformTest; @@ -865,5 +864,4 @@ fn main() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/loop_to_for_loop.cc b/src/tint/transform/loop_to_for_loop.cc index ac205c0692..d01ac48e26 100644 --- a/src/tint/transform/loop_to_for_loop.cc +++ b/src/tint/transform/loop_to_for_loop.cc @@ -25,8 +25,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::LoopToForLoop); -namespace tint { -namespace transform { +namespace tint::transform { namespace { bool IsBlockWithSingleBreak(const ast::BlockStatement* block) { @@ -141,5 +140,4 @@ void LoopToForLoop::Run(CloneContext& ctx, const DataMap&, DataMap&) const { ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/loop_to_for_loop.h b/src/tint/transform/loop_to_for_loop.h index 94e09f64ab..b6482aebed 100644 --- a/src/tint/transform/loop_to_for_loop.h +++ b/src/tint/transform/loop_to_for_loop.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// LoopToForLoop is a Transform that attempts to convert WGSL `loop {}` /// statements into a for-loop statement. @@ -48,7 +47,6 @@ class LoopToForLoop : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_LOOP_TO_FOR_LOOP_H_ diff --git a/src/tint/transform/loop_to_for_loop_test.cc b/src/tint/transform/loop_to_for_loop_test.cc index df51e10bee..c34b0e84b0 100644 --- a/src/tint/transform/loop_to_for_loop_test.cc +++ b/src/tint/transform/loop_to_for_loop_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using LoopToForLoopTest = TransformTest; @@ -304,5 +303,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/manager.cc b/src/tint/transform/manager.cc index 158a28e26c..a52f17531a 100644 --- a/src/tint/transform/manager.cc +++ b/src/tint/transform/manager.cc @@ -26,8 +26,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::Manager); -namespace tint { -namespace transform { +namespace tint::transform { Manager::Manager() = default; Manager::~Manager() = default; @@ -82,5 +81,4 @@ Output Manager::Run(const Program* program, const DataMap& data) const { return out; } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/manager.h b/src/tint/transform/manager.h index 092b568f68..fb614d3920 100644 --- a/src/tint/transform/manager.h +++ b/src/tint/transform/manager.h @@ -21,8 +21,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// A collection of Transforms that act as a single Transform. /// The inner transforms will execute in the appended order. @@ -58,7 +57,6 @@ class Manager : public Castable { std::vector> transforms_; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_MANAGER_H_ diff --git a/src/tint/transform/module_scope_var_to_entry_point_param.cc b/src/tint/transform/module_scope_var_to_entry_point_param.cc index e213c45b8a..b510d7d1df 100644 --- a/src/tint/transform/module_scope_var_to_entry_point_param.cc +++ b/src/tint/transform/module_scope_var_to_entry_point_param.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::ModuleScopeVarToEntryPointParam); -namespace tint { -namespace transform { +namespace tint::transform { namespace { // Returns `true` if `type` is or contains a matrix type. bool ContainsMatrix(const sem::Type* type) { @@ -395,5 +394,4 @@ void ModuleScopeVarToEntryPointParam::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/module_scope_var_to_entry_point_param.h b/src/tint/transform/module_scope_var_to_entry_point_param.h index 334fcd4e12..8297057798 100644 --- a/src/tint/transform/module_scope_var_to_entry_point_param.h +++ b/src/tint/transform/module_scope_var_to_entry_point_param.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Move module-scope variables into the entry point as parameters. /// @@ -90,7 +89,6 @@ class ModuleScopeVarToEntryPointParam struct State; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_MODULE_SCOPE_VAR_TO_ENTRY_POINT_PARAM_H_ diff --git a/src/tint/transform/module_scope_var_to_entry_point_param_test.cc b/src/tint/transform/module_scope_var_to_entry_point_param_test.cc index 3997d9afa4..3089355b5f 100644 --- a/src/tint/transform/module_scope_var_to_entry_point_param_test.cc +++ b/src/tint/transform/module_scope_var_to_entry_point_param_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using ModuleScopeVarToEntryPointParamTest = TransformTest; @@ -1166,5 +1165,4 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, EmtpyModule) { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/multiplanar_external_texture.cc b/src/tint/transform/multiplanar_external_texture.cc index 801c593bdc..00466ac139 100644 --- a/src/tint/transform/multiplanar_external_texture.cc +++ b/src/tint/transform/multiplanar_external_texture.cc @@ -27,8 +27,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::MultiplanarExternalTexture); TINT_INSTANTIATE_TYPEINFO( tint::transform::MultiplanarExternalTexture::NewBindingPoints); -namespace tint { -namespace transform { +namespace tint::transform { namespace { /// This struct stores symbols for new bindings created as a result of @@ -450,5 +449,4 @@ void MultiplanarExternalTexture::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/multiplanar_external_texture.h b/src/tint/transform/multiplanar_external_texture.h index 240d520d01..ab2298ced0 100644 --- a/src/tint/transform/multiplanar_external_texture.h +++ b/src/tint/transform/multiplanar_external_texture.h @@ -23,8 +23,7 @@ #include "src/tint/sem/builtin_type.h" #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// BindingPoint is an alias to sem::BindingPoint using BindingPoint = sem::BindingPoint; @@ -96,7 +95,6 @@ class MultiplanarExternalTexture DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_MULTIPLANAR_EXTERNAL_TEXTURE_H_ diff --git a/src/tint/transform/multiplanar_external_texture_test.cc b/src/tint/transform/multiplanar_external_texture_test.cc index 85150a623a..b0a79d6180 100644 --- a/src/tint/transform/multiplanar_external_texture_test.cc +++ b/src/tint/transform/multiplanar_external_texture_test.cc @@ -15,8 +15,7 @@ #include "src/tint/transform/multiplanar_external_texture.h" #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using MultiplanarExternalTextureTest = TransformTest; @@ -1293,5 +1292,4 @@ type ET = texture_external; } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/num_workgroups_from_uniform.cc b/src/tint/transform/num_workgroups_from_uniform.cc index db71158ba6..72f7fb82eb 100644 --- a/src/tint/transform/num_workgroups_from_uniform.cc +++ b/src/tint/transform/num_workgroups_from_uniform.cc @@ -27,8 +27,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::NumWorkgroupsFromUniform); TINT_INSTANTIATE_TYPEINFO(tint::transform::NumWorkgroupsFromUniform::Config); -namespace tint { -namespace transform { +namespace tint::transform { namespace { /// Accessor describes the identifiers used in a member accessor that is being /// used to retrieve the num_workgroups builtin from a parameter. @@ -166,5 +165,4 @@ NumWorkgroupsFromUniform::Config::Config(sem::BindingPoint ubo_bp) NumWorkgroupsFromUniform::Config::Config(const Config&) = default; NumWorkgroupsFromUniform::Config::~Config() = default; -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/num_workgroups_from_uniform.h b/src/tint/transform/num_workgroups_from_uniform.h index 0d20a021b1..4cbecb6880 100644 --- a/src/tint/transform/num_workgroups_from_uniform.h +++ b/src/tint/transform/num_workgroups_from_uniform.h @@ -18,12 +18,12 @@ #include "src/tint/sem/binding_point.h" #include "src/tint/transform/transform.h" -namespace tint { - // Forward declarations +namespace tint { class CloneContext; +} -namespace transform { +namespace tint::transform { /// NumWorkgroupsFromUniform is a transform that implements the `num_workgroups` /// builtin by loading it from a uniform buffer. @@ -84,7 +84,6 @@ class NumWorkgroupsFromUniform DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_NUM_WORKGROUPS_FROM_UNIFORM_H_ diff --git a/src/tint/transform/num_workgroups_from_uniform_test.cc b/src/tint/transform/num_workgroups_from_uniform_test.cc index 6290d0b70b..734d11be84 100644 --- a/src/tint/transform/num_workgroups_from_uniform_test.cc +++ b/src/tint/transform/num_workgroups_from_uniform_test.cc @@ -20,8 +20,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/transform/unshadow.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using NumWorkgroupsFromUniformTest = TransformTest; @@ -452,5 +451,4 @@ fn main(tint_symbol : tint_symbol_1) { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/promote_initializers_to_const_var_test.cc b/src/tint/transform/promote_initializers_to_const_var_test.cc index b99f965e13..87b9edc8bf 100644 --- a/src/tint/transform/promote_initializers_to_const_var_test.cc +++ b/src/tint/transform/promote_initializers_to_const_var_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using PromoteInitializersToConstVarTest = TransformTest; @@ -623,5 +622,4 @@ let module_arr : array = array(0.0, 1.0, 2.0, 3.0); } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/promote_side_effects_to_decl_test.cc b/src/tint/transform/promote_side_effects_to_decl_test.cc index 0f8c59a89b..299d7066c8 100644 --- a/src/tint/transform/promote_side_effects_to_decl_test.cc +++ b/src/tint/transform/promote_side_effects_to_decl_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using PromoteSideEffectsToDeclTest = TransformTest; @@ -4008,5 +4007,4 @@ fn f() { EXPECT_EQ(expect, str(got)); } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/remove_continue_in_switch_test.cc b/src/tint/transform/remove_continue_in_switch_test.cc index cd485b0c7d..70f167debb 100644 --- a/src/tint/transform/remove_continue_in_switch_test.cc +++ b/src/tint/transform/remove_continue_in_switch_test.cc @@ -15,8 +15,7 @@ #include "src/tint/transform/remove_continue_in_switch.h" #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using RemoveContinueInSwitchTest = TransformTest; @@ -561,5 +560,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/remove_phonies.cc b/src/tint/transform/remove_phonies.cc index 35bad3f934..9904e348de 100644 --- a/src/tint/transform/remove_phonies.cc +++ b/src/tint/transform/remove_phonies.cc @@ -30,8 +30,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::RemovePhonies); -namespace tint { -namespace transform { +namespace tint::transform { namespace { struct SinkSignature { @@ -152,5 +151,4 @@ void RemovePhonies::Run(CloneContext& ctx, const DataMap&, DataMap&) const { ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/remove_phonies.h b/src/tint/transform/remove_phonies.h index 16de70848d..6e355f18a4 100644 --- a/src/tint/transform/remove_phonies.h +++ b/src/tint/transform/remove_phonies.h @@ -20,8 +20,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// RemovePhonies is a Transform that removes all phony-assignment statements, /// while preserving function call expressions in the RHS of the assignment that @@ -52,7 +51,6 @@ class RemovePhonies : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_REMOVE_PHONIES_H_ diff --git a/src/tint/transform/remove_phonies_test.cc b/src/tint/transform/remove_phonies_test.cc index dc6099c126..e6faa3e2dc 100644 --- a/src/tint/transform/remove_phonies_test.cc +++ b/src/tint/transform/remove_phonies_test.cc @@ -20,8 +20,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using RemovePhoniesTest = TransformTest; @@ -427,5 +426,4 @@ struct S { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/remove_unreachable_statements.cc b/src/tint/transform/remove_unreachable_statements.cc index fd56ef0e29..3e13ad7aaa 100644 --- a/src/tint/transform/remove_unreachable_statements.cc +++ b/src/tint/transform/remove_unreachable_statements.cc @@ -30,8 +30,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::RemoveUnreachableStatements); -namespace tint { -namespace transform { +namespace tint::transform { RemoveUnreachableStatements::RemoveUnreachableStatements() = default; @@ -63,5 +62,4 @@ void RemoveUnreachableStatements::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/remove_unreachable_statements.h b/src/tint/transform/remove_unreachable_statements.h index dfc9f155fc..a474efb49d 100644 --- a/src/tint/transform/remove_unreachable_statements.h +++ b/src/tint/transform/remove_unreachable_statements.h @@ -20,8 +20,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// RemoveUnreachableStatements is a Transform that removes all statements /// marked as unreachable. @@ -52,7 +51,6 @@ class RemoveUnreachableStatements DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_REMOVE_UNREACHABLE_STATEMENTS_H_ diff --git a/src/tint/transform/remove_unreachable_statements_test.cc b/src/tint/transform/remove_unreachable_statements_test.cc index 4e5670f45e..43c19508ad 100644 --- a/src/tint/transform/remove_unreachable_statements_test.cc +++ b/src/tint/transform/remove_unreachable_statements_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using RemoveUnreachableStatementsTest = TransformTest; @@ -567,5 +566,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/renamer_test.cc b/src/tint/transform/renamer_test.cc index 70d43225b6..e3f9458ba7 100644 --- a/src/tint/transform/renamer_test.cc +++ b/src/tint/transform/renamer_test.cc @@ -19,8 +19,7 @@ #include "gmock/gmock.h" #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { constexpr const char kUnicodeIdentifier[] = // "𝖎𝖉𝖊𝖓𝖙𝖎𝖋𝖎𝖊𝖗123" @@ -1459,5 +1458,4 @@ INSTANTIATE_TEST_SUITE_P( kUnicodeIdentifier)); } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/robustness.cc b/src/tint/transform/robustness.cc index 44b5f729e1..4a67d495f7 100644 --- a/src/tint/transform/robustness.cc +++ b/src/tint/transform/robustness.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::Robustness); TINT_INSTANTIATE_TYPEINFO(tint::transform::Robustness::Config); -namespace tint { -namespace transform { +namespace tint::transform { /// State holds the current transform state struct Robustness::State { @@ -316,5 +315,4 @@ void Robustness::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) const { ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/robustness.h b/src/tint/transform/robustness.h index 733cf47363..79ddf0891c 100644 --- a/src/tint/transform/robustness.h +++ b/src/tint/transform/robustness.h @@ -20,15 +20,12 @@ #include "src/tint/transform/transform.h" // Forward declarations -namespace tint { -namespace ast { +namespace tint::ast { class IndexAccessorExpression; class CallExpression; -} // namespace ast -} // namespace tint +} // namespace tint::ast -namespace tint { -namespace transform { +namespace tint::transform { /// This transform is responsible for clamping all array accesses to be within /// the bounds of the array. Any access before the start of the array will clamp @@ -82,7 +79,6 @@ class Robustness : public Castable { struct State; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_ROBUSTNESS_H_ diff --git a/src/tint/transform/robustness_test.cc b/src/tint/transform/robustness_test.cc index 1e1dac6abb..db113b2281 100644 --- a/src/tint/transform/robustness_test.cc +++ b/src/tint/transform/robustness_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using RobustnessTest = TransformTest; @@ -1741,5 +1740,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/simplify_pointers.cc b/src/tint/transform/simplify_pointers.cc index 715894bb6d..4cc9391efb 100644 --- a/src/tint/transform/simplify_pointers.cc +++ b/src/tint/transform/simplify_pointers.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::SimplifyPointers); -namespace tint { -namespace transform { +namespace tint::transform { namespace { @@ -235,5 +234,4 @@ void SimplifyPointers::Run(CloneContext& ctx, const DataMap&, DataMap&) const { State(ctx).Run(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/simplify_pointers.h b/src/tint/transform/simplify_pointers.h index 39ebc26fec..3bd49503ea 100644 --- a/src/tint/transform/simplify_pointers.h +++ b/src/tint/transform/simplify_pointers.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// SimplifyPointers is a Transform that moves all usage of function-scope /// `let` statements of a pointer type into their places of usage, while also @@ -54,7 +53,6 @@ class SimplifyPointers : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_SIMPLIFY_POINTERS_H_ diff --git a/src/tint/transform/simplify_pointers_test.cc b/src/tint/transform/simplify_pointers_test.cc index 0e9d44bc5e..6266b6f952 100644 --- a/src/tint/transform/simplify_pointers_test.cc +++ b/src/tint/transform/simplify_pointers_test.cc @@ -17,8 +17,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/transform/unshadow.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using SimplifyPointersTest = TransformTest; @@ -366,5 +365,4 @@ fn main() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/single_entry_point.cc b/src/tint/transform/single_entry_point.cc index 62a662457c..fe92483b17 100644 --- a/src/tint/transform/single_entry_point.cc +++ b/src/tint/transform/single_entry_point.cc @@ -24,8 +24,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::SingleEntryPoint); TINT_INSTANTIATE_TYPEINFO(tint::transform::SingleEntryPoint::Config); -namespace tint { -namespace transform { +namespace tint::transform { SingleEntryPoint::SingleEntryPoint() = default; @@ -113,5 +112,4 @@ SingleEntryPoint::Config::~Config() = default; SingleEntryPoint::Config& SingleEntryPoint::Config::operator=(const Config&) = default; -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/single_entry_point.h b/src/tint/transform/single_entry_point.h index 87807613ff..b5aed68f4c 100644 --- a/src/tint/transform/single_entry_point.h +++ b/src/tint/transform/single_entry_point.h @@ -19,8 +19,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Strip all but one entry point a module. /// @@ -66,7 +65,6 @@ class SingleEntryPoint : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_SINGLE_ENTRY_POINT_H_ diff --git a/src/tint/transform/single_entry_point_test.cc b/src/tint/transform/single_entry_point_test.cc index b6a9d35bb4..750f5c3ba5 100644 --- a/src/tint/transform/single_entry_point_test.cc +++ b/src/tint/transform/single_entry_point_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using SingleEntryPointTest = TransformTest; @@ -513,5 +512,4 @@ fn comp_main1() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/test_helper.h b/src/tint/transform/test_helper.h index 8a36df10d5..7d7015c096 100644 --- a/src/tint/transform/test_helper.h +++ b/src/tint/transform/test_helper.h @@ -25,8 +25,7 @@ #include "src/tint/transform/manager.h" #include "src/tint/writer/wgsl/generator.h" -namespace tint { -namespace transform { +namespace tint::transform { /// @param program the program to get an output WGSL string from /// @returns the output program as a WGSL string, or an error string if the @@ -148,7 +147,6 @@ using TransformTest = TransformTestBase; template using TransformTestWithParam = TransformTestBase>; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_TEST_HELPER_H_ diff --git a/src/tint/transform/transform.cc b/src/tint/transform/transform.cc index 2254ce493e..018bc95ca3 100644 --- a/src/tint/transform/transform.cc +++ b/src/tint/transform/transform.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::Transform); TINT_INSTANTIATE_TYPEINFO(tint::transform::Data); -namespace tint { -namespace transform { +namespace tint::transform { Data::Data() = default; Data::Data(const Data&) = default; @@ -156,5 +155,4 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, return nullptr; } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/transform.h b/src/tint/transform/transform.h index 199cb86596..50518162f9 100644 --- a/src/tint/transform/transform.h +++ b/src/tint/transform/transform.h @@ -22,8 +22,7 @@ #include "src/tint/castable.h" #include "src/tint/program.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Data is the base class for transforms that accept extra input or emit extra /// output information along with a Program. @@ -193,7 +192,6 @@ class Transform : public Castable { const sem::Type* ty); }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_TRANSFORM_H_ diff --git a/src/tint/transform/transform_test.cc b/src/tint/transform/transform_test.cc index 318778dc27..c100c09283 100644 --- a/src/tint/transform/transform_test.cc +++ b/src/tint/transform/transform_test.cc @@ -18,8 +18,7 @@ #include "gtest/gtest.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { // Inherit from Transform so we have access to protected methods @@ -119,5 +118,4 @@ TEST_F(CreateASTTypeForTest, Struct) { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/unshadow.cc b/src/tint/transform/unshadow.cc index 017258f02f..9c28675147 100644 --- a/src/tint/transform/unshadow.cc +++ b/src/tint/transform/unshadow.cc @@ -26,8 +26,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::Unshadow); -namespace tint { -namespace transform { +namespace tint::transform { /// The PIMPL state for the Unshadow transform struct Unshadow::State { @@ -95,5 +94,4 @@ void Unshadow::Run(CloneContext& ctx, const DataMap&, DataMap&) const { State(ctx).Run(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/unshadow.h b/src/tint/transform/unshadow.h index f8119a993d..bfea67763c 100644 --- a/src/tint/transform/unshadow.h +++ b/src/tint/transform/unshadow.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Unshadow is a Transform that renames any variables that shadow another /// variable. @@ -44,7 +43,6 @@ class Unshadow : public Castable { DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_UNSHADOW_H_ diff --git a/src/tint/transform/unshadow_test.cc b/src/tint/transform/unshadow_test.cc index 6ca1375ebc..ccb9fba8a4 100644 --- a/src/tint/transform/unshadow_test.cc +++ b/src/tint/transform/unshadow_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using UnshadowTest = TransformTest; @@ -605,5 +604,4 @@ type a = i32; } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/unwind_discard_functions_test.cc b/src/tint/transform/unwind_discard_functions_test.cc index ae0a1f1395..0b8c0fcae0 100644 --- a/src/tint/transform/unwind_discard_functions_test.cc +++ b/src/tint/transform/unwind_discard_functions_test.cc @@ -16,8 +16,7 @@ #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using UnwindDiscardFunctionsTest = TransformTest; @@ -1417,5 +1416,4 @@ fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/var_for_dynamic_index_test.cc b/src/tint/transform/var_for_dynamic_index_test.cc index 2bd8a6e3ae..a222ad737b 100644 --- a/src/tint/transform/var_for_dynamic_index_test.cc +++ b/src/tint/transform/var_for_dynamic_index_test.cc @@ -17,8 +17,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using VarForDynamicIndexTest = TransformTest; @@ -549,5 +548,4 @@ fn f() { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/vectorize_scalar_matrix_constructors.cc b/src/tint/transform/vectorize_scalar_matrix_constructors.cc index bccc50bf76..8af027284d 100644 --- a/src/tint/transform/vectorize_scalar_matrix_constructors.cc +++ b/src/tint/transform/vectorize_scalar_matrix_constructors.cc @@ -23,8 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::VectorizeScalarMatrixConstructors); -namespace tint { -namespace transform { +namespace tint::transform { VectorizeScalarMatrixConstructors::VectorizeScalarMatrixConstructors() = default; @@ -93,5 +92,4 @@ void VectorizeScalarMatrixConstructors::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/vectorize_scalar_matrix_constructors.h b/src/tint/transform/vectorize_scalar_matrix_constructors.h index 44754e153d..f1abb4fcd9 100644 --- a/src/tint/transform/vectorize_scalar_matrix_constructors.h +++ b/src/tint/transform/vectorize_scalar_matrix_constructors.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// A transform that converts scalar matrix constructors to the vector form. class VectorizeScalarMatrixConstructors @@ -48,7 +47,6 @@ class VectorizeScalarMatrixConstructors DataMap& outputs) const override; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_VECTORIZE_SCALAR_MATRIX_CONSTRUCTORS_H_ diff --git a/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc b/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc index d6d496cb3d..edd68e254d 100644 --- a/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc +++ b/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc @@ -20,8 +20,7 @@ #include "src/tint/transform/test_helper.h" #include "src/tint/utils/string.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using VectorizeScalarMatrixConstructorsTest = @@ -120,5 +119,4 @@ INSTANTIATE_TEST_SUITE_P(VectorizeScalarMatrixConstructorsTest, std::make_pair(4, 4))); } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/vertex_pulling.cc b/src/tint/transform/vertex_pulling.cc index e0d3128e88..420076784f 100644 --- a/src/tint/transform/vertex_pulling.cc +++ b/src/tint/transform/vertex_pulling.cc @@ -28,8 +28,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::VertexPulling); TINT_INSTANTIATE_TYPEINFO(tint::transform::VertexPulling::Config); -namespace tint { -namespace transform { +namespace tint::transform { namespace { @@ -958,5 +957,4 @@ VertexBufferLayoutDescriptor& VertexBufferLayoutDescriptor::operator=( VertexBufferLayoutDescriptor::~VertexBufferLayoutDescriptor() = default; -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/vertex_pulling.h b/src/tint/transform/vertex_pulling.h index 95bc25d1ba..ec0769b9b5 100644 --- a/src/tint/transform/vertex_pulling.h +++ b/src/tint/transform/vertex_pulling.h @@ -22,8 +22,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// Describes the format of data in a vertex buffer enum class VertexFormat { @@ -180,7 +179,6 @@ class VertexPulling : public Castable { Config cfg_; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_VERTEX_PULLING_H_ diff --git a/src/tint/transform/vertex_pulling_test.cc b/src/tint/transform/vertex_pulling_test.cc index 313133d205..3c19aa6d48 100644 --- a/src/tint/transform/vertex_pulling_test.cc +++ b/src/tint/transform/vertex_pulling_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using VertexPullingTest = TransformTest; @@ -1286,5 +1285,4 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/wrap_arrays_in_structs.cc b/src/tint/transform/wrap_arrays_in_structs.cc index f910497165..7cf3fcb770 100644 --- a/src/tint/transform/wrap_arrays_in_structs.cc +++ b/src/tint/transform/wrap_arrays_in_structs.cc @@ -26,8 +26,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::WrapArraysInStructs); -namespace tint { -namespace transform { +namespace tint::transform { WrapArraysInStructs::WrappedArrayInfo::WrappedArrayInfo() = default; WrapArraysInStructs::WrappedArrayInfo::WrappedArrayInfo( @@ -167,5 +166,4 @@ WrapArraysInStructs::WrappedArrayInfo WrapArraysInStructs::WrapArray( }); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/wrap_arrays_in_structs.h b/src/tint/transform/wrap_arrays_in_structs.h index 0d97a442eb..a256ff8dca 100644 --- a/src/tint/transform/wrap_arrays_in_structs.h +++ b/src/tint/transform/wrap_arrays_in_structs.h @@ -21,14 +21,11 @@ #include "src/tint/transform/transform.h" // Forward declarations -namespace tint { -namespace ast { +namespace tint::ast { class Type; -} // namespace ast -} // namespace tint +} // namespace tint::ast -namespace tint { -namespace transform { +namespace tint::transform { /// WrapArraysInStructs is a transform that replaces all array types with a /// structure holding a single field of that array type. @@ -89,7 +86,6 @@ class WrapArraysInStructs : public Castable { const sem::Array* array) const; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_WRAP_ARRAYS_IN_STRUCTS_H_ diff --git a/src/tint/transform/wrap_arrays_in_structs_test.cc b/src/tint/transform/wrap_arrays_in_structs_test.cc index 7627484ac0..7ba884cea3 100644 --- a/src/tint/transform/wrap_arrays_in_structs_test.cc +++ b/src/tint/transform/wrap_arrays_in_structs_test.cc @@ -19,8 +19,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using WrapArraysInStructsTest = TransformTest; @@ -420,5 +419,4 @@ type T0 = i32; } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/zero_init_workgroup_memory.cc b/src/tint/transform/zero_init_workgroup_memory.cc index e0519887ac..8441e17560 100644 --- a/src/tint/transform/zero_init_workgroup_memory.cc +++ b/src/tint/transform/zero_init_workgroup_memory.cc @@ -30,8 +30,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::ZeroInitWorkgroupMemory); -namespace tint { -namespace transform { +namespace tint::transform { /// PIMPL state for the ZeroInitWorkgroupMemory transform struct ZeroInitWorkgroupMemory::State { @@ -457,5 +456,4 @@ void ZeroInitWorkgroupMemory::Run(CloneContext& ctx, ctx.Clone(); } -} // namespace transform -} // namespace tint +} // namespace tint::transform diff --git a/src/tint/transform/zero_init_workgroup_memory.h b/src/tint/transform/zero_init_workgroup_memory.h index 6069b12a1d..33ae52ce7b 100644 --- a/src/tint/transform/zero_init_workgroup_memory.h +++ b/src/tint/transform/zero_init_workgroup_memory.h @@ -17,8 +17,7 @@ #include "src/tint/transform/transform.h" -namespace tint { -namespace transform { +namespace tint::transform { /// ZeroInitWorkgroupMemory is a transform that injects code at the top of entry /// points to zero-initialize workgroup memory used by that entry point (and all @@ -53,7 +52,6 @@ class ZeroInitWorkgroupMemory struct State; }; -} // namespace transform -} // namespace tint +} // namespace tint::transform #endif // SRC_TINT_TRANSFORM_ZERO_INIT_WORKGROUP_MEMORY_H_ diff --git a/src/tint/transform/zero_init_workgroup_memory_test.cc b/src/tint/transform/zero_init_workgroup_memory_test.cc index cfe46479ec..32c73db1e6 100644 --- a/src/tint/transform/zero_init_workgroup_memory_test.cc +++ b/src/tint/transform/zero_init_workgroup_memory_test.cc @@ -18,8 +18,7 @@ #include "src/tint/transform/test_helper.h" -namespace tint { -namespace transform { +namespace tint::transform { namespace { using ZeroInitWorkgroupMemoryTest = TransformTest; @@ -1377,5 +1376,4 @@ struct S { } } // namespace -} // namespace transform -} // namespace tint +} // namespace tint::transform