mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
c83cb66517
Classes that use `@objc @implementation` should be treated exactly like native Objective-C classes. Among other things, this means that rather than the defining module exposing a public type metadata accessor for them, each client should emit its own hidden accessor. Unfortunately, Swift has not been doing this correctly—the defining module may expose an accessor and any clients which know the class is objcImpl will use it. (Clients using a swiftinterface module, or a swiftmodule built from a swiftinterface, won’t know the class is objcImpl, but clients using the original swiftmodule file will know.) Because existing binaries may be calling this symbol, we can’t remove it, but we *can* at least stop using it.
21 lines
945 B
Swift
21 lines
945 B
Swift
// Test doesn't pass on all platforms (rdar://101420862)
|
|
// REQUIRES: OS=macosx
|
|
|
|
// Note: This test employs test/IRGen/objc_implementation.swift as the
|
|
// implementation it's trying to use.
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi -F %clang-importer-sdk-path/frameworks -import-objc-header %S/Inputs/objc_implementation.h -emit-module-path %t/objc_implementation.swiftmodule -target %target-future-triple %S/objc_implementation.swift
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %t -I %S/Inputs/abi -F %clang-importer-sdk-path/frameworks %s -emit-ir -target %target-future-triple > %t.ir
|
|
// RUN: %FileCheck --input-file %t.ir %s
|
|
// REQUIRES: objc_interop
|
|
|
|
import objc_implementation
|
|
|
|
public func fn() {
|
|
_ = ImplClass()
|
|
}
|
|
|
|
// Should emit a non-unique metadata accessor for this module's private use
|
|
// CHECK: define{{.*}} hidden {{.*}}@"$sSo9ImplClassCMa"
|