Skip to content

Commit 12469f5

Browse files
committed
IRGen: Always emit class stubs for classes with resilient ancestry
This logic is no longer guarded by a flag. Sema will still emit certain diagnostics if the flag is not specified though. Progress on <rdar://problem/49090631>.
1 parent 97be86b commit 12469f5

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/IRGen/GenClass.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,6 @@ namespace {
12111211
// hierarchy crosses resilience domains, we use a
12121212
// slightly different query here.
12131213
if (theClass->checkAncestry(AncestryFlags::ResilientOther)) {
1214-
assert(IGM.Context.LangOpts.EnableObjCResilientClassStubs);
12151214
return IGM.getAddrOfObjCResilientClassStub(theClass, NotForDefinition,
12161215
TypeMetadataAddress::AddressPoint);
12171216
}
@@ -2072,9 +2071,7 @@ static llvm::Function *emitObjCMetadataUpdateFunction(IRGenModule &IGM,
20722071
/// does not have statically-emitted metadata.
20732072
bool irgen::hasObjCResilientClassStub(IRGenModule &IGM, ClassDecl *D) {
20742073
assert(IGM.getClassMetadataStrategy(D) == ClassMetadataStrategy::Resilient);
2075-
return (!D->isGenericContext() &&
2076-
IGM.ObjCInterop &&
2077-
IGM.Context.LangOpts.EnableObjCResilientClassStubs);
2074+
return IGM.ObjCInterop && !D->isGenericContext();
20782075
}
20792076

20802077
void irgen::emitObjCResilientClassStub(IRGenModule &IGM, ClassDecl *D) {

lib/TBDGen/TBDGen.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,16 @@ void TBDGenVisitor::visitClassDecl(ClassDecl *CD) {
379379

380380
visitNominalTypeDecl(CD);
381381

382+
bool resilientAncestry = CD->checkAncestry(AncestryFlags::ResilientOther);
383+
382384
// Types with resilient superclasses have some extra symbols.
383-
if (CD->checkAncestry(AncestryFlags::ResilientOther) ||
384-
CD->hasResilientMetadata()) {
385+
if (resilientAncestry || CD->hasResilientMetadata()) {
385386
addSymbol(LinkEntity::forClassMetadataBaseOffset(CD));
387+
}
386388

387-
auto &Ctx = CD->getASTContext();
388-
if (Ctx.LangOpts.EnableObjCResilientClassStubs) {
389+
auto &Ctx = CD->getASTContext();
390+
if (Ctx.LangOpts.EnableObjCInterop) {
391+
if (resilientAncestry) {
389392
addSymbol(LinkEntity::forObjCResilientClassStub(
390393
CD, TypeMetadataAddress::AddressPoint));
391394
}

test/Interpreter/objc_class_resilience_stubs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -enable-library-evolution %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule
44
// RUN: %target-codesign %t/%target-library-name(resilient_struct)
55

6-
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_objc_class)) -I %t -L %t -lresilient_struct -enable-library-evolution %S/../Inputs/resilient_objc_class.swift -emit-module -emit-module-path %t/resilient_objc_class.swiftmodule -Xfrontend -enable-resilient-objc-class-stubs
6+
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_objc_class)) -I %t -L %t -lresilient_struct -enable-library-evolution %S/../Inputs/resilient_objc_class.swift -emit-module -emit-module-path %t/resilient_objc_class.swiftmodule
77
// RUN: %target-codesign %t/%target-library-name(resilient_objc_class)
88

99
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_objc_class -o %t/main %target-rpath(%t) -Xfrontend -enable-resilient-objc-class-stubs

0 commit comments

Comments
 (0)