Program: Remove deprecated types and nodes methods
Fixup all usages
Bug: tint:390
Change-Id: I14c9a0420be7da2d26bf21bce96ca0ded0978711
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38548
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/fuzzers/tint_ast_clone_fuzzer.cc b/fuzzers/tint_ast_clone_fuzzer.cc
index 6c339e9..7b5f951 100644
--- a/fuzzers/tint_ast_clone_fuzzer.cc
+++ b/fuzzers/tint_ast_clone_fuzzer.cc
@@ -64,18 +64,18 @@
// Check that none of the AST nodes or type pointers in dst are found in src
std::unordered_set<tint::ast::Node*> src_nodes;
- for (auto* src_node : src.nodes()) {
+ for (auto* src_node : src.Nodes().Objects()) {
src_nodes.emplace(src_node);
}
std::unordered_set<tint::type::Type*> src_types;
- for (auto& src_type : src.types()) {
- src_types.emplace(src_type.second);
+ for (auto* src_type : src.Types()) {
+ src_types.emplace(src_type);
}
- for (auto* dst_node : dst.nodes()) {
+ for (auto* dst_node : dst.Nodes().Objects()) {
ASSERT_EQ(src_nodes.count(dst_node), 0u);
}
- for (auto& dst_type : dst.types()) {
- ASSERT_EQ(src_types.count(dst_type.second), 0u);
+ for (auto* dst_type : dst.Types()) {
+ ASSERT_EQ(src_types.count(dst_type), 0u);
}
// Regenerate the wgsl for the src program. We use this instead of the
diff --git a/src/ast/module_clone_test.cc b/src/ast/module_clone_test.cc
index b32c577..f76bf0d 100644
--- a/src/ast/module_clone_test.cc
+++ b/src/ast/module_clone_test.cc
@@ -123,19 +123,18 @@
// Check that none of the AST nodes or type pointers in dst are found in src
std::unordered_set<ast::Node*> src_nodes;
- for (auto* src_node : src.nodes()) {
+ for (auto* src_node : src.Nodes().Objects()) {
src_nodes.emplace(src_node);
}
std::unordered_set<type::Type*> src_types;
- for (auto& src_type : src.types()) {
- src_types.emplace(src_type.second);
+ for (auto* src_type : src.Types()) {
+ src_types.emplace(src_type);
}
- for (auto* dst_node : dst.nodes()) {
+ for (auto* dst_node : dst.Nodes().Objects()) {
ASSERT_EQ(src_nodes.count(dst_node), 0u) << dst_node->str();
}
- for (auto& dst_type : dst.types()) {
- ASSERT_EQ(src_types.count(dst_type.second), 0u)
- << dst_type.second->type_name();
+ for (auto* dst_type : dst.Types()) {
+ ASSERT_EQ(src_types.count(dst_type), 0u) << dst_type->type_name();
}
// Regenerate the wgsl for the src program. We use this instead of the
diff --git a/src/program.h b/src/program.h
index aa0e63c..0fe0bb6 100644
--- a/src/program.h
+++ b/src/program.h
@@ -118,19 +118,6 @@
return types_.Get<T>(std::forward<ARGS>(args)...);
}
- /// Returns all the declared types in the program
- /// [DEPRECATED]: Use AST().Types().types()
- /// @returns the mapping from name string to type.
- const std::unordered_map<std::string, type::Type*>& types() {
- return types_.types();
- }
-
- /// @returns all the declared nodes in the program
- /// [DEPRECATED]: Use Nodes().Objects()
- BlockAllocator<ast::Node>::ConstView nodes() const {
- return Nodes().Objects();
- }
-
/// Registers `name` as a symbol
/// @param name the name to register
/// @returns the symbol for the `name`. If `name` is already registered the
diff --git a/src/type/type_manager.h b/src/type/type_manager.h
index 302a3c7..b157328 100644
--- a/src/type/type_manager.h
+++ b/src/type/type_manager.h
@@ -65,7 +65,7 @@
/// Returns the type map
/// @returns the mapping from name string to type.
- const std::unordered_map<std::string, type::Type*>& types() {
+ const std::unordered_map<std::string, type::Type*>& types() const {
return by_name_;
}
diff --git a/src/type_determiner.cc b/src/type_determiner.cc
index 22ca44b..edbed10 100644
--- a/src/type_determiner.cc
+++ b/src/type_determiner.cc
@@ -101,9 +101,8 @@
bool TypeDeterminer::Determine() {
std::vector<type::StorageTexture*> storage_textures;
- for (auto& it : program_->types()) {
- if (auto* storage =
- it.second->UnwrapIfNeeded()->As<type::StorageTexture>()) {
+ for (auto* ty : program_->Types()) {
+ if (auto* storage = ty->UnwrapIfNeeded()->As<type::StorageTexture>()) {
storage_textures.emplace_back(storage);
}
}