Skip to content

Store the type parameters of bound generics in the debug info. #31118

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 2 commits into from
Apr 21, 2020

Conversation

adrian-prantl
Copy link
Contributor

This is needed to anchor any type aliases that appear in bound generic parameters in the debug info so they can be resolved in the typeref-based part of the debugger without needing to query the Swift module.

This fixes the TestSwiftBridgedArray.py test in swiftlang/llvm-project#1090.

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 68d52af28f2d1a221bdf4e8ff3aa64d1fbe2c09b

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 68d52af28f2d1a221bdf4e8ff3aa64d1fbe2c09b

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 68d52af28f2d1a221bdf4e8ff3aa64d1fbe2c09b

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 68d52af28f2d1a221bdf4e8ff3aa64d1fbe2c09b

assert(!DbgTy.isContextArchetype() && "type metadata cannot contain an archetype");
return DbgTy;
}

DebugTypeInfo DebugTypeInfo::getForwardDecl(swift::Type Ty) {
DebugTypeInfo DbgTy(Ty.getPointer(), nullptr, {}, Alignment(1), true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wdyt of making StorageType private in DebugTypeInfo and add a getter for it? This could assert if the field is null and the size is known?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in the second commit.

This is needed to anchor any typedefs that appear in bound generic parameters so
they can be resolved in the typeref-based part of the debugger without needing
to query the Swift module.
Copy link
Member

@dcci dcci left a comment

Choose a reason for hiding this comment

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

I think this is fine, if Vedant is happy with it.

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 68d52af28f2d1a221bdf4e8ff3aa64d1fbe2c09b

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 68d52af28f2d1a221bdf4e8ff3aa64d1fbe2c09b

@vedantk
Copy link
Contributor

vedantk commented Apr 21, 2020

LGTM! I hear from Mishal that CI is having some trouble today though..

@adrian-prantl
Copy link
Contributor Author

@swift-ci smoke test

1 similar comment
@adrian-prantl
Copy link
Contributor Author

@swift-ci smoke test

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 8ef2178

@adrian-prantl
Copy link
Contributor Author

@swift-ci smoke test

@adrian-prantl adrian-prantl merged commit d4112d9 into swiftlang:master Apr 21, 2020
Comment on lines +1016 to +1017
TemplateParams.push_back(DBuilder.createTemplateTypeParameter(
TheCU, "", getOrCreateType(DebugTypeInfo::getForwardDecl(Param))));
Copy link
Contributor

Choose a reason for hiding this comment

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

On master-next createTemplateTypeParameter has a fourth parameter IsDefault (added in https://reviews.llvm.org/D73462 / swiftlang/llvm-project@7a42bab).

What's the right value to pass there to fix the master-next build?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

false. Sorry!

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries. Thanks for the confirmation. :-)

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.

5 participants