From 411d065e2e56bf53eb16ffa2f46a8b31a54a2292 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 7 Apr 2022 14:16:34 +0000 Subject: [PATCH] Condense namespaces in tint/writer/spirv. This PR condenses the namespaces in the tint/writer/spirv folder. Change-Id: Ibe1d241b4a3da3c031b431d4ed2a95f197678def Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86022 Reviewed-by: Ben Clayton Commit-Queue: Dan Sinclair Auto-Submit: Dan Sinclair --- src/tint/writer/spirv/binary_writer.cc | 8 ++------ src/tint/writer/spirv/binary_writer.h | 8 ++------ src/tint/writer/spirv/binary_writer_test.cc | 8 ++------ src/tint/writer/spirv/builder.cc | 8 ++------ src/tint/writer/spirv/builder.h | 12 ++++-------- .../spirv/builder_accessor_expression_test.cc | 8 ++------ src/tint/writer/spirv/builder_assign_test.cc | 8 ++------ .../spirv/builder_binary_expression_test.cc | 8 ++------ .../spirv/builder_bitcast_expression_test.cc | 8 ++------ src/tint/writer/spirv/builder_block_test.cc | 8 ++------ src/tint/writer/spirv/builder_builtin_test.cc | 8 ++------ .../spirv/builder_builtin_texture_test.cc | 8 ++------ src/tint/writer/spirv/builder_call_test.cc | 8 ++------ .../builder_constructor_expression_test.cc | 8 ++------ src/tint/writer/spirv/builder_discard_test.cc | 8 ++------ .../writer/spirv/builder_entry_point_test.cc | 8 ++------ .../spirv/builder_format_conversion_test.cc | 8 ++------ .../spirv/builder_function_attribute_test.cc | 8 ++------ src/tint/writer/spirv/builder_function_test.cc | 8 ++------ .../spirv/builder_function_variable_test.cc | 8 ++------ .../spirv/builder_global_variable_test.cc | 8 ++------ .../spirv/builder_ident_expression_test.cc | 8 ++------ src/tint/writer/spirv/builder_if_test.cc | 8 ++------ src/tint/writer/spirv/builder_literal_test.cc | 8 ++------ src/tint/writer/spirv/builder_loop_test.cc | 8 ++------ src/tint/writer/spirv/builder_return_test.cc | 8 ++------ src/tint/writer/spirv/builder_switch_test.cc | 8 ++------ src/tint/writer/spirv/builder_test.cc | 8 ++------ src/tint/writer/spirv/builder_type_test.cc | 8 ++------ .../spirv/builder_unary_op_expression_test.cc | 8 ++------ src/tint/writer/spirv/function.cc | 8 ++------ src/tint/writer/spirv/function.h | 8 ++------ src/tint/writer/spirv/generator.cc | 8 ++------ src/tint/writer/spirv/generator.h | 17 +++++++---------- src/tint/writer/spirv/instruction.cc | 8 ++------ src/tint/writer/spirv/instruction.h | 8 ++------ src/tint/writer/spirv/instruction_test.cc | 8 ++------ src/tint/writer/spirv/operand.cc | 8 ++------ src/tint/writer/spirv/operand.h | 8 ++------ src/tint/writer/spirv/operand_test.cc | 8 ++------ src/tint/writer/spirv/scalar_constant.h | 13 ++++--------- src/tint/writer/spirv/scalar_constant_test.cc | 8 ++------ src/tint/writer/spirv/spv_dump.cc | 8 ++------ src/tint/writer/spirv/spv_dump.h | 8 ++------ src/tint/writer/spirv/test_helper.h | 8 ++------ 45 files changed, 99 insertions(+), 279 deletions(-) diff --git a/src/tint/writer/spirv/binary_writer.cc b/src/tint/writer/spirv/binary_writer.cc index 28fcc752db..aa32f38e0e 100644 --- a/src/tint/writer/spirv/binary_writer.cc +++ b/src/tint/writer/spirv/binary_writer.cc @@ -16,9 +16,7 @@ #include -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { const uint32_t kGeneratorId = 23u << 16; @@ -72,6 +70,4 @@ void BinaryWriter::process_op(const Operand& op) { } } -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/binary_writer.h b/src/tint/writer/spirv/binary_writer.h index f852a3585e..89789fd955 100644 --- a/src/tint/writer/spirv/binary_writer.h +++ b/src/tint/writer/spirv/binary_writer.h @@ -19,9 +19,7 @@ #include "src/tint/writer/spirv/builder.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// Writer to convert from builder to SPIR-V binary class BinaryWriter { @@ -54,8 +52,6 @@ class BinaryWriter { std::vector out_; }; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_BINARY_WRITER_H_ diff --git a/src/tint/writer/spirv/binary_writer_test.cc b/src/tint/writer/spirv/binary_writer_test.cc index 86420e0e49..5d6b8b8f55 100644 --- a/src/tint/writer/spirv/binary_writer_test.cc +++ b/src/tint/writer/spirv/binary_writer_test.cc @@ -14,9 +14,7 @@ #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BinaryWriterTest = TestHelper; @@ -125,6 +123,4 @@ TEST_F(BinaryWriterTest, TestInstructionWriter) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc index 5de6e46ce9..30a5f41b07 100644 --- a/src/tint/writer/spirv/builder.cc +++ b/src/tint/writer/spirv/builder.cc @@ -62,9 +62,7 @@ #include "src/tint/writer/append_vector.h" #include "src/tint/writer/generate_external_texture_bindings.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuiltinType = sem::BuiltinType; @@ -4380,6 +4378,4 @@ Builder::Backedge& Builder::Backedge::operator=( const Builder::Backedge& other) = default; Builder::Backedge::~Backedge() = default; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder.h b/src/tint/writer/spirv/builder.h index 2a94635c17..297fbaf1f8 100644 --- a/src/tint/writer/spirv/builder.h +++ b/src/tint/writer/spirv/builder.h @@ -40,18 +40,16 @@ #include "src/tint/writer/spirv/function.h" #include "src/tint/writer/spirv/scalar_constant.h" -namespace tint { // Forward declarations -namespace sem { +namespace tint::sem { class Call; class Reference; class TypeConstructor; class TypeConversion; -} // namespace sem +} // namespace tint::sem -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// The result of sanitizing a program for generation. struct SanitizedResult { @@ -658,8 +656,6 @@ class Builder { std::vector backedge_stack_; }; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_BUILDER_H_ diff --git a/src/tint/writer/spirv/builder_accessor_expression_test.cc b/src/tint/writer/spirv/builder_accessor_expression_test.cc index a545613b21..285d2594ee 100644 --- a/src/tint/writer/spirv/builder_accessor_expression_test.cc +++ b/src/tint/writer/spirv/builder_accessor_expression_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -1042,6 +1040,4 @@ OpReturn } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_assign_test.cc b/src/tint/writer/spirv/builder_assign_test.cc index 2fd1db25f0..cd64741bc9 100644 --- a/src/tint/writer/spirv/builder_assign_test.cc +++ b/src/tint/writer/spirv/builder_assign_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -315,6 +313,4 @@ OpStore %9 %10 } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_binary_expression_test.cc b/src/tint/writer/spirv/builder_binary_expression_test.cc index 22007a9e9c..e2768a8d8a 100644 --- a/src/tint/writer/spirv/builder_binary_expression_test.cc +++ b/src/tint/writer/spirv/builder_binary_expression_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -1244,6 +1242,4 @@ INSTANTIATE_TEST_SUITE_P( // } // namespace BinaryArithMatrixMatrix } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_bitcast_expression_test.cc b/src/tint/writer/spirv/builder_bitcast_expression_test.cc index 513712b958..655ed33ae1 100644 --- a/src/tint/writer/spirv/builder_bitcast_expression_test.cc +++ b/src/tint/writer/spirv/builder_bitcast_expression_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -60,6 +58,4 @@ TEST_F(BuilderTest, Bitcast_DuplicateType) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_block_test.cc b/src/tint/writer/spirv/builder_block_test.cc index 579d7bcf47..462161b06c 100644 --- a/src/tint/writer/spirv/builder_block_test.cc +++ b/src/tint/writer/spirv/builder_block_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -61,6 +59,4 @@ OpStore %1 %8 } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_builtin_test.cc b/src/tint/writer/spirv/builder_builtin_test.cc index 67385460b8..0e6ab277ee 100644 --- a/src/tint/writer/spirv/builder_builtin_test.cc +++ b/src/tint/writer/spirv/builder_builtin_test.cc @@ -19,9 +19,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuiltinBuilderTest = TestHelper; @@ -2642,6 +2640,4 @@ OpFunctionEnd } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_builtin_texture_test.cc b/src/tint/writer/spirv/builder_builtin_texture_test.cc index 67df5ad020..00f8e7658c 100644 --- a/src/tint/writer/spirv/builder_builtin_texture_test.cc +++ b/src/tint/writer/spirv/builder_builtin_texture_test.cc @@ -19,9 +19,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { struct expected_texture_overload_spirv { @@ -3750,6 +3748,4 @@ TEST_P(BuiltinTextureTest, OutsideFunction_IsError) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_call_test.cc b/src/tint/writer/spirv/builder_call_test.cc index 8761bacd95..77b169f7c4 100644 --- a/src/tint/writer/spirv/builder_call_test.cc +++ b/src/tint/writer/spirv/builder_call_test.cc @@ -17,9 +17,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -102,6 +100,4 @@ OpFunctionEnd } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_constructor_expression_test.cc b/src/tint/writer/spirv/builder_constructor_expression_test.cc index 2615b05867..495f1c4f5e 100644 --- a/src/tint/writer/spirv/builder_constructor_expression_test.cc +++ b/src/tint/writer/spirv/builder_constructor_expression_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using SpvBuilderConstructorTest = TestHelper; @@ -1853,6 +1851,4 @@ TEST_F(SpvBuilderConstructorTest, } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_discard_test.cc b/src/tint/writer/spirv/builder_discard_test.cc index 5a85bff952..baa566f691 100644 --- a/src/tint/writer/spirv/builder_discard_test.cc +++ b/src/tint/writer/spirv/builder_discard_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -35,6 +33,4 @@ TEST_F(BuilderTest, Discard) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_entry_point_test.cc b/src/tint/writer/spirv/builder_entry_point_test.cc index a860d655c6..738aa4be1e 100644 --- a/src/tint/writer/spirv/builder_entry_point_test.cc +++ b/src/tint/writer/spirv/builder_entry_point_test.cc @@ -29,9 +29,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -317,6 +315,4 @@ TEST_F(BuilderTest, SampleIndex_SampleRateShadingCapability) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_format_conversion_test.cc b/src/tint/writer/spirv/builder_format_conversion_test.cc index 7ff824f84e..396b5ac167 100644 --- a/src/tint/writer/spirv/builder_format_conversion_test.cc +++ b/src/tint/writer/spirv/builder_format_conversion_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { struct TestData { @@ -90,6 +88,4 @@ INSTANTIATE_TEST_SUITE_P( TestData{ast::TexelFormat::kRgba32Float, SpvImageFormatRgba32f})); } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_function_attribute_test.cc b/src/tint/writer/spirv/builder_function_attribute_test.cc index 3ddb7eb89c..8a9e82a2fb 100644 --- a/src/tint/writer/spirv/builder_function_attribute_test.cc +++ b/src/tint/writer/spirv/builder_function_attribute_test.cc @@ -17,9 +17,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -267,6 +265,4 @@ OpExecutionMode %11 DepthReplacing } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_function_test.cc b/src/tint/writer/spirv/builder_function_test.cc index b3185636c9..23dd0c8a42 100644 --- a/src/tint/writer/spirv/builder_function_test.cc +++ b/src/tint/writer/spirv/builder_function_test.cc @@ -16,9 +16,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -285,6 +283,4 @@ OpFunctionEnd } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_function_variable_test.cc b/src/tint/writer/spirv/builder_function_variable_test.cc index fd64ea93ac..6264b27e03 100644 --- a/src/tint/writer/spirv/builder_function_variable_test.cc +++ b/src/tint/writer/spirv/builder_function_variable_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -194,6 +192,4 @@ TEST_F(BuilderTest, FunctionVar_Const) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_global_variable_test.cc b/src/tint/writer/spirv/builder_global_variable_test.cc index b7234fd31f..16ae30bff3 100644 --- a/src/tint/writer/spirv/builder_global_variable_test.cc +++ b/src/tint/writer/spirv/builder_global_variable_test.cc @@ -17,9 +17,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -660,6 +658,4 @@ TEST_F(BuilderTest, GlobalVar_WorkgroupWithZeroInit) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_ident_expression_test.cc b/src/tint/writer/spirv/builder_ident_expression_test.cc index dfaf9f6f41..48d35a35bb 100644 --- a/src/tint/writer/spirv/builder_ident_expression_test.cc +++ b/src/tint/writer/spirv/builder_ident_expression_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -160,6 +158,4 @@ TEST_F(BuilderTest, IdentifierExpression_NoLoadConst) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_if_test.cc b/src/tint/writer/spirv/builder_if_test.cc index 25ec9e8ac7..661bbd8658 100644 --- a/src/tint/writer/spirv/builder_if_test.cc +++ b/src/tint/writer/spirv/builder_if_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -668,6 +666,4 @@ OpReturn } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_literal_test.cc b/src/tint/writer/spirv/builder_literal_test.cc index 1b68523060..49378efe08 100644 --- a/src/tint/writer/spirv/builder_literal_test.cc +++ b/src/tint/writer/spirv/builder_literal_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { using BuilderTest = TestHelper; @@ -163,6 +161,4 @@ TEST_F(BuilderTest, Literal_F32_Dedup) { )"); } -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_loop_test.cc b/src/tint/writer/spirv/builder_loop_test.cc index 23a7ec4d10..555c167185 100644 --- a/src/tint/writer/spirv/builder_loop_test.cc +++ b/src/tint/writer/spirv/builder_loop_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -490,6 +488,4 @@ OpBranchConditional %10 %1 %2 } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_return_test.cc b/src/tint/writer/spirv/builder_return_test.cc index 73f0c1a135..3b0eb4a0fc 100644 --- a/src/tint/writer/spirv/builder_return_test.cc +++ b/src/tint/writer/spirv/builder_return_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -86,6 +84,4 @@ OpReturnValue %5 } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_switch_test.cc b/src/tint/writer/spirv/builder_switch_test.cc index 4336ccf7ea..8fd79213fb 100644 --- a/src/tint/writer/spirv/builder_switch_test.cc +++ b/src/tint/writer/spirv/builder_switch_test.cc @@ -16,9 +16,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -447,6 +445,4 @@ OpFunctionEnd } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_test.cc b/src/tint/writer/spirv/builder_test.cc index 6a82ce51c0..59938ad56d 100644 --- a/src/tint/writer/spirv/builder_test.cc +++ b/src/tint/writer/spirv/builder_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -43,6 +41,4 @@ TEST_F(BuilderTest, Capabilities_Dedup) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_type_test.cc b/src/tint/writer/spirv/builder_type_test.cc index 3a8941c03c..8ab7b9d454 100644 --- a/src/tint/writer/spirv/builder_type_test.cc +++ b/src/tint/writer/spirv/builder_type_test.cc @@ -18,9 +18,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest_Type = TestHelper; @@ -961,6 +959,4 @@ TEST_F(BuilderTest_Type, Dedup_Sampler_And_ComparisonSampler) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_unary_op_expression_test.cc b/src/tint/writer/spirv/builder_unary_op_expression_test.cc index 901d51affb..ae08c947c9 100644 --- a/src/tint/writer/spirv/builder_unary_op_expression_test.cc +++ b/src/tint/writer/spirv/builder_unary_op_expression_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; @@ -117,6 +115,4 @@ TEST_F(BuilderTest, UnaryOp_LoadRequired) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/function.cc b/src/tint/writer/spirv/function.cc index f8857e9a26..c7dc85588b 100644 --- a/src/tint/writer/spirv/function.cc +++ b/src/tint/writer/spirv/function.cc @@ -14,9 +14,7 @@ #include "src/tint/writer/spirv/function.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { Function::Function() : declaration_(Instruction{spv::Op::OpNop, {}}), @@ -50,6 +48,4 @@ void Function::iterate(std::function cb) const { cb(Instruction{spv::Op::OpFunctionEnd, {}}); } -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/function.h b/src/tint/writer/spirv/function.h index 2f856d278b..de6f8a4876 100644 --- a/src/tint/writer/spirv/function.h +++ b/src/tint/writer/spirv/function.h @@ -19,9 +19,7 @@ #include "src/tint/writer/spirv/instruction.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// A SPIR-V function class Function { @@ -94,8 +92,6 @@ class Function { InstructionList instructions_; }; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_FUNCTION_H_ diff --git a/src/tint/writer/spirv/generator.cc b/src/tint/writer/spirv/generator.cc index f27514aa0e..7d299355ff 100644 --- a/src/tint/writer/spirv/generator.cc +++ b/src/tint/writer/spirv/generator.cc @@ -16,9 +16,7 @@ #include "src/tint/writer/spirv/binary_writer.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { Result::Result() = default; Result::~Result() = default; @@ -62,6 +60,4 @@ Result Generate(const Program* program, const Options& options) { return result; } -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/generator.h b/src/tint/writer/spirv/generator.h index 191e43abfa..3d6f43215d 100644 --- a/src/tint/writer/spirv/generator.h +++ b/src/tint/writer/spirv/generator.h @@ -21,17 +21,16 @@ #include "src/tint/writer/writer.h" -namespace tint { - // Forward declarations +namespace tint { class Program; - -namespace writer { -namespace spirv { - -/// Forward declarations +namespace writer::spirv { class Builder; class BinaryWriter; +} // namespace writer::spirv +} // namespace tint + +namespace tint::writer::spirv { /// Configuration options used for generating SPIR-V. struct Options { @@ -79,8 +78,6 @@ struct Result { /// @returns the resulting SPIR-V and supplementary information Result Generate(const Program* program, const Options& options); -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_GENERATOR_H_ diff --git a/src/tint/writer/spirv/instruction.cc b/src/tint/writer/spirv/instruction.cc index 29f8bcaaab..4be648b37a 100644 --- a/src/tint/writer/spirv/instruction.cc +++ b/src/tint/writer/spirv/instruction.cc @@ -16,9 +16,7 @@ #include -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { Instruction::Instruction(spv::Op op, OperandList operands) : op_(op), operands_(std::move(operands)) {} @@ -35,6 +33,4 @@ uint32_t Instruction::word_length() const { return size; } -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/instruction.h b/src/tint/writer/spirv/instruction.h index e2892b19d0..7fd126c6ea 100644 --- a/src/tint/writer/spirv/instruction.h +++ b/src/tint/writer/spirv/instruction.h @@ -20,9 +20,7 @@ #include "spirv/unified1/spirv.hpp11" #include "src/tint/writer/spirv/operand.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// A single SPIR-V instruction class Instruction { @@ -52,8 +50,6 @@ class Instruction { /// A list of instructions using InstructionList = std::vector; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_INSTRUCTION_H_ diff --git a/src/tint/writer/spirv/instruction_test.cc b/src/tint/writer/spirv/instruction_test.cc index 46e8d25085..2c919f05b1 100644 --- a/src/tint/writer/spirv/instruction_test.cc +++ b/src/tint/writer/spirv/instruction_test.cc @@ -16,9 +16,7 @@ #include "gtest/gtest.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using InstructionTest = testing::Test; @@ -47,6 +45,4 @@ TEST_F(InstructionTest, Length) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/operand.cc b/src/tint/writer/spirv/operand.cc index ef85b3a3b6..7d2724997c 100644 --- a/src/tint/writer/spirv/operand.cc +++ b/src/tint/writer/spirv/operand.cc @@ -14,9 +14,7 @@ #include "src/tint/writer/spirv/operand.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { // static Operand Operand::Float(float val) { @@ -60,6 +58,4 @@ uint32_t Operand::length() const { return val; } -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/operand.h b/src/tint/writer/spirv/operand.h index 9af06ced15..46a5deb55b 100644 --- a/src/tint/writer/spirv/operand.h +++ b/src/tint/writer/spirv/operand.h @@ -18,9 +18,7 @@ #include #include -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// A single SPIR-V instruction operand class Operand { @@ -92,8 +90,6 @@ class Operand { /// A list of operands using OperandList = std::vector; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_OPERAND_H_ diff --git a/src/tint/writer/spirv/operand_test.cc b/src/tint/writer/spirv/operand_test.cc index 36b4306dba..9a688e9056 100644 --- a/src/tint/writer/spirv/operand_test.cc +++ b/src/tint/writer/spirv/operand_test.cc @@ -16,9 +16,7 @@ #include "gtest/gtest.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using OperandTest = testing::Test; @@ -62,6 +60,4 @@ TEST_F(OperandTest, Length_String_Empty) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/scalar_constant.h b/src/tint/writer/spirv/scalar_constant.h index 100ebcc6d2..abb1a0dcf6 100644 --- a/src/tint/writer/spirv/scalar_constant.h +++ b/src/tint/writer/spirv/scalar_constant.h @@ -22,15 +22,12 @@ #include "src/tint/utils/hash.h" -namespace tint { - // Forward declarations -namespace sem { +namespace tint::sem { class Call; -} // namespace sem +} // namespace tint::sem -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// ScalarConstant represents a scalar constant value struct ScalarConstant { @@ -127,9 +124,7 @@ struct ScalarConstant { uint32_t constant_id = 0; }; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv namespace std { diff --git a/src/tint/writer/spirv/scalar_constant_test.cc b/src/tint/writer/spirv/scalar_constant_test.cc index 3113e553b8..253f05b86f 100644 --- a/src/tint/writer/spirv/scalar_constant_test.cc +++ b/src/tint/writer/spirv/scalar_constant_test.cc @@ -15,9 +15,7 @@ #include "src/tint/writer/spirv/scalar_constant.h" #include "src/tint/writer/spirv/test_helper.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { using SpirvScalarConstantTest = TestHelper; @@ -55,6 +53,4 @@ TEST_F(SpirvScalarConstantTest, U32) { } } // namespace -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/spv_dump.cc b/src/tint/writer/spirv/spv_dump.cc index 463b1fedb5..21dc1a54ab 100644 --- a/src/tint/writer/spirv/spv_dump.cc +++ b/src/tint/writer/spirv/spv_dump.cc @@ -17,9 +17,7 @@ #include "spirv-tools/libspirv.hpp" #include "src/tint/writer/spirv/binary_writer.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { namespace { std::string Disassemble(const std::vector& data) { @@ -84,6 +82,4 @@ std::string DumpInstructions(const InstructionList& insts) { return Disassemble(writer.result()); } -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/spv_dump.h b/src/tint/writer/spirv/spv_dump.h index 6d9170ca13..2147d1d4f7 100644 --- a/src/tint/writer/spirv/spv_dump.h +++ b/src/tint/writer/spirv/spv_dump.h @@ -20,9 +20,7 @@ #include "src/tint/writer/spirv/builder.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// Dumps the given builder to a SPIR-V disassembly string /// @param builder the builder to convert @@ -39,8 +37,6 @@ std::string DumpInstruction(const Instruction& inst); /// @returns the instruction as a SPIR-V disassembly string std::string DumpInstructions(const InstructionList& insts); -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_SPV_DUMP_H_ diff --git a/src/tint/writer/spirv/test_helper.h b/src/tint/writer/spirv/test_helper.h index 6e233f0f95..e80c331685 100644 --- a/src/tint/writer/spirv/test_helper.h +++ b/src/tint/writer/spirv/test_helper.h @@ -23,9 +23,7 @@ #include "spirv-tools/libspirv.hpp" #include "src/tint/writer/spirv/binary_writer.h" -namespace tint { -namespace writer { -namespace spirv { +namespace tint::writer::spirv { /// Helper class for testing template @@ -132,8 +130,6 @@ using TestHelper = TestHelperBase; template using TestParamHelper = TestHelperBase>; -} // namespace spirv -} // namespace writer -} // namespace tint +} // namespace tint::writer::spirv #endif // SRC_TINT_WRITER_SPIRV_TEST_HELPER_H_