mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In order for the runtime demangler to be able to find ObjC classes and protocols, it needs to have the runtime name of the declaration be in the mangled name. Only do this for runtime manglings, to minimize the potential ABI impact for symbol names that already have the source-level names of ObjC entities baked in. Fixes SR-12169 | rdar://59306590.
20 lines
861 B
Swift
20 lines
861 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -import-objc-header %S/Inputs/objc_runtime_name_clang_attr.h %s | %FileCheck %s
|
|
// REQUIRES: objc_interop
|
|
|
|
// Use the runtime name for runtime instantiation
|
|
// CHECK-LABEL: @"$sSo16ObjCRuntimeNamedCSgMD" = {{.*}}@"symbolic So26ObjCRuntimeNameIsDifferentCSg"
|
|
public func getMetadata() -> Any.Type {
|
|
return ObjCRuntimeNamed?.self
|
|
}
|
|
// CHECK-LABEL: @"$sSo21ObjCProtoRuntimeNamed_pSgMD" = {{.*}}@"symbolic So31ObjCProtoRuntimeNameIsDifferent_pSg"
|
|
public func getMetadata2() -> Any.Type {
|
|
return ObjCProtoRuntimeNamed?.self
|
|
}
|
|
|
|
// Use the source name for symbols to avoid breaking ABI.
|
|
// CHECK-LABEL: define{{.*}}3fooyySo16ObjCRuntimeNamedCF
|
|
public func foo(_: ObjCRuntimeNamed) {}
|
|
|
|
// CHECK-LABEL: define{{.*}}3fooyySo21ObjCProtoRuntimeNamed_pF
|
|
public func foo(_: ObjCProtoRuntimeNamed) {}
|