gccrs: Use single node ID for all builtin types
gccrs assigns a consistent node ID to all builtin types to resolve multi-crate issues.
gccrs now assigns a single, consistent node ID and HIR ID to all builtin types, regardless of where they are created. This addresses an issue where resolving multiple crates led to duplicate node IDs for the same builtin types. By using a singleton to store these IDs, the compiler ensures type consistency across different crate resolutions.
In Details
This commit introduces a singleton pattern within gccrs to manage the node and HIR IDs for builtin types. Previously, when resolving multiple crates, identical builtin types could be assigned distinct node IDs. This change centralizes the creation and retrieval of these IDs, ensuring that all instances of a builtin type (e.g., TYPE0, TYPE1) share the same internal representation across different crate resolutions, simplifying type equivalence checks.
- gccrs
- The Rust frontend for GCC, enabling the compilation of Rust code using the GCC compiler infrastructure.
- node ID
- An identifier for a node in the compiler's internal representation, such as the Abstract Syntax Tree (AST) or the High-level Intermediate Representation (HIR).
- HIR
- High-level Intermediate Representation. A representation of the code that is closer to the source code's structure than lower-level IRs, used in the Rust compiler.
- builtin type
- Predefined types in a programming language, such as integers, floats, booleans, and characters, that are part of the language's core definition.
- crate
- A compilation unit in Rust, analogous to a library or executable.