Rename TypeManager to Manager.

With the move to the type:: hierarchy rename type::TypeManager to
type::Manager.

Bug: tint:1718
Change-Id: I1c8e2c2e469e20b959676232e9f3d62c9b3a789e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113429
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-12-09 05:00:07 +00:00 committed by Dawn LUCI CQ
parent 0dc71406da
commit 837b8042d3
11 changed files with 47 additions and 47 deletions

View File

@ -34,7 +34,7 @@
#include "src/tint/transform/single_entry_point.h"
#include "src/tint/transform/substitute_override.h"
#include "src/tint/transform/vertex_pulling.h"
#include "src/tint/type/type_manager.h"
#include "src/tint/type/manager.h"
#include "src/tint/writer/flatten_bindings.h"
#include "src/tint/writer/writer.h"

View File

@ -564,6 +564,7 @@ libtint_source_set("libtint_core_all_src") {
"type/f16.h",
"type/f32.h",
"type/i32.h",
"type/manager.h",
"type/matrix.h",
"type/multisampled_texture.h",
"type/node.h",
@ -576,7 +577,6 @@ libtint_source_set("libtint_core_all_src") {
"type/struct.h",
"type/texture.h",
"type/type.h",
"type/type_manager.h",
"type/u32.h",
"type/vector.h",
"type/void.h",
@ -721,6 +721,8 @@ libtint_source_set("libtint_type_src") {
"type/f32.h",
"type/i32.cc",
"type/i32.h",
"type/manager.cc",
"type/manager.h",
"type/matrix.cc",
"type/matrix.h",
"type/multisampled_texture.cc",
@ -745,8 +747,6 @@ libtint_source_set("libtint_type_src") {
"type/texture.h",
"type/type.cc",
"type/type.h",
"type/type_manager.cc",
"type/type_manager.h",
"type/u32.cc",
"type/u32.h",
"type/vector.cc",
@ -1223,6 +1223,7 @@ if (tint_build_unittests) {
"type/f16_test.cc",
"type/f32_test.cc",
"type/i32_test.cc",
"type/manager_test.cc",
"type/matrix_test.cc",
"type/multisampled_texture_test.cc",
"type/pointer_test.cc",
@ -1233,7 +1234,6 @@ if (tint_build_unittests) {
"type/storage_texture_test.cc",
"type/struct_test.cc",
"type/texture_test.cc",
"type/type_manager_test.cc",
"type/type_test.cc",
"type/u32_test.cc",
"type/vector_test.cc",

View File

@ -478,6 +478,8 @@ list(APPEND TINT_LIB_SRCS
type/f32.h
type/i32.cc
type/i32.h
type/manager.cc
type/manager.h
type/matrix.cc
type/matrix.h
type/multisampled_texture.cc
@ -500,8 +502,6 @@ list(APPEND TINT_LIB_SRCS
type/texture.h
type/type.cc
type/type.h
type/type_manager.cc
type/type_manager.h
type/u32.cc
type/u32.h
type/vector.cc
@ -942,6 +942,7 @@ if(TINT_BUILD_TESTS)
type/f16_test.cc
type/f32_test.cc
type/i32_test.cc
type/manager_test.cc
type/matrix_test.cc
type/multisampled_texture_test.cc
type/pointer_test.cc
@ -952,7 +953,6 @@ if(TINT_BUILD_TESTS)
type/struct_test.cc
type/texture_test.cc
type/type_test.cc
type/type_manager_test.cc
type/u32_test.cc
type/vector_test.cc
utils/bitcast_test.cc

View File

@ -23,7 +23,7 @@
#include "src/tint/sem/constant.h"
#include "src/tint/sem/info.h"
#include "src/tint/symbol_table.h"
#include "src/tint/type/type_manager.h"
#include "src/tint/type/manager.h"
// Forward Declarations
namespace tint {
@ -73,7 +73,7 @@ class Program {
ast::NodeID HighestASTNodeID() const { return highest_node_id_; }
/// @returns a reference to the program's types
const type::TypeManager& Types() const {
const type::Manager& Types() const {
AssertNotMoved();
return types_;
}
@ -180,7 +180,7 @@ class Program {
ProgramID id_;
ast::NodeID highest_node_id_;
type::TypeManager types_;
type::Manager types_;
ASTNodeAllocator ast_nodes_;
SemNodeAllocator sem_nodes_;
ConstantAllocator constant_nodes_;

View File

@ -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_ = type::TypeManager::Wrap(program->Types());
builder.types_ = type::Manager::Wrap(program->Types());
builder.ast_ =
builder.create<ast::Module>(program->AST().source, program->AST().GlobalDeclarations());
builder.sem_ = sem::Info::Wrap(program->Sem());

View File

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

View File

@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/tint/type/type_manager.h"
#include "src/tint/type/manager.h"
namespace tint::type {
TypeManager::TypeManager() = default;
TypeManager::TypeManager(TypeManager&&) = default;
TypeManager& TypeManager::operator=(TypeManager&& rhs) = default;
TypeManager::~TypeManager() = default;
Manager::Manager() = default;
Manager::Manager(Manager&&) = default;
Manager& Manager::operator=(Manager&& rhs) = default;
Manager::~Manager() = default;
} // namespace tint::type

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SRC_TINT_TYPE_TYPE_MANAGER_H_
#define SRC_TINT_TYPE_TYPE_MANAGER_H_
#ifndef SRC_TINT_TYPE_MANAGER_H_
#define SRC_TINT_TYPE_MANAGER_H_
#include <functional>
#include <string>
@ -29,24 +29,24 @@
namespace tint::type {
/// The type manager holds all the pointers to the known types.
class TypeManager final {
class Manager final {
public:
/// Iterator is the type returned by begin() and end()
using TypeIterator = utils::BlockAllocator<Type>::ConstIterator;
/// Constructor
TypeManager();
Manager();
/// Move constructor
TypeManager(TypeManager&&);
Manager(Manager&&);
/// Move assignment operator
/// @param rhs the Manager to move
/// @return this Manager
TypeManager& operator=(TypeManager&& rhs);
Manager& operator=(Manager&& rhs);
/// Destructor
~TypeManager();
~Manager();
/// Wrap returns a new Manager created with the types of `inner`.
/// The Manager returned by Wrap is intended to temporarily extend the types
@ -57,8 +57,8 @@ class TypeManager final {
/// function. See crbug.com/tint/460.
/// @param inner the immutable Manager to extend
/// @return the Manager that wraps `inner`
static TypeManager Wrap(const TypeManager& inner) {
TypeManager out;
static Manager Wrap(const Manager& inner) {
Manager out;
out.types_.Wrap(inner.types_);
out.nodes_.Wrap(inner.nodes_);
return out;
@ -149,4 +149,4 @@ struct equal_to<tint::type::Node> {
} // namespace std
#endif // SRC_TINT_TYPE_TYPE_MANAGER_H_
#endif // SRC_TINT_TYPE_MANAGER_H_

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/tint/type/type_manager.h"
#include "src/tint/type/manager.h"
#include "gtest/gtest.h"
#include "src/tint/type/i32.h"
@ -31,17 +31,17 @@ size_t count(const T& range_loopable) {
return n;
}
using TypeManagerTest = testing::Test;
using ManagerTest = testing::Test;
TEST_F(TypeManagerTest, GetUnregistered) {
TypeManager tm;
TEST_F(ManagerTest, GetUnregistered) {
Manager tm;
auto* t = tm.Get<I32>();
ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->Is<I32>());
}
TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) {
TypeManager tm;
TEST_F(ManagerTest, GetSameTypeReturnsSamePtr) {
Manager tm;
auto* t = tm.Get<I32>();
ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->Is<I32>());
@ -50,8 +50,8 @@ TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) {
EXPECT_EQ(t, t2);
}
TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) {
TypeManager tm;
TEST_F(ManagerTest, GetDifferentTypeReturnsDifferentPtr) {
Manager tm;
Type* t = tm.Get<I32>();
ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->Is<I32>());
@ -62,17 +62,17 @@ TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) {
EXPECT_TRUE(t2->Is<U32>());
}
TEST_F(TypeManagerTest, Find) {
TypeManager tm;
TEST_F(ManagerTest, Find) {
Manager tm;
auto* created = tm.Get<I32>();
EXPECT_EQ(tm.Find<U32>(), nullptr);
EXPECT_EQ(tm.Find<I32>(), created);
}
TEST_F(TypeManagerTest, WrapDoesntAffectInner) {
TypeManager inner;
TypeManager outer = TypeManager::Wrap(inner);
TEST_F(ManagerTest, WrapDoesntAffectInner) {
Manager inner;
Manager outer = Manager::Wrap(inner);
inner.Get<I32>();

View File

@ -48,7 +48,7 @@ std::string StorageTexture::FriendlyName(const SymbolTable&) const {
return out.str();
}
Type* StorageTexture::SubtypeFor(ast::TexelFormat format, TypeManager& type_mgr) {
Type* StorageTexture::SubtypeFor(ast::TexelFormat format, Manager& type_mgr) {
switch (format) {
case ast::TexelFormat::kR32Uint:
case ast::TexelFormat::kRgba8Uint:

View File

@ -23,7 +23,7 @@
// Forward declarations
namespace tint::type {
class TypeManager;
class Manager;
} // namespace tint::type
namespace tint::type {
@ -67,9 +67,9 @@ class StorageTexture final : public Castable<StorageTexture, Texture> {
std::string FriendlyName(const SymbolTable& symbols) const override;
/// @param format the storage texture image format
/// @param type_mgr the TypeManager used to build the returned type
/// @param type_mgr the Manager used to build the returned type
/// @returns the storage texture subtype for the given TexelFormat
static Type* SubtypeFor(ast::TexelFormat format, TypeManager& type_mgr);
static Type* SubtypeFor(ast::TexelFormat format, Manager& type_mgr);
private:
ast::TexelFormat const texel_format_;