Skip to content

Commit af3fbc5

Browse files
author
Nathan Hawes
authored
Revert "Add tests for weak-linked class stubs"
1 parent 0ea82d6 commit af3fbc5

File tree

7 files changed

+8
-99
lines changed

7 files changed

+8
-99
lines changed

lib/PrintAsObjC/PrintAsObjC.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,6 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
322322
void visitClassDecl(ClassDecl *CD) {
323323
printDocumentationComment(CD);
324324

325-
// This is just for testing, so we check explicitly for the attribute instead
326-
// of asking if the class is weak imported. If the class has availablility,
327-
// we'll print a SWIFT_AVAIALBLE() which implies __attribute__((weak_imported))
328-
// already.
329-
if (CD->getAttrs().hasAttribute<WeakLinkedAttr>())
330-
os << "SWIFT_WEAK_IMPORT\n";
331-
332325
bool hasResilientAncestry =
333326
CD->checkAncestry().contains(AncestryFlags::ResilientOther);
334327
if (hasResilientAncestry) {
@@ -2724,9 +2717,6 @@ class ModuleWriter {
27242717
"#if !defined(SWIFT_AVAILABILITY)\n"
27252718
"# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))\n"
27262719
"#endif\n"
2727-
"#if !defined(SWIFT_WEAK_IMPORT)\n"
2728-
"# define SWIFT_WEAK_IMPORT __attribute__((weak_import))\n"
2729-
"#endif\n"
27302720
"#if !defined(SWIFT_DEPRECATED)\n"
27312721
"# define SWIFT_DEPRECATED __attribute__((deprecated))\n"
27322722
"#endif\n"

test/PrintAsObjC/classes.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,3 @@ public class NonObjCClass { }
805805
@objc func referenceSingleGenericClass(_: SingleImportedObjCGeneric<AnyObject>?) {}
806806
}
807807
// CHECK: @end
808-
809-
// CHECK: SWIFT_WEAK_IMPORT
810-
// CHECK-NEXT: SWIFT_CLASS("_TtC7classes17WeakImportedClass")
811-
// CHECK-NEXT: @interface WeakImportedClass
812-
// CHECK-NEXT: @end
813-
@_weakLinked @objc class WeakImportedClass {}

validation-test/Runtime/Inputs/class-stubs-weak/first.swift

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

validation-test/Runtime/Inputs/class-stubs-weak/module.map

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

validation-test/Runtime/Inputs/class-stubs-weak/second.swift

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

validation-test/Runtime/class_stubs.m

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
// RUN: %target-build-swift -emit-library -emit-module -o %t/libfirst.dylib -emit-objc-header-path %t/first.h %S/Inputs/class-stubs-from-objc/first.swift -Xlinker -install_name -Xlinker @executable_path/libfirst.dylib -enable-library-evolution
66
// RUN: %target-build-swift -emit-library -o %t/libsecond.dylib -emit-objc-header-path %t/second.h -I %t %S/Inputs/class-stubs-from-objc/second.swift -Xlinker -install_name -Xlinker @executable_path/libsecond.dylib -lfirst -L %t -Xfrontend -enable-resilient-objc-class-stubs
77
// RUN: cp %S/Inputs/class-stubs-from-objc/module.map %t/
8-
// RUN: xcrun %clang %s -I %t -L %t -fmodules -fobjc-arc -o %t/main -lfirst -lsecond -Wl,-U,_objc_loadClassref
8+
// RUN: xcrun %clang %s -I %t -L %t -fmodules -fobjc-arc -o %t/main -lfirst -lsecond
99
// RUN: %target-codesign %t/main %t/libfirst.dylib %t/libsecond.dylib
10-
// RUN: %target-run %t/main %t/libfirst.dylib %t/libsecond.dylib
10+
// RUN: %target-run %t/main %t/libfirst.dylib %t/libsecond.dylib | %FileCheck %s
1111

1212
// REQUIRES: executable_test
1313
// REQUIRES: objc_interop
1414

15+
// XFAIL: *
16+
1517
#import <dlfcn.h>
1618
#import <stdio.h>
1719
#import "second.h"
@@ -37,17 +39,9 @@ int main(int argc, const char * const argv[]) {
3739

3840
DerivedClass *obj = [[DerivedClass alloc] init];
3941

40-
{
41-
long result = [obj instanceMethod];
42-
printf("[obj instanceMethod] == %ld\n", result);
43-
if (result != 43)
44-
exit(EXIT_FAILURE);
45-
}
42+
// CHECK: Result is 43
43+
printf("Result is %ld\n", [obj instanceMethod]);
4644

47-
{
48-
long result = [DerivedClass classMethod];
49-
printf("[obj classMethod] == %ld\n", result);
50-
if (result != 31338)
51-
exit(EXIT_FAILURE);
52-
}
45+
// CHECK: Result is 31338
46+
printf("Result is %ld\n", [DerivedClass classMethod]);
5347
}

validation-test/Runtime/class_stubs_weak.m

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

0 commit comments

Comments
 (0)