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 <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2022-09-01 17:35:39 +00:00 committed by Dawn LUCI CQ
parent ad22c3e7ab
commit 655db07022
8 changed files with 27 additions and 27 deletions

View File

@ -73,7 +73,7 @@ class Program {
ast::NodeID HighestASTNodeID() const { return highest_node_id_; } ast::NodeID HighestASTNodeID() const { return highest_node_id_; }
/// @returns a reference to the program's types /// @returns a reference to the program's types
const sem::Manager& Types() const { const sem::TypeManager& Types() const {
AssertNotMoved(); AssertNotMoved();
return types_; return types_;
} }
@ -165,7 +165,7 @@ class Program {
ProgramID id_; ProgramID id_;
ast::NodeID highest_node_id_; ast::NodeID highest_node_id_;
sem::Manager types_; sem::TypeManager types_;
ASTNodeAllocator ast_nodes_; ASTNodeAllocator ast_nodes_;
SemNodeAllocator sem_nodes_; SemNodeAllocator sem_nodes_;
ConstantAllocator constant_nodes_; ConstantAllocator constant_nodes_;

View File

@ -70,7 +70,7 @@ ProgramBuilder ProgramBuilder::Wrap(const Program* program) {
ProgramBuilder builder; ProgramBuilder builder;
builder.id_ = program->ID(); builder.id_ = program->ID();
builder.last_ast_node_id_ = program->HighestASTNodeID(); builder.last_ast_node_id_ = program->HighestASTNodeID();
builder.types_ = sem::Manager::Wrap(program->Types()); builder.types_ = sem::TypeManager::Wrap(program->Types());
builder.ast_ = builder.ast_ =
builder.create<ast::Module>(program->AST().source, program->AST().GlobalDeclarations()); builder.create<ast::Module>(program->AST().source, program->AST().GlobalDeclarations());
builder.sem_ = sem::Info::Wrap(program->Sem()); builder.sem_ = sem::Info::Wrap(program->Sem());

View File

@ -297,13 +297,13 @@ class ProgramBuilder {
ProgramID ID() const { return id_; } ProgramID ID() const { return id_; }
/// @returns a reference to the program's types /// @returns a reference to the program's types
sem::Manager& Types() { sem::TypeManager& Types() {
AssertNotMoved(); AssertNotMoved();
return types_; return types_;
} }
/// @returns a reference to the program's types /// @returns a reference to the program's types
const sem::Manager& Types() const { const sem::TypeManager& Types() const {
AssertNotMoved(); AssertNotMoved();
return types_; return types_;
} }
@ -3169,7 +3169,7 @@ class ProgramBuilder {
private: private:
ProgramID id_; ProgramID id_;
ast::NodeID last_ast_node_id_ = ast::NodeID{static_cast<decltype(ast::NodeID::value)>(0) - 1}; ast::NodeID last_ast_node_id_ = ast::NodeID{static_cast<decltype(ast::NodeID::value)>(0) - 1};
sem::Manager types_; sem::TypeManager types_;
ASTNodeAllocator ast_nodes_; ASTNodeAllocator ast_nodes_;
SemNodeAllocator sem_nodes_; SemNodeAllocator sem_nodes_;
ConstantAllocator constant_nodes_; ConstantAllocator constant_nodes_;

View File

@ -48,7 +48,7 @@ std::string StorageTexture::FriendlyName(const SymbolTable&) const {
return out.str(); 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) { switch (format) {
case ast::TexelFormat::kR32Uint: case ast::TexelFormat::kR32Uint:
case ast::TexelFormat::kRgba8Uint: case ast::TexelFormat::kRgba8Uint:

View File

@ -23,7 +23,7 @@
// Forward declarations // Forward declarations
namespace tint::sem { namespace tint::sem {
class Manager; class TypeManager;
} // namespace tint::sem } // namespace tint::sem
namespace tint::sem { namespace tint::sem {
@ -67,9 +67,9 @@ class StorageTexture final : public Castable<StorageTexture, Texture> {
std::string FriendlyName(const SymbolTable& symbols) const override; std::string FriendlyName(const SymbolTable& symbols) const override;
/// @param format the storage texture image format /// @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 /// @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: private:
ast::TexelFormat const texel_format_; ast::TexelFormat const texel_format_;

View File

@ -16,9 +16,9 @@
namespace tint::sem { namespace tint::sem {
Manager::Manager() = default; TypeManager::TypeManager() = default;
Manager::Manager(Manager&&) = default; TypeManager::TypeManager(TypeManager&&) = default;
Manager& Manager::operator=(Manager&& rhs) = default; TypeManager& TypeManager::operator=(TypeManager&& rhs) = default;
Manager::~Manager() = default; TypeManager::~TypeManager() = default;
} // namespace tint::sem } // namespace tint::sem

View File

@ -25,24 +25,24 @@
namespace tint::sem { namespace tint::sem {
/// The type manager holds all the pointers to the known types. /// The type manager holds all the pointers to the known types.
class Manager final : public utils::UniqueAllocator<Type> { class TypeManager final : public utils::UniqueAllocator<Type> {
public: public:
/// Iterator is the type returned by begin() and end() /// Iterator is the type returned by begin() and end()
using Iterator = utils::BlockAllocator<Type>::ConstIterator; using Iterator = utils::BlockAllocator<Type>::ConstIterator;
/// Constructor /// Constructor
Manager(); TypeManager();
/// Move constructor /// Move constructor
Manager(Manager&&); TypeManager(TypeManager&&);
/// Move assignment operator /// Move assignment operator
/// @param rhs the Manager to move /// @param rhs the Manager to move
/// @return this Manager /// @return this Manager
Manager& operator=(Manager&& rhs); TypeManager& operator=(TypeManager&& rhs);
/// Destructor /// Destructor
~Manager(); ~TypeManager();
/// Wrap returns a new Manager created with the types of `inner`. /// Wrap returns a new Manager created with the types of `inner`.
/// The Manager returned by Wrap is intended to temporarily extend the types /// The Manager returned by Wrap is intended to temporarily extend the types
@ -53,8 +53,8 @@ class Manager final : public utils::UniqueAllocator<Type> {
/// function. See crbug.com/tint/460. /// function. See crbug.com/tint/460.
/// @param inner the immutable Manager to extend /// @param inner the immutable Manager to extend
/// @return the Manager that wraps `inner` /// @return the Manager that wraps `inner`
static Manager Wrap(const Manager& inner) { static TypeManager Wrap(const TypeManager& inner) {
Manager out; TypeManager out;
out.items = inner.items; out.items = inner.items;
return out; return out;
} }

View File

@ -34,14 +34,14 @@ size_t count(const T& range_loopable) {
using TypeManagerTest = testing::Test; using TypeManagerTest = testing::Test;
TEST_F(TypeManagerTest, GetUnregistered) { TEST_F(TypeManagerTest, GetUnregistered) {
Manager tm; TypeManager tm;
auto* t = tm.Get<I32>(); auto* t = tm.Get<I32>();
ASSERT_NE(t, nullptr); ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->Is<I32>()); EXPECT_TRUE(t->Is<I32>());
} }
TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) { TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) {
Manager tm; TypeManager tm;
auto* t = tm.Get<I32>(); auto* t = tm.Get<I32>();
ASSERT_NE(t, nullptr); ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->Is<I32>()); EXPECT_TRUE(t->Is<I32>());
@ -51,7 +51,7 @@ TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) {
} }
TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) { TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) {
Manager tm; TypeManager tm;
Type* t = tm.Get<I32>(); Type* t = tm.Get<I32>();
ASSERT_NE(t, nullptr); ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->Is<I32>()); EXPECT_TRUE(t->Is<I32>());
@ -63,7 +63,7 @@ TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) {
} }
TEST_F(TypeManagerTest, Find) { TEST_F(TypeManagerTest, Find) {
Manager tm; TypeManager tm;
auto* created = tm.Get<I32>(); auto* created = tm.Get<I32>();
EXPECT_EQ(tm.Find<U32>(), nullptr); EXPECT_EQ(tm.Find<U32>(), nullptr);
@ -71,8 +71,8 @@ TEST_F(TypeManagerTest, Find) {
} }
TEST_F(TypeManagerTest, WrapDoesntAffectInner) { TEST_F(TypeManagerTest, WrapDoesntAffectInner) {
Manager inner; TypeManager inner;
Manager outer = Manager::Wrap(inner); TypeManager outer = TypeManager::Wrap(inner);
inner.Get<I32>(); inner.Get<I32>();