Skip to content

[DebugInfo] Use underlying type of global variables with opaque type #80380

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
Apr 3, 2025

Conversation

augusto2112
Copy link
Contributor

rdar://144881938

@augusto2112
Copy link
Contributor Author

@swift-ci test

@@ -3869,6 +3869,14 @@ void IRGenDebugInfoImpl::emitGlobalVariableDeclaration(
if (Opts.DebugInfoLevel <= IRGenDebugInfoLevel::LineTables)
return;

// If this global variable contains an opaque type, replace it with its
// underlying type.
if (auto UnderlyingType = IGM.substOpaqueTypesWithUnderlyingTypes(
Copy link
Contributor

Choose a reason for hiding this comment

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

substOpaqueTypesWithUnderlyingTypes never returns null, so this if statement is always taken

Copy link
Contributor

Choose a reason for hiding this comment

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

And it's a noop for all other types?

if (auto UnderlyingType = IGM.substOpaqueTypesWithUnderlyingTypes(
DbgTy.getType()->getCanonicalType())) {
auto &TI = IGM.getTypeInfoForUnlowered(UnderlyingType);
DbgTy = DebugTypeInfo::getFromTypeInfo(UnderlyingType, TI, IGM);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we still don't want to do this all the time.

@augusto2112
Copy link
Contributor Author

@augusto2112
Copy link
Contributor Author

@augusto2112 augusto2112 merged commit cac0abb into swiftlang:main Apr 3, 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