Skip to content

Commit da65826

Browse files
committed
[SILGen] Remove an obsolete linking hack
We already make sure @objc entry-points aren't optimized out.
1 parent 0f40089 commit da65826

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/SIL/IR/SILDeclRef.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,11 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
233233
return forDefinition ? linkage : addExternalToLinkage(linkage);
234234
};
235235

236-
// Native function-local declarations have shared linkage.
237-
// FIXME: @objc declarations should be too, but we currently have no way
238-
// of marking them "used" other than making them external.
236+
// Function-local declarations have private linkage, unless serialized.
239237
ValueDecl *d = getDecl();
240238
DeclContext *moduleContext = d->getDeclContext();
241239
while (!moduleContext->isModuleScopeContext()) {
242-
if (!isForeign && moduleContext->isLocalContext()) {
240+
if (moduleContext->isLocalContext()) {
243241
return isSerialized() ? SILLinkage::Shared : SILLinkage::Private;
244242
}
245243
moduleContext = moduleContext->getParent();

test/IRGen/objc_local.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %build-irgen-test-overlays
33
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
4+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -O | %FileCheck %s
45

56
// REQUIRES: objc_interop
67

0 commit comments

Comments
 (0)