Condense namespaces in tint/writer.

This PR condenses the namespaces in the tint/writer folder.

Change-Id: I66b28d6e70b99834dc6a25fee4c71e3036e0864a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86026
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-07 14:43:05 +00:00 committed by Dawn LUCI CQ
parent c05f045df4
commit 67e79fe506
15 changed files with 33 additions and 64 deletions

View File

@ -23,9 +23,7 @@
#include "src/tint/sem/type_conversion.h" #include "src/tint/sem/type_conversion.h"
#include "src/tint/utils/transform.h" #include "src/tint/utils/transform.h"
namespace tint { namespace tint::writer {
namespace writer {
namespace { namespace {
struct VectorConstructorInfo { struct VectorConstructorInfo {
@ -172,5 +170,4 @@ const sem::Call* AppendVector(ProgramBuilder* b,
return constructor_sem; return constructor_sem;
} }
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -17,14 +17,13 @@
#include "src/tint/program_builder.h" #include "src/tint/program_builder.h"
namespace tint { // Forward Declarations
namespace tint::ast {
namespace ast {
class CallExpression; class CallExpression;
class Expression; class Expression;
} // namespace ast } // namespace tint::ast
namespace writer { namespace tint::writer {
/// A helper function used to append a vector with an additional scalar. /// A helper function used to append a vector with an additional scalar.
/// If the scalar's type does not match the target vector element type, /// If the scalar's type does not match the target vector element type,
@ -40,7 +39,6 @@ const sem::Call* AppendVector(ProgramBuilder* builder,
const ast::Expression* vector, const ast::Expression* vector,
const ast::Expression* scalar); const ast::Expression* scalar);
} // namespace writer } // namespace tint::writer
} // namespace tint
#endif // SRC_TINT_WRITER_APPEND_VECTOR_H_ #endif // SRC_TINT_WRITER_APPEND_VECTOR_H_

View File

@ -19,8 +19,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace tint { namespace tint::writer {
namespace writer {
namespace { namespace {
class AppendVectorTest : public ::testing::Test, public ProgramBuilder {}; class AppendVectorTest : public ::testing::Test, public ProgramBuilder {};
@ -484,5 +483,4 @@ TEST_F(AppendVectorTest, ZeroVec3i32_i32) {
} }
} // namespace } // namespace
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -14,8 +14,7 @@
#include "src/tint/writer/array_length_from_uniform_options.h" #include "src/tint/writer/array_length_from_uniform_options.h"
namespace tint { namespace tint::writer {
namespace writer {
ArrayLengthFromUniformOptions::ArrayLengthFromUniformOptions() = default; ArrayLengthFromUniformOptions::ArrayLengthFromUniformOptions() = default;
ArrayLengthFromUniformOptions::~ArrayLengthFromUniformOptions() = default; ArrayLengthFromUniformOptions::~ArrayLengthFromUniformOptions() = default;
@ -26,5 +25,4 @@ ArrayLengthFromUniformOptions& ArrayLengthFromUniformOptions::operator=(
ArrayLengthFromUniformOptions::ArrayLengthFromUniformOptions( ArrayLengthFromUniformOptions::ArrayLengthFromUniformOptions(
ArrayLengthFromUniformOptions&&) = default; ArrayLengthFromUniformOptions&&) = default;
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -19,8 +19,7 @@
#include "src/tint/sem/binding_point.h" #include "src/tint/sem/binding_point.h"
namespace tint { namespace tint::writer {
namespace writer {
/// Options used to specify a mapping of binding points to indices into a UBO /// Options used to specify a mapping of binding points to indices into a UBO
/// from which to load buffer sizes. /// from which to load buffer sizes.
@ -49,7 +48,6 @@ struct ArrayLengthFromUniformOptions {
// struct members. // struct members.
}; };
} // namespace writer } // namespace tint::writer
} // namespace tint
#endif // SRC_TINT_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_ #endif // SRC_TINT_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_

View File

@ -23,8 +23,7 @@
#include "src/tint/debug.h" #include "src/tint/debug.h"
namespace tint { namespace tint::writer {
namespace writer {
std::string FloatToString(float f) { std::string FloatToString(float f) {
// Try printing the float in fixed point, with a smallish limit on the // Try printing the float in fixed point, with a smallish limit on the
@ -154,5 +153,4 @@ std::string FloatToBitPreservingString(float f) {
return ss.str(); return ss.str();
} }
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -17,8 +17,7 @@
#include <string> #include <string>
namespace tint { namespace tint::writer {
namespace writer {
/// Converts the float `f` to a string using fixed-point notation (not /// Converts the float `f` to a string using fixed-point notation (not
/// scientific). The float will be printed with the full precision required to /// scientific). The float will be printed with the full precision required to
@ -33,7 +32,6 @@ std::string FloatToString(float f);
/// @return the float f formatted to a string /// @return the float f formatted to a string
std::string FloatToBitPreservingString(float f); std::string FloatToBitPreservingString(float f);
} // namespace writer } // namespace tint::writer
} // namespace tint
#endif // SRC_TINT_WRITER_FLOAT_TO_STRING_H_ #endif // SRC_TINT_WRITER_FLOAT_TO_STRING_H_

View File

@ -20,8 +20,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace tint { namespace tint::writer {
namespace writer {
namespace { namespace {
// Makes an IEEE 754 binary32 floating point number with // Makes an IEEE 754 binary32 floating point number with
@ -222,5 +221,4 @@ TEST(FloatToBitPreservingStringTest, DISABLED_NaN_NonMsb) {
} }
} // namespace } // namespace
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -14,10 +14,8 @@
#include "src/tint/writer/text.h" #include "src/tint/writer/text.h"
namespace tint { namespace tint::writer {
namespace writer {
Text::~Text() = default; Text::~Text() = default;
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -19,8 +19,7 @@
#include "src/tint/writer/writer.h" #include "src/tint/writer/writer.h"
namespace tint { namespace tint::writer {
namespace writer {
/// Class to generate text source /// Class to generate text source
class Text : public Writer { class Text : public Writer {
@ -31,7 +30,6 @@ class Text : public Writer {
virtual std::string result() const = 0; virtual std::string result() const = 0;
}; };
} // namespace writer } // namespace tint::writer
} // namespace tint
#endif // SRC_TINT_WRITER_TEXT_H_ #endif // SRC_TINT_WRITER_TEXT_H_

View File

@ -19,8 +19,7 @@
#include "src/tint/utils/map.h" #include "src/tint/utils/map.h"
namespace tint { namespace tint::writer {
namespace writer {
TextGenerator::TextGenerator(const Program* program) TextGenerator::TextGenerator(const Program* program)
: program_(program), builder_(ProgramBuilder::Wrap(program)) {} : program_(program), builder_(ProgramBuilder::Wrap(program)) {}
@ -151,5 +150,4 @@ TextGenerator::ScopedIndent::~ScopedIndent() {
buffer_->DecrementIndent(); buffer_->DecrementIndent();
} }
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -24,8 +24,7 @@
#include "src/tint/diagnostic/diagnostic.h" #include "src/tint/diagnostic/diagnostic.h"
#include "src/tint/program_builder.h" #include "src/tint/program_builder.h"
namespace tint { namespace tint::writer {
namespace writer {
/// Helper methods for generators which are creating text output /// Helper methods for generators which are creating text output
class TextGenerator { class TextGenerator {
@ -236,7 +235,6 @@ class TextGenerator {
std::unordered_map<const sem::Struct*, std::string> builtin_struct_names_; std::unordered_map<const sem::Struct*, std::string> builtin_struct_names_;
}; };
} // namespace writer } // namespace tint::writer
} // namespace tint
#endif // SRC_TINT_WRITER_TEXT_GENERATOR_H_ #endif // SRC_TINT_WRITER_TEXT_GENERATOR_H_

View File

@ -16,8 +16,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace tint { namespace tint::writer {
namespace writer {
namespace { namespace {
TEST(TextGeneratorTest, UniqueIdentifier) { TEST(TextGeneratorTest, UniqueIdentifier) {
@ -44,5 +43,4 @@ TEST(TextGeneratorTest, UniqueIdentifier_ConflictWithExisting) {
} }
} // namespace } // namespace
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -14,10 +14,8 @@
#include "src/tint/writer/writer.h" #include "src/tint/writer/writer.h"
namespace tint { namespace tint::writer {
namespace writer {
Writer::~Writer() = default; Writer::~Writer() = default;
} // namespace writer } // namespace tint::writer
} // namespace tint

View File

@ -17,8 +17,7 @@
#include <string> #include <string>
namespace tint { namespace tint::writer {
namespace writer {
/// Base class for the output writers /// Base class for the output writers
class Writer { class Writer {
@ -41,7 +40,6 @@ class Writer {
std::string error_; std::string error_;
}; };
} // namespace writer } // namespace tint::writer
} // namespace tint
#endif // SRC_TINT_WRITER_WRITER_H_ #endif // SRC_TINT_WRITER_WRITER_H_