Skip to content

Commit

Permalink
IRGen: compute locality for type metadata accessor
Browse files Browse the repository at this point in the history
We previously did not properly compute the link info for type metadata
accessor. This becomes a problem for metadata accessors which are
canonically remote (e.g. the type metadata accessor for `NSError`). This
fixes the incorrect DLLStorage that was being attributed to these
functions.
  • Loading branch information
compnerd committed Mar 8, 2025
1 parent b6918a3 commit dec54dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/IRGen/GenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2377,6 +2377,11 @@ LinkInfo LinkInfo::get(const UniversalLinkageInfo &linkInfo,
// types to be referenced directly.
if (const auto *MD = entity.getSILFunction()->getParentModule())
isKnownLocal = MD == swiftModule || MD->isStaticLibrary();
} else if (entity.isTypeMetadataAccessFunction()) {
if (NominalTypeDecl *NTD = entity.getType()->getAnyNominal()) {
const ModuleDecl *MD = NTD->getDeclContext()->getParentModule();
isKnownLocal = MD == swiftModule || MD->isStaticLibrary();
}
}

bool weakImported = entity.isWeakImported(swiftModule);
Expand Down

0 comments on commit dec54dd

Please sign in to comment.