Skip to content
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

Generate doc comment when type alias is hidden #3122

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jschwe
Copy link
Contributor

@jschwe jschwe commented Feb 8, 2025

If a type is not documented, but a type alias with the same canonical path is, then generate the
documentation of the type alias onto the type, since otherwise it would be lost.

Fixes #3119

If a type is not documented, but a type alias with
the same canonical path is, then generate the
documentation of the typealias onto the type,
since otherwise it would be lost.
}
let type_alias_comment = ctx
.items()
.filter(|(_id, alias)| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Iterating over all items seems not really fine, performance wise. Can we avoid it somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm - I think since we are using this fallback for the case where typedef and struct declaration are at the same time, a potential type alias should always be at item_id + 1. I don't think we currently have a way to access the "next" item or do arithmetic on item ids, but this would avoid iterating through all items.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can do it the other way around? During the clang phase, go peek at the typedef's comment? Haven't tried it tho.

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.

Comments are not generated for typedef struct forward declaration.
2 participants