Skip to content

[5.1] IRGen: Save the current generic signature before mangling an opaque type decl #27022

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

Conversation

aschwaighofer
Copy link
Contributor

It comes with its own generic signature.

Explanation: We crash generating the mangling for an opaque type decl.

Scope of Issue: Affects code that uses opaque result types.
The compiler will crash.

Risk: Low. We cache and restore a generic signature before mangling opaque type
decls which will introduce their own generic signature.

Review: Joe Groff

Testing: Swift regression test added.

rdar://54824119

Master PR: #27017

…aque type decl

It comes with its own generic signature.

Explanation: We crash generating the mangling for an opaque type decl.

Scope of Issue: Affects  code that uses opaque result types.
                The compiler will crash.

Risk: Low. We cache and restore a generic signature before mangling opaque type
     decls which will introduce their own generic signature.

Review: Joe Groff

Testing: Swift regression test added.

rdar://54824119
@aschwaighofer aschwaighofer requested a review from a team as a code owner September 4, 2019 18:37
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Sep 4, 2019

Build failed
Swift Test Linux Platform
Git Sha - b00315b

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@@ -735,7 +735,9 @@ void ASTMangler::appendOpaqueDeclName(const OpaqueTypeDecl *opaqueDecl) {
if (canSymbolicReference(opaqueDecl)) {
appendSymbolicReference(opaqueDecl);
} else if (auto namingDecl = opaqueDecl->getNamingDecl()) {
CanGenericSignature savedSignature = CurGenericSignature;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should CurGenericSignature be a stack then, with an RAII utility to save and restore the signature?

Copy link
Member

Choose a reason for hiding this comment

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

llvm::SaveAndRestore is a good way to indicate what's happening here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@airspeedswift airspeedswift merged commit 53f32e6 into swiftlang:swift-5.1-branch Sep 9, 2019
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