From c990b3c867fffc203d16aab4315a3a40d5cd246d Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 7 Apr 2022 16:04:35 +0000 Subject: [PATCH] Condense namespaces in tint/sem. This PR condenses the namespaces in the tint/sem folder. Change-Id: Iff802ca78d4cb7fd21134a640dfe5d04e85148b4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86030 Commit-Queue: Dan Sinclair Auto-Submit: Dan Sinclair Reviewed-by: Ben Clayton Commit-Queue: Ben Clayton --- src/tint/sem/array.cc | 6 ++---- src/tint/sem/array.h | 12 ++++-------- src/tint/sem/atomic_type.cc | 6 ++---- src/tint/sem/atomic_type.h | 6 ++---- src/tint/sem/atomic_type_test.cc | 6 ++---- src/tint/sem/behavior.cc | 6 ++---- src/tint/sem/behavior.h | 6 ++---- src/tint/sem/binding_point.h | 6 ++---- src/tint/sem/block_statement.cc | 6 ++---- src/tint/sem/block_statement.h | 12 ++++-------- src/tint/sem/bool_type.cc | 6 ++---- src/tint/sem/bool_type.h | 6 ++---- src/tint/sem/bool_type_test.cc | 6 ++---- src/tint/sem/builtin.cc | 6 ++---- src/tint/sem/builtin.h | 6 ++---- src/tint/sem/builtin_test.cc | 6 ++---- src/tint/sem/builtin_type.cc | 6 ++---- src/tint/sem/builtin_type.cc.tmpl | 6 ++---- src/tint/sem/builtin_type.h | 6 ++---- src/tint/sem/builtin_type.h.tmpl | 6 ++---- src/tint/sem/call.cc | 6 ++---- src/tint/sem/call.h | 6 ++---- src/tint/sem/call_target.cc | 6 ++---- src/tint/sem/call_target.h | 9 +++++---- src/tint/sem/constant.cc | 6 ++---- src/tint/sem/constant.h | 6 ++---- src/tint/sem/depth_multisampled_texture_type.cc | 6 ++---- src/tint/sem/depth_multisampled_texture_type.h | 6 ++---- .../sem/depth_multisampled_texture_type_test.cc | 6 ++---- src/tint/sem/depth_texture_type.cc | 6 ++---- src/tint/sem/depth_texture_type.h | 6 ++---- src/tint/sem/depth_texture_type_test.cc | 6 ++---- src/tint/sem/expression.cc | 6 ++---- src/tint/sem/expression.h | 8 ++++---- src/tint/sem/external_texture_type.cc | 6 ++---- src/tint/sem/external_texture_type.h | 6 ++---- src/tint/sem/external_texture_type_test.cc | 6 ++---- src/tint/sem/f32_type.cc | 6 ++---- src/tint/sem/f32_type.h | 6 ++---- src/tint/sem/f32_type_test.cc | 6 ++---- src/tint/sem/for_loop_statement.cc | 6 ++---- src/tint/sem/for_loop_statement.h | 11 +++++------ src/tint/sem/function.cc | 8 +++----- src/tint/sem/function.h | 12 ++++++------ src/tint/sem/i32_type.cc | 6 ++---- src/tint/sem/i32_type.h | 6 ++---- src/tint/sem/i32_type_test.cc | 6 ++---- src/tint/sem/if_statement.cc | 6 ++---- src/tint/sem/if_statement.h | 8 +++----- src/tint/sem/info.cc | 6 ++---- src/tint/sem/info.h | 6 ++++-- src/tint/sem/loop_statement.cc | 6 ++---- src/tint/sem/loop_statement.h | 12 ++++-------- src/tint/sem/matrix_type.cc | 6 ++---- src/tint/sem/matrix_type.h | 10 +++++----- src/tint/sem/matrix_type_test.cc | 6 ++---- src/tint/sem/member_accessor_expression.cc | 6 ++---- src/tint/sem/member_accessor_expression.h | 13 ++++++------- src/tint/sem/multisampled_texture_type.cc | 6 ++---- src/tint/sem/multisampled_texture_type.h | 6 ++---- src/tint/sem/multisampled_texture_type_test.cc | 6 ++---- src/tint/sem/node.cc | 6 ++---- src/tint/sem/node.h | 6 ++---- src/tint/sem/parameter_usage.cc | 6 ++---- src/tint/sem/parameter_usage.cc.tmpl | 6 ++---- src/tint/sem/parameter_usage.h | 6 ++---- src/tint/sem/parameter_usage.h.tmpl | 6 ++---- src/tint/sem/pipeline_stage_set.h | 6 ++---- src/tint/sem/pointer_type.cc | 6 ++---- src/tint/sem/pointer_type.h | 6 ++---- src/tint/sem/pointer_type_test.cc | 6 ++---- src/tint/sem/reference_type.cc | 6 ++---- src/tint/sem/reference_type.h | 6 ++---- src/tint/sem/reference_type_test.cc | 6 ++---- src/tint/sem/sampled_texture_type.cc | 6 ++---- src/tint/sem/sampled_texture_type.h | 6 ++---- src/tint/sem/sampled_texture_type_test.cc | 6 ++---- src/tint/sem/sampler_texture_pair.h | 6 ++---- src/tint/sem/sampler_type.cc | 6 ++---- src/tint/sem/sampler_type.h | 6 ++---- src/tint/sem/sampler_type_test.cc | 6 ++---- src/tint/sem/sem_array_test.cc | 6 ++---- src/tint/sem/sem_struct_test.cc | 6 ++---- src/tint/sem/statement.cc | 6 ++---- src/tint/sem/statement.h | 13 ++++--------- src/tint/sem/storage_texture_type.cc | 6 ++---- src/tint/sem/storage_texture_type.h | 11 ++++++----- src/tint/sem/storage_texture_type_test.cc | 6 ++---- src/tint/sem/struct.cc | 6 ++---- src/tint/sem/struct.h | 13 ++++++------- src/tint/sem/switch_statement.cc | 6 ++---- src/tint/sem/switch_statement.h | 12 ++++-------- src/tint/sem/test_helper.h | 6 ++---- src/tint/sem/texture_type.cc | 6 ++---- src/tint/sem/texture_type.h | 6 ++---- src/tint/sem/texture_type_test.cc | 6 ++---- src/tint/sem/type.cc | 6 ++---- src/tint/sem/type.h | 9 ++++----- src/tint/sem/type_constructor.cc | 6 ++---- src/tint/sem/type_constructor.h | 6 ++---- src/tint/sem/type_conversion.cc | 6 ++---- src/tint/sem/type_conversion.h | 6 ++---- src/tint/sem/type_manager.cc | 6 ++---- src/tint/sem/type_manager_test.cc | 6 ++---- src/tint/sem/type_mappings.h | 12 ++++++------ src/tint/sem/u32_type.cc | 6 ++---- src/tint/sem/u32_type.h | 6 ++---- src/tint/sem/u32_type_test.cc | 6 ++---- src/tint/sem/variable.cc | 6 ++---- src/tint/sem/variable.h | 13 ++++++------- src/tint/sem/vector_type.cc | 6 ++---- src/tint/sem/vector_type.h | 6 ++---- src/tint/sem/vector_type_test.cc | 6 ++---- src/tint/sem/void_type.cc | 6 ++---- src/tint/sem/void_type.h | 6 ++---- 115 files changed, 281 insertions(+), 499 deletions(-) diff --git a/src/tint/sem/array.cc b/src/tint/sem/array.cc index ff486a544b..296979c355 100644 --- a/src/tint/sem/array.cc +++ b/src/tint/sem/array.cc @@ -21,8 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Array); -namespace tint { -namespace sem { +namespace tint::sem { Array::Array(const Type* element, uint32_t count, @@ -81,5 +80,4 @@ uint32_t Array::Size() const { return size_; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/array.h b/src/tint/sem/array.h index b6639fe805..e10777b67b 100644 --- a/src/tint/sem/array.h +++ b/src/tint/sem/array.h @@ -22,14 +22,11 @@ #include "src/tint/sem/type.h" // Forward declarations -namespace tint { -namespace ast { +namespace tint::ast { class Array; -} // namespace ast -} // namespace tint +} // namespace tint::ast -namespace tint { -namespace sem { +namespace tint::sem { /// Array holds the semantic information for Array nodes. class Array final : public Castable { @@ -111,7 +108,6 @@ class Array final : public Castable { const bool constructible_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_ARRAY_H_ diff --git a/src/tint/sem/atomic_type.cc b/src/tint/sem/atomic_type.cc index b806039ff3..6376a7baac 100644 --- a/src/tint/sem/atomic_type.cc +++ b/src/tint/sem/atomic_type.cc @@ -20,8 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Atomic); -namespace tint { -namespace sem { +namespace tint::sem { Atomic::Atomic(const sem::Type* subtype) : subtype_(subtype) { TINT_ASSERT(AST, !subtype->Is()); @@ -60,5 +59,4 @@ Atomic::Atomic(Atomic&&) = default; Atomic::~Atomic() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/atomic_type.h b/src/tint/sem/atomic_type.h index 20035ec1a8..e0dcb15396 100644 --- a/src/tint/sem/atomic_type.h +++ b/src/tint/sem/atomic_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A atomic type. class Atomic final : public Castable { @@ -62,7 +61,6 @@ class Atomic final : public Castable { sem::Type const* const subtype_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_ATOMIC_TYPE_H_ diff --git a/src/tint/sem/atomic_type_test.cc b/src/tint/sem/atomic_type_test.cc index 0132233d6e..15aa484ce6 100644 --- a/src/tint/sem/atomic_type_test.cc +++ b/src/tint/sem/atomic_type_test.cc @@ -16,8 +16,7 @@ #include "src/tint/sem/test_helper.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using AtomicTest = TestHelper; @@ -54,5 +53,4 @@ TEST_F(AtomicTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/behavior.cc b/src/tint/sem/behavior.cc index a443d335c4..628aa60ac0 100644 --- a/src/tint/sem/behavior.cc +++ b/src/tint/sem/behavior.cc @@ -14,8 +14,7 @@ #include "src/tint/sem/behavior.h" -namespace tint { -namespace sem { +namespace tint::sem { std::ostream& operator<<(std::ostream& out, Behavior behavior) { switch (behavior) { @@ -35,5 +34,4 @@ std::ostream& operator<<(std::ostream& out, Behavior behavior) { return out << ""; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/behavior.h b/src/tint/sem/behavior.h index f921080834..e8d158d75d 100644 --- a/src/tint/sem/behavior.h +++ b/src/tint/sem/behavior.h @@ -17,8 +17,7 @@ #include "src/tint/utils/enum_set.h" -namespace tint { -namespace sem { +namespace tint::sem { /// Behavior enumerates the possible behaviors of an expression or statement. /// @see https://www.w3.org/TR/WGSL/#behaviors @@ -40,7 +39,6 @@ using Behaviors = utils::EnumSet; /// @returns out so calls can be chained std::ostream& operator<<(std::ostream& out, Behavior behavior); -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_BEHAVIOR_H_ diff --git a/src/tint/sem/binding_point.h b/src/tint/sem/binding_point.h index 3f6d307d7a..8e8c6c7382 100644 --- a/src/tint/sem/binding_point.h +++ b/src/tint/sem/binding_point.h @@ -21,8 +21,7 @@ #include "src/tint/utils/hash.h" -namespace tint { -namespace sem { +namespace tint::sem { /// BindingPoint holds a group and binding index. struct BindingPoint { @@ -46,8 +45,7 @@ struct BindingPoint { } }; -} // namespace sem -} // namespace tint +} // namespace tint::sem namespace std { diff --git a/src/tint/sem/block_statement.cc b/src/tint/sem/block_statement.cc index fe2bac2805..707448301c 100644 --- a/src/tint/sem/block_statement.cc +++ b/src/tint/sem/block_statement.cc @@ -22,8 +22,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::BlockStatement); TINT_INSTANTIATE_TYPEINFO(tint::sem::FunctionBlockStatement); TINT_INSTANTIATE_TYPEINFO(tint::sem::LoopBlockStatement); -namespace tint { -namespace sem { +namespace tint::sem { BlockStatement::BlockStatement(const ast::BlockStatement* declaration, const CompoundStatement* parent, @@ -63,5 +62,4 @@ void LoopBlockStatement::SetFirstContinue( num_decls_at_first_continue_ = num_decls; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/block_statement.h b/src/tint/sem/block_statement.h index c6e537f9de..6b71baf385 100644 --- a/src/tint/sem/block_statement.h +++ b/src/tint/sem/block_statement.h @@ -21,17 +21,14 @@ #include "src/tint/sem/statement.h" // Forward declarations -namespace tint { -namespace ast { +namespace tint::ast { class BlockStatement; class ContinueStatement; class Function; class Variable; -} // namespace ast -} // namespace tint +} // namespace tint::ast -namespace tint { -namespace sem { +namespace tint::sem { /// Holds semantic information about a block, such as parent block and variables /// declared in the block. @@ -117,7 +114,6 @@ class LoopBlockStatement final size_t num_decls_at_first_continue_ = 0; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_BLOCK_STATEMENT_H_ diff --git a/src/tint/sem/bool_type.cc b/src/tint/sem/bool_type.cc index d42f687cb4..7a20768d43 100644 --- a/src/tint/sem/bool_type.cc +++ b/src/tint/sem/bool_type.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Bool); -namespace tint { -namespace sem { +namespace tint::sem { Bool::Bool() = default; @@ -51,5 +50,4 @@ uint32_t Bool::Align() const { return 4; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/bool_type.h b/src/tint/sem/bool_type.h index 7e53e88338..9e949bdfe4 100644 --- a/src/tint/sem/bool_type.h +++ b/src/tint/sem/bool_type.h @@ -25,8 +25,7 @@ #undef Bool #endif -namespace tint { -namespace sem { +namespace tint::sem { /// A boolean type class Bool final : public Castable { @@ -64,7 +63,6 @@ class Bool final : public Castable { uint32_t Align() const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_BOOL_TYPE_H_ diff --git a/src/tint/sem/bool_type_test.cc b/src/tint/sem/bool_type_test.cc index eb6d1e9670..390de43f1a 100644 --- a/src/tint/sem/bool_type_test.cc +++ b/src/tint/sem/bool_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using BoolTest = TestHelper; @@ -46,5 +45,4 @@ TEST_F(BoolTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/builtin.cc b/src/tint/sem/builtin.cc index 02533f4d46..a822be5fcd 100644 --- a/src/tint/sem/builtin.cc +++ b/src/tint/sem/builtin.cc @@ -23,8 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Builtin); -namespace tint { -namespace sem { +namespace tint::sem { const char* Builtin::str() const { return sem::str(type_); @@ -161,7 +160,6 @@ bool Builtin::HasSideEffects() const { return false; } -} // namespace sem -} // namespace tint +} // namespace tint::sem //! @endcond diff --git a/src/tint/sem/builtin.h b/src/tint/sem/builtin.h index bb216ac4f8..61589eeed8 100644 --- a/src/tint/sem/builtin.h +++ b/src/tint/sem/builtin.h @@ -23,8 +23,7 @@ #include "src/tint/sem/pipeline_stage_set.h" #include "src/tint/utils/hash.h" -namespace tint { -namespace sem { +namespace tint::sem { /// Determines if the given `i` is a coarse derivative /// @param i the builtin type @@ -147,8 +146,7 @@ static constexpr double kRadToDeg = 57.295779513082322865; /// Constant value used by the radians() builtin static constexpr double kDegToRad = 0.017453292519943295474; -} // namespace sem -} // namespace tint +} // namespace tint::sem namespace std { diff --git a/src/tint/sem/builtin_test.cc b/src/tint/sem/builtin_test.cc index 385451bfc7..d931bcf512 100644 --- a/src/tint/sem/builtin_test.cc +++ b/src/tint/sem/builtin_test.cc @@ -16,8 +16,7 @@ #include "gtest/gtest.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { struct BuiltinData { @@ -124,5 +123,4 @@ TEST_F(BuiltinTypeTest, ParseNoMatch) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/builtin_type.cc b/src/tint/sem/builtin_type.cc index 55418a7cd3..eb22a2f648 100644 --- a/src/tint/sem/builtin_type.cc +++ b/src/tint/sem/builtin_type.cc @@ -26,8 +26,7 @@ #include -namespace tint { -namespace sem { +namespace tint::sem { BuiltinType ParseBuiltinType(const std::string& name) { if (name == "abs") { @@ -571,5 +570,4 @@ std::ostream& operator<<(std::ostream& out, BuiltinType i) { return out; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/builtin_type.cc.tmpl b/src/tint/sem/builtin_type.cc.tmpl index 0a44d0ee7b..ab072d92cf 100644 --- a/src/tint/sem/builtin_type.cc.tmpl +++ b/src/tint/sem/builtin_type.cc.tmpl @@ -12,8 +12,7 @@ See: #include -namespace tint { -namespace sem { +namespace tint::sem { BuiltinType ParseBuiltinType(const std::string& name) { {{- range .Sem.Functions }} @@ -41,5 +40,4 @@ std::ostream& operator<<(std::ostream& out, BuiltinType i) { return out; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/builtin_type.h b/src/tint/sem/builtin_type.h index 98e5b57662..e2d741f9d7 100644 --- a/src/tint/sem/builtin_type.h +++ b/src/tint/sem/builtin_type.h @@ -28,8 +28,7 @@ #include #include -namespace tint { -namespace sem { +namespace tint::sem { /// Enumerator of all builtin functions enum class BuiltinType { @@ -155,7 +154,6 @@ const char* str(BuiltinType i); /// matches the name in the WGSL spec. std::ostream& operator<<(std::ostream& out, BuiltinType i); -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_BUILTIN_TYPE_H_ diff --git a/src/tint/sem/builtin_type.h.tmpl b/src/tint/sem/builtin_type.h.tmpl index 135ed0d2b5..7b018df53a 100644 --- a/src/tint/sem/builtin_type.h.tmpl +++ b/src/tint/sem/builtin_type.h.tmpl @@ -14,8 +14,7 @@ See: #include #include -namespace tint { -namespace sem { +namespace tint::sem { /// Enumerator of all builtin functions enum class BuiltinType { @@ -39,7 +38,6 @@ const char* str(BuiltinType i); /// matches the name in the WGSL spec. std::ostream& operator<<(std::ostream& out, BuiltinType i); -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_BUILTIN_TYPE_H_ diff --git a/src/tint/sem/call.cc b/src/tint/sem/call.cc index 682c802ac2..415316eab3 100644 --- a/src/tint/sem/call.cc +++ b/src/tint/sem/call.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Call); -namespace tint { -namespace sem { +namespace tint::sem { Call::Call(const ast::CallExpression* declaration, const CallTarget* target, @@ -38,5 +37,4 @@ Call::Call(const ast::CallExpression* declaration, Call::~Call() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/call.h b/src/tint/sem/call.h index fad6db3b0e..786bd252de 100644 --- a/src/tint/sem/call.h +++ b/src/tint/sem/call.h @@ -20,8 +20,7 @@ #include "src/tint/sem/builtin.h" #include "src/tint/sem/expression.h" -namespace tint { -namespace sem { +namespace tint::sem { /// Call is the base class for semantic nodes that hold semantic information for /// ast::CallExpression nodes. @@ -62,7 +61,6 @@ class Call final : public Castable { std::vector arguments_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_CALL_H_ diff --git a/src/tint/sem/call_target.cc b/src/tint/sem/call_target.cc index 3e1264ddc1..7fc3c81e54 100644 --- a/src/tint/sem/call_target.cc +++ b/src/tint/sem/call_target.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::CallTarget); -namespace tint { -namespace sem { +namespace tint::sem { CallTarget::CallTarget(const sem::Type* return_type, const ParameterList& parameters) @@ -61,8 +60,7 @@ bool CallTargetSignature::operator==(const CallTargetSignature& other) const { return true; } -} // namespace sem -} // namespace tint +} // namespace tint::sem namespace std { diff --git a/src/tint/sem/call_target.h b/src/tint/sem/call_target.h index 8faa099389..1671899d2b 100644 --- a/src/tint/sem/call_target.h +++ b/src/tint/sem/call_target.h @@ -22,10 +22,12 @@ #include "src/tint/sem/variable.h" #include "src/tint/utils/hash.h" -namespace tint { -namespace sem { // Forward declarations +namespace tint::sem { class Type; +} + +namespace tint::sem { /// CallTargetSignature holds the return type and parameters for a call target struct CallTargetSignature { @@ -84,8 +86,7 @@ class CallTarget : public Castable { CallTargetSignature signature_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem namespace std { diff --git a/src/tint/sem/constant.cc b/src/tint/sem/constant.cc index 8b54b0ebec..3b23d05ebf 100644 --- a/src/tint/sem/constant.cc +++ b/src/tint/sem/constant.cc @@ -21,8 +21,7 @@ #include "src/tint/program_builder.h" #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { @@ -80,5 +79,4 @@ bool Constant::AnyZero() const { return false; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/constant.h b/src/tint/sem/constant.h index 363fe939f7..cfb6f1e7e3 100644 --- a/src/tint/sem/constant.h +++ b/src/tint/sem/constant.h @@ -20,8 +20,7 @@ #include "src/tint/program_builder.h" #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A Constant is compile-time known expression value, expressed as a flattened /// list of scalar values. Value may be of a scalar or vector type. @@ -139,7 +138,6 @@ class Constant { Scalars elems_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_CONSTANT_H_ diff --git a/src/tint/sem/depth_multisampled_texture_type.cc b/src/tint/sem/depth_multisampled_texture_type.cc index 4e2f34cef9..bb5b8a7747 100644 --- a/src/tint/sem/depth_multisampled_texture_type.cc +++ b/src/tint/sem/depth_multisampled_texture_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::DepthMultisampledTexture); -namespace tint { -namespace sem { +namespace tint::sem { namespace { bool IsValidDepthDimension(ast::TextureDimension dim) { @@ -57,5 +56,4 @@ std::string DepthMultisampledTexture::FriendlyName(const SymbolTable&) const { return out.str(); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/depth_multisampled_texture_type.h b/src/tint/sem/depth_multisampled_texture_type.h index f2eff66ddf..de234176b1 100644 --- a/src/tint/sem/depth_multisampled_texture_type.h +++ b/src/tint/sem/depth_multisampled_texture_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A multisampled depth texture type. class DepthMultisampledTexture final @@ -46,7 +45,6 @@ class DepthMultisampledTexture final std::string FriendlyName(const SymbolTable& symbols) const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_DEPTH_MULTISAMPLED_TEXTURE_TYPE_H_ diff --git a/src/tint/sem/depth_multisampled_texture_type_test.cc b/src/tint/sem/depth_multisampled_texture_type_test.cc index a8264e68d3..ea92986384 100644 --- a/src/tint/sem/depth_multisampled_texture_type_test.cc +++ b/src/tint/sem/depth_multisampled_texture_type_test.cc @@ -20,8 +20,7 @@ #include "src/tint/sem/sampled_texture_type.h" #include "src/tint/sem/storage_texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using DepthMultisampledTextureTest = TestHelper; @@ -60,5 +59,4 @@ TEST_F(DepthMultisampledTextureTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/depth_texture_type.cc b/src/tint/sem/depth_texture_type.cc index ec8d85f639..1ff0060427 100644 --- a/src/tint/sem/depth_texture_type.cc +++ b/src/tint/sem/depth_texture_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::DepthTexture); -namespace tint { -namespace sem { +namespace tint::sem { namespace { bool IsValidDepthDimension(ast::TextureDimension dim) { @@ -57,5 +56,4 @@ std::string DepthTexture::FriendlyName(const SymbolTable&) const { return out.str(); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/depth_texture_type.h b/src/tint/sem/depth_texture_type.h index 657c4b6440..0f257857d9 100644 --- a/src/tint/sem/depth_texture_type.h +++ b/src/tint/sem/depth_texture_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A depth texture type. class DepthTexture final : public Castable { @@ -45,7 +44,6 @@ class DepthTexture final : public Castable { std::string FriendlyName(const SymbolTable& symbols) const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_DEPTH_TEXTURE_TYPE_H_ diff --git a/src/tint/sem/depth_texture_type_test.cc b/src/tint/sem/depth_texture_type_test.cc index 17db4c446c..28bb84ad03 100644 --- a/src/tint/sem/depth_texture_type_test.cc +++ b/src/tint/sem/depth_texture_type_test.cc @@ -20,8 +20,7 @@ #include "src/tint/sem/sampled_texture_type.h" #include "src/tint/sem/storage_texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using DepthTextureTest = TestHelper; @@ -74,5 +73,4 @@ TEST_F(DepthTextureTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/expression.cc b/src/tint/sem/expression.cc index 774ac6223a..a5f2b1bb9d 100644 --- a/src/tint/sem/expression.cc +++ b/src/tint/sem/expression.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Expression); -namespace tint { -namespace sem { +namespace tint::sem { Expression::Expression(const ast::Expression* declaration, const sem::Type* type, @@ -36,5 +35,4 @@ Expression::Expression(const ast::Expression* declaration, Expression::~Expression() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/expression.h b/src/tint/sem/expression.h index 85640b1a45..23eae1bcb3 100644 --- a/src/tint/sem/expression.h +++ b/src/tint/sem/expression.h @@ -20,12 +20,13 @@ #include "src/tint/sem/constant.h" #include "src/tint/sem/node.h" -namespace tint { -namespace sem { // Forward declarations +namespace tint::sem { class Statement; class Type; +} // namespace tint::sem +namespace tint::sem { /// Expression holds the semantic information for expression nodes. class Expression : public Castable { public: @@ -77,7 +78,6 @@ class Expression : public Castable { const bool has_side_effects_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_EXPRESSION_H_ diff --git a/src/tint/sem/external_texture_type.cc b/src/tint/sem/external_texture_type.cc index 885bbae872..adfd3734d5 100644 --- a/src/tint/sem/external_texture_type.cc +++ b/src/tint/sem/external_texture_type.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::ExternalTexture); -namespace tint { -namespace sem { +namespace tint::sem { ExternalTexture::ExternalTexture() : Base(ast::TextureDimension::k2d) {} @@ -39,5 +38,4 @@ std::string ExternalTexture::FriendlyName(const SymbolTable&) const { return "texture_external"; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/external_texture_type.h b/src/tint/sem/external_texture_type.h index 2406c08052..4a070054e2 100644 --- a/src/tint/sem/external_texture_type.h +++ b/src/tint/sem/external_texture_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// An external texture type class ExternalTexture final : public Castable { @@ -45,7 +44,6 @@ class ExternalTexture final : public Castable { std::string FriendlyName(const SymbolTable& symbols) const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_EXTERNAL_TEXTURE_TYPE_H_ diff --git a/src/tint/sem/external_texture_type_test.cc b/src/tint/sem/external_texture_type_test.cc index b2af740bf5..439b3bc006 100644 --- a/src/tint/sem/external_texture_type_test.cc +++ b/src/tint/sem/external_texture_type_test.cc @@ -20,8 +20,7 @@ #include "src/tint/sem/storage_texture_type.h" #include "src/tint/sem/test_helper.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using ExternalTextureTest = TestHelper; @@ -68,5 +67,4 @@ TEST_F(ExternalTextureTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/f32_type.cc b/src/tint/sem/f32_type.cc index 2e666d55b2..c5b013e3d4 100644 --- a/src/tint/sem/f32_type.cc +++ b/src/tint/sem/f32_type.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::F32); -namespace tint { -namespace sem { +namespace tint::sem { F32::F32() = default; @@ -51,5 +50,4 @@ uint32_t F32::Align() const { return 4; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/f32_type.h b/src/tint/sem/f32_type.h index c239c16888..0d0fabf618 100644 --- a/src/tint/sem/f32_type.h +++ b/src/tint/sem/f32_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A float 32 type class F32 final : public Castable { @@ -54,7 +53,6 @@ class F32 final : public Castable { uint32_t Align() const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_F32_TYPE_H_ diff --git a/src/tint/sem/f32_type_test.cc b/src/tint/sem/f32_type_test.cc index 24acd64aa0..7fd7b76a81 100644 --- a/src/tint/sem/f32_type_test.cc +++ b/src/tint/sem/f32_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using F32Test = TestHelper; @@ -46,5 +45,4 @@ TEST_F(F32Test, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/for_loop_statement.cc b/src/tint/sem/for_loop_statement.cc index 4321a1446e..55996330ca 100644 --- a/src/tint/sem/for_loop_statement.cc +++ b/src/tint/sem/for_loop_statement.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::ForLoopStatement); -namespace tint { -namespace sem { +namespace tint::sem { ForLoopStatement::ForLoopStatement(const ast::ForLoopStatement* declaration, const CompoundStatement* parent, @@ -32,5 +31,4 @@ const ast::ForLoopStatement* ForLoopStatement::Declaration() const { return static_cast(Base::Declaration()); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/for_loop_statement.h b/src/tint/sem/for_loop_statement.h index 7f8321b1af..0142d282ff 100644 --- a/src/tint/sem/for_loop_statement.h +++ b/src/tint/sem/for_loop_statement.h @@ -17,17 +17,17 @@ #include "src/tint/sem/statement.h" +// Forward Declarations namespace tint { namespace ast { class ForLoopStatement; -} // namespace ast +} namespace sem { class Expression; -} // namespace sem +} } // namespace tint -namespace tint { -namespace sem { +namespace tint::sem { /// Holds semantic information about a for-loop statement class ForLoopStatement final @@ -58,7 +58,6 @@ class ForLoopStatement final const Expression* condition_ = nullptr; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_FOR_LOOP_STATEMENT_H_ diff --git a/src/tint/sem/function.cc b/src/tint/sem/function.cc index 83ba6f8177..4ffda9a91b 100644 --- a/src/tint/sem/function.cc +++ b/src/tint/sem/function.cc @@ -25,8 +25,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Function); -namespace tint { -namespace sem { +namespace tint::sem { Function::Function(const ast::Function* declaration, Type* return_type, @@ -38,7 +37,7 @@ Function::Function(const ast::Function* declaration, for (auto* parameter : parameters) { parameter->SetOwner(this); } -} // namespace sem +} Function::~Function() = default; @@ -193,5 +192,4 @@ Function::TransitivelyReferencedSampledTextureVariablesImpl( return ret; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/function.h b/src/tint/sem/function.h index 6e34356c9a..f8854e0c02 100644 --- a/src/tint/sem/function.h +++ b/src/tint/sem/function.h @@ -23,20 +23,21 @@ #include "src/tint/sem/call.h" #include "src/tint/utils/unique_vector.h" -namespace tint { - // Forward declarations +namespace tint { namespace ast { class BuiltinAttribute; class Function; class LocationAttribute; class ReturnStatement; } // namespace ast - namespace sem { - class Builtin; class Variable; +} // namespace sem +} // namespace tint + +namespace tint::sem { /// WorkgroupDimension describes the size of a single dimension of an entry /// point's workgroup size. @@ -283,7 +284,6 @@ class Function final : public Castable { sem::Behaviors behaviors_{sem::Behavior::kNext}; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_FUNCTION_H_ diff --git a/src/tint/sem/i32_type.cc b/src/tint/sem/i32_type.cc index 47cd5a6cf3..0865c03b88 100644 --- a/src/tint/sem/i32_type.cc +++ b/src/tint/sem/i32_type.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::I32); -namespace tint { -namespace sem { +namespace tint::sem { I32::I32() = default; @@ -51,5 +50,4 @@ uint32_t I32::Align() const { return 4; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/i32_type.h b/src/tint/sem/i32_type.h index 6a28f8fe87..f6747a2340 100644 --- a/src/tint/sem/i32_type.h +++ b/src/tint/sem/i32_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A signed int 32 type. class I32 final : public Castable { @@ -54,7 +53,6 @@ class I32 final : public Castable { uint32_t Align() const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_I32_TYPE_H_ diff --git a/src/tint/sem/i32_type_test.cc b/src/tint/sem/i32_type_test.cc index ab73a8d304..679331a094 100644 --- a/src/tint/sem/i32_type_test.cc +++ b/src/tint/sem/i32_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using I32Test = TestHelper; @@ -46,5 +45,4 @@ TEST_F(I32Test, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/if_statement.cc b/src/tint/sem/if_statement.cc index 38a7395d1b..5102b898c2 100644 --- a/src/tint/sem/if_statement.cc +++ b/src/tint/sem/if_statement.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::IfStatement); TINT_INSTANTIATE_TYPEINFO(tint::sem::ElseStatement); -namespace tint { -namespace sem { +namespace tint::sem { IfStatement::IfStatement(const ast::IfStatement* declaration, const CompoundStatement* parent, @@ -44,5 +43,4 @@ const ast::ElseStatement* ElseStatement::Declaration() const { return static_cast(Base::Declaration()); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/if_statement.h b/src/tint/sem/if_statement.h index c38a32af32..6e11d52b79 100644 --- a/src/tint/sem/if_statement.h +++ b/src/tint/sem/if_statement.h @@ -25,11 +25,10 @@ class ElseStatement; } // namespace ast namespace sem { class Expression; -} // namespace sem +} } // namespace tint -namespace tint { -namespace sem { +namespace tint::sem { /// Holds semantic information about an if statement class IfStatement final : public Castable { @@ -92,7 +91,6 @@ class ElseStatement final : public Castable { const Expression* condition_ = nullptr; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_IF_STATEMENT_H_ diff --git a/src/tint/sem/info.cc b/src/tint/sem/info.cc index f839d8aba4..edeab7e841 100644 --- a/src/tint/sem/info.cc +++ b/src/tint/sem/info.cc @@ -14,8 +14,7 @@ #include "src/tint/sem/info.h" -namespace tint { -namespace sem { +namespace tint::sem { Info::Info() = default; @@ -25,5 +24,4 @@ Info::~Info() = default; Info& Info::operator=(Info&&) = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/info.h b/src/tint/sem/info.h index ccc31bd271..8502269726 100644 --- a/src/tint/sem/info.h +++ b/src/tint/sem/info.h @@ -22,10 +22,12 @@ #include "src/tint/sem/node.h" #include "src/tint/sem/type_mappings.h" -namespace tint::sem { - // Forward declarations +namespace tint::sem { class Module; +} + +namespace tint::sem { /// Info holds all the resolved semantic information for a Program. class Info { diff --git a/src/tint/sem/loop_statement.cc b/src/tint/sem/loop_statement.cc index 4be6e05800..a26bf9e37e 100644 --- a/src/tint/sem/loop_statement.cc +++ b/src/tint/sem/loop_statement.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::LoopStatement); TINT_INSTANTIATE_TYPEINFO(tint::sem::LoopContinuingBlockStatement); -namespace tint { -namespace sem { +namespace tint::sem { LoopStatement::LoopStatement(const ast::LoopStatement* declaration, const CompoundStatement* parent, @@ -42,5 +41,4 @@ LoopContinuingBlockStatement::LoopContinuingBlockStatement( } LoopContinuingBlockStatement::~LoopContinuingBlockStatement() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/loop_statement.h b/src/tint/sem/loop_statement.h index 23ca4d384a..0c8edd982a 100644 --- a/src/tint/sem/loop_statement.h +++ b/src/tint/sem/loop_statement.h @@ -18,14 +18,11 @@ #include "src/tint/sem/block_statement.h" // Forward declarations -namespace tint { -namespace ast { +namespace tint::ast { class LoopStatement; -} // namespace ast -} // namespace tint +} -namespace tint { -namespace sem { +namespace tint::sem { /// Holds semantic information about a loop statement class LoopStatement final : public Castable { @@ -58,7 +55,6 @@ class LoopContinuingBlockStatement final ~LoopContinuingBlockStatement() override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_LOOP_STATEMENT_H_ diff --git a/src/tint/sem/matrix_type.cc b/src/tint/sem/matrix_type.cc index e043368767..cfd9c1c486 100644 --- a/src/tint/sem/matrix_type.cc +++ b/src/tint/sem/matrix_type.cc @@ -20,8 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Matrix); -namespace tint { -namespace sem { +namespace tint::sem { Matrix::Matrix(const Vector* column_type, uint32_t columns) : subtype_(column_type->type()), @@ -74,5 +73,4 @@ uint32_t Matrix::ColumnStride() const { return column_type_->Align(); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/matrix_type.h b/src/tint/sem/matrix_type.h index 888a7af8fd..809c6f3125 100644 --- a/src/tint/sem/matrix_type.h +++ b/src/tint/sem/matrix_type.h @@ -19,11 +19,12 @@ #include "src/tint/sem/type.h" -namespace tint { -namespace sem { - // Forward declaration +namespace tint::sem { class Vector; +} + +namespace tint::sem { /// A matrix type class Matrix final : public Castable { @@ -79,7 +80,6 @@ class Matrix final : public Castable { const uint32_t columns_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_MATRIX_TYPE_H_ diff --git a/src/tint/sem/matrix_type_test.cc b/src/tint/sem/matrix_type_test.cc index 59688cac44..52ae36b6a0 100644 --- a/src/tint/sem/matrix_type_test.cc +++ b/src/tint/sem/matrix_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using MatrixTest = TestHelper; @@ -73,5 +72,4 @@ TEST_F(MatrixTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/member_accessor_expression.cc b/src/tint/sem/member_accessor_expression.cc index 53b1402c96..4e04ab479c 100644 --- a/src/tint/sem/member_accessor_expression.cc +++ b/src/tint/sem/member_accessor_expression.cc @@ -21,8 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::MemberAccessorExpression); TINT_INSTANTIATE_TYPEINFO(tint::sem::StructMemberAccess); TINT_INSTANTIATE_TYPEINFO(tint::sem::Swizzle); -namespace tint { -namespace sem { +namespace tint::sem { MemberAccessorExpression::MemberAccessorExpression( const ast::MemberAccessorExpression* declaration, @@ -53,5 +52,4 @@ Swizzle::Swizzle(const ast::MemberAccessorExpression* declaration, Swizzle::~Swizzle() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/member_accessor_expression.h b/src/tint/sem/member_accessor_expression.h index 9eed53b29f..cca1a43d87 100644 --- a/src/tint/sem/member_accessor_expression.h +++ b/src/tint/sem/member_accessor_expression.h @@ -19,18 +19,18 @@ #include "src/tint/sem/expression.h" -namespace tint { - /// Forward declarations +namespace tint { namespace ast { class MemberAccessorExpression; } // namespace ast - namespace sem { - -/// Forward declarations class Struct; class StructMember; +} // namespace sem +} // namespace tint + +namespace tint::sem { /// MemberAccessorExpression holds the semantic information for a /// ast::MemberAccessorExpression node. @@ -105,7 +105,6 @@ class Swizzle final : public Castable { std::vector const indices_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_MEMBER_ACCESSOR_EXPRESSION_H_ diff --git a/src/tint/sem/multisampled_texture_type.cc b/src/tint/sem/multisampled_texture_type.cc index 7552850774..72ce2f510e 100644 --- a/src/tint/sem/multisampled_texture_type.cc +++ b/src/tint/sem/multisampled_texture_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::MultisampledTexture); -namespace tint { -namespace sem { +namespace tint::sem { MultisampledTexture::MultisampledTexture(ast::TextureDimension dim, const Type* type) @@ -52,5 +51,4 @@ std::string MultisampledTexture::FriendlyName( return out.str(); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/multisampled_texture_type.h b/src/tint/sem/multisampled_texture_type.h index 1e1ee050d5..0e993ec74c 100644 --- a/src/tint/sem/multisampled_texture_type.h +++ b/src/tint/sem/multisampled_texture_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A multisampled texture type. class MultisampledTexture final @@ -53,7 +52,6 @@ class MultisampledTexture final const Type* const type_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_MULTISAMPLED_TEXTURE_TYPE_H_ diff --git a/src/tint/sem/multisampled_texture_type_test.cc b/src/tint/sem/multisampled_texture_type_test.cc index 3cd8ac0a5b..eb53ccd60a 100644 --- a/src/tint/sem/multisampled_texture_type_test.cc +++ b/src/tint/sem/multisampled_texture_type_test.cc @@ -20,8 +20,7 @@ #include "src/tint/sem/storage_texture_type.h" #include "src/tint/sem/test_helper.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using MultisampledTextureTest = TestHelper; @@ -99,5 +98,4 @@ TEST_F(MultisampledTextureTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/node.cc b/src/tint/sem/node.cc index 3a61890c93..d06979795c 100644 --- a/src/tint/sem/node.cc +++ b/src/tint/sem/node.cc @@ -16,8 +16,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Node); -namespace tint { -namespace sem { +namespace tint::sem { Node::Node() = default; @@ -25,5 +24,4 @@ Node::Node(const Node&) = default; Node::~Node() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/node.h b/src/tint/sem/node.h index ecf630d9f0..d03b042572 100644 --- a/src/tint/sem/node.h +++ b/src/tint/sem/node.h @@ -17,8 +17,7 @@ #include "src/tint/castable.h" -namespace tint { -namespace sem { +namespace tint::sem { /// Node is the base class for all semantic nodes class Node : public Castable { @@ -33,7 +32,6 @@ class Node : public Castable { ~Node() override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_NODE_H_ diff --git a/src/tint/sem/parameter_usage.cc b/src/tint/sem/parameter_usage.cc index 57218827f6..3bea237828 100644 --- a/src/tint/sem/parameter_usage.cc +++ b/src/tint/sem/parameter_usage.cc @@ -24,8 +24,7 @@ #include "src/tint/sem/parameter_usage.h" -namespace tint { -namespace sem { +namespace tint::sem { const char* str(ParameterUsage usage) { switch (usage) { @@ -61,5 +60,4 @@ const char* str(ParameterUsage usage) { return ""; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/parameter_usage.cc.tmpl b/src/tint/sem/parameter_usage.cc.tmpl index 2a9a060aa6..1339171d6c 100644 --- a/src/tint/sem/parameter_usage.cc.tmpl +++ b/src/tint/sem/parameter_usage.cc.tmpl @@ -10,8 +10,7 @@ See: #include "src/tint/sem/parameter_usage.h" -namespace tint { -namespace sem { +namespace tint::sem { const char* str(ParameterUsage usage) { switch (usage) { @@ -25,5 +24,4 @@ const char* str(ParameterUsage usage) { return ""; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/parameter_usage.h b/src/tint/sem/parameter_usage.h index 698d9cb285..56f6e782e9 100644 --- a/src/tint/sem/parameter_usage.h +++ b/src/tint/sem/parameter_usage.h @@ -25,8 +25,7 @@ #ifndef SRC_TINT_SEM_PARAMETER_USAGE_H_ #define SRC_TINT_SEM_PARAMETER_USAGE_H_ -namespace tint { -namespace sem { +namespace tint::sem { /// ParameterUsage is extra metadata for identifying a parameter based on its /// overload position @@ -50,7 +49,6 @@ enum class ParameterUsage { /// @returns a string representation of the given parameter usage. const char* str(ParameterUsage usage); -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_PARAMETER_USAGE_H_ diff --git a/src/tint/sem/parameter_usage.h.tmpl b/src/tint/sem/parameter_usage.h.tmpl index 00a2f992d2..1edb674ad4 100644 --- a/src/tint/sem/parameter_usage.h.tmpl +++ b/src/tint/sem/parameter_usage.h.tmpl @@ -11,8 +11,7 @@ See: #ifndef SRC_TINT_SEM_PARAMETER_USAGE_H_ #define SRC_TINT_SEM_PARAMETER_USAGE_H_ -namespace tint { -namespace sem { +namespace tint::sem { /// ParameterUsage is extra metadata for identifying a parameter based on its /// overload position @@ -26,7 +25,6 @@ enum class ParameterUsage { /// @returns a string representation of the given parameter usage. const char* str(ParameterUsage usage); -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_PARAMETER_USAGE_H_ diff --git a/src/tint/sem/pipeline_stage_set.h b/src/tint/sem/pipeline_stage_set.h index 8b96da9e32..e27f2062d5 100644 --- a/src/tint/sem/pipeline_stage_set.h +++ b/src/tint/sem/pipeline_stage_set.h @@ -18,12 +18,10 @@ #include "src/tint/ast/pipeline_stage.h" #include "src/tint/utils/enum_set.h" -namespace tint { -namespace sem { +namespace tint::sem { using PipelineStageSet = utils::EnumSet; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_PIPELINE_STAGE_SET_H_ diff --git a/src/tint/sem/pointer_type.cc b/src/tint/sem/pointer_type.cc index 43eb514ba8..b1f137a542 100644 --- a/src/tint/sem/pointer_type.cc +++ b/src/tint/sem/pointer_type.cc @@ -20,8 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Pointer); -namespace tint { -namespace sem { +namespace tint::sem { Pointer::Pointer(const Type* subtype, ast::StorageClass storage_class, @@ -59,5 +58,4 @@ Pointer::Pointer(Pointer&&) = default; Pointer::~Pointer() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/pointer_type.h b/src/tint/sem/pointer_type.h index 7e2e48cc4c..c3697c1451 100644 --- a/src/tint/sem/pointer_type.h +++ b/src/tint/sem/pointer_type.h @@ -21,8 +21,7 @@ #include "src/tint/ast/storage_class.h" #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A pointer type. class Pointer final : public Castable { @@ -66,7 +65,6 @@ class Pointer final : public Castable { ast::Access const access_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_POINTER_TYPE_H_ diff --git a/src/tint/sem/pointer_type_test.cc b/src/tint/sem/pointer_type_test.cc index cc1dc8ab97..713677d230 100644 --- a/src/tint/sem/pointer_type_test.cc +++ b/src/tint/sem/pointer_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using PointerTest = TestHelper; @@ -93,5 +92,4 @@ TEST_F(PointerTest, FriendlyNameWithStorageClass) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/reference_type.cc b/src/tint/sem/reference_type.cc index 6edf888f7f..6eaceda559 100644 --- a/src/tint/sem/reference_type.cc +++ b/src/tint/sem/reference_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Reference); -namespace tint { -namespace sem { +namespace tint::sem { Reference::Reference(const Type* subtype, ast::StorageClass storage_class, @@ -58,5 +57,4 @@ Reference::Reference(Reference&&) = default; Reference::~Reference() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/reference_type.h b/src/tint/sem/reference_type.h index cc2921b574..d2639a4849 100644 --- a/src/tint/sem/reference_type.h +++ b/src/tint/sem/reference_type.h @@ -21,8 +21,7 @@ #include "src/tint/ast/storage_class.h" #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A reference type. class Reference final : public Castable { @@ -66,7 +65,6 @@ class Reference final : public Castable { ast::Access const access_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_REFERENCE_TYPE_H_ diff --git a/src/tint/sem/reference_type_test.cc b/src/tint/sem/reference_type_test.cc index 9b3536d1c7..9d99598c0f 100644 --- a/src/tint/sem/reference_type_test.cc +++ b/src/tint/sem/reference_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/reference_type.h" #include "src/tint/sem/test_helper.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using ReferenceTest = TestHelper; @@ -93,5 +92,4 @@ TEST_F(ReferenceTest, FriendlyNameWithStorageClass) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/sampled_texture_type.cc b/src/tint/sem/sampled_texture_type.cc index 9840a17207..5d9d9c5660 100644 --- a/src/tint/sem/sampled_texture_type.cc +++ b/src/tint/sem/sampled_texture_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::SampledTexture); -namespace tint { -namespace sem { +namespace tint::sem { SampledTexture::SampledTexture(ast::TextureDimension dim, const Type* type) : Base(dim), type_(type) { @@ -49,5 +48,4 @@ std::string SampledTexture::FriendlyName(const SymbolTable& symbols) const { return out.str(); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/sampled_texture_type.h b/src/tint/sem/sampled_texture_type.h index 4cfa15ca58..b67737e679 100644 --- a/src/tint/sem/sampled_texture_type.h +++ b/src/tint/sem/sampled_texture_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A sampled texture type. class SampledTexture final : public Castable { @@ -52,7 +51,6 @@ class SampledTexture final : public Castable { const Type* const type_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_SAMPLED_TEXTURE_TYPE_H_ diff --git a/src/tint/sem/sampled_texture_type_test.cc b/src/tint/sem/sampled_texture_type_test.cc index 146aaf56a7..7ddb48206c 100644 --- a/src/tint/sem/sampled_texture_type_test.cc +++ b/src/tint/sem/sampled_texture_type_test.cc @@ -19,8 +19,7 @@ #include "src/tint/sem/storage_texture_type.h" #include "src/tint/sem/test_helper.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using SampledTextureTest = TestHelper; @@ -91,5 +90,4 @@ TEST_F(SampledTextureTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/sampler_texture_pair.h b/src/tint/sem/sampler_texture_pair.h index 4773dcf4b9..f9b665f899 100644 --- a/src/tint/sem/sampler_texture_pair.h +++ b/src/tint/sem/sampler_texture_pair.h @@ -20,8 +20,7 @@ #include "src/tint/sem/binding_point.h" -namespace tint { -namespace sem { +namespace tint::sem { /// Mapping of a sampler to a texture it samples. struct SamplerTexturePair { @@ -46,8 +45,7 @@ struct SamplerTexturePair { } }; -} // namespace sem -} // namespace tint +} // namespace tint::sem namespace std { diff --git a/src/tint/sem/sampler_type.cc b/src/tint/sem/sampler_type.cc index 6fdbc343a7..6558a17bf3 100644 --- a/src/tint/sem/sampler_type.cc +++ b/src/tint/sem/sampler_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Sampler); -namespace tint { -namespace sem { +namespace tint::sem { Sampler::Sampler(ast::SamplerKind kind) : kind_(kind) {} @@ -43,5 +42,4 @@ std::string Sampler::FriendlyName(const SymbolTable&) const { return kind_ == ast::SamplerKind::kSampler ? "sampler" : "sampler_comparison"; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/sampler_type.h b/src/tint/sem/sampler_type.h index fd11fb5df8..d1fffab7f9 100644 --- a/src/tint/sem/sampler_type.h +++ b/src/tint/sem/sampler_type.h @@ -20,8 +20,7 @@ #include "src/tint/ast/sampler.h" #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A sampler type. class Sampler final : public Castable { @@ -57,7 +56,6 @@ class Sampler final : public Castable { ast::SamplerKind const kind_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_SAMPLER_TYPE_H_ diff --git a/src/tint/sem/sampler_type_test.cc b/src/tint/sem/sampler_type_test.cc index b8aa17b90a..edd57d20e8 100644 --- a/src/tint/sem/sampler_type_test.cc +++ b/src/tint/sem/sampler_type_test.cc @@ -16,8 +16,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using SamplerTest = TestHelper; @@ -67,5 +66,4 @@ TEST_F(SamplerTest, FriendlyNameComparisonSampler) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/sem_array_test.cc b/src/tint/sem/sem_array_test.cc index 6f84a97797..fc78f38baf 100644 --- a/src/tint/sem/sem_array_test.cc +++ b/src/tint/sem/sem_array_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using ArrayTest = TestHelper; @@ -127,5 +126,4 @@ TEST_F(ArrayTest, FriendlyNameStaticSizedNonImplicitStride) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/sem_struct_test.cc b/src/tint/sem/sem_struct_test.cc index 60faf8dbab..d788be991f 100644 --- a/src/tint/sem/sem_struct_test.cc +++ b/src/tint/sem/sem_struct_test.cc @@ -16,8 +16,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using StructTest = TestHelper; @@ -120,5 +119,4 @@ TEST_F(StructTest, Layout) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/statement.cc b/src/tint/sem/statement.cc index 149507d3cf..2046f630bc 100644 --- a/src/tint/sem/statement.cc +++ b/src/tint/sem/statement.cc @@ -23,8 +23,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Statement); TINT_INSTANTIATE_TYPEINFO(tint::sem::CompoundStatement); -namespace tint { -namespace sem { +namespace tint::sem { Statement::Statement(const ast::Statement* declaration, const CompoundStatement* parent, @@ -44,5 +43,4 @@ CompoundStatement::CompoundStatement(const ast::Statement* declaration, CompoundStatement::~CompoundStatement() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/statement.h b/src/tint/sem/statement.h index 708e741198..f7cf40cf72 100644 --- a/src/tint/sem/statement.h +++ b/src/tint/sem/statement.h @@ -26,16 +26,12 @@ class Statement; } // namespace ast namespace sem { class BlockStatement; +class CompoundStatement; +class Function; } // namespace sem } // namespace tint -namespace tint { -namespace sem { - -/// Forward declaration -class CompoundStatement; -class Function; - +namespace tint::sem { namespace detail { /// FindFirstParentReturn is a traits helper for determining the return type for /// the template member function Statement::FindFirstParent(). @@ -182,7 +178,6 @@ const detail::FindFirstParentReturnType* Statement::FindFirstParent() return nullptr; } -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_STATEMENT_H_ diff --git a/src/tint/sem/storage_texture_type.cc b/src/tint/sem/storage_texture_type.cc index 8b98edc1fe..1b017ddbf8 100644 --- a/src/tint/sem/storage_texture_type.cc +++ b/src/tint/sem/storage_texture_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::StorageTexture); -namespace tint { -namespace sem { +namespace tint::sem { StorageTexture::StorageTexture(ast::TextureDimension dim, ast::TexelFormat format, @@ -87,5 +86,4 @@ sem::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, return nullptr; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/storage_texture_type.h b/src/tint/sem/storage_texture_type.h index f3d545987c..06d8dc5c5d 100644 --- a/src/tint/sem/storage_texture_type.h +++ b/src/tint/sem/storage_texture_type.h @@ -21,10 +21,12 @@ #include "src/tint/ast/storage_texture.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { - +// Forward Declarations +namespace tint::sem { class Manager; +} + +namespace tint::sem { /// A storage texture type. class StorageTexture final : public Castable { @@ -75,7 +77,6 @@ class StorageTexture final : public Castable { Type* const subtype_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_STORAGE_TEXTURE_TYPE_H_ diff --git a/src/tint/sem/storage_texture_type_test.cc b/src/tint/sem/storage_texture_type_test.cc index 7a2dcaaac7..73361ce14b 100644 --- a/src/tint/sem/storage_texture_type_test.cc +++ b/src/tint/sem/storage_texture_type_test.cc @@ -19,8 +19,7 @@ #include "src/tint/sem/sampled_texture_type.h" #include "src/tint/sem/test_helper.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { struct StorageTextureTest : public TestHelper { @@ -152,5 +151,4 @@ TEST_F(StorageTextureTest, I32) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/struct.cc b/src/tint/sem/struct.cc index a2ecc73f77..ce3029d38e 100644 --- a/src/tint/sem/struct.cc +++ b/src/tint/sem/struct.cc @@ -26,8 +26,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Struct); TINT_INSTANTIATE_TYPEINFO(tint::sem::StructMember); -namespace tint { -namespace sem { +namespace tint::sem { Struct::Struct(const ast::Struct* declaration, Symbol name, @@ -181,5 +180,4 @@ StructMember::StructMember(const ast::StructMember* declaration, StructMember::~StructMember() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/struct.h b/src/tint/sem/struct.h index dc33dc2943..425bbc138e 100644 --- a/src/tint/sem/struct.h +++ b/src/tint/sem/struct.h @@ -27,18 +27,18 @@ #include "src/tint/sem/type.h" #include "src/tint/symbol.h" -namespace tint { - // Forward declarations +namespace tint { namespace ast { class StructMember; } // namespace ast - namespace sem { - -// Forward declarations class StructMember; class Type; +} // namespace sem +} // namespace tint + +namespace tint::sem { /// A vector of StructMember pointers. using StructMemberList = std::vector; @@ -230,7 +230,6 @@ class StructMember : public Castable { const uint32_t size_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_STRUCT_H_ diff --git a/src/tint/sem/switch_statement.cc b/src/tint/sem/switch_statement.cc index 403ae9238f..9800ed61ae 100644 --- a/src/tint/sem/switch_statement.cc +++ b/src/tint/sem/switch_statement.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::CaseStatement); TINT_INSTANTIATE_TYPEINFO(tint::sem::SwitchStatement); -namespace tint { -namespace sem { +namespace tint::sem { SwitchStatement::SwitchStatement(const ast::SwitchStatement* declaration, const CompoundStatement* parent, @@ -49,5 +48,4 @@ const ast::CaseStatement* CaseStatement::Declaration() const { return static_cast(Base::Declaration()); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/switch_statement.h b/src/tint/sem/switch_statement.h index ff17f58608..b56bc8598b 100644 --- a/src/tint/sem/switch_statement.h +++ b/src/tint/sem/switch_statement.h @@ -18,15 +18,12 @@ #include "src/tint/sem/block_statement.h" // Forward declarations -namespace tint { -namespace ast { +namespace tint::ast { class CaseStatement; class SwitchStatement; -} // namespace ast -} // namespace tint +} // namespace tint::ast -namespace tint { -namespace sem { +namespace tint::sem { /// Holds semantic information about an switch statement class SwitchStatement final @@ -74,7 +71,6 @@ class CaseStatement final : public Castable { const BlockStatement* body_ = nullptr; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_SWITCH_STATEMENT_H_ diff --git a/src/tint/sem/test_helper.h b/src/tint/sem/test_helper.h index 1f87769927..412e36a61c 100644 --- a/src/tint/sem/test_helper.h +++ b/src/tint/sem/test_helper.h @@ -20,8 +20,7 @@ #include "gtest/gtest.h" #include "src/tint/program_builder.h" -namespace tint { -namespace sem { +namespace tint::sem { /// Helper class for testing template @@ -43,7 +42,6 @@ using TestHelper = TestHelperBase; template using TestParamHelper = TestHelperBase>; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_TEST_HELPER_H_ diff --git a/src/tint/sem/texture_type.cc b/src/tint/sem/texture_type.cc index 0fa7cb96ac..e14b606c84 100644 --- a/src/tint/sem/texture_type.cc +++ b/src/tint/sem/texture_type.cc @@ -16,8 +16,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Texture); -namespace tint { -namespace sem { +namespace tint::sem { Texture::Texture(ast::TextureDimension dim) : dim_(dim) {} @@ -25,5 +24,4 @@ Texture::Texture(Texture&&) = default; Texture::~Texture() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/texture_type.h b/src/tint/sem/texture_type.h index 23f997bda3..9aa333065b 100644 --- a/src/tint/sem/texture_type.h +++ b/src/tint/sem/texture_type.h @@ -18,8 +18,7 @@ #include "src/tint/ast/texture.h" #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A texture type. class Texture : public Castable { @@ -38,7 +37,6 @@ class Texture : public Castable { ast::TextureDimension const dim_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_TEXTURE_TYPE_H_ diff --git a/src/tint/sem/texture_type_test.cc b/src/tint/sem/texture_type_test.cc index d36e825aa6..8737415d92 100644 --- a/src/tint/sem/texture_type_test.cc +++ b/src/tint/sem/texture_type_test.cc @@ -17,8 +17,7 @@ #include "src/tint/sem/sampled_texture_type.h" #include "src/tint/sem/test_helper.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using TextureTypeDimTest = TestParamHelper; @@ -42,5 +41,4 @@ INSTANTIATE_TEST_SUITE_P(Dimensions, ast::TextureDimension::kCubeArray)); } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/type.cc b/src/tint/sem/type.cc index c14ec69079..f8c32e7ad1 100644 --- a/src/tint/sem/type.cc +++ b/src/tint/sem/type.cc @@ -27,8 +27,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Type); -namespace tint { -namespace sem { +namespace tint::sem { Type::Type() = default; @@ -154,5 +153,4 @@ bool Type::is_handle() const { return IsAnyOf(); } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/type.h b/src/tint/sem/type.h index c0abce3d76..c93c4e6256 100644 --- a/src/tint/sem/type.h +++ b/src/tint/sem/type.h @@ -20,13 +20,13 @@ #include "src/tint/sem/node.h" -namespace tint { - // Forward declarations +namespace tint { class ProgramBuilder; class SymbolTable; +} // namespace tint -namespace sem { +namespace tint::sem { /// Supported memory layouts for calculating sizes enum class MemoryLayout { kUniformBuffer, kStorageBuffer }; @@ -118,8 +118,7 @@ class Type : public Castable { Type(); }; -} // namespace sem -} // namespace tint +} // namespace tint::sem namespace std { diff --git a/src/tint/sem/type_constructor.cc b/src/tint/sem/type_constructor.cc index 8ad9388f54..4213edbaf2 100644 --- a/src/tint/sem/type_constructor.cc +++ b/src/tint/sem/type_constructor.cc @@ -16,8 +16,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeConstructor); -namespace tint { -namespace sem { +namespace tint::sem { TypeConstructor::TypeConstructor(const sem::Type* type, const ParameterList& parameters) @@ -25,5 +24,4 @@ TypeConstructor::TypeConstructor(const sem::Type* type, TypeConstructor::~TypeConstructor() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/type_constructor.h b/src/tint/sem/type_constructor.h index ca6bf818d0..d9ff7a1d4c 100644 --- a/src/tint/sem/type_constructor.h +++ b/src/tint/sem/type_constructor.h @@ -17,8 +17,7 @@ #include "src/tint/sem/call_target.h" -namespace tint { -namespace sem { +namespace tint::sem { /// TypeConstructor is the CallTarget for a type constructor. class TypeConstructor final : public Castable { @@ -32,7 +31,6 @@ class TypeConstructor final : public Castable { ~TypeConstructor() override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_TYPE_CONSTRUCTOR_H_ diff --git a/src/tint/sem/type_conversion.cc b/src/tint/sem/type_conversion.cc index 7def17b358..47a4a71fda 100644 --- a/src/tint/sem/type_conversion.cc +++ b/src/tint/sem/type_conversion.cc @@ -16,8 +16,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeConversion); -namespace tint { -namespace sem { +namespace tint::sem { TypeConversion::TypeConversion(const sem::Type* type, const sem::Parameter* parameter) @@ -25,5 +24,4 @@ TypeConversion::TypeConversion(const sem::Type* type, TypeConversion::~TypeConversion() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/type_conversion.h b/src/tint/sem/type_conversion.h index fcea914d08..5433641936 100644 --- a/src/tint/sem/type_conversion.h +++ b/src/tint/sem/type_conversion.h @@ -17,8 +17,7 @@ #include "src/tint/sem/call_target.h" -namespace tint { -namespace sem { +namespace tint::sem { /// TypeConversion is the CallTarget for a type conversion (cast). class TypeConversion final : public Castable { @@ -38,7 +37,6 @@ class TypeConversion final : public Castable { const sem::Type* Target() const { return ReturnType(); } }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_TYPE_CONVERSION_H_ diff --git a/src/tint/sem/type_manager.cc b/src/tint/sem/type_manager.cc index e9161d10f4..e6f5f6d4b1 100644 --- a/src/tint/sem/type_manager.cc +++ b/src/tint/sem/type_manager.cc @@ -14,13 +14,11 @@ #include "src/tint/sem/type_manager.h" -namespace tint { -namespace sem { +namespace tint::sem { Manager::Manager() = default; Manager::Manager(Manager&&) = default; Manager& Manager::operator=(Manager&& rhs) = default; Manager::~Manager() = default; -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/type_manager_test.cc b/src/tint/sem/type_manager_test.cc index 7fc96d9287..6cbea9be92 100644 --- a/src/tint/sem/type_manager_test.cc +++ b/src/tint/sem/type_manager_test.cc @@ -18,8 +18,7 @@ #include "src/tint/sem/i32_type.h" #include "src/tint/sem/u32_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { template @@ -79,5 +78,4 @@ TEST_F(TypeManagerTest, WrapDoesntAffectInner) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/type_mappings.h b/src/tint/sem/type_mappings.h index 1ca2b6dd67..123b8cc544 100644 --- a/src/tint/sem/type_mappings.h +++ b/src/tint/sem/type_mappings.h @@ -17,9 +17,8 @@ #include -namespace tint { - // Forward declarations +namespace tint { namespace ast { class Array; class CallExpression; @@ -37,9 +36,7 @@ class Type; class TypeDecl; class Variable; } // namespace ast - namespace sem { -// Forward declarations class Array; class Call; class Expression; @@ -54,6 +51,10 @@ class Struct; class StructMember; class Type; class Variable; +} // namespace sem +} // namespace tint + +namespace tint::sem { /// TypeMappings is a struct that holds undefined `operator()` methods that's /// used by SemanticNodeTypeFor to map AST / type node types to their @@ -85,7 +86,6 @@ template using SemanticNodeTypeFor = typename std::remove_pointer()))>::type; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_TYPE_MAPPINGS_H_ diff --git a/src/tint/sem/u32_type.cc b/src/tint/sem/u32_type.cc index 15801488b2..f73b61756b 100644 --- a/src/tint/sem/u32_type.cc +++ b/src/tint/sem/u32_type.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::U32); -namespace tint { -namespace sem { +namespace tint::sem { U32::U32() = default; @@ -51,5 +50,4 @@ uint32_t U32::Align() const { return 4; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/u32_type.h b/src/tint/sem/u32_type.h index 5fa5c12a37..d81886c96a 100644 --- a/src/tint/sem/u32_type.h +++ b/src/tint/sem/u32_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A unsigned int 32 type. class U32 final : public Castable { @@ -54,7 +53,6 @@ class U32 final : public Castable { uint32_t Align() const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_U32_TYPE_H_ diff --git a/src/tint/sem/u32_type_test.cc b/src/tint/sem/u32_type_test.cc index 1bbdc9bc7c..dae4c422f3 100644 --- a/src/tint/sem/u32_type_test.cc +++ b/src/tint/sem/u32_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using U32Test = TestHelper; @@ -46,5 +45,4 @@ TEST_F(U32Test, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/variable.cc b/src/tint/sem/variable.cc index b8e4a49a17..af3deb9b5b 100644 --- a/src/tint/sem/variable.cc +++ b/src/tint/sem/variable.cc @@ -25,8 +25,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::LocalVariable); TINT_INSTANTIATE_TYPEINFO(tint::sem::Parameter); TINT_INSTANTIATE_TYPEINFO(tint::sem::VariableUser); -namespace tint { -namespace sem { +namespace tint::sem { Variable::Variable(const ast::Variable* declaration, const sem::Type* type, @@ -85,5 +84,4 @@ VariableUser::VariableUser(const ast::IdentifierExpression* declaration, /* has_side_effects */ false), variable_(variable) {} -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/variable.h b/src/tint/sem/variable.h index 0f196d0f71..4c89f506ca 100644 --- a/src/tint/sem/variable.h +++ b/src/tint/sem/variable.h @@ -24,20 +24,20 @@ #include "src/tint/sem/expression.h" #include "src/tint/sem/parameter_usage.h" -namespace tint { - // Forward declarations +namespace tint { namespace ast { class IdentifierExpression; class Variable; } // namespace ast - namespace sem { - -// Forward declarations class CallTarget; class Type; class VariableUser; +} // namespace sem +} // namespace tint + +namespace tint::sem { /// Variable is the base class for local variables, global variables and /// parameters. @@ -252,8 +252,7 @@ class VariableUser final : public Castable { /// A pair of sem::Variables. Can be hashed. typedef std::pair VariablePair; -} // namespace sem -} // namespace tint +} // namespace tint::sem namespace std { diff --git a/src/tint/sem/vector_type.cc b/src/tint/sem/vector_type.cc index 518bacfc7a..1df39457f8 100644 --- a/src/tint/sem/vector_type.cc +++ b/src/tint/sem/vector_type.cc @@ -19,8 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Vector); -namespace tint { -namespace sem { +namespace tint::sem { Vector::Vector(Type const* subtype, uint32_t width) : subtype_(subtype), width_(width) { @@ -85,5 +84,4 @@ uint32_t Vector::AlignOf(uint32_t width) { return 0; // Unreachable } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/vector_type.h b/src/tint/sem/vector_type.h index 48ee1c55f8..4542c5b982 100644 --- a/src/tint/sem/vector_type.h +++ b/src/tint/sem/vector_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A vector type. class Vector final : public Castable { @@ -75,7 +74,6 @@ class Vector final : public Castable { const uint32_t width_; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_VECTOR_TYPE_H_ diff --git a/src/tint/sem/vector_type_test.cc b/src/tint/sem/vector_type_test.cc index 1640d13b70..4d5391807c 100644 --- a/src/tint/sem/vector_type_test.cc +++ b/src/tint/sem/vector_type_test.cc @@ -15,8 +15,7 @@ #include "src/tint/sem/test_helper.h" #include "src/tint/sem/texture_type.h" -namespace tint { -namespace sem { +namespace tint::sem { namespace { using VectorTest = TestHelper; @@ -65,5 +64,4 @@ TEST_F(VectorTest, FriendlyName) { } } // namespace -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/void_type.cc b/src/tint/sem/void_type.cc index e366e81203..6dae92132b 100644 --- a/src/tint/sem/void_type.cc +++ b/src/tint/sem/void_type.cc @@ -18,8 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Void); -namespace tint { -namespace sem { +namespace tint::sem { Void::Void() = default; @@ -39,5 +38,4 @@ std::string Void::FriendlyName(const SymbolTable&) const { return "void"; } -} // namespace sem -} // namespace tint +} // namespace tint::sem diff --git a/src/tint/sem/void_type.h b/src/tint/sem/void_type.h index 0411de02ee..1131cb8df1 100644 --- a/src/tint/sem/void_type.h +++ b/src/tint/sem/void_type.h @@ -19,8 +19,7 @@ #include "src/tint/sem/type.h" -namespace tint { -namespace sem { +namespace tint::sem { /// A void type class Void final : public Castable { @@ -44,7 +43,6 @@ class Void final : public Castable { std::string FriendlyName(const SymbolTable& symbols) const override; }; -} // namespace sem -} // namespace tint +} // namespace tint::sem #endif // SRC_TINT_SEM_VOID_TYPE_H_