Skip to content

[Debug info] Retain all type aliases in asttypes mode #78901

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 3 commits into from
Jan 29, 2025

Conversation

adrian-prantl
Copy link
Contributor

Bound generic types don't reference their type parameters in ASTTypes mode, so we need to artificially keep typealiases alive, since they can appear in reflection metadata.

rdar://143595521

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

// mode, so we need to artificially keep typealiases alive, since they can
// appear in reflection metadata.
if (Opts.DebugInfoLevel < IRGenDebugInfoLevel::DwarfTypes)
DBuilder.retainType(TypeDef);
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought retainType would retain the type in the IR but not in DWARF, am I wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, does dsymutil keep them too? I think maybe that's what I was remembering. LGTM if yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should not, that's a great point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is a better solution that builds on top of #78965.

Copy link
Contributor

@augusto2112 augusto2112 left a comment

Choose a reason for hiding this comment

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

LGTM if dsymutil keeps the retained types.

This cleanup allows for more consistent debug info emission since we depend less
on IRGen magic to emit debug info for types.
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

…ST types

This ensures that debug info for these types is emitted even if this is the only
way they are references in the input program.

rdar://143595521
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit a5dddce into swiftlang:main Jan 29, 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.

2 participants