Skip to content

Commit dec54dd

Browse files
committed
IRGen: compute locality for type metadata accessor
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.
1 parent b6918a3 commit dec54dd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,11 @@ LinkInfo LinkInfo::get(const UniversalLinkageInfo &linkInfo,
23772377
// types to be referenced directly.
23782378
if (const auto *MD = entity.getSILFunction()->getParentModule())
23792379
isKnownLocal = MD == swiftModule || MD->isStaticLibrary();
2380+
} else if (entity.isTypeMetadataAccessFunction()) {
2381+
if (NominalTypeDecl *NTD = entity.getType()->getAnyNominal()) {
2382+
const ModuleDecl *MD = NTD->getDeclContext()->getParentModule();
2383+
isKnownLocal = MD == swiftModule || MD->isStaticLibrary();
2384+
}
23802385
}
23812386

23822387
bool weakImported = entity.isWeakImported(swiftModule);

0 commit comments

Comments
 (0)