Skip to content

[PrintAsClang] Ensure that all macro-generated decls get printed. #77224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

allevato
Copy link
Member

Some macro-generated declarations are not being printed in the Obj-C/C++ generated header. Members introduced by attached member macros on a type appear to be fine, but those introduced by a attached peer or freestanding declaration macros don't show up.

This change updates the header writer to call getAllMembers throughout instead of getMembers, which makes sure that everything gets collected. Likewise, we update the top-level logic from getTopLevelDecls to getTopLevelDeclsWithAuxiliaryDecls to pick up freestanding decls introduced at file scope.

Fixes #68170.

Some macro-generated declarations are not being printed in the
Obj-C/C++ generated header. Members introduced by attached `member`
macros on a type appear to be fine, but those introduced by a
attached `peer` or freestanding `declaration` macros don't show up.

This change updates the header writer to call `getAllMembers`
throughout instead of `getMembers`, which makes sure that everything
gets collected. Likewise, we update the top-level logic from
`getTopLevelDecls` to `getTopLevelDeclsWithAuxiliaryDecls` to pick
up freestanding decls introduced at file scope.

Fixes swiftlang#68170.
@allevato
Copy link
Member Author

@swift-ci please smoke test

@allevato allevato requested a review from beccadax October 28, 2024 17:15
@allevato
Copy link
Member Author

allevato commented Nov 7, 2024

Friendly ping; can someone please take a look at this? @DougGregor @beccadax

@DougGregor
Copy link
Member

This looks great, @allevato , thank you for the ping and my apologies for missing it. Please feel free to merge.

@allevato allevato merged commit fe6703b into swiftlang:main Nov 7, 2024
3 checks passed
@allevato allevato deleted the macro-objc branch November 7, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swift compiler doesn't produce visible objc interface with the @attached(peer) macro
2 participants