Skip to content

Commit a70a76e

Browse files
committed
IRGen: compute locality for type declarations
We previously did not properly compute the link info for type declarations. 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 cc14548 commit a70a76e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,12 @@ 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.isTypeKind()) {
2381+
if (NominalTypeDecl *NTD = entity.getType().getAnyNominal()) {
2382+
const ModuleDecl *MD =
2383+
NTD->getDecl()->getDeclContext()->getParentModule();
2384+
isKnownLocal = MD == swiftModule || MD->isStaticLibrary();
2385+
}
23802386
}
23812387

23822388
bool weakImported = entity.isWeakImported(swiftModule);

0 commit comments

Comments
 (0)