From 655db070220ab631f58104db52038ea20ffe7a58 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 1 Sep 2022 17:35:39 +0000 Subject: [PATCH] tint/sem: Rename sem::Manager to TypeManager This used to live in a `type` namespace, and wasn't prefixed when types were moved to sem. Change-Id: Ic7a08c2fb40aff034247524c755d9f66157e4da2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101000 Commit-Queue: Ben Clayton Reviewed-by: Dan Sinclair Kokoro: Kokoro --- src/tint/program.h | 4 ++-- src/tint/program_builder.cc | 2 +- src/tint/program_builder.h | 6 +++--- src/tint/sem/storage_texture.cc | 2 +- src/tint/sem/storage_texture.h | 6 +++--- src/tint/sem/type_manager.cc | 8 ++++---- src/tint/sem/type_manager.h | 14 +++++++------- src/tint/sem/type_manager_test.cc | 12 ++++++------ 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/tint/program.h b/src/tint/program.h index ea884701ef..b482f9050a 100644 --- a/src/tint/program.h +++ b/src/tint/program.h @@ -73,7 +73,7 @@ class Program { ast::NodeID HighestASTNodeID() const { return highest_node_id_; } /// @returns a reference to the program's types - const sem::Manager& Types() const { + const sem::TypeManager& Types() const { AssertNotMoved(); return types_; } @@ -165,7 +165,7 @@ class Program { ProgramID id_; ast::NodeID highest_node_id_; - sem::Manager types_; + sem::TypeManager types_; ASTNodeAllocator ast_nodes_; SemNodeAllocator sem_nodes_; ConstantAllocator constant_nodes_; diff --git a/src/tint/program_builder.cc b/src/tint/program_builder.cc index c6cff0fc67..443be11966 100644 --- a/src/tint/program_builder.cc +++ b/src/tint/program_builder.cc @@ -70,7 +70,7 @@ ProgramBuilder ProgramBuilder::Wrap(const Program* program) { ProgramBuilder builder; builder.id_ = program->ID(); builder.last_ast_node_id_ = program->HighestASTNodeID(); - builder.types_ = sem::Manager::Wrap(program->Types()); + builder.types_ = sem::TypeManager::Wrap(program->Types()); builder.ast_ = builder.create(program->AST().source, program->AST().GlobalDeclarations()); builder.sem_ = sem::Info::Wrap(program->Sem()); diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h index 487420c747..0af3a9020b 100644 --- a/src/tint/program_builder.h +++ b/src/tint/program_builder.h @@ -297,13 +297,13 @@ class ProgramBuilder { ProgramID ID() const { return id_; } /// @returns a reference to the program's types - sem::Manager& Types() { + sem::TypeManager& Types() { AssertNotMoved(); return types_; } /// @returns a reference to the program's types - const sem::Manager& Types() const { + const sem::TypeManager& Types() const { AssertNotMoved(); return types_; } @@ -3169,7 +3169,7 @@ class ProgramBuilder { private: ProgramID id_; ast::NodeID last_ast_node_id_ = ast::NodeID{static_cast(0) - 1}; - sem::Manager types_; + sem::TypeManager types_; ASTNodeAllocator ast_nodes_; SemNodeAllocator sem_nodes_; ConstantAllocator constant_nodes_; diff --git a/src/tint/sem/storage_texture.cc b/src/tint/sem/storage_texture.cc index 5b743e9054..caa8a79cda 100644 --- a/src/tint/sem/storage_texture.cc +++ b/src/tint/sem/storage_texture.cc @@ -48,7 +48,7 @@ std::string StorageTexture::FriendlyName(const SymbolTable&) const { return out.str(); } -sem::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, sem::Manager& type_mgr) { +sem::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, sem::TypeManager& type_mgr) { switch (format) { case ast::TexelFormat::kR32Uint: case ast::TexelFormat::kRgba8Uint: diff --git a/src/tint/sem/storage_texture.h b/src/tint/sem/storage_texture.h index 68dbff95a5..00258d62a4 100644 --- a/src/tint/sem/storage_texture.h +++ b/src/tint/sem/storage_texture.h @@ -23,7 +23,7 @@ // Forward declarations namespace tint::sem { -class Manager; +class TypeManager; } // namespace tint::sem namespace tint::sem { @@ -67,9 +67,9 @@ class StorageTexture final : public Castable { std::string FriendlyName(const SymbolTable& symbols) const override; /// @param format the storage texture image format - /// @param type_mgr the sem::Manager used to build the returned type + /// @param type_mgr the sem::TypeManager used to build the returned type /// @returns the storage texture subtype for the given TexelFormat - static sem::Type* SubtypeFor(ast::TexelFormat format, sem::Manager& type_mgr); + static sem::Type* SubtypeFor(ast::TexelFormat format, sem::TypeManager& type_mgr); private: ast::TexelFormat const texel_format_; diff --git a/src/tint/sem/type_manager.cc b/src/tint/sem/type_manager.cc index e6f5f6d4b1..8c26a4fd61 100644 --- a/src/tint/sem/type_manager.cc +++ b/src/tint/sem/type_manager.cc @@ -16,9 +16,9 @@ namespace tint::sem { -Manager::Manager() = default; -Manager::Manager(Manager&&) = default; -Manager& Manager::operator=(Manager&& rhs) = default; -Manager::~Manager() = default; +TypeManager::TypeManager() = default; +TypeManager::TypeManager(TypeManager&&) = default; +TypeManager& TypeManager::operator=(TypeManager&& rhs) = default; +TypeManager::~TypeManager() = default; } // namespace tint::sem diff --git a/src/tint/sem/type_manager.h b/src/tint/sem/type_manager.h index d2befcd03d..636b7a04e6 100644 --- a/src/tint/sem/type_manager.h +++ b/src/tint/sem/type_manager.h @@ -25,24 +25,24 @@ namespace tint::sem { /// The type manager holds all the pointers to the known types. -class Manager final : public utils::UniqueAllocator { +class TypeManager final : public utils::UniqueAllocator { public: /// Iterator is the type returned by begin() and end() using Iterator = utils::BlockAllocator::ConstIterator; /// Constructor - Manager(); + TypeManager(); /// Move constructor - Manager(Manager&&); + TypeManager(TypeManager&&); /// Move assignment operator /// @param rhs the Manager to move /// @return this Manager - Manager& operator=(Manager&& rhs); + TypeManager& operator=(TypeManager&& rhs); /// Destructor - ~Manager(); + ~TypeManager(); /// Wrap returns a new Manager created with the types of `inner`. /// The Manager returned by Wrap is intended to temporarily extend the types @@ -53,8 +53,8 @@ class Manager final : public utils::UniqueAllocator { /// function. See crbug.com/tint/460. /// @param inner the immutable Manager to extend /// @return the Manager that wraps `inner` - static Manager Wrap(const Manager& inner) { - Manager out; + static TypeManager Wrap(const TypeManager& inner) { + TypeManager out; out.items = inner.items; return out; } diff --git a/src/tint/sem/type_manager_test.cc b/src/tint/sem/type_manager_test.cc index b9c90fec7e..d2ca916f72 100644 --- a/src/tint/sem/type_manager_test.cc +++ b/src/tint/sem/type_manager_test.cc @@ -34,14 +34,14 @@ size_t count(const T& range_loopable) { using TypeManagerTest = testing::Test; TEST_F(TypeManagerTest, GetUnregistered) { - Manager tm; + TypeManager tm; auto* t = tm.Get(); ASSERT_NE(t, nullptr); EXPECT_TRUE(t->Is()); } TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) { - Manager tm; + TypeManager tm; auto* t = tm.Get(); ASSERT_NE(t, nullptr); EXPECT_TRUE(t->Is()); @@ -51,7 +51,7 @@ TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) { } TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) { - Manager tm; + TypeManager tm; Type* t = tm.Get(); ASSERT_NE(t, nullptr); EXPECT_TRUE(t->Is()); @@ -63,7 +63,7 @@ TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) { } TEST_F(TypeManagerTest, Find) { - Manager tm; + TypeManager tm; auto* created = tm.Get(); EXPECT_EQ(tm.Find(), nullptr); @@ -71,8 +71,8 @@ TEST_F(TypeManagerTest, Find) { } TEST_F(TypeManagerTest, WrapDoesntAffectInner) { - Manager inner; - Manager outer = Manager::Wrap(inner); + TypeManager inner; + TypeManager outer = TypeManager::Wrap(inner); inner.Get();