gccrs: Add impl-item-name indexes for method resolution.
Introduces indexes for impl-item names to speed up method resolution.
This commit adds new indexes for implementation item names within gccrs, specifically enhancing the rust-hir-map utility. These indexes are used in rust-hir-dot-operator.cc to improve the efficiency of method resolution, allowing the compiler to more quickly find associated functions or methods within trait implementations.
In Details
The Mappings struct in util/rust-hir-map.cc and util/rust-hir-map.h has been extended with new functions (insert_hir_impl_block, insert_trait_item_mapping) to create and manage indexes based on implementation item names. The rust-hir-dot-operator.cc file is updated to leverage these indexes during method resolution, which is part of the process for resolving trait method calls and associated function calls.
- impl-item-name indexes
- Data structures that map names of items within Rust implementation blocks (impl blocks) to their corresponding definitions. These indexes speed up the process of finding methods or associated functions.
- method resolution
- The process by which the compiler determines which specific method or function to call when a method-like syntax is used (e.g.,
my_object.my_method()). This involves considering traits and inherent implementations. - impl block
- A Rust code block used to define methods or associated functions for a specific type or to implement a trait for a type.