Skip to content

[Swiftify] Copy doc comment from clang node (#81584) #81640

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
May 30, 2025

Conversation

hnrklssn
Copy link
Contributor

  • Explanation:
    Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however.

This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia.

For now the comment is not altered at all, meaning @param still remains even if the parameter is removed.

@hnrklssn hnrklssn requested a review from a team as a code owner May 20, 2025 15:15
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

@hnrklssn hnrklssn requested a review from DougGregor May 20, 2025 15:16
@hnrklssn hnrklssn force-pushed the swiftify-doccoment-6.2 branch from 17221f1 to 3bbf785 Compare May 24, 2025 00:11
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

@hnrklssn hnrklssn force-pushed the swiftify-doccoment-6.2 branch from 3bbf785 to c9d51aa Compare May 29, 2025 00:57
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

Swift nodes imported from clang don't have doc comments carried over,
but IDEs are clever enough to fetch the comments from the associated
clang node. The swift node in the macro expansion from _SwiftifyImport
doesn't have a clang node directly associated with it however.

This patch adds the same comment from the clang node to the
_SwiftifyImport macro invocation node. Since the macro has access to
this node, it can easily copy over its leading trivia.

For now the comment is not altered at all, meaning @param still remains
even if the parmeter is removed.

rdar://151346977
(cherry picked from commit 6534b9b)
@hnrklssn hnrklssn force-pushed the swiftify-doccoment-6.2 branch from c9d51aa to 341ee51 Compare May 29, 2025 07:20
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

@hnrklssn hnrklssn merged commit 509871e into swiftlang:release/6.2 May 30, 2025
5 checks passed
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.

3 participants