Skip to content

Commit def86ce

Browse files
committed
Revert "[irgen] Force emission of objc class refs for non-foreign clang objc classes whose metadata we use."
This reverts commit 8247525. While correct, it has uncovered several issues in existing code bases that need to be sorted out before we can land it again. Fixes rdar://problem/57846390.
1 parent 22bfebe commit def86ce

20 files changed

+24
-120
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,27 +1281,6 @@ void IRGenerator::noteUseOfTypeGlobals(NominalTypeDecl *type,
12811281
}
12821282
}
12831283

1284-
// Force emission of ObjC class refs used by type refs.
1285-
//
1286-
// Otherwise, autolinking can fail if we try to load the class decl from the
1287-
// name of the class.
1288-
if (auto *classDecl = dyn_cast<ClassDecl>(type)) {
1289-
// The logic behind this predicate is that:
1290-
//
1291-
// 1. We need to check if a class decl is foreign to exclude CF classes.
1292-
//
1293-
// 2. We want to check that the class decl is objc to exclude c++ classes in
1294-
// the future.
1295-
//
1296-
// 3. We check that we have a clang node since we want to ensure we have
1297-
// something coming from clang, rather than from swift which does not
1298-
// have this issue.
1299-
if (classDecl->hasClangNode() && classDecl->isObjC() && !classDecl->isForeign()) {
1300-
PrimaryIGM->getAddrOfObjCClassRef(classDecl);
1301-
return;
1302-
}
1303-
}
1304-
13051284
if (!hasLazyMetadata(type))
13061285
return;
13071286

test/IRGen/autolink_classlookup_test.swift

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/Inputs/ObjCClasses/framework.module.map

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/Interpreter/SDK/Inputs/mixed_mode/ObjCStuff.m

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/Interpreter/SDK/mixed_mode_class_with_missing_properties.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: cp %s %t/main.swift
3-
// RUN: %target-clang -c -o %t/ObjCStuff.o -fobjc-arc -I %t -I %S/Inputs/mixed_mode %S/Inputs/mixed_mode/ObjCStuff.m -fmodules
43
// RUN: %target-build-swift -whole-module-optimization -emit-module-path %t/UsingObjCStuff.swiftmodule -c -o %t/UsingObjCStuff.o -module-name UsingObjCStuff -I %t -I %S/Inputs/mixed_mode -swift-version 5 -parse-as-library %S/Inputs/mixed_mode/UsingObjCStuff.swift
5-
// RUN: %target-build-swift -o %t/a.out.v4 -I %t -I %S/Inputs/mixed_mode -module-name main -swift-version 4 %t/main.swift %t/UsingObjCStuff.o %t/ObjCStuff.o
6-
// RUN: %target-build-swift -o %t/a.out.v5 -I %t -I %S/Inputs/mixed_mode -module-name main -swift-version 5 %t/main.swift %t/UsingObjCStuff.o %t/ObjCStuff.o
4+
// RUN: %target-build-swift -o %t/a.out.v4 -I %t -I %S/Inputs/mixed_mode -module-name main -swift-version 4 %t/main.swift %t/UsingObjCStuff.o
5+
// RUN: %target-build-swift -o %t/a.out.v5 -I %t -I %S/Inputs/mixed_mode -module-name main -swift-version 5 %t/main.swift %t/UsingObjCStuff.o
76
// RUN: %target-codesign %t/a.out.v4
87
// RUN: %target-codesign %t/a.out.v5
98
// RUN: %target-run %t/a.out.v4 | %FileCheck %s

test/Interpreter/autolink_classlookup_test.swift

Lines changed: 0 additions & 30 deletions
This file was deleted.

test/Interpreter/errors_imported.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
//
3-
// RUN: %target-clang -fobjc-arc %S/../Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
4-
// RUN: %target-build-swift -I %S/../Inputs/ObjCClasses/ %t/ObjCClasses.o %s -o %t/a.out
3+
// RUN: %target-clang -fobjc-arc %S/Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
4+
// RUN: %target-build-swift -I %S/Inputs/ObjCClasses/ %t/ObjCClasses.o %s -o %t/a.out
55
// RUN: %target-codesign %t/a.out
66
// RUN: %target-run %t/a.out
77

0 commit comments

Comments
 (0)