Skip to content

Revert "Add tests for weak-linked class stubs" #24612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions lib/PrintAsObjC/PrintAsObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,6 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
void visitClassDecl(ClassDecl *CD) {
printDocumentationComment(CD);

// This is just for testing, so we check explicitly for the attribute instead
// of asking if the class is weak imported. If the class has availablility,
// we'll print a SWIFT_AVAIALBLE() which implies __attribute__((weak_imported))
// already.
if (CD->getAttrs().hasAttribute<WeakLinkedAttr>())
os << "SWIFT_WEAK_IMPORT\n";

bool hasResilientAncestry =
CD->checkAncestry().contains(AncestryFlags::ResilientOther);
if (hasResilientAncestry) {
Expand Down Expand Up @@ -2724,9 +2717,6 @@ class ModuleWriter {
"#if !defined(SWIFT_AVAILABILITY)\n"
"# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))\n"
"#endif\n"
"#if !defined(SWIFT_WEAK_IMPORT)\n"
"# define SWIFT_WEAK_IMPORT __attribute__((weak_import))\n"
"#endif\n"
"#if !defined(SWIFT_DEPRECATED)\n"
"# define SWIFT_DEPRECATED __attribute__((deprecated))\n"
"#endif\n"
Expand Down
6 changes: 0 additions & 6 deletions test/PrintAsObjC/classes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -805,9 +805,3 @@ public class NonObjCClass { }
@objc func referenceSingleGenericClass(_: SingleImportedObjCGeneric<AnyObject>?) {}
}
// CHECK: @end

// CHECK: SWIFT_WEAK_IMPORT
// CHECK-NEXT: SWIFT_CLASS("_TtC7classes17WeakImportedClass")
// CHECK-NEXT: @interface WeakImportedClass
// CHECK-NEXT: @end
@_weakLinked @objc class WeakImportedClass {}
11 changes: 0 additions & 11 deletions validation-test/Runtime/Inputs/class-stubs-weak/first.swift

This file was deleted.

3 changes: 0 additions & 3 deletions validation-test/Runtime/Inputs/class-stubs-weak/module.map

This file was deleted.

5 changes: 0 additions & 5 deletions validation-test/Runtime/Inputs/class-stubs-weak/second.swift

This file was deleted.

22 changes: 8 additions & 14 deletions validation-test/Runtime/class_stubs.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
// 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
// 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
// RUN: cp %S/Inputs/class-stubs-from-objc/module.map %t/
// RUN: xcrun %clang %s -I %t -L %t -fmodules -fobjc-arc -o %t/main -lfirst -lsecond -Wl,-U,_objc_loadClassref
// RUN: xcrun %clang %s -I %t -L %t -fmodules -fobjc-arc -o %t/main -lfirst -lsecond
// RUN: %target-codesign %t/main %t/libfirst.dylib %t/libsecond.dylib
// RUN: %target-run %t/main %t/libfirst.dylib %t/libsecond.dylib
// RUN: %target-run %t/main %t/libfirst.dylib %t/libsecond.dylib | %FileCheck %s

// REQUIRES: executable_test
// REQUIRES: objc_interop

// XFAIL: *

#import <dlfcn.h>
#import <stdio.h>
#import "second.h"
Expand All @@ -37,17 +39,9 @@ int main(int argc, const char * const argv[]) {

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

{
long result = [obj instanceMethod];
printf("[obj instanceMethod] == %ld\n", result);
if (result != 43)
exit(EXIT_FAILURE);
}
// CHECK: Result is 43
printf("Result is %ld\n", [obj instanceMethod]);

{
long result = [DerivedClass classMethod];
printf("[obj classMethod] == %ld\n", result);
if (result != 31338)
exit(EXIT_FAILURE);
}
// CHECK: Result is 31338
printf("Result is %ld\n", [DerivedClass classMethod]);
}
50 changes: 0 additions & 50 deletions validation-test/Runtime/class_stubs_weak.m

This file was deleted.