Skip to content

[ClangImporter] Break cycle in IAM extensions #71027

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
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9043,6 +9043,11 @@ ClangImporter::Implementation::importDeclContextOf(
nominal->getDeclaredType());
SwiftContext.evaluator.cacheOutput(ExtendedNominalRequest{ext},
std::move(nominal));

// Record this extension so we can find it later. We do this early because
// once we've set the member loader, we don't know when the compiler will use
// it and end up back in this method.
extensionPoints[extensionKey] = ext;
ext->setMemberLoader(this, reinterpret_cast<uintptr_t>(declSubmodule));

if (auto protoDecl = ext->getExtendedProtocolDecl()) {
Expand All @@ -9052,8 +9057,6 @@ ClangImporter::Implementation::importDeclContextOf(
// Add the extension to the nominal type.
nominal->addExtension(ext);

// Record this extension so we can find it later.
extensionPoints[extensionKey] = ext;
return ext;
}

Expand Down