diff --git a/fuzzers/tint_ast_clone_fuzzer.cc b/fuzzers/tint_ast_clone_fuzzer.cc index 6c339e982a..7b5f951f83 100644 --- a/fuzzers/tint_ast_clone_fuzzer.cc +++ b/fuzzers/tint_ast_clone_fuzzer.cc @@ -64,18 +64,18 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // Check that none of the AST nodes or type pointers in dst are found in src std::unordered_set src_nodes; - for (auto* src_node : src.nodes()) { + for (auto* src_node : src.Nodes().Objects()) { src_nodes.emplace(src_node); } std::unordered_set 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 b32c577eef..f76bf0d945 100644 --- a/src/ast/module_clone_test.cc +++ b/src/ast/module_clone_test.cc @@ -123,19 +123,18 @@ fn main() -> void { // Check that none of the AST nodes or type pointers in dst are found in src std::unordered_set src_nodes; - for (auto* src_node : src.nodes()) { + for (auto* src_node : src.Nodes().Objects()) { src_nodes.emplace(src_node); } std::unordered_set 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 aa0e63c686..0fe0bb6ec4 100644 --- a/src/program.h +++ b/src/program.h @@ -118,19 +118,6 @@ class Program { return types_.Get(std::forward(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& types() { - return types_.types(); - } - - /// @returns all the declared nodes in the program - /// [DEPRECATED]: Use Nodes().Objects() - BlockAllocator::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 302a3c7a3a..b157328260 100644 --- a/src/type/type_manager.h +++ b/src/type/type_manager.h @@ -65,7 +65,7 @@ class Manager { /// Returns the type map /// @returns the mapping from name string to type. - const std::unordered_map& types() { + const std::unordered_map& types() const { return by_name_; } diff --git a/src/type_determiner.cc b/src/type_determiner.cc index 22ca44b84e..edbed10f9d 100644 --- a/src/type_determiner.cc +++ b/src/type_determiner.cc @@ -101,9 +101,8 @@ void TypeDeterminer::set_referenced_from_function_if_needed(ast::Variable* var, bool TypeDeterminer::Determine() { std::vector storage_textures; - for (auto& it : program_->types()) { - if (auto* storage = - it.second->UnwrapIfNeeded()->As()) { + for (auto* ty : program_->Types()) { + if (auto* storage = ty->UnwrapIfNeeded()->As()) { storage_textures.emplace_back(storage); } }