mirror of
https://github.com/apple/swift.git
synced 2026-10-28 21:15:56 +01:00
Macro constants do not have Clang declarations, so APINotes `Globals` metadata cannot be applied through the normal declaration processing path. When importing a macro constant, preserve the macro's `IdentifierInfo` and owning Clang module, and ask Clang Sema whether APINotes provides a replacement type for that macro name. The owning module is needed for module APINotes sidecars such as `WinSDK.apinotes`; location-only lookup can otherwise fall back to directory `APINotes.apinotes` lookup and miss typed macro annotations. Thread the macro identifier through the importer so recursive macro aliases continue to use the originally imported macro name for APINotes lookup while still resolving through to the target macro value. Add APINotes coverage for typed macro constants, including an alias whose target has a different APINotes type. This verifies both that the alias keeps its own APINotes type and that it materializes the resolved target value.