Objective-C,C++: Rework metadata generation
Improves Objective-C metadata generation by adding indices and type information.
This commit refactors the generation of Objective-C metadata, which describes module properties to the runtime. The metadata, represented by CONSTRUCTORS, needs to be preserved even if seemingly unused during Link-Time Optimization (LTO), as the runtime actively uses it.
Previously, these metadata CONSTRUCTORS lacked proper indices and typing. This change introduces a more robust mechanism for generating metadata objects with correct indices (numerical or structure member references) and appropriate data types. Internal APIs for metadata construction have also been renamed for clarity.
In Details
Refactors the generation of Objective-C metadata, specifically its CONSTRUCTORS. These are compile-time literals but not compile-time constants, as the runtime modifies them. They must be preserved across LTO. The rework addresses missing indices (numerical for arrays, structure member refs for structs) and proper typing for initializer elements within these metadata constructors. Internal APIs related to metadata object construction have been renamed to identify them explicitly as metadata builders.
- Objective-C
- An object-oriented programming language, a superset of C, widely used in Apple's macOS and iOS development.
- Metadata
- Data that provides information about other data. In this context, it's data that describes Objective-C classes, protocols, and methods to the runtime system.
- LTO (Link-Time Optimization)
- An optimization process where the linker performs optimizations across multiple object files, rather than just within a single file. This allows for more aggressive whole-program optimization.
- Runtime
- The environment in which a program executes. For Objective-C, the runtime handles dynamic features like message sending and object creation.