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
[Serialization] Force destructor creation for imported class for SIB deserialization #33255
[Serialization] Force destructor creation for imported class for SIB deserialization #33255
Conversation
a8e8bac
to
ff0d742
Compare
Is this ready for review and CI runs? |
@MaxDesiatov Yes 👍 |
@swift-ci please test |
Build failed |
Build failed |
ff0d742
to
f40d6c1
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test Windows platform |
@slavapestov Would you mind to take a look at this change? |
@gottesmm @brentdax @slavapestov This change will unblock another lto work, so it will make the project move forward if this PR move forward. 🙏 |
assert(isa<ClassDecl>(nominal)); | ||
// Force creation of an implicit destructor | ||
auto CD = dyn_cast<ClassDecl>(nominal); | ||
(void) CD->getDestructor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just adding the destructor to the values vector and skipping the second lookup below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I updated.
Swift class deinit decl can be implicitly synthesized when emitting swiftmodule, so swiftmodule always have deinit decl. So resolution of x-refs to deinit of swift class always success. But when x-refs points deinit of clang imported class, it always failed because clang importer doesn't force to synthesize deinit before looking up. x-refs to deinit decl appears in only deinit of its subclasses, so it's serialized only when deinit have body. And deinit has body only on SIB because deinit is always non-inlinable. It means that this missing of deinit creation can be problem only on SIB This commit changes to force to synthesize class deinit decl before looking up members.
f40d6c1
to
878efac
Compare
@swift-ci please test |
@swift-ci please smoke test |
@swift-ci smoke test |
@swift-ci please smoke test |
@slavapestov @DougGregor Thanks for your reviews! Would you mind merging this patch? |
Swift class deinit decl can be implicitly synthesized when emitting swiftmodule, so swiftmodule always have deinit decl. So resolution of x-refs to deinit of swift class always success.
But when x-refs points deinit of clang imported class, it always failed because clang importer doesn't force to synthesize deinit before looking up.
x-refs to deinit decl appears in only deinit of its subclasses, so it's serialized only when deinit have body. And deinit has body only on SIB because deinit is always non-inlinable.
It means that this missing of deinit creation can be problem only on SIB.
This commit changes to force to synthesize class deinit decl before looking up members.